diff options
Diffstat (limited to 'js/AppBase.js')
-rw-r--r-- | js/AppBase.js | 59 |
1 files changed, 41 insertions, 18 deletions
diff --git a/js/AppBase.js b/js/AppBase.js index 9ab2f507e..4552eea11 100644 --- a/js/AppBase.js +++ b/js/AppBase.js @@ -51,8 +51,9 @@ define(["dojo/_base/declare"], function (declare) { if (dijit.byId("loading_bar")) dijit.byId("loading_bar").update({progress: loading_progress}); - if (loading_progress >= 90) - Element.hide("overlay"); + if (loading_progress >= 90) { + $("overlay").hide(); + } }, keyeventToAction: function(event) { @@ -184,10 +185,7 @@ define(["dojo/_base/declare"], function (declare) { }, handleRpcJson: function(transport) { - const netalert_dijit = dijit.byId("net-alert"); - let netalert = false; - - if (netalert_dijit) netalert = netalert_dijit.domNode; + const netalert = $$("#toolbar .net-alert")[0]; try { const reply = JSON.parse(transport.responseText); @@ -239,17 +237,15 @@ define(["dojo/_base/declare"], function (declare) { return reply; } else { - if (netalert) - netalert.show(); - else - Notify.error("Communication problem with server."); + if (netalert) netalert.show(); + + Notify.error("Communication problem with server."); } } catch (e) { - if (netalert) - netalert.show(); - else - Notify.error("Communication problem with server."); + if (netalert) netalert.show(); + + Notify.error("Communication problem with server."); console.error(e); } @@ -269,12 +265,10 @@ define(["dojo/_base/declare"], function (declare) { } if (k == "update_result") { - const updatesIcon = dijit.byId("updatesIcon").domNode; - if (v) { - Element.show(updatesIcon); + Element.show("updates-available"); } else { - Element.hide(updatesIcon); + Element.hide("updates-available"); } } @@ -324,6 +318,12 @@ define(["dojo/_base/declare"], function (declare) { case "label_base_index": _label_base_index = parseInt(params[k]); break; + case "cdm_auto_catchup": + if (params[k] == 1) { + const hl = $("headlines-frame"); + if (hl) hl.addClassName("auto_catchup"); + } + break; case "hotkeys": // filter mnemonic definitions (used for help panel) from hotkeys map // i.e. *(191)|Ctrl-/ -> *(191) @@ -352,6 +352,29 @@ define(["dojo/_base/declare"], function (declare) { this.initSecondStage(); }, + toggleNightMode: function() { + const link = $("theme_css"); + + if (link) { + + let user_theme = ""; + let user_css = ""; + + if (link.getAttribute("href").indexOf("themes/night.css") == -1) { + user_css = "themes/night.css?" + Date.now(); + user_theme = "night.css"; + } else { + user_theme = "default.php"; + user_css = "css/default.css?" + Date.now(); + } + + fetch(user_css).then(() => { + link.setAttribute("href", user_css); + xhrPost("backend.php", {op: "rpc", method: "setpref", key: "USER_CSS_THEME", value: user_theme}); + }); + + } + }, explainError: function(code) { return this.displayDlg(__("Error explained"), "explainError", code); }, |