Added a navigation at bottom with "Back" button in fullscreen
* Refactor all buttons with "noback" to support custom backgrounds * Create calcCustomCss function that creates custom background-color hover colors automatically * Other refactors
This commit is contained in:
parent
e973da1aa8
commit
6bf5ee7fcd
|
@ -23,7 +23,7 @@
|
||||||
<header class="flex">
|
<header class="flex">
|
||||||
<div id="nav-container" class="flex center">
|
<div id="nav-container" class="flex center">
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<div id="fedilove-icon" class="flex center icon button round">
|
<div id="fedilove-icon" class="flex center icon button noback round">
|
||||||
<a class="center" href="#">
|
<a class="center" href="#">
|
||||||
<img class="fedilove-icon" src="/assets/images/icon-proto-1.png"/>
|
<img class="fedilove-icon" src="/assets/images/icon-proto-1.png"/>
|
||||||
</a>
|
</a>
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php if ($actor !== null): ?>
|
<?php if ($actor !== null): ?>
|
||||||
<div class="flex icon button round">
|
<div class="flex icon button noback round">
|
||||||
<a class="center" href="javascript:app.navmenu.show()">
|
<a class="center" href="javascript:app.navmenu.show()">
|
||||||
<img class="avatar round"
|
<img class="avatar round"
|
||||||
src="<?php echo htmlspecialchars($actor->icon) ?>"/>
|
src="<?php echo htmlspecialchars($actor->icon) ?>"/>
|
||||||
|
|
|
@ -6,7 +6,7 @@ $alt_s = false;
|
||||||
if ($id !== false)
|
if ($id !== false)
|
||||||
$alt_s = 'alt_'.$id;
|
$alt_s = 'alt_'.$id;
|
||||||
?>
|
?>
|
||||||
<a class="component icon button <?php echo ($class ?? '') ?>"
|
<a class="component icon button noback <?php echo ($class ?? '') ?>"
|
||||||
<?php if ($id !== false): ?>
|
<?php if ($id !== false): ?>
|
||||||
id="<?php echo $id ?>"
|
id="<?php echo $id ?>"
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
|
@ -33,4 +33,20 @@ $actor = $database->getActorByUsername($user->username);
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="nav-full" class="fixed-top size-max height-mobile" style="display:none">
|
||||||
|
<div class="panel nostyle flex size-max">
|
||||||
|
<div class="content center height-max">
|
||||||
|
<div id="buttons" class="content absolute-bottom">
|
||||||
|
<div style="display: flow-root; margin: 2em">
|
||||||
|
<div class="component button round floating right"
|
||||||
|
style="background-color: #db71ff"
|
||||||
|
onclick="window.history.back()">
|
||||||
|
<i class="fa fa-arrow-left fa-fw"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<?php tpl('app.footer') ?>
|
<?php tpl('app.footer') ?>
|
||||||
|
|
|
@ -8,6 +8,9 @@ body.app.fullscreen {
|
||||||
body.app.fullscreen main {
|
body.app.fullscreen main {
|
||||||
margin: auto !important;
|
margin: auto !important;
|
||||||
}
|
}
|
||||||
|
body.app.fullscreen #app-container {
|
||||||
|
margin-bottom: 8em !important;
|
||||||
|
}
|
||||||
.app header {
|
.app header {
|
||||||
height: 4.5em;
|
height: 4.5em;
|
||||||
}
|
}
|
||||||
|
@ -69,6 +72,19 @@ img.avatar {
|
||||||
filter: grayscale() !important;
|
filter: grayscale() !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button.floating {
|
||||||
|
padding: 1.5em;
|
||||||
|
box-shadow: 0px 0px 1em #0000005e;
|
||||||
|
border: 1px solid #0000002e;
|
||||||
|
}
|
||||||
|
.button.floating .fa {
|
||||||
|
color: #fff !important;
|
||||||
|
font-size: 1.4em;
|
||||||
|
}
|
||||||
|
.button.floating.right {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
a.button {
|
a.button {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
@ -112,6 +128,15 @@ main {
|
||||||
#nav-chat .fa { color: #62c672 }
|
#nav-chat .fa { color: #62c672 }
|
||||||
#nav-chat.active { background: linear-gradient(#62c6723b, transparent, transparent, transparent) }
|
#nav-chat.active { background: linear-gradient(#62c6723b, transparent, transparent, transparent) }
|
||||||
|
|
||||||
|
#nav-full {
|
||||||
|
user-select: none;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
#nav-full #buttons .button {
|
||||||
|
user-select: auto;
|
||||||
|
pointer-events: all;
|
||||||
|
}
|
||||||
|
|
||||||
#app-container {
|
#app-container {
|
||||||
max-width: 60em;
|
max-width: 60em;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -125,6 +150,11 @@ main {
|
||||||
@media (max-width: 700px) {
|
@media (max-width: 700px) {
|
||||||
.panel { margin-bottom: .4em !important }
|
.panel { margin-bottom: .4em !important }
|
||||||
}
|
}
|
||||||
|
.panel.nostyle {
|
||||||
|
padding: 0 !important;
|
||||||
|
background: none !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
.panel .content {
|
.panel .content {
|
||||||
max-width: var(--content_max_width);
|
max-width: var(--content_max_width);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
@ -11,11 +11,11 @@ body.app {
|
||||||
box-shadow: 0px 0px 5px #0000001c;
|
box-shadow: 0px 0px 5px #0000001c;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button:not(.disabled,.light):hover {
|
.button.noback:not(.disabled,.light):hover {
|
||||||
background: #0000000a !important;
|
background: #0000000a !important;
|
||||||
}
|
}
|
||||||
.button:not(.disabled,.light):active,
|
.button.noback:not(.disabled,.light):active,
|
||||||
.button:not(.disabled,.light):focus {
|
.button.noback:not(.disabled,.light):focus {
|
||||||
background: #00000024 !important;
|
background: #00000024 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -251,6 +251,7 @@ app.fullscreen = {
|
||||||
el.classList.add('absolute-top');
|
el.classList.add('absolute-top');
|
||||||
el.classList.add('width-max');
|
el.classList.add('width-max');
|
||||||
document.querySelector('header').style.display = 'none';
|
document.querySelector('header').style.display = 'none';
|
||||||
|
document.querySelector('#nav-full').removeAttribute('style');
|
||||||
document.body.classList.add('fullscreen');
|
document.body.classList.add('fullscreen');
|
||||||
},
|
},
|
||||||
disable: function() {
|
disable: function() {
|
||||||
|
@ -258,6 +259,7 @@ app.fullscreen = {
|
||||||
el.classList.remove('absolute-top');
|
el.classList.remove('absolute-top');
|
||||||
el.classList.remove('width-max');
|
el.classList.remove('width-max');
|
||||||
document.querySelector('header').removeAttribute('style');
|
document.querySelector('header').removeAttribute('style');
|
||||||
|
document.querySelector('#nav-full').style.display = 'none';
|
||||||
document.body.classList.remove('fullscreen')
|
document.body.classList.remove('fullscreen')
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,11 +212,14 @@ function hashredir(tohash, fallback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function printstack() { console.error(new Error().stack) }
|
function printstack() { console.error(new Error().stack) }
|
||||||
function uuidv4() {
|
function uuidv4(sep) {
|
||||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
sep = sep === undefined ? true : sep;
|
||||||
|
const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
||||||
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
||||||
return v.toString(16);
|
return v.toString(16);
|
||||||
});
|
});
|
||||||
|
if (sep) return uuid;
|
||||||
|
return uuid.replaceAll('-','');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNormalizedURI() { return window.location.pathname.replace(/\/+?$/, '') }
|
function getNormalizedURI() { return window.location.pathname.replace(/\/+?$/, '') }
|
||||||
|
@ -334,12 +337,66 @@ const http = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function buildRGB(r, g, b) {
|
||||||
|
if (r > 255) r = 255;
|
||||||
|
if (g > 255) g = 255;
|
||||||
|
if (b > 255) b = 255;
|
||||||
|
if (r < 0) r = 0;
|
||||||
|
if (g < 0) g = 0;
|
||||||
|
if (b < 0) b = 0;
|
||||||
|
return `rgb(${r}, ${g}, ${b})`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseRGB(string) {
|
||||||
|
if (string === undefined) return null;
|
||||||
|
var rgb = string.substr(string.indexOf('(')+1).trim();
|
||||||
|
rgb = rgb.substr(0, rgb.lastIndexOf(')')).trim();
|
||||||
|
rgb = rgb.split(',');
|
||||||
|
for (var i in rgb)
|
||||||
|
rgb[i] = parseInt(rgb[i]);
|
||||||
|
return rgb;
|
||||||
|
}
|
||||||
|
|
||||||
function calcHeightMobile() {
|
function calcHeightMobile() {
|
||||||
document.querySelectorAll('.height-mobile').forEach(function(node) {
|
document.querySelectorAll('.height-mobile').forEach(function(node) {
|
||||||
node.style.height = `${window.innerHeight}px`;
|
node.style.height = `${window.innerHeight}px`;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
window.addEventListener('load', function(e) { calcHeightMobile() });
|
function calcCustomCss() {
|
||||||
|
var dom = document.getElementById('custom-css');
|
||||||
|
if (dom === null) {
|
||||||
|
dom = document.createElement('style');
|
||||||
|
document.body.appendChild(dom);
|
||||||
|
}
|
||||||
|
dom.innerHTML = '';
|
||||||
|
const cssObjs = document.querySelectorAll('.button.component:not(.noback)');
|
||||||
|
for (var i = 0; i < cssObjs.length; i++) {
|
||||||
|
const id = 'cs-' + uuidv4(false).substr(0,16);
|
||||||
|
const obj = cssObjs[i];
|
||||||
|
obj.setAttribute('data-cs', id);
|
||||||
|
const rgb = parseRGB(obj.style['background-color']);
|
||||||
|
if (rgb === null) continue;
|
||||||
|
|
||||||
|
const colorH = buildRGB(rgb[0]-10, rgb[1]-10, rgb[2]-10);
|
||||||
|
const colorF = buildRGB(rgb[0]-25, rgb[1]-25, rgb[2]-25);
|
||||||
|
console.log(rgb);
|
||||||
|
const _css = `
|
||||||
|
*[data-cs="{id}"]:hover { background-color: {colorH} !important }
|
||||||
|
*[data-cs="{id}"]:active,
|
||||||
|
*[data-cs="{id}"]:focus { background-color: {colorF} !important }
|
||||||
|
`.replaceAll('{id}', id)
|
||||||
|
.replaceAll('{colorH}', colorH)
|
||||||
|
.replaceAll('{colorF}', colorF)
|
||||||
|
.trim();
|
||||||
|
dom.innerHTML += _css;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('load', function(e) {
|
||||||
|
calcHeightMobile();
|
||||||
|
calcCustomCss();
|
||||||
|
});
|
||||||
|
|
||||||
window.addEventListener('resize', function(e) { calcHeightMobile() });
|
window.addEventListener('resize', function(e) { calcHeightMobile() });
|
||||||
(function() {
|
(function() {
|
||||||
if (window.cssprops !== undefined) {
|
if (window.cssprops !== undefined) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<div class="card-item item button dark rounder" data-id="{._id}"
|
<div class="card-item item button noback dark rounder" data-id="{._id}"
|
||||||
onclick="app.pages.home.loadQuiz('{.id}')"
|
onclick="app.pages.home.loadQuiz('{.id}')"
|
||||||
onEnter="app.pages.home.loadQuiz('{.id}')"
|
onEnter="app.pages.home.loadQuiz('{.id}')"
|
||||||
tabindex="0">
|
tabindex="0">
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<div id="meet-actions" class="height-max flex">
|
<div id="meet-actions" class="height-max flex">
|
||||||
<div class="flex center">
|
<div class="flex center">
|
||||||
<a class="component icon button light round" title="{s:alt.nav_close}"
|
<a class="component icon button noback light round" title="{s:alt.nav_close}"
|
||||||
href="javascript:window.history.back()"
|
href="javascript:window.history.back()"
|
||||||
style="position: absolute; left: 0; margin-left: .5em;">
|
style="position: absolute; left: 0; margin-left: .5em;">
|
||||||
<div class="ic-container flex">
|
<div class="ic-container flex">
|
||||||
|
@ -8,28 +8,28 @@
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a id="meet-action-discard"
|
<a id="meet-action-discard"
|
||||||
class="component icon button light round" title="{s:alt.nav_discard}"
|
class="component icon button noback light round" title="{s:alt.nav_discard}"
|
||||||
href="javascript:app.pages.meet.actions.discard()">
|
href="javascript:app.pages.meet.actions.discard()">
|
||||||
<div class="ic-container flex">
|
<div class="ic-container flex">
|
||||||
<i class="center fa fa-times-circle fa-fw"></i>
|
<i class="center fa fa-times-circle fa-fw"></i>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a id="meet-action-crush"
|
<a id="meet-action-crush"
|
||||||
class="component icon button light round" title="{s:alt.nav_crush}"
|
class="component icon button noback light round" title="{s:alt.nav_crush}"
|
||||||
href="javascript:app.pages.meet.actions.crush()">
|
href="javascript:app.pages.meet.actions.crush()">
|
||||||
<div class="ic-container flex">
|
<div class="ic-container flex">
|
||||||
<i class="center fa fa-heart fa-fw"></i>
|
<i class="center fa fa-heart fa-fw"></i>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a id="meet-action-quiz"
|
<a id="meet-action-quiz"
|
||||||
class="component icon button light round" title="{s:alt.action_quiz}"
|
class="component icon button noback light round" title="{s:alt.action_quiz}"
|
||||||
href="javascript:app.pages.meet.actions.quiz()">
|
href="javascript:app.pages.meet.actions.quiz()">
|
||||||
<div class="ic-container flex">
|
<div class="ic-container flex">
|
||||||
<i class="center fa fa-quote-right fa-fw"></i>
|
<i class="center fa fa-quote-right fa-fw"></i>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a id="meet-action-maybe"
|
<a id="meet-action-maybe"
|
||||||
class="component icon button light round" title="{s:alt.nav_crush}"
|
class="component icon button noback light round" title="{s:alt.nav_crush}"
|
||||||
href="javascript:app.pages.meet.actions.maybe()">
|
href="javascript:app.pages.meet.actions.maybe()">
|
||||||
<div class="ic-container flex">
|
<div class="ic-container flex">
|
||||||
<i class="center fa fa-question-circle fa-fw"></i>
|
<i class="center fa fa-question-circle fa-fw"></i>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<p>{s:app.meet_empty_p}</p>
|
<p>{s:app.meet_empty_p}</p>
|
||||||
<br>
|
<br>
|
||||||
<a id="be-first" href="#compose"
|
<a id="be-first" href="#compose"
|
||||||
class="button light rounder"
|
class="button noback light rounder"
|
||||||
>{s:app.be_the_first}</a>
|
>{s:app.be_the_first}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<div class="type-options">
|
<div class="type-options">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
{loop:options}
|
{loop:options}
|
||||||
<label class="card-item button rounder flex">
|
<label class="card-item button noback rounder flex">
|
||||||
<div class="center">
|
<div class="center">
|
||||||
<input type="radio" name="question_{.index}"
|
<input type="radio" name="question_{.index}"
|
||||||
value="{.item}">
|
value="{.item}">
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<div class="confirm flex">
|
<div class="confirm flex">
|
||||||
<a class="width-max text-center button rounder nope"
|
<a class="width-max text-center button noback rounder nope"
|
||||||
onclick="app.toast.dismiss('{.id}', event)">{.no_text}</a>
|
onclick="app.toast.dismiss('{.id}', event)">{.no_text}</a>
|
||||||
<a class="width-max text-center button rounder yes"
|
<a class="width-max text-center button noback rounder yes"
|
||||||
onclick="app.toast.accept('{.id}', event)">{.yes_text}</a>
|
onclick="app.toast.accept('{.id}', event)">{.yes_text}</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue