diff --git a/js/App.js b/js/App.js index 483d2221118bce9a6c8478dc527f417bf38dd574..514a6d4b7adbdc4ef231c08fe9d840389fd1f30c 100644 --- a/js/App.js +++ b/js/App.js @@ -1,5 +1,6 @@ 'use strict'; +/* eslint-disable new-cap */ /* global __, Article, Ajax, Headlines, Filters, fox */ /* global xhrPost, xhrJson, dojo, dijit, PluginHost, Notify, $$, Feeds, Cookie */ /* global CommonDialogs, Plugins, Effect */ diff --git a/js/Article.js b/js/Article.js index d6e7bbad9f52173884a175491f2f693c1a2afd39..61368dfed4dda3aaa384ea76816d68ce597c6258 100644 --- a/js/Article.js +++ b/js/Article.js @@ -1,5 +1,6 @@ 'use strict' +/* eslint-disable no-new */ /* global __, ngettext, App, Headlines, xhrPost, xhrJson, dojo, dijit, PluginHost, Notify, $$, Ajax, fox */ const Article = { @@ -250,52 +251,52 @@ const Article = { return false; }, editTags: function (id) { - xhrPost("backend.php", {op: "article", method: "editarticletags", param: id}, (transport) => { - - const dialog = new fox.SingleUseDialog({ - id: "editTagsDlg", - title: __("Edit article Tags"), - content: transport.responseText, - execute: function () { - if (this.validate()) { - Notify.progress("Saving article tags...", true); - - xhrPost("backend.php", this.attr('value'), (transport) => { - try { - Notify.close(); - dialog.hide(); - - const data = JSON.parse(transport.responseText); - - if (data) { - const id = data.id; - - const tags = $("ATSTR-" + id); - const tooltip = dijit.byId("ATSTRTIP-" + id); - - if (tags) tags.innerHTML = data.content; - if (tooltip) tooltip.attr('label', data.content_full); - } - } catch (e) { - App.Error.report(e); + const dialog = new fox.SingleUseDialog({ + id: "editTagsDlg", + title: __("Edit article Tags"), + content: __("Loading, please wait..."), + execute: function () { + if (this.validate()) { + Notify.progress("Saving article tags...", true); + + xhrPost("backend.php", this.attr('value'), (transport) => { + try { + Notify.close(); + dialog.hide(); + + const data = JSON.parse(transport.responseText); + + if (data) { + const id = data.id; + + const tags = $("ATSTR-" + id); + const tooltip = dijit.byId("ATSTRTIP-" + id); + + if (tags) tags.innerHTML = data.content; + if (tooltip) tooltip.attr('label', data.content_full); } - }); - } - }, - }); + } catch (e) { + App.Error.report(e); + } + }); + } + }, + }); + + const tmph = dojo.connect(dialog, 'onShow', function () { + dojo.disconnect(tmph); - const tmph = dojo.connect(dialog, 'onShow', function () { - dojo.disconnect(tmph); + xhrPost("backend.php", {op: "article", method: "editarticletags", param: id}, (transport) => { + dialog.attr('content', transport.responseText); new Ajax.Autocompleter('tags_str', 'tags_choices', "backend.php?op=article&method=completeTags", {tokens: ',', paramName: "search"}); }); - - dialog.show(); - }); + dialog.show(); + }, cdmMoveToId: function (id, params) { params = params || {}; diff --git a/js/FeedTree.js b/js/FeedTree.js index c61d8a50fda99fb037d8b9995fa1b35ec9179d46..26c1c916ce18cebdbaca2f04c332077d93e60e93 100755 --- a/js/FeedTree.js +++ b/js/FeedTree.js @@ -7,9 +7,9 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dojo/_base/array", "dojo/co // save state in localStorage instead of cookies // reference: https://stackoverflow.com/a/27968996 _saveExpandedNodes: function(){ - if(this.persist && this.cookieName){ - var ary = []; - for(var id in this._openedNodes){ + if (this.persist && this.cookieName){ + const ary = []; + for (const id in this._openedNodes){ ary.push(id); } // Was: @@ -21,16 +21,16 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dojo/_base/array", "dojo/co // summary: // Load in which nodes should be opened automatically this._openedNodes = {}; - if(this.persist && this.cookieName){ + if (this.persist && this.cookieName){ // Was: // var oreo = cookie(this.cookieName); - var oreo = localStorage.getItem(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 }); } - if(oreo){ + if (oreo){ array.forEach(oreo.split(','), function(item){ this._openedNodes[item] = true; }, this); diff --git a/js/Headlines.js b/js/Headlines.js index 3b44984306971ddcab78fd9892c4de00f57c5b6c..ea4c81a6a101f03064a0a6475ba2990ae2072059 100755 --- a/js/Headlines.js +++ b/js/Headlines.js @@ -199,6 +199,7 @@ const Headlines = { } else if (event.ctrlKey) { Headlines.select('invert', id); } else { + // eslint-disable-next-line no-lonely-if if (App.isCombinedMode()) { if (event.altKey && !in_body) { @@ -237,6 +238,7 @@ const Headlines = { return in_body; } else { + // eslint-disable-next-line no-lonely-if if (event.altKey) { Article.openInNewWindow(id); Headlines.toggleUnread(id, 0); diff --git a/js/PrefFeedTree.js b/js/PrefFeedTree.js index df8cbfd1d3c7db18d5d911e1a56761daaaeb427e..89195e616bb7e2d6d47cf564d42654d6028499c6 100644 --- a/js/PrefFeedTree.js +++ b/js/PrefFeedTree.js @@ -1,3 +1,4 @@ +/* eslint-disable prefer-rest-params */ /* global __, lib, dijit, define, dojo, CommonDialogs, Notify, Tables, xhrPost, fox, App */ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], function (declare, domConstruct) { diff --git a/js/PrefFilterTree.js b/js/PrefFilterTree.js index b16fcb4c985697ffbc53f9fcfd6ffc606807c0ad..abfdbb3b02de971acdc9939a06e3b0b2b94f380e 100644 --- a/js/PrefFilterTree.js +++ b/js/PrefFilterTree.js @@ -1,4 +1,5 @@ -/* global __, $$, define, lib, dijit, dojo, xhrPost, Notify, Filters, Lists */ +/* eslint-disable prefer-rest-params */ +/* global __, define, lib, dijit, dojo, xhrPost, Notify */ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], function (declare, domConstruct) { @@ -54,6 +55,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio return label; }, getIconClass: function (item, opened) { + // eslint-disable-next-line no-nested-ternary return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "invisible"; }, getRowClass: function (item, opened) { @@ -62,7 +64,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio return enabled ? "dijitTreeRow" : "dijitTreeRow filterDisabled"; }, checkItemAcceptance: function(target, source, position) { - const item = dijit.getEnclosingWidget(target).item; + //const item = dijit.getEnclosingWidget(target).item; // disable copying items source.copyState = function() { return false; }; diff --git a/js/PrefHelpers.js b/js/PrefHelpers.js index 4e0161625ffb2b162894f8e7a9631176dc7cb7ea..5bb76d1796a526764277039a232e07e104d24824 100644 --- a/js/PrefHelpers.js +++ b/js/PrefHelpers.js @@ -1,6 +1,7 @@ 'use strict'; -/* global __, dijit, dojo, Tables, xhrPost, Notify, xhrJson, App, fox */ +/* eslint-disable no-new */ +/* global __, dijit, dojo, Tables, xhrPost, Notify, xhrJson, App, fox, Effect */ const Helpers = { AppPasswords: { diff --git a/js/PrefLabelTree.js b/js/PrefLabelTree.js index eab1a643b323379c522dd9cdd71962447e1365d2..73f375f2d8c8d0b4ea635bf7b5ce7bdb3451fcd6 100644 --- a/js/PrefLabelTree.js +++ b/js/PrefLabelTree.js @@ -1,3 +1,4 @@ +/* eslint-disable prefer-rest-params */ /* global __, define, lib, dijit, dojo, xhrPost, Notify, fox */ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dijit/form/DropDownButton"], function (declare, domConstruct) { @@ -39,6 +40,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dijit/f return tnode; }, getIconClass: function (item, opened) { + // eslint-disable-next-line no-nested-ternary return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "invisible"; }, getSelectedLabels: function() { diff --git a/js/common.js b/js/common.js index c17e8bc4508cff922f4b7539ead14514bed7a90a..fb5cc653166dd48a4b315fc6d87a9a07a2cf0572 100755 --- a/js/common.js +++ b/js/common.js @@ -1,6 +1,7 @@ 'use strict'; /* global dijit, __, App, Ajax */ +/* eslint-disable no-new */ /* error reporting shim */ // TODO: deprecated; remove @@ -31,8 +32,8 @@ function xhrPost(url, params, complete) { /* exported xhrJson */ function xhrJson(url, params, complete) { - return new Promise((resolve, reject) => { - return xhrPost(url, params).then((reply) => { + return new Promise((resolve, reject) => + xhrPost(url, params).then((reply) => { let obj = null; try { @@ -44,8 +45,7 @@ function xhrJson(url, params, complete) { if (complete != undefined) complete(obj); resolve(obj); - }); - }); + })); } /* add method to remove element from array */ diff --git a/js/form/ComboButton.js b/js/form/ComboButton.js index 1084cda9cd215c04cb98b9638a0b6bb7cbda8076..2ad4bf123240a84c11668cd5d7ca07a97f6137f0 100755 --- a/js/form/ComboButton.js +++ b/js/form/ComboButton.js @@ -1,4 +1,5 @@ -/* global dijit */ +/* eslint-disable prefer-rest-params */ +/* global dijit, define */ define(["dojo/_base/declare", "dijit/form/ComboButton"], function (declare) { return declare("fox.form.ComboButton", dijit.form.ComboButton, { startup: function() { diff --git a/js/form/DropDownButton.js b/js/form/DropDownButton.js index 0c182772ad043265e27cd70d7925d756964b359b..d5ea39726e08774b681691f330d80b268b48a34d 100755 --- a/js/form/DropDownButton.js +++ b/js/form/DropDownButton.js @@ -1,4 +1,5 @@ -/* global dijit */ +/* eslint-disable prefer-rest-params */ +/* global dijit, define */ define(["dojo/_base/declare", "dijit/form/DropDownButton"], function (declare) { return declare("fox.form.DropDownButton", dijit.form.DropDownButton, { startup: function() { diff --git a/js/form/Select.js b/js/form/Select.js index c62db1821ea1993e2569e428a4d37ec47ec3f91d..530880e2da732eeb1722ccf4b182427d43af1db3 100755 --- a/js/form/Select.js +++ b/js/form/Select.js @@ -1,4 +1,4 @@ -/* global dijit */ +/* global dijit, define */ define(["dojo/_base/declare", "dijit/form/Select"], function (declare) { return declare("fox.form.Select", dijit.form.Select, { focus: function() { diff --git a/js/form/ValidationTextArea.js b/js/form/ValidationTextArea.js index a7993f716dd96b29d760bebd7372a7647b812cda..c53260f400d543031e50a2b0dcb34faf18539805 100644 --- a/js/form/ValidationTextArea.js +++ b/js/form/ValidationTextArea.js @@ -1,4 +1,6 @@ // https://stackoverflow.com/questions/19317258/how-to-use-dijit-textarea-validation-dojo-1-9 +/* eslint-disable no-new */ +/* global define */ define(["dojo/_base/declare", "dojo/_base/lang", "dijit/form/SimpleTextarea", "dijit/form/ValidationTextBox"], function(declare, lang, SimpleTextarea, ValidationTextBox) { @@ -8,6 +10,7 @@ define(["dojo/_base/declare", "dojo/_base/lang", "dijit/form/SimpleTextarea", "d this.constraints = {}; this.baseClass += ' dijitValidationTextArea'; }, + // eslint-disable-next-line no-template-curly-in-string templateString: "<textarea ${!nameAttrSetting} data-dojo-attach-point='focusNode,containerNode,textbox' autocomplete='off'></textarea>", validator: function(value, constraints) { //console.log(this, value, constraints); diff --git a/js/tt-rss.js b/js/tt-rss.js index 7bf166b51795ded64802139741ff67d2e7eefc2a..764667a0d871361c869ea7909cd6cc32d4e86c7f 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -1,6 +1,6 @@ 'use strict' -/* global require, App */ +/* global require, App, $H */ /* exported Plugins */ const Plugins = {};