fix some minor linter problems

This commit is contained in:
Andrew Dolgov 2018-12-02 07:31:10 +03:00
parent 1e2d4410d3
commit e5f3b75540
3 changed files with 62 additions and 56 deletions

View File

@ -1,4 +1,4 @@
/* global notify,__,dijit */ /* global notify,__,dijit,fox */
const Feeds = { const Feeds = {
counters_last_request: 0, counters_last_request: 0,
@ -155,6 +155,7 @@ const Feeds = {
url: "backend.php?op=pref_feeds&method=getfeedtree&mode=2" url: "backend.php?op=pref_feeds&method=getfeedtree&mode=2"
}); });
// noinspection JSUnresolvedFunction
const treeModel = new fox.FeedStoreModel({ const treeModel = new fox.FeedStoreModel({
store: store, store: store,
query: { query: {
@ -165,9 +166,10 @@ const Feeds = {
childrenAttrs: ["items"] childrenAttrs: ["items"]
}); });
// noinspection JSUnresolvedFunction
const tree = new fox.FeedTree({ const tree = new fox.FeedTree({
model: treeModel, model: treeModel,
onClick: function (item, node) { onClick: function (item/*, node*/) {
const id = String(item.id); const id = String(item.id);
const is_cat = id.match("^CAT:"); const is_cat = id.match("^CAT:");
const feed = id.substr(id.indexOf(":") + 1); const feed = id.substr(id.indexOf(":") + 1);

View File

@ -89,9 +89,6 @@ const Utils = {
if (!this.hotkey_prefix && hotkeys_map[0].indexOf(keychar) != -1) { if (!this.hotkey_prefix && hotkeys_map[0].indexOf(keychar) != -1) {
const date = new Date();
const ts = Math.round(date.getTime() / 1000);
this.hotkey_prefix = keychar; this.hotkey_prefix = keychar;
$("cmdline").innerHTML = keychar; $("cmdline").innerHTML = keychar;
Element.show("cmdline"); Element.show("cmdline");
@ -123,11 +120,13 @@ const Utils = {
let action_name = false; let action_name = false;
for (const sequence in hotkeys_map[1]) { for (const sequence in hotkeys_map[1]) {
if (hotkeys_map[1].hasOwnProperty(sequence)) {
if (sequence == hotkey_full) { if (sequence == hotkey_full) {
action_name = hotkeys_map[1][sequence]; action_name = hotkeys_map[1][sequence];
break; break;
} }
} }
}
console.log('keyeventToAction', hotkey_full, '=>', action_name); console.log('keyeventToAction', hotkey_full, '=>', action_name);
@ -282,8 +281,11 @@ const Utils = {
//console.log("parsing runtime info..."); //console.log("parsing runtime info...");
for (const k in data) { for (const k in data) {
if (data.hasOwnProperty(k)) {
const v = data[k]; const v = data[k];
console.log("RI:", k, "=>", v);
if (k == "dep_ts" && parseInt(getInitParam("dep_ts")) > 0) { if (k == "dep_ts" && parseInt(getInitParam("dep_ts")) > 0) {
if (parseInt(getInitParam("dep_ts")) < parseInt(v) && getInitParam("reload_on_ts_change")) { if (parseInt(getInitParam("dep_ts")) < parseInt(v) && getInitParam("reload_on_ts_change")) {
window.location.reload(); window.location.reload();
@ -318,7 +320,7 @@ const Utils = {
} }
init_params[k] = v; init_params[k] = v;
notify(''); }
} }
PluginHost.run(PluginHost.HOOK_RUNTIME_INFO_LOADED, data); PluginHost.run(PluginHost.HOOK_RUNTIME_INFO_LOADED, data);
@ -349,7 +351,7 @@ const Utils = {
if (params.hasOwnProperty(k)) { if (params.hasOwnProperty(k)) {
switch (k) { switch (k) {
case "label_base_index": case "label_base_index":
_label_base_index = parseInt(params[k]) _label_base_index = parseInt(params[k]);
break; break;
case "hotkeys": case "hotkeys":
// filter mnemonic definitions (used for help panel) from hotkeys map // filter mnemonic definitions (used for help panel) from hotkeys map
@ -357,9 +359,11 @@ const Utils = {
const tmp = []; const tmp = [];
for (const sequence in params[k][1]) { for (const sequence in params[k][1]) {
if (params[k][1].hasOwnProperty(sequence)) {
const filtered = sequence.replace(/\|.*$/, ""); const filtered = sequence.replace(/\|.*$/, "");
tmp[filtered] = params[k][1][sequence]; tmp[filtered] = params[k][1][sequence];
} }
}
params[k][1] = tmp; params[k][1] = tmp;
break; break;
@ -458,9 +462,11 @@ const CommonDialogs = {
let count = 0; let count = 0;
for (const feedUrl in feeds) { for (const feedUrl in feeds) {
if (feeds.hasOwnProperty(feedUrl)) {
select.addOption({value: feedUrl, label: feeds[feedUrl]}); select.addOption({value: feedUrl, label: feeds[feedUrl]});
count++; count++;
} }
}
Effect.Appear('feedDlg_feedsContainer', {duration: 0.5}); Effect.Appear('feedDlg_feedsContainer', {duration: 0.5});
@ -687,7 +693,7 @@ const CommonDialogs = {
const query = {op: "pref-feeds", quiet: 1, method: "remove", ids: feed_id}; const query = {op: "pref-feeds", quiet: 1, method: "remove", ids: feed_id};
xhrPost("backend.php", query, (transport) => { xhrPost("backend.php", query, () => {
if (dijit.byId("feedEditDlg")) dijit.byId("feedEditDlg").hide(); if (dijit.byId("feedEditDlg")) dijit.byId("feedEditDlg").hide();
if (App.isPrefs()) { if (App.isPrefs()) {
@ -752,10 +758,10 @@ const CommonDialogs = {
const e = $('gen_feed_url'); const e = $('gen_feed_url');
if (new_link) { if (new_link) {
e.innerHTML = e.innerHTML.replace(/\&amp;key=.*$/, e.innerHTML = e.innerHTML.replace(/&amp;key=.*$/,
"&amp;key=" + new_link); "&amp;key=" + new_link);
e.href = e.href.replace(/\&key=.*$/, e.href = e.href.replace(/&key=.*$/,
"&key=" + new_link); "&key=" + new_link);
new Effect.Highlight(e); new Effect.Highlight(e);
@ -1509,7 +1515,7 @@ function removeFeedIcon(id) {
const query = { op: "pref-feeds", method: "removeicon", feed_id: id }; const query = { op: "pref-feeds", method: "removeicon", feed_id: id };
xhrPost("backend.php", query, (transport) => { xhrPost("backend.php", query, () => {
notify_info("Feed icon removed."); notify_info("Feed icon removed.");
if (App.isPrefs()) { if (App.isPrefs()) {
Feeds.reload(); Feeds.reload();

View File

@ -280,7 +280,7 @@ const App = {
if (id) { if (id) {
Article.editArticleTags(id); Article.editArticleTags(id);
} }
} };
this.hotkey_actions["open_in_new_window"] = function () { this.hotkey_actions["open_in_new_window"] = function () {
if (Article.getActiveArticleId()) { if (Article.getActiveArticleId()) {
Article.openArticleInNewWindow(Article.getActiveArticleId()); Article.openArticleInNewWindow(Article.getActiveArticleId());
@ -504,23 +504,21 @@ const App = {
CommonDialogs.editFeed(Feeds.getActiveFeedId()); CommonDialogs.editFeed(Feeds.getActiveFeedId());
break; break;
case "qmcRemoveFeed": case "qmcRemoveFeed":
var actid = Feeds.getActiveFeedId(); const actid = Feeds.getActiveFeedId();
if (Feeds.activeFeedIsCat()) {
alert(__("You can't unsubscribe from the category."));
return;
}
if (!actid) { if (!actid) {
alert(__("Please select some feed first.")); alert(__("Please select some feed first."));
return; return;
} }
var fn = Feeds.getFeedName(actid); if (Feeds.activeFeedIsCat()) {
alert(__("You can't unsubscribe from the category."));
return;
}
var pr = __("Unsubscribe from %s?").replace("%s", fn); const fn = Feeds.getFeedName(actid);
if (confirm(pr)) { if (confirm(__("Unsubscribe from %s?").replace("%s", fn))) {
CommonDialogs.unsubscribeFeed(actid); CommonDialogs.unsubscribeFeed(actid);
} }
break; break;