summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsupahgreg <supahgreg@users.noreply.github.com>2025-10-12 21:02:39 +0000
committersupahgreg <supahgreg@users.noreply.github.com>2025-10-12 21:34:29 +0000
commit39182a76e4070d3b92af10bf609fef8151bce6e4 (patch)
tree806c6e1b1ab421a2631f5e9062a8988480f8ba31
parent1299d632bdc8b676d3fc2114a1788a2f8f63597c (diff)
Address ESLint rule 'eqeqeq'.
https://eslint.org/docs/latest/rules/eqeqeq
-rw-r--r--eslint.config.js26
-rw-r--r--js/App.js59
-rw-r--r--js/Article.js12
-rw-r--r--js/CommonDialogs.js12
-rw-r--r--js/CommonFilters.js14
-rw-r--r--js/FeedStoreModel.js2
-rwxr-xr-xjs/FeedTree.js26
-rw-r--r--js/Feeds.js36
-rwxr-xr-xjs/Headlines.js98
-rw-r--r--js/PluginHost.js10
-rw-r--r--js/PrefFeedTree.js24
-rw-r--r--js/PrefFilterTree.js6
-rw-r--r--js/PrefHelpers.js32
-rw-r--r--js/PrefLabelTree.js2
-rw-r--r--js/PrefUsers.js4
-rwxr-xr-xjs/common.js66
-rwxr-xr-xjs/form/Select.js4
-rw-r--r--js/form/ValidationMultiSelect.js2
-rwxr-xr-xjs/prefs.js2
-rw-r--r--js/tt-rss.js2
-rw-r--r--js/utility.js6
21 files changed, 216 insertions, 229 deletions
diff --git a/eslint.config.js b/eslint.config.js
index f1fc76d28..a42b6d0e3 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -21,29 +21,15 @@ export default [
clearInterval: 'readonly',
fetch: 'readonly',
XMLHttpRequest: 'readonly',
+ FormData: 'readonly',
+ URLSearchParams: 'readonly',
localStorage: 'readonly',
+ sessionStorage: 'readonly',
location: 'readonly',
history: 'readonly',
-
- // tt-rss
- App: 'writable',
- Article: 'writable',
- CommonDialogs: 'writable',
- CommonFilters: 'writable',
- Feeds: 'writable',
- FeedStoreModel: 'writable',
- FeedTree: 'writable',
- Headlines: 'writable',
- PluginHost: 'writable',
- PrefFeedStore: 'writable',
- PrefFeedTree: 'writable',
- PrefFilterStore: 'writable',
- PrefFilterTree: 'writable',
- PrefHelpers: 'writable',
- PrefLabelTree: 'writable',
- PrefUsers: 'writable',
- SingleUseDialog: 'writable',
- Toolbar: 'writable',
+ navigator: 'readonly',
+ Event: 'readonly',
+ CustomEvent: 'readonly',
// Dojo
dojo: 'readonly',
diff --git a/js/App.js b/js/App.js
index 33bd81d9a..c727cc947 100644
--- a/js/App.js
+++ b/js/App.js
@@ -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 {
diff --git a/js/Article.js b/js/Article.js
index a57454dec..b38cb50c6 100644
--- a/js/Article.js
+++ b/js/Article.js
@@ -166,7 +166,7 @@ const Article = {
`<div class='attachments-inline'>
${enclosures.entries.map((enc) => {
if (!enclosures.inline_text_only) {
- if (enc.content_type && enc.content_type.indexOf("image/") != -1) {
+ if (enc.content_type && enc.content_type.indexOf("image/") !== -1) {
return `<p>
<img loading="lazy"
width="${enc.width ? enc.width : ''}"
@@ -174,7 +174,7 @@ const Article = {
src="${App.escapeHtml(enc.content_url)}"
title="${App.escapeHtml(enc.title ? enc.title : enc.content_url)}"/>
</p>`
- } else if (enc.content_type && enc.content_type.indexOf("audio/") != -1 && App.audioCanPlay(enc.content_type)) {
+ } else if (enc.content_type && enc.content_type.indexOf("audio/") !== -1 && App.audioCanPlay(enc.content_type)) {
return `<p class='inline-player' title="${App.escapeHtml(enc.content_url)}">
<audio preload="none" controls="controls">
<source type="${App.escapeHtml(enc.content_type)}" src="${App.escapeHtml(enc.content_url)}"/>
@@ -250,7 +250,7 @@ const Article = {
return comments;
},
unpack: function(row) {
- if (row.getAttribute("data-is-packed") == "1") {
+ if (row.getAttribute("data-is-packed") === "1") {
console.log("unpacking: " + row.id);
const container = row.querySelector(".content-inner");
@@ -260,7 +260,7 @@ const Article = {
dojo.parser.parse(container);
// blank content element might screw up onclick selection and keyboard moving
- if (container.textContent.length == 0)
+ if (container.textContent.length === 0)
container.innerHTML += "&nbsp;";
// in expandable mode, save content for later, so that we can pack unfocused rows back
@@ -273,7 +273,7 @@ const Article = {
}
},
pack: function(row) {
- if (row.getAttribute("data-is-packed") != "1") {
+ if (row.getAttribute("data-is-packed") !== "1") {
console.log("packing", row.id);
row.setAttribute("data-is-packed", "1");
@@ -428,7 +428,7 @@ const Article = {
}
},
setActive: function (id) {
- if (id != Article.getActive()) {
+ if (id !== Article.getActive()) {
console.log("setActive", id, "was", Article.getActive());
App.findAll("div[id*=RROW][class*=active]").forEach((row) => {
diff --git a/js/CommonDialogs.js b/js/CommonDialogs.js
index f1be94c7c..a9395d62e 100644
--- a/js/CommonDialogs.js
+++ b/js/CommonDialogs.js
@@ -332,7 +332,7 @@ const CommonDialogs = {
addLabel: function() {
const caption = prompt(__("Please enter label caption:"), "");
- if (caption != undefined && caption.trim().length > 0) {
+ if (caption !== undefined && caption.trim().length > 0) {
const query = {op: "Pref_Labels", method: "add", caption: caption.trim()};
@@ -351,7 +351,7 @@ const CommonDialogs = {
const msg = __("Unsubscribe from %s?").replace("%s", title);
- if (typeof title == "undefined" || confirm(msg)) {
+ if (typeof title === "undefined" || confirm(msg)) {
Notify.progress("Removing feed...");
const query = {op: "Pref_Feeds", quiet: 1, method: "remove", ids: feed_id};
@@ -360,7 +360,7 @@ const CommonDialogs = {
if (App.isPrefs()) {
dijit.byId("feedTree").reload();
} else {
- if (feed_id == Feeds.getActive())
+ if (feed_id === Feeds.getActive())
setTimeout(() => {
Feeds.openDefaultFeed();
},
@@ -396,10 +396,10 @@ const CommonDialogs = {
}
},
uploadIcon: function(input) {
- if (input.files.length != 0) {
+ if (input.files.length !== 0) {
const icon_file = input.files[0];
- if (icon_file.type.indexOf("image/") == -1) {
+ if (icon_file.type.indexOf("image/") === -1) {
alert(__("Please select an image file."));
return;
}
@@ -501,7 +501,7 @@ const CommonDialogs = {
xhr.json("backend.php", {op: "Pref_Feeds", method: "editfeed", id: feed_id}, (reply) => {
const feed = reply.feed;
- const is_readonly = reply.user.access_level == App.UserAccessLevels.ACCESS_LEVEL_READONLY;
+ const is_readonly = reply.user.access_level === App.UserAccessLevels.ACCESS_LEVEL_READONLY;
// for unsub prompt
dialog.feed_title = feed.title;
diff --git a/js/CommonFilters.js b/js/CommonFilters.js
index 6d40373d6..e27d3c40c 100644
--- a/js/CommonFilters.js
+++ b/js/CommonFilters.js
@@ -61,7 +61,7 @@ const Filters = {
// all done-- either the backend found no more pre-filtering entries, or test limits were reached
test_dialog.domNode.querySelector(".loading-indicator").hide();
- if (test_dialog.results == 0) {
+ if (test_dialog.results === 0) {
results_list.innerHTML = `<li class="text-center text-muted">
${__('No recent articles matching this filter have been found.')}</li>`;
@@ -132,9 +132,9 @@ const Filters = {
insertAction: function(parentNode, replaceNode) {
const form = document.forms["filter_new_action_form"];
- if (form.action_id.value == 7) {
+ if (form.action_id.value === '7') {
form.action_param.value = form.action_param_label.value;
- } else if (form.action_id.value == 9) {
+ } else if (form.action_id.value === '9') {
form.action_param.value = form.action_param_plugin.value;
}
@@ -254,11 +254,11 @@ const Filters = {
dijit.byId("filterDlg_actionParamPlugin").domNode.hide();
// if selected action supports parameters, enable params field
- if (action == dialog.ACTION_LABEL) {
+ if (action === dialog.ACTION_LABEL) {
dijit.byId("filterDlg_actionParamLabel").domNode.show();
- } else if (action == dialog.ACTION_PLUGIN) {
+ } else if (action === dialog.ACTION_PLUGIN) {
dijit.byId("filterDlg_actionParamPlugin").domNode.show();
- } else if (dialog.PARAM_ACTIONS.indexOf(action) != -1) {
+ } else if (dialog.PARAM_ACTIONS.indexOf(action) !== -1) {
dijit.byId("filterDlg_actionParam").domNode.show();
}
},
@@ -531,7 +531,7 @@ const Filters = {
// `selectedText` is always empty at this point (tested by selecting some article text).
const selectedText = App.getSelectedText();
- if (selectedText != "") {
+ if (selectedText !== '') {
const feed_id = Feeds.activeIsCat() ? 'CAT:' + parseInt(Feeds.getActive()) :
Feeds.getActive();
const rule = {reg_exp: selectedText, feed_id: [feed_id], filter_type: 1};
diff --git a/js/FeedStoreModel.js b/js/FeedStoreModel.js
index befc441af..fa8f730d6 100644
--- a/js/FeedStoreModel.js
+++ b/js/FeedStoreModel.js
@@ -56,7 +56,7 @@ define(["dojo/_base/declare", "dijit/tree/ForestStoreModel"], function (declare)
},
hasCats: function () {
if (this.store && this.store._itemsByIdentity)
- return this.store._itemsByIdentity['CAT:-1'] != undefined;
+ return this.store._itemsByIdentity['CAT:-1'] !== undefined;
else
return false;
},
diff --git a/js/FeedTree.js b/js/FeedTree.js
index 683205579..cd7e1f311 100755
--- a/js/FeedTree.js
+++ b/js/FeedTree.js
@@ -26,7 +26,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dojo/_base/array", "dojo/co
// var oreo = cookie(this.cookieName);
let oreo = localStorage.getItem(this.cookieName);
// migrate old data if nothing in localStorage
- if (oreo == null || oreo === '') {
+ if (oreo === null || oreo === '') {
oreo = cookie(this.cookieName);
cookie(this.cookieName, null, { expires: -1 });
}
@@ -50,7 +50,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dojo/_base/array", "dojo/co
let iconNode;
if (iconName) {
- if (iconName.indexOf("/") == -1) {
+ if (iconName.indexOf("/") === -1) {
iconNode = dojo.create("i", { className: "material-icons icon icon-" + iconName, innerHTML: iconName });
} else {
iconNode = dojo.create('img', { className: 'icon' });
@@ -156,7 +156,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dojo/_base/array", "dojo/co
domConstruct.place(tnode.loadingNode, tnode.expandoNode, 'only');
}
- if (id.match("CAT:") && bare_id == -1) {
+ if (id.match("CAT:") && bare_id === -1) {
const menu = new dijit.Menu();
menu.row_id = bare_id;
@@ -205,7 +205,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dojo/_base/array", "dojo/co
}
},
getTooltip: function (item) {
- return [item.updated, item.error].filter((x) => x && x != "").join(" - ");
+ return [item.updated, item.error].filter((x) => x && x !== "").join(" - ");
},
getIconClass: function (item, opened) {
// eslint-disable-next-line no-nested-ternary
@@ -217,21 +217,21 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dojo/_base/array", "dojo/co
getRowClass: function (item/*, opened */) {
let rc = "dijitTreeRow dijitTreeRowFlex";
- const is_cat = String(item.id).indexOf('CAT:') != -1;
+ const is_cat = String(item.id).indexOf('CAT:') !== -1;
if (is_cat)
rc += " Is_Cat";
else
rc += " Is_Feed";
- if (!is_cat && item.error != '') rc += " Error";
+ if (!is_cat && item.error !== '') rc += " Error";
if (item.unread > 0) rc += " Unread";
if (item.auxcounter > 0) rc += " Has_Aux";
if (item.markedcounter > 0) rc += " Has_Marked";
if (item.publishedcounter > 0) rc += " Has_Published";
if (item.updates_disabled > 0) rc += " UpdatesDisabled";
- if (item.bare_id >= App.LABEL_BASE_INDEX && item.bare_id < 0 && !is_cat || item.bare_id == Feeds.FEED_ARCHIVED && !is_cat) rc += " Special";
- if (item.bare_id == Feeds.CATEGORY_SPECIAL && is_cat) rc += " AlwaysVisible";
+ if (item.bare_id >= App.LABEL_BASE_INDEX && item.bare_id < 0 && !is_cat || item.bare_id === Feeds.FEED_ARCHIVED && !is_cat) rc += " Special";
+ if (item.bare_id === Feeds.CATEGORY_SPECIAL && is_cat) rc += " AlwaysVisible";
if (item.bare_id < App.LABEL_BASE_INDEX) rc += " Label";
return rc;
@@ -266,7 +266,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dojo/_base/array", "dojo/co
const items = this.model.store._arrayOfTopLevelItems;
for (let i = 0; i < items.length; i++) {
- if (String(items[i].id) == test_id) {
+ if (String(items[i].id) === test_id) {
this.expandParentNodes(feed, is_cat, parents);
} else {
this.findNodeParentsAndExpandThem(feed, is_cat, items[i], []);
@@ -276,13 +276,13 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dojo/_base/array", "dojo/co
parents.push(root);
for (let i = 0; i < root.items.length; i++) {
- if (String(root.items[i].id) == test_id) {
+ if (String(root.items[i].id) === test_id) {
this.expandParentNodes(feed, is_cat, parents);
} else {
this.findNodeParentsAndExpandThem(feed, is_cat, root.items[i], parents.slice(0));
}
}
- } else if (String(root.id) == test_id) {
+ } else if (String(root.id) === test_id) {
this.expandParentNodes(feed, is_cat, parents.slice(0));
}
} catch (e) {
@@ -423,7 +423,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dojo/_base/array", "dojo/co
const items = this.model.store._arrayOfAllItems;
const start = items.indexOf(treeItem);
- if (start != -1) {
+ if (start !== -1) {
let item = this._nextTreeItemFromIndex(start, unread_only);
// let's try again from the top
@@ -469,7 +469,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dojo/_base/array", "dojo/co
const items = this.model.store._arrayOfAllItems;
const start = items.indexOf(treeItem);
- if (start != -1) {
+ if (start !== -1) {
let item = this._prevTreeItemFromIndex(start, unread_only);
// wrap from the bottom
diff --git a/js/Feeds.js b/js/Feeds.js
index 71d9c29d4..825f6f8ef 100644
--- a/js/Feeds.js
+++ b/js/Feeds.js
@@ -31,7 +31,7 @@ const Feeds = {
entries.forEach((entry) => {
//console.log('feeds',entry.target, entry.intersectionRatio);
- if (entry.intersectionRatio == 0)
+ if (entry.intersectionRatio === 0)
Feeds.onHide(entry);
else
Feeds.onShow(entry);
@@ -50,7 +50,7 @@ const Feeds = {
// If number of properties is different,
// objects are not equivalent
- if (aProps.length != bProps.length) {
+ if (aProps.length !== bProps.length) {
return false;
}
@@ -87,13 +87,13 @@ const Feeds = {
const ts = elems[l].ts;
const updated = elems[l].updated;
- if (id == "global-unread") {
+ if (id === "global-unread") {
App.global_unread = ctr;
App.updateTitle();
continue;
}
- if (id == "subscribed-feeds") {
+ if (id === "subscribed-feeds") {
/* feeds_found = ctr; */
continue;
}
@@ -102,12 +102,14 @@ const Feeds = {
(kind == "cat")) {
}*/
- this.setUnread(id, (kind == "cat"), ctr);
- this.setValue(id, (kind == "cat"), 'auxcounter', parseInt(elems[l].auxcounter));
- this.setValue(id, (kind == "cat"), 'markedcounter', parseInt(elems[l].markedcounter));
- this.setValue(id, (kind == "cat"), 'publishedcounter', parseInt(elems[l].publishedcounter));
+ const is_cat = (kind === 'cat');
- if (kind != "cat") {
+ this.setUnread(id, is_cat, ctr);
+ this.setValue(id, is_cat, 'auxcounter', parseInt(elems[l].auxcounter));
+ this.setValue(id, is_cat, 'markedcounter', parseInt(elems[l].markedcounter));
+ this.setValue(id, is_cat, 'publishedcounter', parseInt(elems[l].publishedcounter));
+
+ if (!is_cat) {
this.setValue(id, false, 'error', error);
this.setValue(id, false, 'updated', updated);
@@ -130,7 +132,7 @@ const Feeds = {
PluginHost.run(PluginHost.HOOK_COUNTERS_PROCESSED, elems);
},
reloadCurrent: function(method) {
- if (this.getActive() != undefined) {
+ if (this.getActive() !== undefined) {
console.log("reloadCurrent", this.getActive(), this.activeIsCat(), method);
this.open({feed: this.getActive(), is_cat: this.activeIsCat(), method: method});
@@ -274,7 +276,7 @@ const Feeds = {
if (hash.query)
this._search_query = {query: hash.query, search_language: hash.search_language};
- if (hash.f != undefined) {
+ if (hash.f !== undefined) {
this.open({feed: parseInt(hash.f), is_cat: parseInt(hash.c)});
} else {
this.openDefaultFeed();
@@ -389,7 +391,7 @@ const Feeds = {
// this is used to quickly switch between feeds, sets active but xhr is on a timeout
const delayed = params.delayed || false;
- if (offset != 0) {
+ if (offset !== 0) {
if (this.infscroll_in_progress)
return;
@@ -419,9 +421,9 @@ const Feeds = {
query = Object.assign(query, this._search_query);
}
- if (offset != 0) {
+ if (offset !== 0) {
query.skip = offset;
- } else if (!is_cat && feed == this.getActive() && !params.method) {
+ } else if (!is_cat && feed === this.getActive() && !params.method) {
query.m = "ForceUpdate";
}
@@ -450,7 +452,7 @@ const Feeds = {
catchupAll: function() {
const str = __("Mark all articles as read?");
- if (App.getInitParam("confirm_feed_catchup") != 1 || confirm(str)) {
+ if (App.getInitParam("confirm_feed_catchup") !== 1 || confirm(str)) {
Notify.progress("Marking all feeds as read...");
@@ -509,7 +511,7 @@ const Feeds = {
if (next_feed !== false) {
this.open({feed: next_feed, is_cat: next_is_cat});
}
- } else if (feed == this.getActive() && is_cat == this.activeIsCat()) {
+ } else if (feed === this.getActive() && is_cat === this.activeIsCat()) {
this.reloadCurrent();
}
@@ -524,7 +526,7 @@ const Feeds = {
const str = __("Mark all articles in %s as read?").replace("%s", title);
- if (App.getInitParam("confirm_feed_catchup") != 1 || confirm(str)) {
+ if (App.getInitParam("confirm_feed_catchup") !== 1 || confirm(str)) {
const rows = App.findAll("#headlines-frame > div[id*=RROW][class*=Unread][data-orig-feed-id='" + id + "']");
diff --git a/js/Headlines.js b/js/Headlines.js
index 74b8ca00d..1547781c4 100755
--- a/js/Headlines.js
+++ b/js/Headlines.js
@@ -56,7 +56,7 @@ const Headlines = {
const modified = [];
mutations.forEach((m) => {
- if (m.type == 'attributes' && ['class', 'data-score'].indexOf(m.attributeName) != -1) {
+ if (m.type === 'attributes' && ['class', 'data-score'].indexOf(m.attributeName) !== -1) {
const row = m.target;
const id = row.getAttribute("data-article-id");
@@ -105,22 +105,22 @@ const Headlines = {
};
modified.forEach(function (m) {
- if (m.old.marked != m.new.marked)
+ if (m.old.marked !== m.new.marked)
ops.tmark.push(m.id);
- if (m.old.published != m.new.published)
+ if (m.old.published !== m.new.published)
ops.tpub.push(m.id);
- if (m.old.unread != m.new.unread)
+ if (m.old.unread !== m.new.unread)
m.new.unread ? ops.unread.push(m.id) : ops.read.push(m.id);
- if (m.old.selected != m.new.selected)
+ if (m.old.selected !== m.new.selected)
m.new.selected ? ops.select.push(m.row) : ops.deselect.push(m.row);
- if (m.old.active != m.new.active)
+ if (m.old.active !== m.new.active)
m.new.active ? ops.activate.push(m.row) : ops.deactivate.push(m.row);
- if (m.old.score != m.new.score) {
+ if (m.old.score !== m.new.score) {
const score = m.new.score;
ops.rescore[score] = ops.rescore[score] || [];
@@ -158,25 +158,25 @@ const Headlines = {
const promises = [];
- if (ops.tmark.length != 0)
+ if (ops.tmark.length !== 0)
promises.push(xhr.post("backend.php",
{op: "RPC", method: "markSelected", "ids[]": ops.tmark, cmode: 2}));
- if (ops.tpub.length != 0)
+ if (ops.tpub.length !== 0)
promises.push(xhr.post("backend.php",
{op: "RPC", method: "publishSelected", "ids[]": ops.tpub, cmode: 2}));
- if (ops.read.length != 0)
+ if (ops.read.length !== 0)
promises.push(xhr.post("backend.php",
{op: "RPC", method: "catchupSelected", "ids[]": ops.read, cmode: 0}));
- if (ops.unread.length != 0)
+ if (ops.unread.length !== 0)
promises.push(xhr.post("backend.php",
{op: "RPC", method: "catchupSelected", "ids[]": ops.unread, cmode: 1}));
const scores = Object.keys(ops.rescore);
- if (scores.length != 0) {
+ if (scores.length !== 0) {
scores.forEach((score) => {
promises.push(xhr.post("backend.php",
{op: "Article", method: "setScore", "ids[]": ops.rescore[score], score: score}));
@@ -236,7 +236,7 @@ const Headlines = {
Article.openInNewWindow(id);
Headlines.toggleUnread(id, 0);
- } else if (Article.getActive() != id) {
+ } else if (Article.getActive() !== id) {
Headlines.select('none');
@@ -309,7 +309,7 @@ const Headlines = {
offset = unread_in_buffer;
break;
case "adaptive":
- if (!(Feeds.getActive() == Feeds.FEED_STARRED && !Feeds.activeIsCat()))
+ if (!(Feeds.getActive() === Feeds.FEED_STARRED && !Feeds.activeIsCat()))
offset = num_unread > 0 ? unread_in_buffer : num_all;
break;
}
@@ -352,7 +352,7 @@ const Headlines = {
const last_row = hsp.previousSibling;
// invoke lazy load if last article in buffer is nearly visible OR is active
- if (Article.getActive() == last_row.getAttribute("data-article-id") || last_row.offsetTop - 250 <= container.scrollTop + container.offsetHeight) {
+ if (Article.getActive() === last_row.getAttribute("data-article-id") || last_row.offsetTop - 250 <= container.scrollTop + container.offsetHeight) {
hsp.innerHTML = `<span class='text-muted text-small text-center'><img class="icon-three-dots" src="${App.getInitParam('icon_three_dots')}"> ${__("Loading, please wait...")}</span>`;
Headlines.loadMore();
@@ -466,7 +466,7 @@ const Headlines = {
if (hl.unread) row_class += " Unread";
if (headlines.vfeed_group_enabled) row_class += " vgrlf";
- if (headlines.vfeed_group_enabled && hl.feed_title && this.vgroup_last_feed != hl.feed_id) {
+ if (headlines.vfeed_group_enabled && hl.feed_title && this.vgroup_last_feed !== hl.feed_id) {
const vgrhdr = `<div data-feed-id='${hl.feed_id}' class='feed-title'>
<div class="pull-right icon-feed" title="${App.escapeHtml(hl.feed_title)}"
onclick="Feeds.open({feed:${hl.feed_id}})">${Feeds.renderIcon(hl.feed_id, hl.has_icon)}</div>
@@ -635,7 +635,7 @@ const Headlines = {
target.destroyDescendants();
- if (tb && typeof tb == 'object') {
+ if (tb && typeof tb === 'object') {
target.attr('innerHTML',
`
<span class='left'>
@@ -672,7 +672,7 @@ const Headlines = {
<option></option>
<option value='headlines_catchupSelection'>${__('Mark as read')}</option>
<option value='article_selectionSetScore'>${__('Set score')}</option>
- ${tb.plugin_menu_items != '' ?
+ ${tb.plugin_menu_items !== '' ?
`
<option></option>
${tb.plugin_menu_items}
@@ -747,7 +747,7 @@ const Headlines = {
feed_id = reply['headlines']['id'];
Feeds.last_search_query = reply['headlines']['search_query'];
- if (feed_id != Feeds.FEED_ERROR && (feed_id != Feeds.getActive() || is_cat != Feeds.activeIsCat()))
+ if (feed_id !== Feeds.FEED_ERROR && (feed_id !== Feeds.getActive() || is_cat !== Feeds.activeIsCat()))
return;
const headlines_count = reply['headlines-info']['count'];
@@ -758,7 +758,7 @@ const Headlines = {
console.log('received', headlines_count, 'headlines');
if (!append) {
- Feeds.infscroll_disabled = parseInt(headlines_count) != 30;
+ Feeds.infscroll_disabled = parseInt(headlines_count) !== 30;
console.log('infscroll_disabled=', Feeds.infscroll_disabled);
// also called in renderAgain() after view mode switch
@@ -790,7 +790,7 @@ const Headlines = {
Headlines.renderToolbar(reply['headlines']);
- if (typeof reply['headlines']['content'] == 'string') {
+ if (typeof reply['headlines']['content'] === 'string') {
App.byId("headlines-frame").innerHTML = reply['headlines']['content'];
} else {
App.byId("headlines-frame").innerHTML = '';
@@ -831,7 +831,7 @@ const Headlines = {
Headlines.updateCurrentUnread();
- } else if (headlines_count > 0 && feed_id == Feeds.getActive() && is_cat == Feeds.activeIsCat()) {
+ } else if (headlines_count > 0 && feed_id === Feeds.getActive() && is_cat === Feeds.activeIsCat()) {
const c = dijit.byId("headlines-frame");
let hsp = App.byId("headlines-spacer");
@@ -841,7 +841,7 @@ const Headlines = {
let headlines_appended = 0;
- if (typeof reply['headlines']['content'] == 'string') {
+ if (typeof reply['headlines']['content'] === 'string') {
App.byId("headlines-frame").innerHTML = reply['headlines']['content'];
} else {
for (let i = 0; i < reply['headlines']['content'].length; i++) {
@@ -856,7 +856,7 @@ const Headlines = {
}
}
- Feeds.infscroll_disabled = headlines_appended == 0;
+ Feeds.infscroll_disabled = headlines_appended === 0;
console.log('appended', headlines_appended, 'headlines, infscroll_disabled=', Feeds.infscroll_disabled);
@@ -931,7 +931,7 @@ const Headlines = {
const toolbar = dijit.byId("toolbar-main");
let order_by = toolbar.getValues().order_by;
- if (order_by != "date_reverse")
+ if (order_by !== "date_reverse")
order_by = "date_reverse";
else
order_by = App.getInitParam("default_view_order_by");
@@ -939,11 +939,11 @@ const Headlines = {
toolbar.setValues({order_by: order_by});
},
selectionToggleUnread: function (params = {}) {
- const cmode = params.cmode != undefined ? params.cmode : 2;
+ const cmode = params.cmode !== undefined ? params.cmode : 2;
const no_error = params.no_error || false;
const ids = params.ids || Headlines.getSelected();
- if (ids.length == 0) {
+ if (ids.length === 0) {
if (!no_error)
alert(__("No articles selected."));
@@ -970,7 +970,7 @@ const Headlines = {
selectionToggleMarked: function (ids) {
ids = ids || Headlines.getSelected();
- if (ids.length == 0) {
+ if (ids.length === 0) {
alert(__("No articles selected."));
return;
}
@@ -982,7 +982,7 @@ const Headlines = {
selectionTogglePublished: function (ids) {
ids = ids || Headlines.getSelected();
- if (ids.length == 0) {
+ if (ids.length === 0) {
alert(__("No articles selected."));
return;
}
@@ -1022,13 +1022,13 @@ const Headlines = {
const rows = Headlines.getLoaded();
for (let i = 0; i < rows.length; i++) {
- if (rows[i] == current_id) {
+ if (rows[i] === current_id) {
// Account for adjacent identical article ids.
if (i > 0) prev_id = rows[i - 1];
for (let j = i + 1; j < rows.length; j++) {
- if (rows[j] != current_id) {
+ if (rows[j] !== current_id) {
next_id = rows[j];
break;
}
@@ -1059,7 +1059,7 @@ const Headlines = {
const next = row.nextSibling;
// hsp has half-screen height in auto catchup mode therefore we use its first child (normally A element)
- if (next && Element.visible(next) && next.id == "headlines-spacer" && next.firstChild) {
+ if (next && Element.visible(next) && next.id === "headlines-spacer" && next.firstChild) {
const offset = App.byId("headlines-spacer").offsetTop - App.byId("headlines-frame").offsetHeight + next.firstChild.offsetHeight;
// don't jump back either
@@ -1107,7 +1107,7 @@ const Headlines = {
const row = App.byId(`RROW-${id}`);
if (row) {
- if (typeof cmode == "undefined") cmode = 2;
+ if (typeof cmode === "undefined") cmode = 2;
switch (cmode) {
case 0:
@@ -1125,7 +1125,7 @@ const Headlines = {
selectionRemoveLabel: function (id, ids) {
if (!ids) ids = Headlines.getSelected();
- if (ids.length == 0) {
+ if (ids.length === 0) {
alert(__("No articles selected."));
return;
}
@@ -1142,7 +1142,7 @@ const Headlines = {
selectionAssignLabel: function (id, ids) {
if (!ids) ids = Headlines.getSelected();
- if (ids.length == 0) {
+ if (ids.length === 0) {
alert(__("No articles selected."));
return;
}
@@ -1159,7 +1159,7 @@ const Headlines = {
deleteSelection: function () {
const rows = Headlines.getSelected();
- if (rows.length == 0) {
+ if (rows.length === 0) {
alert(__("No articles selected."));
return;
}
@@ -1167,7 +1167,7 @@ const Headlines = {
const fn = Feeds.getName(Feeds.getActive(), Feeds.activeIsCat());
let str;
- if (Feeds.getActive() != 0) {
+ if (Feeds.getActive() !== 0) {
str = ngettext("Delete %d selected article in %s?", "Delete %d selected articles in %s?", rows.length);
} else {
str = ngettext("Delete %d selected article?", "Delete %d selected articles?", rows.length);
@@ -1229,7 +1229,7 @@ const Headlines = {
}
},
getRange: function (start, stop) {
- if (start == stop)
+ if (start === stop)
return [start];
const rows = App.findAll("#headlines-frame > div[id*=RROW]");
@@ -1240,7 +1240,7 @@ const Headlines = {
const row = rows[i];
const id = row.getAttribute('data-article-id');
- if (id == start || id == stop) {
+ if (id === start || id === stop) {
if (!collecting) {
collecting = true;
} else {
@@ -1296,7 +1296,7 @@ const Headlines = {
catchupSelection: function () {
const rows = Headlines.getSelected();
- if (rows.length == 0) {
+ if (rows.length === 0) {
alert(__("No articles selected."));
return;
}
@@ -1329,7 +1329,7 @@ const Headlines = {
if (!below) {
for (let i = 0; i < visible_ids.length; i++) {
- if (visible_ids[i] != id) {
+ if (visible_ids[i] !== id) {
const e = App.byId(`RROW-${visible_ids[i]}`);
if (e && e.hasClassName("Unread")) {
@@ -1341,7 +1341,7 @@ const Headlines = {
}
} else {
for (let i = visible_ids.length - 1; i >= 0; i--) {
- if (visible_ids[i] != id) {
+ if (visible_ids[i] !== id) {
const e = App.byId(`RROW-${visible_ids[i]}`);
if (e && e.hasClassName("Unread")) {
@@ -1353,12 +1353,12 @@ const Headlines = {
}
}
- if (ids_to_mark.length == 0) {
+ if (ids_to_mark.length === 0) {
alert(__("No articles found to mark"));
} else {
const msg = ngettext("Mark %d article as read?", "Mark %d articles as read?", ids_to_mark.length).replace("%d", ids_to_mark.length);
- if (App.getInitParam("confirm_feed_catchup") != 1 || confirm(msg)) {
+ if (App.getInitParam("confirm_feed_catchup") !== 1 || confirm(msg)) {
for (let i = 0; i < ids_to_mark.length; i++) {
const e = App.byId(`RROW-${ids_to_mark[i]}`);
@@ -1437,7 +1437,7 @@ const Headlines = {
let ids = Headlines.getSelected();
// cast to string
const id = (this.getParent().currentTarget.getAttribute("data-article-id")) + "";
- ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id];
+ ids = ids.length !== 0 && ids.indexOf(id) !== -1 ? ids : [id];
Headlines.selectionToggleUnread({ids: ids, no_error: 1});
}
@@ -1449,7 +1449,7 @@ const Headlines = {
let ids = Headlines.getSelected();
// cast to string
const id = (this.getParent().currentTarget.getAttribute("data-article-id")) + "";
- ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id];
+ ids = ids.length !== 0 && ids.indexOf(id) !== -1 ? ids : [id];
Headlines.selectionToggleMarked(ids);
}
@@ -1461,7 +1461,7 @@ const Headlines = {
let ids = Headlines.getSelected();
// cast to string
const id = (this.getParent().currentTarget.getAttribute("data-article-id")) + "";
- ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id];
+ ids = ids.length !== 0 && ids.indexOf(id) !== -1 ? ids : [id];
Headlines.selectionTogglePublished(ids);
}
@@ -1506,7 +1506,7 @@ const Headlines = {
// cast to string
const id = (this.getParent().ownerMenu.currentTarget.getAttribute("data-article-id")) + "";
- ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id];
+ ids = ids.length !== 0 && ids.indexOf(id) !== -1 ? ids : [id];
Headlines.selectionAssignLabel(this.labelId, ids);
}
@@ -1520,7 +1520,7 @@ const Headlines = {
// cast to string
const id = (this.getParent().ownerMenu.currentTarget.getAttribute("data-article-id")) + "";
- ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id];
+ ids = ids.length !== 0 && ids.indexOf(id) !== -1 ? ids : [id];
Headlines.selectionRemoveLabel(this.labelId, ids);
}
diff --git a/js/PluginHost.js b/js/PluginHost.js
index 513429e4a..e770c7050 100644
--- a/js/PluginHost.js
+++ b/js/PluginHost.js
@@ -24,7 +24,7 @@ const PluginHost = {
HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM2: 19,
hooks: [],
register: function (name, callback) {
- if (typeof(this.hooks[name]) == 'undefined')
+ if (typeof(this.hooks[name]) === 'undefined')
this.hooks[name] = [];
this.hooks[name].push(callback);
@@ -32,7 +32,7 @@ const PluginHost = {
run: function (name, args) {
//console.warn('PluginHost.run', name);
- if (typeof(this.hooks[name]) != 'undefined')
+ if (typeof(this.hooks[name]) !== 'undefined')
for (let i = 0; i < this.hooks[name].length; i++) {
this.hooks[name][i](args);
}
@@ -40,9 +40,9 @@ const PluginHost = {
run_until: function (name, check, ...args) {
//console.warn('PluginHost.run_until', name, check, args);
- if (typeof(this.hooks[name]) != 'undefined')
+ if (typeof(this.hooks[name]) !== 'undefined')
for (let i = 0; i < this.hooks[name].length; i++) {
- if (this.hooks[name][i](args) == check)
+ if (this.hooks[name][i](args) === check)
return true;
}
@@ -50,7 +50,7 @@ const PluginHost = {
},
unregister: function (name, callback) {
for (let i = 0; i < this.hooks[name].length; i++)
- if (this.hooks[name][i] == callback)
+ if (this.hooks[name][i] === callback)
this.hooks[name].splice(i, 1);
}
};
diff --git a/js/PrefFeedTree.js b/js/PrefFeedTree.js
index f1729382c..7a7c5b551 100644
--- a/js/PrefFeedTree.js
+++ b/js/PrefFeedTree.js
@@ -49,7 +49,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dojo/_b
// var oreo = cookie(this.cookieName);
let oreo = localStorage.getItem(this.cookieName);
// migrate old data if nothing in localStorage
- if (oreo == null || oreo === '') {
+ if (oreo === null || oreo === '') {
oreo = cookie(this.cookieName);
cookie(this.cookieName, null, { expires: -1 });
}
@@ -135,7 +135,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dojo/_b
},
// eslint-disable-next-line no-unused-vars
getRowClass: function (item, opened) {
- let rc = (!item.error || item.error == '') ? "dijitTreeRow" :
+ let rc = (!item.error || item.error === '') ? "dijitTreeRow" :
"dijitTreeRow Error";
if (item.updates_disabled > 0) rc += " UpdatesDisabled";
@@ -144,7 +144,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dojo/_b
},
getIconClass: function (item, opened) {
// eslint-disable-next-line no-nested-ternary
- return (!item || this.model.store.getValue(item, 'type') == 'category') ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "feed-icon";
+ return (!item || this.model.store.getValue(item, 'type') === 'category') ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "feed-icon";
},
reload: function() {
const searchElem = App.byId("feed_search");
@@ -175,11 +175,11 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dojo/_b
//console.log(id + " " + position + " " + source_id);
if (source_id.match("FEED:")) {
- return ((id.match("CAT:") && position == "over") ||
- (id.match("FEED:") && position != "over"));
+ return ((id.match("CAT:") && position === "over") ||
+ (id.match("FEED:") && position !== "over"));
} else if (source_id.match("CAT:")) {
return ((id.match("CAT:") && !id.match("CAT:0")) ||
- (id.match("root") && position == "over"));
+ (id.match("root") && position === "over"));
}
},
resetFeedOrder: function() {
@@ -293,7 +293,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dojo/_b
editSelectedFeed: function() {
const rows = this.getSelectedFeeds();
- if (rows.length == 0) {
+ if (rows.length === 0) {
alert(__("No feeds selected."));
return;
}
@@ -309,7 +309,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dojo/_b
editMultiple: function() {
const rows = this.getSelectedFeeds();
- if (rows.length == 0) {
+ if (rows.length === 0) {
alert(__("No feeds selected."));
return;
}
@@ -340,7 +340,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dojo/_b
target.attr('disabled', !checkbox.attr('checked'));
console.log(target, target.attr('type'));
- if (target.attr('type') == "checkbox") {
+ if (target.attr('type') === "checkbox") {
const label = checkbox.domNode.closest("label");
if (checkbox.attr('checked'))
@@ -358,7 +358,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dojo/_b
Object.keys(query).forEach((key) => {
const val = query[key];
- if (typeof val == "object" && val.length == 0)
+ if (typeof val === "object" && val.length === 0)
query[key] = ["off"];
});
@@ -384,12 +384,12 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dojo/_b
},
editCategory: function(id, item) {
// uncategorized
- if (String(item.id) == "CAT:0")
+ if (String(item.id) === "CAT:0")
return;
const new_name = prompt(__('Rename category to:'), item.name);
- if (new_name && new_name != item.name) {
+ if (new_name && new_name !== item.name) {
Notify.progress("Loading, please wait...");
diff --git a/js/PrefFilterTree.js b/js/PrefFilterTree.js
index e63dd5797..9a9728c08 100644
--- a/js/PrefFilterTree.js
+++ b/js/PrefFilterTree.js
@@ -29,7 +29,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio
if (param) {
param = dojo.doc.createElement('ul');
- param.className = (enabled != false) ? 'actions_summary' : 'actions_summary filterDisabled';
+ param.className = (enabled !== false) ? 'actions_summary' : 'actions_summary filterDisabled';
param.innerHTML = args.item.param[0];
domConstruct.place(param, tnode.rowNode, 'first');
}
@@ -85,7 +85,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio
// disable copying items
source.copyState = function() { return false; };
- return position != 'over';
+ return position !== 'over';
},
onDndDrop: function() {
this.inherited(arguments);
@@ -132,7 +132,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio
joinSelectedFilters: function() {
const rows = this.getSelectedFilters();
- if (rows.length == 0) {
+ if (rows.length === 0) {
alert(__("No filters selected."));
return;
}
diff --git a/js/PrefHelpers.js b/js/PrefHelpers.js
index cf822d987..b0b0d9c97 100644
--- a/js/PrefHelpers.js
+++ b/js/PrefHelpers.js
@@ -15,7 +15,7 @@ const Helpers = {
removeSelected: function() {
const rows = this.getSelected();
- if (rows.length == 0) {
+ if (rows.length === 0) {
alert("No passwords selected.");
} else if (confirm(__("Remove selected app passwords?"))) {
@@ -131,7 +131,7 @@ const Helpers = {
cloneSelected: function() {
const sel_rows = this.getSelectedProfiles();
- if (sel_rows.length == 1) {
+ if (sel_rows.length === 1) {
const new_title = prompt(__("Name for cloned profile:"));
if (new_title) {
@@ -238,7 +238,7 @@ const Helpers = {
execute: function () {
const sel_rows = this.getSelectedProfiles();
- if (sel_rows.length == 1) {
+ if (sel_rows.length === 1) {
if (confirm(__("Activate selected profile?"))) {
Notify.progress("Loading, please wait...");
@@ -386,11 +386,11 @@ const Helpers = {
this._list_of_plugins.plugins.forEach((plugin) => {
- if (search_tokens.length == 0 ||
+ if (search_tokens.length === 0 ||
Object.values(plugin).filter((pval) =>
search_tokens.filter((stoken) =>
- (pval.toString().indexOf(stoken) != -1 ? stoken : null)
- ).length == search_tokens.length).length > 0) {
+ (pval.toString().indexOf(stoken) !== -1 ? stoken : null)
+ ).length === search_tokens.length).length > 0) {
++results_rendered;
@@ -433,7 +433,7 @@ const Helpers = {
}
});
- if (results_rendered == 0) {
+ if (results_rendered === 0) {
container.innerHTML += `<li class='text-center text-info'>${__("Could not find any plugins for this search query.")}</li>`;
}
@@ -456,7 +456,7 @@ const Helpers = {
Notify.progress("Loading, please wait...");
xhr.json("backend.php", {op: "Pref_Prefs", method: "uninstallPlugin", plugin: plugin}, (reply) => {
- if (reply && reply.status == 1)
+ if (reply && reply.status === 1)
Helpers.Plugins.reload();
else {
Notify.error("Plugin uninstallation failed.");
@@ -562,11 +562,11 @@ const Helpers = {
const is_installed = (dialog.installed_plugins
.filter((p) => plugin.topics.map((t) => t.replace(/-/g, "_")).includes(p))).length > 0;
- if (search_tokens.length == 0 ||
+ if (search_tokens.length === 0 ||
Object.values(plugin).filter((pval) =>
search_tokens.filter((stoken) =>
- (pval.indexOf(stoken) != -1 ? stoken : null)
- ).length == search_tokens.length).length > 0) {
+ (pval.indexOf(stoken) !== -1 ? stoken : null)
+ ).length === search_tokens.length).length > 0) {
++results_rendered;
@@ -592,7 +592,7 @@ const Helpers = {
}
});
- if (results_rendered == 0) {
+ if (results_rendered === 0) {
container.innerHTML = `<li class='text-center text-info'>${__("Could not find any plugins for this search query.")}</li>`;
}
@@ -664,7 +664,7 @@ const Helpers = {
container.innerHTML = "";
reply.forEach((p) => {
- if (p.rv.git_status == 0)
+ if (p.rv.git_status === 0)
dialog.need_refresh = true;
else
enable_update_btn = true;
@@ -704,7 +704,7 @@ const Helpers = {
dialog.attr('title', __("No updates available"));
dijit.getEnclosingWidget(dialog.domNode.querySelector(".update-btn"))
- .attr('disabled', num_updated == 0);
+ .attr('disabled', num_updated === 0);
}
},
@@ -735,7 +735,7 @@ const Helpers = {
update_button.domNode.show();
}
- if (p.rv.need_update || p.rv.git_status != 0) {
+ if (p.rv.need_update || p.rv.git_status !== 0) {
container.innerHTML +=
`
<li><h3>${p.plugin}</h3>
@@ -787,7 +787,7 @@ const Helpers = {
import: function() {
const opml_file = App.byId("opml_file");
- if (opml_file.value.length == 0) {
+ if (opml_file.value.length === 0) {
alert(__("Please choose an OPML file first."));
return false;
} else {
diff --git a/js/PrefLabelTree.js b/js/PrefLabelTree.js
index 582e5a9b9..c73a3ac46 100644
--- a/js/PrefLabelTree.js
+++ b/js/PrefLabelTree.js
@@ -19,7 +19,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dijit/f
const type = this.model.store.getValue(args.item, 'type');
//const bare_id = this.model.store.getValue(args.item, 'bare_id');
- if (type == 'label') {
+ if (type === 'label') {
const label = dojo.doc.createElement('i');
//const fg_color = args.item.fg_color[0];
const bg_color = String(args.item.bg_color);
diff --git a/js/PrefUsers.js b/js/PrefUsers.js
index e8f4a7489..362e62662 100644
--- a/js/PrefUsers.js
+++ b/js/PrefUsers.js
@@ -32,7 +32,7 @@ const Users = {
edit: function(id) {
xhr.json('backend.php', {op: 'Pref_Users', method: 'edit', id: id}, (reply) => {
const user = reply.user;
- const admin_disabled = (user.id == 1);
+ const admin_disabled = (user.id === 1);
const dialog = new fox.SingleUseDialog({
id: "userEditDlg",
@@ -132,7 +132,7 @@ const Users = {
resetSelected: function() {
const rows = this.getSelection();
- if (rows.length == 0) {
+ if (rows.length === 0) {
alert(__("No users selected."));
return;
}
diff --git a/js/common.js b/js/common.js
index 99cf52fa1..cdc6cd6cc 100755
--- a/js/common.js
+++ b/js/common.js
@@ -5,7 +5,7 @@
/* exported __ */
function __(msg) {
- if (typeof App != "undefined") {
+ if (typeof App !== "undefined") {
return App.l10n.__(msg);
} else {
return msg;
@@ -106,7 +106,7 @@ Element.prototype.fadeOut = function() {
Element.prototype.fadeIn = function(display = undefined){
this.style.opacity = 0;
- this.style.display = display == undefined ? "block" : display;
+ this.style.display = display === undefined ? "block" : display;
const self = this;
(function fade() {
@@ -119,39 +119,39 @@ Element.prototype.fadeIn = function(display = undefined){
};
Element.prototype.visible = function() {
- return window.getComputedStyle(this).display != "none"; //&& this.offsetHeight != 0 && this.offsetWidth != 0;
+ return window.getComputedStyle(this).display !== "none"; //&& this.offsetHeight !== 0 && this.offsetWidth !== 0;
}
Element.visible = function(elem) {
- if (typeof elem == "string")
+ if (typeof elem === "string")
elem = document.getElementById(elem);
return elem.visible();
}
Element.show = function(elem) {
- if (typeof elem == "string")
+ if (typeof elem === "string")
elem = document.getElementById(elem);
return elem.show();
}
Element.hide = function(elem) {
- if (typeof elem == "string")
+ if (typeof elem === "string")
elem = document.getElementById(elem);
return elem.hide();
}
Element.toggle = function(elem) {
- if (typeof elem == "string")
+ if (typeof elem === "string")
elem = document.getElementById(elem);
return elem.toggle();
}
Element.hasClassName = function (elem, className) {
- if (typeof elem == "string")
+ if (typeof elem === "string")
elem = document.getElementById(elem);
return elem.hasClassName(className);
@@ -159,7 +159,7 @@ Element.hasClassName = function (elem, className) {
Array.prototype.remove = function(s) {
for (let i=0; i < this.length; i++) {
- if (s == this[i]) this.splice(i, 1);
+ if (s === this[i]) this.splice(i, 1);
}
};
@@ -176,14 +176,14 @@ const xhr = {
console.log('xhr.post', '>>>', params);
return new Promise((resolve, reject) => {
- if (typeof __csrf_token != "undefined")
+ if (typeof __csrf_token !== "undefined")
params = {...params, ...{csrf_token: __csrf_token}};
dojo.xhrPost({url: url,
postData: dojo.objectToQuery(params),
handleAs: "text",
error: function(error) {
- if (failed != undefined)
+ if (failed !== undefined)
failed(error);
reject(error);
@@ -191,7 +191,7 @@ const xhr = {
load: function(data, ioargs) {
console.log('xhr.post', '<<<', ioargs.xhr, (new Date().getTime() - xhr._ts) + " ms");
- if (complete != undefined)
+ if (typeof complete === 'function')
complete(data, ioargs.xhr);
resolve(data)
@@ -209,7 +209,7 @@ const xhr = {
} catch (e) {
console.error("xhr.json", e, xhr);
- if (failed != undefined)
+ if (typeof failed === 'function')
failed(e);
reject(e);
@@ -218,21 +218,21 @@ const xhr = {
console.log('xhr.json', '<<<', obj, (new Date().getTime() - xhr._ts) + " ms");
- if (obj && typeof App != "undefined")
- if (!App.handleRpcJson(obj)) {
+ if (obj && typeof App !== "undefined")
+ if (!App.handleRpcJson(obj)) {
- if (failed != undefined)
- failed(obj);
+ if (typeof failed === 'function')
+ failed(obj);
- reject(obj);
- return;
- }
+ reject(obj);
+ return;
+ }
- if (complete != undefined) complete(obj);
+ if (typeof complete === 'function')
+ complete(obj);
- resolve(obj);
- }
- ));
+ resolve(obj);
+ }));
}
};
@@ -241,7 +241,7 @@ function xhrPost(url, params = {}, complete = undefined) {
console.log("xhrPost:", params);
return new Promise((resolve, reject) => {
- if (typeof __csrf_token != "undefined")
+ if (typeof __csrf_token !== "undefined")
params = {...params, ...{csrf_token: __csrf_token}};
dojo.xhrPost({url: url,
@@ -251,7 +251,7 @@ function xhrPost(url, params = {}, complete = undefined) {
reject(error);
},
load: function(data, ioargs) {
- if (complete != undefined)
+ if (complete !== undefined)
complete(ioargs.xhr);
resolve(ioargs.xhr)
@@ -279,7 +279,7 @@ const Lists = {
checked ? row.addClassName("Selected") : row.removeClassName("Selected");
},
select: function(elem, selected) {
- if (typeof elem == "string")
+ if (typeof elem === "string")
elem = document.getElementById(elem);
elem.querySelectorAll("li").forEach((row) => {
@@ -300,7 +300,7 @@ const Lists = {
getSelected: function(elem) {
const rv = [];
- if (typeof elem == "string")
+ if (typeof elem === "string")
elem = document.getElementById(elem);
elem.querySelectorAll("li").forEach((row) => {
@@ -337,7 +337,7 @@ const Tables = {
},
select: function(elem, selected) {
- if (typeof elem == "string")
+ if (typeof elem === "string")
elem = document.getElementById(elem);
elem.querySelectorAll("tr").forEach((row) => {
@@ -358,7 +358,7 @@ const Tables = {
getSelected: function(elem) {
const rv = [];
- if (typeof elem == "string")
+ if (typeof elem === "string")
elem = document.getElementById(elem);
elem.querySelectorAll("tr").forEach((row) => {
@@ -394,8 +394,8 @@ const Cookie = {
const ca = document.cookie.split(';');
for (let i=0; i < ca.length; i++) {
let c = ca[i];
- while (c.charAt(0) == ' ') c = c.substring(1);
- if (c.indexOf(name) == 0) return decodeURIComponent(c.substring(name.length, c.length));
+ while (c.charAt(0) === ' ') c = c.substring(1);
+ if (c.indexOf(name) === 0) return decodeURIComponent(c.substring(name.length, c.length));
}
return "";
},
@@ -455,7 +455,7 @@ const Notify = {
}
if (icon)
- if (icon.indexOf("data:image") != -1)
+ if (icon.indexOf("data:image") !== -1)
msgfmt = "<img src=\"%s\">".replace("%s", icon) + msgfmt;
else
msgfmt = "<i class='material-icons icon-notify'>%s</i>".replace("%s", icon) + msgfmt;
diff --git a/js/form/Select.js b/js/form/Select.js
index 0c73cd52c..2259fd762 100755
--- a/js/form/Select.js
+++ b/js/form/Select.js
@@ -15,7 +15,7 @@ define(["dojo/_base/declare",
startup: function() {
this.inherited(arguments);
- if (this.attr('data-dropdown-skip-first') == 'true') {
+ if (this.attr('data-dropdown-skip-first') === 'true') {
aspect.before(this, "_loadChildren", () => {
this.options = this.options.splice(1);
});
@@ -26,7 +26,7 @@ define(["dojo/_base/declare",
//
},
_setValueAttr: function(/*anything*/ newValue, /*Boolean?*/ priorityChange){
- if (this.attr('data-prevent-value-change') == 'true' && newValue != '')
+ if (this.attr('data-prevent-value-change') === 'true' && newValue !== '')
return;
this.inherited(arguments);
diff --git a/js/form/ValidationMultiSelect.js b/js/form/ValidationMultiSelect.js
index 4e7263c61..a0199c9c6 100644
--- a/js/form/ValidationMultiSelect.js
+++ b/js/form/ValidationMultiSelect.js
@@ -11,7 +11,7 @@ define(["dojo/_base/declare", "dojo/_base/lang", "dijit/form/MultiSelect", ],
this.baseClass += ' dijitValidationMultiSelect';
},
validate: function(/*Boolean*/ isFocused){
- if (this.required && this.attr('value').length == 0)
+ if (this.required && this.attr('value').length === 0)
return false;
return true;
diff --git a/js/prefs.js b/js/prefs.js
index 8f4f45700..0fb70f710 100755
--- a/js/prefs.js
+++ b/js/prefs.js
@@ -63,7 +63,7 @@ require(["dojo/_base/kernel",
try {
App.init(parser, true);
} catch (e) {
- if (typeof App != "undefined" && App.Error)
+ if (typeof App !== "undefined" && App.Error)
App.Error.report(e);
else
alert(e + "\n\n" + e.stack);
diff --git a/js/tt-rss.js b/js/tt-rss.js
index 10fafc447..8e0401d80 100644
--- a/js/tt-rss.js
+++ b/js/tt-rss.js
@@ -61,7 +61,7 @@ require(["dojo/_base/kernel",
try {
App.init(parser, false);
} catch (e) {
- if (typeof App != "undefined" && App.Error)
+ if (typeof App !== "undefined" && App.Error)
App.Error.report(e);
else
alert(e + "\n\n" + e.stack);
diff --git a/js/utility.js b/js/utility.js
index 2e27c4fe6..e5de5f300 100644
--- a/js/utility.js
+++ b/js/utility.js
@@ -7,8 +7,8 @@ window.addEventListener("load", function() {
apply_night_mode: function (is_night, link) {
console.log("night mode changed to", is_night);
- const light_theme = typeof __default_light_theme != 'undefined' ? __default_light_theme : 'themes/light.css';
- const dark_theme = typeof __default_dark_theme != 'undefined' ? __default_dark_theme : 'themes/night.css';
+ const light_theme = typeof __default_light_theme !== 'undefined' ? __default_light_theme : 'themes/light.css';
+ const dark_theme = typeof __default_dark_theme !== 'undefined' ? __default_dark_theme : 'themes/night.css';
if (link) {
const css_override = is_night ? dark_theme : light_theme;
@@ -27,7 +27,7 @@ window.addEventListener("load", function() {
link.onload = function() {
document.querySelector("body").removeClassName("css_loading");
- if (typeof UtilityApp != "undefined")
+ if (typeof UtilityApp !== "undefined")
UtilityApp.init();
};