diff --git a/public/assets/js/app.js b/public/assets/js/app.js index 890d921..752258c 100644 --- a/public/assets/js/app.js +++ b/public/assets/js/app.js @@ -664,6 +664,15 @@ function showPopup(title, content, width=80, height=70) { } window.addEventListener("load", () => { + // refresh ui + updateBg(); + switchMode(getVar("gameMode"), false); + if (getVar("leftPanelEnabled") && (window.innerWidth > phoneWidth)) { switchLeftPanel() }; + themeSwitch(); + reportBtnSwitch(); + switchNewTheme(); + updateStats(); + // load data setupData(() => { console.log("📈 done !") switchMode(gameMode); diff --git a/public/assets/js/utils.js b/public/assets/js/utils.js index d8fa119..cf3395b 100644 --- a/public/assets/js/utils.js +++ b/public/assets/js/utils.js @@ -33,8 +33,6 @@ function updateBg() { } } -updateBg(); - ////////////////////// //// RESET SCORES //// ////////////////////// @@ -99,8 +97,6 @@ function switchMode(mode, initialize=true) { updateBg(); } -switchMode(getVar("gameMode"), false); - //////////////////// //// LEFT PANEL //// //////////////////// @@ -132,8 +128,6 @@ function switchLeftPanel() { } } -if (getVar("leftPanelEnabled") && (window.innerWidth > phoneWidth)) { switchLeftPanel() }; - /////////////// //// THEME //// /////////////// @@ -148,8 +142,6 @@ function themeSwitch() { } } -themeSwitch(); - /////////////////////// //// REPORT BUTTON //// /////////////////////// @@ -166,8 +158,6 @@ function reportBtnSwitch() { } } -reportBtnSwitch(); - ///////////////////////// //// CHARACTERS LIST //// ///////////////////////// @@ -290,8 +280,6 @@ function switchNewTheme() { } } -switchNewTheme(); - ////////////////////// //// UPDATE STATS //// ////////////////////// @@ -313,8 +301,6 @@ function updateStats() { statsChar.innerHTML = charText } -updateStats() - // update buttons state // function buttonState(tf, b, mode) { if (mode == "char") { @@ -352,4 +338,4 @@ function showNotification(message) { notifBtn.onclick = () => { notifBar.style.transform = "translateY(-100%)"; } notifBar.style.transform = "translateY(0%)"; -} \ No newline at end of file +} diff --git a/public/index.html b/public/index.html index 7583ac6..75d8b5b 100644 --- a/public/index.html +++ b/public/index.html @@ -640,7 +640,7 @@ - - + +