fix various minor issues reported by eslint
This commit is contained in:
parent
755662a9d7
commit
88027d7a39
|
@ -88,7 +88,7 @@ module.exports = {
|
|||
"max-nested-callbacks": "error",
|
||||
"max-params": "off",
|
||||
"max-statements": "off",
|
||||
"max-statements-per-line": "error",
|
||||
"max-statements-per-line": [ "warn", { "max" : 2 } ],
|
||||
"multiline-comment-style": "off",
|
||||
"multiline-ternary": "off",
|
||||
"new-cap": "error",
|
||||
|
|
14
js/App.js
14
js/App.js
|
@ -1,3 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
/* global __, ngettext, Article, Headlines, Filters */
|
||||
/* global xhrPost, xhrJson, dojo, dijit, PluginHost, Notify, $$, Feeds, Cookie */
|
||||
/* global CommonDialogs, CommonFilters, Plugins */
|
||||
|
||||
const App = {
|
||||
_initParams: [],
|
||||
_rpc_seq: 0,
|
||||
|
@ -505,12 +511,12 @@ const App = {
|
|||
stack_msg += `<div><b>Additional information:</b></div>
|
||||
<textarea name="stack" readonly="1">${params.info}</textarea>`;
|
||||
|
||||
let content = `<div class="error-contents">
|
||||
const content = `<div class="error-contents">
|
||||
<p class="message">${message}</p>
|
||||
${stack_msg}
|
||||
<div class="dlgButtons">
|
||||
<button dojoType="dijit.form.Button"
|
||||
onclick=\"dijit.byId('exceptionDlg').hide()">${__('Close this window')}</button>
|
||||
onclick="dijit.byId('exceptionDlg').hide()">${__('Close this window')}</button>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
|
@ -611,7 +617,7 @@ const App = {
|
|||
|
||||
switch (this.urlParam('method')) {
|
||||
case "editfeed":
|
||||
window.setTimeout(function () {
|
||||
window.setTimeout(() => {
|
||||
CommonDialogs.editFeed(this.urlParam('methodparam'))
|
||||
}, 100);
|
||||
break;
|
||||
|
@ -1099,6 +1105,7 @@ const App = {
|
|||
CommonDialogs.editFeed(Feeds.getActive());
|
||||
break;
|
||||
case "qmcRemoveFeed":
|
||||
{
|
||||
const actid = Feeds.getActive();
|
||||
|
||||
if (!actid) {
|
||||
|
@ -1116,6 +1123,7 @@ const App = {
|
|||
if (confirm(__("Unsubscribe from %s?").replace("%s", fn))) {
|
||||
CommonDialogs.unsubscribeFeed(actid);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "qmcCatchupAll":
|
||||
Feeds.catchupAll();
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
'use strict'
|
||||
/* global __, ngettext */
|
||||
|
||||
/* global __, ngettext, App, Headlines, xhrPost, xhrJson, dojo, dijit, PluginHost, Notify, $$, escapeHtml */
|
||||
|
||||
const Article = {
|
||||
_scroll_reset_timeout: false,
|
||||
getScoreClass: function (score) {
|
||||
|
@ -342,7 +344,7 @@ const Article = {
|
|||
mouseIn: function (id) {
|
||||
this.post_under_pointer = id;
|
||||
},
|
||||
mouseOut: function (id) {
|
||||
mouseOut: function (/* id */) {
|
||||
this.post_under_pointer = false;
|
||||
},
|
||||
getUnderPointer: function () {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
'use strict'
|
||||
/* global __, ngettext */
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
|
||||
/* global __, ngettext, dojo, dijit, Notify, App, Feeds, $$, xhrPost, xhrJson, Tables, Effect */
|
||||
|
||||
/* exported CommonDialogs */
|
||||
const CommonDialogs = {
|
||||
closeInfoBox: function() {
|
||||
const dialog = dijit.byId("infoBox");
|
||||
|
@ -102,8 +104,10 @@ const CommonDialogs = {
|
|||
xhrPost("backend.php", this.attr('value'), (transport) => {
|
||||
try {
|
||||
|
||||
let reply;
|
||||
|
||||
try {
|
||||
var reply = JSON.parse(transport.responseText);
|
||||
reply = JSON.parse(transport.responseText);
|
||||
} catch (e) {
|
||||
Element.hide("feed_add_spinner");
|
||||
alert(__("Failed to parse output. This can indicate server timeout and/or network issues. Backend output was logged to browser console."));
|
||||
|
@ -136,6 +140,7 @@ const CommonDialogs = {
|
|||
dialog.show_error(__("Specified URL doesn't seem to contain any feeds."));
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
const feeds = rc['feeds'];
|
||||
|
||||
Element.show("fadd_multiple_notify");
|
||||
|
@ -147,16 +152,14 @@ const CommonDialogs = {
|
|||
|
||||
select.addOption({value: '', label: __("Expand to select feed")});
|
||||
|
||||
let count = 0;
|
||||
for (const feedUrl in feeds) {
|
||||
if (feeds.hasOwnProperty(feedUrl)) {
|
||||
select.addOption({value: feedUrl, label: feeds[feedUrl]});
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
Effect.Appear('feedDlg_feedsContainer', {duration: 0.5});
|
||||
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
dialog.show_error(__("Couldn't download the specified URL: %s").replace("%s", rc['message']));
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
'use strict'
|
||||
/* global __, ngettext */
|
||||
|
||||
/* global __, ngettext, App, Article, Lists */
|
||||
/* global xhrPost, xhrJson, dojo, dijit, Notify, $$, Feeds */
|
||||
|
||||
const Filters = {
|
||||
filterDlgCheckAction: function(sender) {
|
||||
|
@ -138,7 +140,7 @@ const Filters = {
|
|||
content: __('Loading, please wait...'),
|
||||
});
|
||||
|
||||
const tmph = dojo.connect(rule_dlg, "onShow", null, function (e) {
|
||||
const tmph = dojo.connect(rule_dlg, "onShow", null, function (/* e */) {
|
||||
dojo.disconnect(tmph);
|
||||
|
||||
xhrPost("backend.php", {op: 'pref-filters', method: 'newrule', rule: ruleStr}, (transport) => {
|
||||
|
@ -252,7 +254,7 @@ const Filters = {
|
|||
href: "backend.php?op=pref-filters&method=testFilterDlg"
|
||||
});
|
||||
|
||||
dojo.connect(test_dlg, "onLoad", null, function (e) {
|
||||
dojo.connect(test_dlg, "onLoad", null, function (/* e */) {
|
||||
test_dlg.getTestResults(params, 0);
|
||||
});
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* global dijit */
|
||||
/* global dojo, dijit, define, App, Feeds, CommonDialogs, LABEL_BASE_INDEX */
|
||||
|
||||
define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"], function (declare, domConstruct) {
|
||||
|
||||
return declare("fox.FeedTree", dijit.Tree, {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
'use strict'
|
||||
/* global __, ngettext */
|
||||
|
||||
/* global __, ngettext, App, Headlines, xhrPost, dojo, dijit, Form, fox, PluginHost, Notify, $$ */
|
||||
|
||||
const Feeds = {
|
||||
counters_last_request: 0,
|
||||
|
@ -207,6 +208,7 @@ const Feeds = {
|
|||
//document.onkeypress = (event) => { return App.hotkeyHandler(event) };
|
||||
window.onresize = () => { Headlines.scrollHandler(); }
|
||||
|
||||
/* global hash_get */
|
||||
const hash_feed_id = hash_get('f');
|
||||
const hash_feed_is_cat = hash_get('c') == "1";
|
||||
|
||||
|
@ -262,6 +264,7 @@ const Feeds = {
|
|||
setActive: function(id, is_cat) {
|
||||
console.log('setActive', id, is_cat);
|
||||
|
||||
/* global hash_set */
|
||||
hash_set('f', id);
|
||||
hash_set('c', is_cat ? 1 : 0);
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
'use strict';
|
||||
/* global __, ngettext */
|
||||
|
||||
/* global __, ngettext, Article, App, escapeHtml */
|
||||
/* global xhrPost, xhrJson, dojo, dijit, PluginHost, Notify, $$, Feeds */
|
||||
/* global CommonDialogs */
|
||||
|
||||
const Headlines = {
|
||||
vgroup_last_feed: undefined,
|
||||
|
@ -319,7 +322,7 @@ const Headlines = {
|
|||
|
||||
if (App.getInitParam("cdm_auto_catchup")) {
|
||||
|
||||
let rows = $$("#headlines-frame > div[id*=RROW][class*=Unread]");
|
||||
const rows = $$("#headlines-frame > div[id*=RROW][class*=Unread]");
|
||||
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
const row = rows[i];
|
||||
|
@ -1185,8 +1188,8 @@ const Headlines = {
|
|||
|
||||
if (App.getInitParam("confirm_feed_catchup") != 1 || confirm(msg)) {
|
||||
|
||||
for (var i = 0; i < ids_to_mark.length; i++) {
|
||||
var e = $("RROW-" + ids_to_mark[i]);
|
||||
for (let i = 0; i < ids_to_mark.length; i++) {
|
||||
const e = $("RROW-" + ids_to_mark[i]);
|
||||
e.removeClassName("Unread");
|
||||
}
|
||||
}
|
||||
|
@ -1231,14 +1234,14 @@ const Headlines = {
|
|||
|
||||
menu.addChild(new dijit.MenuItem({
|
||||
label: __("Open original article"),
|
||||
onClick: function (event) {
|
||||
onClick: function (/* event */) {
|
||||
Article.openInNewWindow(this.getParent().currentTarget.getAttribute("data-article-id"));
|
||||
}
|
||||
}));
|
||||
|
||||
menu.addChild(new dijit.MenuItem({
|
||||
label: __("Display article URL"),
|
||||
onClick: function (event) {
|
||||
onClick: function (/* event */) {
|
||||
Article.displayUrl(this.getParent().currentTarget.getAttribute("data-article-id"));
|
||||
}
|
||||
}));
|
||||
|
@ -1387,7 +1390,7 @@ const Headlines = {
|
|||
|
||||
menu.addChild(new dijit.MenuItem({
|
||||
label: __("Select articles in group"),
|
||||
onClick: function (event) {
|
||||
onClick: function (/* event */) {
|
||||
Headlines.select("all",
|
||||
"#headlines-frame > div[id*=RROW]" +
|
||||
"[data-orig-feed-id='" + this.getParent().currentTarget.getAttribute("data-feed-id") + "']");
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// based on http://www.velvetcache.org/2010/08/19/a-simple-javascript-hooks-system
|
||||
|
||||
|
||||
/* exported PluginHost */
|
||||
const PluginHost = {
|
||||
HOOK_ARTICLE_RENDERED: 1,
|
||||
HOOK_ARTICLE_RENDERED_CDM: 2,
|
||||
|
@ -31,7 +33,7 @@ const PluginHost = {
|
|||
}
|
||||
},
|
||||
unregister: function (name, callback) {
|
||||
for (var i = 0; i < this.hooks[name].length; i++)
|
||||
for (let i = 0; i < this.hooks[name].length; i++)
|
||||
if (this.hooks[name][i] == callback)
|
||||
this.hooks[name].splice(i, 1);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/* global define, dojo */
|
||||
|
||||
define(["dojo/_base/declare", "dojo/data/ItemFileWriteStore"], function (declare) {
|
||||
|
||||
return declare("fox.PrefFeedStore", dojo.data.ItemFileWriteStore, {
|
||||
|
||||
_saveEverything: function(saveCompleteCallback, saveFailedCallback,
|
||||
newFileContentString) {
|
||||
_saveEverything: function(saveCompleteCallback, saveFailedCallback, newFileContentString) {
|
||||
|
||||
dojo.xhrPost({
|
||||
url: "backend.php",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* global lib,dijit */
|
||||
/* global __, lib, dijit, define, dojo, CommonDialogs, Notify, Tables, xhrPost */
|
||||
|
||||
define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], function (declare, domConstruct) {
|
||||
|
||||
return declare("fox.PrefFeedTree", lib.CheckBoxTree, {
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/* global define, dojo */
|
||||
|
||||
define(["dojo/_base/declare", "dojo/data/ItemFileWriteStore"], function (declare) {
|
||||
|
||||
return declare("fox.PrefFilterStore", dojo.data.ItemFileWriteStore, {
|
||||
|
||||
_saveEverything: function (saveCompleteCallback, saveFailedCallback,
|
||||
newFileContentString) {
|
||||
_saveEverything: function (saveCompleteCallback, saveFailedCallback, newFileContentString) {
|
||||
|
||||
dojo.xhrPost({
|
||||
url: "backend.php",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* global dijit,lib */
|
||||
/* global __, $$, define, lib, dijit, dojo, xhrPost, Notify, Filters, Lists */
|
||||
|
||||
define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], function (declare, domConstruct) {
|
||||
|
||||
return declare("fox.PrefFilterTree", lib.CheckBoxTree, {
|
||||
|
@ -236,9 +237,6 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio
|
|||
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
/* global __, dijit, dojo, Tables, xhrPost, Notify, xhrJson */
|
||||
|
||||
const Helpers = {
|
||||
AppPasswords: {
|
||||
getSelected: function() {
|
||||
|
@ -12,8 +16,7 @@ const Helpers = {
|
|||
|
||||
if (rows.length == 0) {
|
||||
alert("No passwords selected.");
|
||||
} else {
|
||||
if (confirm(__("Remove selected app passwords?"))) {
|
||||
} else if (confirm(__("Remove selected app passwords?"))) {
|
||||
|
||||
xhrPost("backend.php", {op: "pref-prefs", method: "deleteAppPassword", ids: rows.toString()}, (transport) => {
|
||||
this.updateContent(transport.responseText);
|
||||
|
@ -22,7 +25,6 @@ const Helpers = {
|
|||
|
||||
Notify.progress("Loading, please wait...");
|
||||
}
|
||||
}
|
||||
},
|
||||
generate: function() {
|
||||
const title = prompt("Password description:")
|
||||
|
@ -132,6 +134,7 @@ const Helpers = {
|
|||
},
|
||||
execute: function () {
|
||||
if (this.validate()) {
|
||||
//
|
||||
}
|
||||
},
|
||||
href: query
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* global lib,dijit */
|
||||
/* global __, define, lib, dijit, dojo, xhrPost, Notify */
|
||||
|
||||
define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dijit/form/DropDownButton"], function (declare, domConstruct) {
|
||||
|
||||
return declare("fox.PrefLabelTree", lib.CheckBoxTree, {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
'use strict'
|
||||
/* global __, ngettext */
|
||||
|
||||
/* global __ */
|
||||
/* global xhrPost, dojo, dijit, Notify, Tables */
|
||||
|
||||
const Users = {
|
||||
reload: function(sort) {
|
||||
|
@ -39,7 +41,7 @@ const Users = {
|
|||
if (this.validate()) {
|
||||
Notify.progress("Saving data...", true);
|
||||
|
||||
xhrPost("backend.php", dojo.formToObject("user_edit_form"), (transport) => {
|
||||
xhrPost("backend.php", dojo.formToObject("user_edit_form"), (/* transport */) => {
|
||||
dialog.hide();
|
||||
Users.reload();
|
||||
});
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
/* global dijit */
|
||||
/* global dijit, define */
|
||||
|
||||
define(["dojo/_base/declare", "dijit/Toolbar"], function (declare) {
|
||||
return declare("fox.Toolbar", dijit.Toolbar, {
|
||||
_onContainerKeydown: function(/* Event */ e) {
|
||||
_onContainerKeydown: function(/* Event */ /* e */) {
|
||||
return; // Stop dijit.Toolbar from interpreting keystrokes
|
||||
},
|
||||
_onContainerKeypress: function(/* Event */ e) {
|
||||
_onContainerKeypress: function(/* Event */ /* e */) {
|
||||
return; // Stop dijit.Toolbar from interpreting keystrokes
|
||||
},
|
||||
focus: function() {
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
'use strict'
|
||||
|
||||
/* global require, App */
|
||||
|
||||
/* exported Plugins */
|
||||
const Plugins = {};
|
||||
|
||||
require(["dojo/_base/kernel",
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
'use strict'
|
||||
/* global dijit,__ */
|
||||
|
||||
/* global require, App */
|
||||
|
||||
/* exported Plugins */
|
||||
const Plugins = {};
|
||||
|
||||
require(["dojo/_base/kernel",
|
||||
|
@ -65,11 +67,13 @@ require(["dojo/_base/kernel",
|
|||
});
|
||||
});
|
||||
|
||||
/* exported hash_get */
|
||||
function hash_get(key) {
|
||||
const kv = window.location.hash.substring(1).toQueryParams();
|
||||
return kv[key];
|
||||
}
|
||||
|
||||
/* exported hash_set */
|
||||
function hash_set(key, value) {
|
||||
const kv = window.location.hash.substring(1).toQueryParams();
|
||||
kv[key] = value;
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
/* TODO: this should probably be something like night_mode.js since it does nothing specific to utility scripts */2
|
||||
/* global UtilityApp */
|
||||
|
||||
/* TODO: this should probably be something like night_mode.js since it does nothing specific to utility scripts */
|
||||
|
||||
Event.observe(window, "load", function() {
|
||||
const UtilityJS = {
|
||||
|
|
Loading…
Reference in New Issue