From 16f0e09949d3069e947c2d98483f65d8b182c08f Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Fri, 12 Aug 2022 14:55:09 +0300 Subject: [PATCH] [mobile] for bug 57560 --- apps/common/mobile/resources/css/skeleton.css | 4 ++++ apps/common/mobile/utils/htmlutils.js | 22 +++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/apps/common/mobile/resources/css/skeleton.css b/apps/common/mobile/resources/css/skeleton.css index fd4da6d28..0ac99096e 100644 --- a/apps/common/mobile/resources/css/skeleton.css +++ b/apps/common/mobile/resources/css/skeleton.css @@ -92,6 +92,10 @@ body.theme-type-dark { animation: flickerAnimation 2s infinite ease-in-out; } +.framework7-initializing .page-content { + display: none; +} + @keyframes flickerAnimation { 0% { opacity:0.1; } 50% { opacity:1; } diff --git a/apps/common/mobile/utils/htmlutils.js b/apps/common/mobile/utils/htmlutils.js index af2eaaca4..1ecf09e46 100644 --- a/apps/common/mobile/utils/htmlutils.js +++ b/apps/common/mobile/utils/htmlutils.js @@ -1,25 +1,25 @@ -let obj = !localStorage ? {id: 'theme-light', type: 'light'} : JSON.parse(localStorage.getItem("ui-theme")); -if ( !obj ) { - obj = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? - {id: 'theme-dark', type: 'dark'} : {id: 'theme-light', type: 'light'}; - localStorage && localStorage.setItem("ui-theme", JSON.stringify(obj)); -} - -document.body.classList.add(`theme-type-${obj.type}`); - const load_stylesheet = reflink => { let link = document.createElement( "link" ); link.href = reflink; - link.type = "text/css"; + // link.type = "text/css"; link.rel = "stylesheet"; document.getElementsByTagName("head")[0].appendChild(link); }; if ( !localStorage && localStorage.getItem('mode-direction') === 'rtl' ) { - document.body.classList.add('rtl'); load_stylesheet('./css/framework7-rtl.css') + document.body.classList.add('rtl'); } else { load_stylesheet('./css/framework7.css') } + +let obj = !localStorage ? {id: 'theme-light', type: 'light'} : JSON.parse(localStorage.getItem("ui-theme")); +if ( !obj ) { + obj = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? + {id: 'theme-dark', type: 'dark'} : {id: 'theme-light', type: 'light'}; + localStorage && localStorage.setItem("ui-theme", JSON.stringify(obj)); +} + +document.body.classList.add(`theme-type-${obj.type}`);