summaryrefslogtreecommitdiff
path: root/js/App.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/App.js')
-rw-r--r--js/App.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/js/App.js b/js/App.js
index 1ac3a43f0..ae3eecb09 100644
--- a/js/App.js
+++ b/js/App.js
@@ -172,21 +172,21 @@ const App = {
console.log("nightModeChanged: night mode changed to", is_night, "retry", retry);
if (link) {
- if (navigator.onLine) {
- const css_override = is_night ? App.getInitParam("default_dark_theme") : App.getInitParam("default_light_theme");
- link.setAttribute("href", css_override + "?" + Date.now());
- } else if (retry < 5) {
- console.log("nightModeChanged: we're offline, will attempt to retry...");
-
+ if (retry < 5) {
window.clearTimeout(this._night_mode_retry_timeout);
this._night_mode_retry_timeout = window.setTimeout(
() => this.nightModeChanged(is_night, link, ++retry),
3000);
-
- } else {
- console.log("nightModeChanged: too many retries, giving up");
}
+
+ xhr.post("backend.php", {op: "RPC", method: "getRuntimeInfo"}, () => {
+ const css_override = is_night ? App.getInitParam("default_dark_theme") : App.getInitParam("default_light_theme");
+
+ link.setAttribute("href", css_override + "?" + Date.now());
+
+ window.clearTimeout(this._night_mode_retry_timeout);
+ });
}
},
setupNightModeDetection: function(callback) {