remove unnecessary "== 1" when checking for init params

unsubscribeFeed: check for undefined title correctly
This commit is contained in:
Andrew Dolgov 2019-12-10 09:10:45 +03:00
parent a40f22d8aa
commit 5b4eb8d7b9
3 changed files with 14 additions and 14 deletions

View File

@ -385,7 +385,7 @@ define(["dojo/_base/declare"], function (declare) {
const msg = __("Unsubscribe from %s?").replace("%s", title); const msg = __("Unsubscribe from %s?").replace("%s", title);
if (title == undefined || confirm(msg)) { if (typeof title == "undefined" || confirm(msg)) {
Notify.progress("Removing feed..."); Notify.progress("Removing feed...");
const query = {op: "pref-feeds", quiet: 1, method: "remove", ids: feed_id}; const query = {op: "pref-feeds", quiet: 1, method: "remove", ids: feed_id};

View File

@ -93,7 +93,7 @@ define(["dojo/_base/declare"], function (declare) {
} }
} }
this.hideOrShowFeeds(App.getInitParam("hide_read_feeds") == 1); this.hideOrShowFeeds(App.getInitParam("hide_read_feeds"));
this._counters_prev = elems; this._counters_prev = elems;
PluginHost.run(PluginHost.HOOK_COUNTERS_PROCESSED); PluginHost.run(PluginHost.HOOK_COUNTERS_PROCESSED);
@ -147,7 +147,7 @@ define(["dojo/_base/declare"], function (declare) {
const treeModel = new fox.FeedStoreModel({ const treeModel = new fox.FeedStoreModel({
store: store, store: store,
query: { query: {
"type": App.getInitParam('enable_feed_cats') == 1 ? "category" : "feed" "type": App.getInitParam('enable_feed_cats') ? "category" : "feed"
}, },
rootId: "root", rootId: "root",
rootLabel: "Feeds", rootLabel: "Feeds",
@ -212,7 +212,7 @@ define(["dojo/_base/declare"], function (declare) {
this.open({feed: -3}); this.open({feed: -3});
} }
this.hideOrShowFeeds(App.getInitParam("hide_read_feeds") == 1); this.hideOrShowFeeds(App.getInitParam("hide_read_feeds"));
if (App.getInitParam("is_default_pw")) { if (App.getInitParam("is_default_pw")) {
console.warn("user password is at default value"); console.warn("user password is at default value");
@ -237,7 +237,7 @@ define(["dojo/_base/declare"], function (declare) {
} }
// bw_limit disables timeout() so we request initial counters separately // bw_limit disables timeout() so we request initial counters separately
if (App.getInitParam("bw_limit") == "1") { if (App.getInitParam("bw_limit")) {
this.requestCounters(true); this.requestCounters(true);
} else { } else {
setTimeout(() => { setTimeout(() => {
@ -274,7 +274,7 @@ define(["dojo/_base/declare"], function (declare) {
if (tree) return tree.selectFeed(feed, is_cat); if (tree) return tree.selectFeed(feed, is_cat);
}, },
toggleUnread: function() { toggleUnread: function() {
const hide = !(App.getInitParam("hide_read_feeds") == "1"); const hide = !App.getInitParam("hide_read_feeds");
xhrPost("backend.php", {op: "rpc", method: "setpref", key: "HIDE_READ_FEEDS", value: hide}, () => { xhrPost("backend.php", {op: "rpc", method: "setpref", key: "HIDE_READ_FEEDS", value: hide}, () => {
this.hideOrShowFeeds(hide); this.hideOrShowFeeds(hide);
@ -385,7 +385,7 @@ define(["dojo/_base/declare"], function (declare) {
} }
}, },
catchupFeed: function(feed, is_cat, mode) { catchupFeed: function(feed, is_cat, mode) {
if (is_cat == undefined) is_cat = false; is_cat = is_cat || false;
let str = false; let str = false;
@ -409,7 +409,7 @@ define(["dojo/_base/declare"], function (declare) {
str = str.replace("%s", fn) str = str.replace("%s", fn)
.replace("%w", mark_what); .replace("%w", mark_what);
if (App.getInitParam("confirm_feed_catchup") == 1 && !confirm(str)) { if (App.getInitParam("confirm_feed_catchup") && !confirm(str)) {
return; return;
} }
@ -424,7 +424,7 @@ define(["dojo/_base/declare"], function (declare) {
xhrPost("backend.php", catchup_query, (transport) => { xhrPost("backend.php", catchup_query, (transport) => {
App.handleRpcJson(transport); App.handleRpcJson(transport);
const show_next_feed = App.getInitParam("on_catchup_show_next_feed") == "1"; const show_next_feed = App.getInitParam("on_catchup_show_next_feed");
if (show_next_feed) { if (show_next_feed) {
const nuf = this.getNextUnread(feed, is_cat); const nuf = this.getNextUnread(feed, is_cat);

View File

@ -303,7 +303,7 @@ define(["dojo/_base/declare"], function (declare) {
} }
} }
if (App.getInitParam("cdm_auto_catchup") == 1) { if (App.getInitParam("cdm_auto_catchup")) {
let rows = $$("#headlines-frame > div[id*=RROW][class*=Unread]"); let rows = $$("#headlines-frame > div[id*=RROW][class*=Unread]");
@ -919,7 +919,7 @@ define(["dojo/_base/declare"], function (declare) {
const row = $("RROW-" + id); const row = $("RROW-" + id);
if (row) { if (row) {
if (cmode == undefined) cmode = 2; if (typeof cmode == "undefined") cmode = 2;
switch (cmode) { switch (cmode) {
case 0: case 0:
@ -990,7 +990,7 @@ define(["dojo/_base/declare"], function (declare) {
str = str.replace("%d", rows.length); str = str.replace("%d", rows.length);
str = str.replace("%s", fn); str = str.replace("%s", fn);
if (App.getInitParam("confirm_feed_catchup") == 1 && !confirm(str)) { if (App.getInitParam("confirm_feed_catchup") && !confirm(str)) {
return; return;
} }
@ -1136,7 +1136,7 @@ define(["dojo/_base/declare"], function (declare) {
str = str.replace("%d", rows.length); str = str.replace("%d", rows.length);
str = str.replace("%s", fn); str = str.replace("%s", fn);
if (App.getInitParam("confirm_feed_catchup") == 1 && !confirm(str)) { if (App.getInitParam("confirm_feed_catchup") && !confirm(str)) {
return; return;
} }
@ -1162,7 +1162,7 @@ define(["dojo/_base/declare"], function (declare) {
str = str.replace("%d", rows.length); str = str.replace("%d", rows.length);
str = str.replace("%s", fn); str = str.replace("%s", fn);
if (App.getInitParam("confirm_feed_catchup") == 1 && !confirm(str)) { if (App.getInitParam("confirm_feed_catchup") && !confirm(str)) {
return; return;
} }