Add app.fullscreen module to handle virtual "fullscreen" of app content

This commit is contained in:
Niko 2022-02-24 01:11:39 +01:00
parent ac4a4ac715
commit 76b6787c60
2 changed files with 17 additions and 0 deletions

View File

@ -245,6 +245,21 @@ app.post = {
},
}
app.fullscreen = {
enable: function() {
const el = document.querySelector('main');
el.classList.add('absolute-top');
el.classList.add('width-max');
document.querySelector('header').style.display = 'none';
},
disable: function() {
const el = document.querySelector('main');
el.classList.remove('absolute-top');
el.classList.remove('width-max');
document.querySelector('header').removeAttribute('style');
},
}
app.media = {
view: function(url) {
if (url.match(/^.*\.(jpg|jpeg|png|ico|webp)$/))
@ -484,6 +499,7 @@ window.onhashchange = function(e) {
args = [];
app.overlay.hideAll();
app.fullscreen.disable();
for (var i = 0; i < app.hashHandlers.length; i++) {
const cfg = app.hashHandlers[i];
if (cfg.exact !== undefined &&

View File

@ -13,6 +13,7 @@ app.pages.quiz = {
}
}
app.fullscreen.enable();
const container = document.getElementById('app-container');
container.innerHTML = '';