From 76b6787c6051d951ca4d4bd08090a24f6f24e2d3 Mon Sep 17 00:00:00 2001 From: Niko Date: Thu, 24 Feb 2022 01:11:39 +0100 Subject: [PATCH] Add app.fullscreen module to handle virtual "fullscreen" of app content --- web/src/app/js/app.js | 16 ++++++++++++++++ web/src/app/js/pages/quiz.js | 1 + 2 files changed, 17 insertions(+) diff --git a/web/src/app/js/app.js b/web/src/app/js/app.js index f093aae..2c56e26 100644 --- a/web/src/app/js/app.js +++ b/web/src/app/js/app.js @@ -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 && diff --git a/web/src/app/js/pages/quiz.js b/web/src/app/js/pages/quiz.js index 4d80eee..88ae5da 100644 --- a/web/src/app/js/pages/quiz.js +++ b/web/src/app/js/pages/quiz.js @@ -13,6 +13,7 @@ app.pages.quiz = { } } + app.fullscreen.enable(); const container = document.getElementById('app-container'); container.innerHTML = '';