diff options
| author | supahgreg <supahgreg@users.noreply.github.com> | 2025-10-12 21:02:39 +0000 |
|---|---|---|
| committer | supahgreg <supahgreg@users.noreply.github.com> | 2025-10-12 21:34:29 +0000 |
| commit | 39182a76e4070d3b92af10bf609fef8151bce6e4 (patch) | |
| tree | 806c6e1b1ab421a2631f5e9062a8988480f8ba31 /js/App.js | |
| parent | 1299d632bdc8b676d3fc2114a1788a2f8f63597c (diff) | |
Address ESLint rule 'eqeqeq'.
https://eslint.org/docs/latest/rules/eqeqeq
Diffstat (limited to 'js/App.js')
| -rw-r--r-- | js/App.js | 59 |
1 files changed, 29 insertions, 30 deletions
@@ -2,7 +2,7 @@ /* eslint-disable new-cap */ /* global __, Article, Headlines, Filters, fox */ -/* global xhr, dojo, dijit, PluginHost, Notify, Feeds, Cookie */ +/* global xhr, PluginHost, Notify, Feeds, Cookie */ /* global CommonDialogs, Plugins */ const App = { @@ -75,7 +75,7 @@ const App = { return ` <select name="${name}" dojoType="fox.form.Select" id="${App.escapeHtml(id)}" ${this.attributes_to_string(attributes)}> ${values.map((v) => - `<option ${v == value ? 'selected="selected"' : ''} value="${App.escapeHtml(v)}">${App.escapeHtml(v)}</option>` + `<option ${v === value ? 'selected="selected"' : ''} value="${App.escapeHtml(v)}">${App.escapeHtml(v)}</option>` ).join("")} </select> ` @@ -89,7 +89,7 @@ const App = { return ` <select name="${name}" dojoType="fox.form.Select" id="${App.escapeHtml(id)}" ${this.attributes_to_string(attributes)}> ${keys.map((vk) => - `<option ${vk == value ? 'selected="selected"' : ''} value="${App.escapeHtml(vk)}">${App.escapeHtml(values[vk])}</option>` + `<option ${vk === value ? 'selected="selected"' : ''} value="${App.escapeHtml(vk)}">${App.escapeHtml(values[vk])}</option>` ).join("")} </select> ` @@ -333,7 +333,7 @@ const App = { for (const seq in hotkeys_map[1]) { if (hotkeys_map[1].hasOwnProperty(seq)) { - if (seq == sequence) { + if (seq === sequence) { return hotkeys_map[1][seq]; } } @@ -345,11 +345,11 @@ const App = { const keycode = event.which; const keychar = String.fromCharCode(keycode); - if (keycode == 27) { // escape and drop prefix + if (keycode === 27) { // escape and drop prefix this.hotkey_prefix = false; } - if (!this.hotkey_prefix && hotkeys_map[0].indexOf(keychar) != -1) { + if (!this.hotkey_prefix && hotkeys_map[0].indexOf(keychar) !== -1) { this.hotkey_prefix = keychar; App.byId("cmdline").innerHTML = keychar; @@ -370,7 +370,7 @@ const App = { let hotkey_name = ""; - if (event.type == "keydown") { + if (event.type === 'keydown') { hotkey_name = "(" + keycode + ")"; // ensure ^*char notation @@ -473,20 +473,20 @@ const App = { const counters = reply['counters']; const runtime_info = reply['runtime-info']; - if (error && error.code && error.code != App.Error.E_SUCCESS) { + if (error && error.code && error.code !== App.Error.E_SUCCESS) { console.warn("handleRpcJson: fatal error", error); this.Error.fatal(error.code, error.params); return false; } - if (seq && this.get_seq() != seq) { + if (seq && this.get_seq() !== seq) { console.warn("handleRpcJson: sequence mismatch: ", seq, '!=', this.get_seq()); return false; } // not in preferences - if (typeof Feeds != "undefined") { - if (message == "UPDATE_COUNTERS") { + if (typeof Feeds !== 'undefined') { + if (message === 'UPDATE_COUNTERS') { console.log("need to refresh counters for", reply.feeds); Feeds.requestCounters(reply.feeds); } @@ -515,12 +515,12 @@ const App = { console.log("RI:", k, "=>", v); - if (k == "daemon_is_running" && v != 1) { + if (k === "daemon_is_running" && v !== 1) { Notify.error("Update daemon is not running.", true); return; } - if (k == "recent_log_events") { + if (k === "recent_log_events") { const alert = App.find(".log-alert"); if (alert) { @@ -528,14 +528,14 @@ const App = { } } - if (k == "daemon_stamp_ok" && v != 1) { + if (k === "daemon_stamp_ok" && v !== 1) { Notify.error("Update daemon is not updating feeds.", true); return; } - if (typeof Feeds != "undefined") { - if (k == "max_feed_id" || k == "num_feeds") { - if (this.getInitParam(k) && this.getInitParam(k) != v) { + if (typeof Feeds !== 'undefined') { + if (k === "max_feed_id" || k === "num_feeds") { + if (this.getInitParam(k) && this.getInitParam(k) !== v) { console.log("feed count changed, need to reload feedlist:", this.getInitParam(k), v); Feeds.reload(); } @@ -609,13 +609,13 @@ const App = { E_SCHEMA_MISMATCH: "E_SCHEMA_MISMATCH", E_URL_SCHEME_MISMATCH: "E_URL_SCHEME_MISMATCH", fatal: function (error, params = {}) { - if (error == App.Error.E_UNAUTHORIZED) { + if (error === App.Error.E_UNAUTHORIZED) { window.location.href = "index.php"; return; - } else if (error == App.Error.E_SCHEMA_MISMATCH) { + } else if (error === App.Error.E_SCHEMA_MISMATCH) { window.location.href = "public.php?op=dbupdate"; return; - } else if (error == App.Error.E_URL_SCHEME_MISMATCH) { + } else if (error === App.Error.E_URL_SCHEME_MISMATCH) { params.description = __("URL scheme reported by your browser (%a) doesn't match server-configured SELF_URL_PATH (%b), check X-Forwarded-Proto.") .replace("%a", params.client_scheme) .replace("%b", params.server_scheme); @@ -744,12 +744,12 @@ const App = { } }); - if (typeof Promise.allSettled == "undefined") { + if (typeof Promise.allSettled === "undefined") { errorMsg = `Browser check failed: <code>Promise.allSettled</code> is not defined.`; throw new Error(errorMsg); } - return errorMsg == ""; + return errorMsg === ""; }, updateRuntimeInfo: function() { xhr.json("backend.php", {op: "RPC", method: "getruntimeinfo"}, () => { @@ -902,18 +902,17 @@ const App = { document.title = tmp; }, hotkeyHandler: function(event) { - if (event.target.nodeName == "INPUT" || event.target.nodeName == "TEXTAREA") return; + if (event.target.nodeName === "INPUT" || event.target.nodeName === "TEXTAREA") return; // Arrow buttons and escape are not reported via keypress, handle them via keydown. // escape = 27, left = 37, up = 38, right = 39, down = 40, pgup = 33, pgdn = 34, insert = 45, delete = 46 - if (event.type == "keydown" && event.which != 27 && (event.which < 33 || event.which > 46)) return; - + if (event.type === "keydown" && event.which !== 27 && (event.which < 33 || event.which > 46)) return; const action_name = this.keyeventToAction(event); if (action_name) { const action_func = this.hotkey_actions[action_name]; - if (action_func != null) { + if (action_func !== null) { action_func(event); event.stopPropagation(); return false; @@ -1120,7 +1119,7 @@ const App = { } }; this.hotkey_actions["email_article"] = () => { - if (typeof Plugins.Mail != "undefined") { + if (typeof Plugins.Mail !== "undefined") { Plugins.Mail.onHotkey(Headlines.getSelected()); } else { alert(__("Please enable mail or mailto plugin first.")); @@ -1145,7 +1144,7 @@ const App = { Headlines.select('none'); }; this.hotkey_actions["feed_refresh"] = () => { - if (typeof Feeds.getActive() != "undefined") { + if (typeof Feeds.getActive() !== "undefined") { Feeds.open({feed: Feeds.getActive(), is_cat: Feeds.activeIsCat()}); } }; @@ -1191,7 +1190,7 @@ const App = { CommonDialogs.editFeed(Feeds.getActive()); }; this.hotkey_actions["feed_catchup"] = () => { - if (typeof Feeds.getActive() != "undefined") { + if (typeof Feeds.getActive() !== "undefined") { Feeds.catchupCurrent(); } }; @@ -1254,7 +1253,7 @@ const App = { Feeds.toggle(); }; this.hotkey_actions["toggle_full_text"] = () => { - if (typeof Plugins.Af_Readability != "undefined") { + if (typeof Plugins.Af_Readability !== "undefined") { if (Article.getActive()) Plugins.Af_Readability.embed(Article.getActive()); } else { |