Cleanup DOM boot

This commit is contained in:
djmaze 2020-09-09 16:53:36 +02:00
parent e1f1a3aa12
commit 90acc04750
3 changed files with 6 additions and 6 deletions

View file

@ -3,6 +3,7 @@
const
doc = document,
html = doc.documentElement,
app = doc.getElementById('rl-app'),
options = app && app.dataset.boot && JSON.parse(app.dataset.boot) || {},
@ -151,7 +152,7 @@ win.__initAppData = appData => {
if (appData) {
if (appData.NewThemeLink) {
(doc.getElementById('app-theme-link') || {}).href = appData.NewThemeLink;
doc.getElementById('app-theme-link').href = appData.NewThemeLink;
}
appData.IncludeCss && writeCSS(appData.IncludeCss);
@ -169,11 +170,10 @@ win.__initAppData = appData => {
const libs = () =>
loadScript(appData.StaticLibJsLink).then(() => {
doc.getElementById('rl-check').remove();
if (appData.IncludeBackground) {
const img = appData.IncludeBackground.replace('{{USER}}', rl.hash.get() || '0');
if (img) {
doc.documentElement.classList.add('UserBackground');
html.classList.add('UserBackground');
doc.body.style.backgroundImage = "url("+img+")";
}
}
@ -220,6 +220,8 @@ Storage('session');
// init section
setInterval(setTimestamp, 60000); // 1m
html.classList.add(options.mobileDevice ? 'mobile' : 'no-mobile');
['app-css','app-theme-link'].forEach(css => {
css = doc.getElementById(css);
css.href = css.dataset.href;

3
dev/bootstrap.js vendored
View file

@ -1,4 +1,4 @@
import { $htmlCL, data as GlobalsData, bMobileDevice, dropdownVisibility } from 'Common/Globals';
import { data as GlobalsData, bMobileDevice, dropdownVisibility } from 'Common/Globals';
import * as Enums from 'Common/Enums';
import * as Plugins from 'Common/Plugins';
import { i18n } from 'Common/Translator';
@ -31,7 +31,6 @@ export default (App) => {
});
addEventListener('unload', () => GlobalsData.bUnload = true);
$htmlCL.add(bMobileDevice ? 'mobile' : 'no-mobile');
addEventListener('click', ()=>rl.Dropdowns.detectVisibility());
rl.app = App;

View file

@ -41,7 +41,6 @@
<div id="rl-templates"></div>
<div id="rl-hidden"></div>
</div>
<div id="rl-check"></div>
<div class="progressjs"><div class="progressjs-inner"><div class="progressjs-percent"></div></div></div>
<script type="text/javascript">{{BaseAppBootScript}}</script>
</body>