silence (or fix) a bunch of eslint warnings

master
Andrew Dolgov 4 years ago
parent ad7842c98a
commit 7f0800537e

@ -1,5 +1,6 @@
'use strict'; 'use strict';
/* eslint-disable new-cap */
/* global __, Article, Ajax, Headlines, Filters, fox */ /* global __, Article, Ajax, Headlines, Filters, fox */
/* global xhrPost, xhrJson, dojo, dijit, PluginHost, Notify, $$, Feeds, Cookie */ /* global xhrPost, xhrJson, dojo, dijit, PluginHost, Notify, $$, Feeds, Cookie */
/* global CommonDialogs, Plugins, Effect */ /* global CommonDialogs, Plugins, Effect */

@ -1,5 +1,6 @@
'use strict' 'use strict'
/* eslint-disable no-new */
/* global __, ngettext, App, Headlines, xhrPost, xhrJson, dojo, dijit, PluginHost, Notify, $$, Ajax, fox */ /* global __, ngettext, App, Headlines, xhrPost, xhrJson, dojo, dijit, PluginHost, Notify, $$, Ajax, fox */
const Article = { const Article = {
@ -250,52 +251,52 @@ const Article = {
return false; return false;
}, },
editTags: function (id) { editTags: function (id) {
xhrPost("backend.php", {op: "article", method: "editarticletags", param: id}, (transport) => { const dialog = new fox.SingleUseDialog({
id: "editTagsDlg",
const dialog = new fox.SingleUseDialog({ title: __("Edit article Tags"),
id: "editTagsDlg", content: __("Loading, please wait..."),
title: __("Edit article Tags"), execute: function () {
content: transport.responseText, if (this.validate()) {
execute: function () { Notify.progress("Saving article tags...", true);
if (this.validate()) {
Notify.progress("Saving article tags...", true); xhrPost("backend.php", this.attr('value'), (transport) => {
try {
xhrPost("backend.php", this.attr('value'), (transport) => { Notify.close();
try { dialog.hide();
Notify.close();
dialog.hide(); const data = JSON.parse(transport.responseText);
const data = JSON.parse(transport.responseText); if (data) {
const id = data.id;
if (data) {
const id = data.id; const tags = $("ATSTR-" + id);
const tooltip = dijit.byId("ATSTRTIP-" + 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);
if (tags) tags.innerHTML = data.content;
if (tooltip) tooltip.attr('label', data.content_full);
}
} catch (e) {
App.Error.report(e);
} }
}); } catch (e) {
} App.Error.report(e);
}, }
}); });
}
},
});
const tmph = dojo.connect(dialog, 'onShow', function () {
dojo.disconnect(tmph);
const tmph = dojo.connect(dialog, 'onShow', function () { xhrPost("backend.php", {op: "article", method: "editarticletags", param: id}, (transport) => {
dojo.disconnect(tmph); dialog.attr('content', transport.responseText);
new Ajax.Autocompleter('tags_str', 'tags_choices', new Ajax.Autocompleter('tags_str', 'tags_choices',
"backend.php?op=article&method=completeTags", "backend.php?op=article&method=completeTags",
{tokens: ',', paramName: "search"}); {tokens: ',', paramName: "search"});
}); });
dialog.show();
}); });
dialog.show();
}, },
cdmMoveToId: function (id, params) { cdmMoveToId: function (id, params) {
params = params || {}; params = params || {};

@ -7,9 +7,9 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dojo/_base/array", "dojo/co
// save state in localStorage instead of cookies // save state in localStorage instead of cookies
// reference: https://stackoverflow.com/a/27968996 // reference: https://stackoverflow.com/a/27968996
_saveExpandedNodes: function(){ _saveExpandedNodes: function(){
if(this.persist && this.cookieName){ if (this.persist && this.cookieName){
var ary = []; const ary = [];
for(var id in this._openedNodes){ for (const id in this._openedNodes){
ary.push(id); ary.push(id);
} }
// Was: // Was:
@ -21,16 +21,16 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dojo/_base/array", "dojo/co
// summary: // summary:
// Load in which nodes should be opened automatically // Load in which nodes should be opened automatically
this._openedNodes = {}; this._openedNodes = {};
if(this.persist && this.cookieName){ if (this.persist && this.cookieName){
// Was: // Was:
// var oreo = cookie(this.cookieName); // var oreo = cookie(this.cookieName);
var oreo = localStorage.getItem(this.cookieName); let oreo = localStorage.getItem(this.cookieName);
// migrate old data if nothing in localStorage // migrate old data if nothing in localStorage
if(oreo == null || oreo === '') { if (oreo == null || oreo === '') {
oreo = cookie(this.cookieName); oreo = cookie(this.cookieName);
cookie(this.cookieName, null, { expires: -1 }); cookie(this.cookieName, null, { expires: -1 });
} }
if(oreo){ if (oreo){
array.forEach(oreo.split(','), function(item){ array.forEach(oreo.split(','), function(item){
this._openedNodes[item] = true; this._openedNodes[item] = true;
}, this); }, this);

@ -199,6 +199,7 @@ const Headlines = {
} else if (event.ctrlKey) { } else if (event.ctrlKey) {
Headlines.select('invert', id); Headlines.select('invert', id);
} else { } else {
// eslint-disable-next-line no-lonely-if
if (App.isCombinedMode()) { if (App.isCombinedMode()) {
if (event.altKey && !in_body) { if (event.altKey && !in_body) {
@ -237,6 +238,7 @@ const Headlines = {
return in_body; return in_body;
} else { } else {
// eslint-disable-next-line no-lonely-if
if (event.altKey) { if (event.altKey) {
Article.openInNewWindow(id); Article.openInNewWindow(id);
Headlines.toggleUnread(id, 0); Headlines.toggleUnread(id, 0);

@ -1,3 +1,4 @@
/* eslint-disable prefer-rest-params */
/* global __, lib, dijit, define, dojo, CommonDialogs, Notify, Tables, xhrPost, fox, App */ /* global __, lib, dijit, define, dojo, CommonDialogs, Notify, Tables, xhrPost, fox, App */
define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], function (declare, domConstruct) { define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], function (declare, domConstruct) {

@ -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) { 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; return label;
}, },
getIconClass: function (item, opened) { getIconClass: function (item, opened) {
// eslint-disable-next-line no-nested-ternary
return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "invisible"; return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "invisible";
}, },
getRowClass: function (item, opened) { getRowClass: function (item, opened) {
@ -62,7 +64,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio
return enabled ? "dijitTreeRow" : "dijitTreeRow filterDisabled"; return enabled ? "dijitTreeRow" : "dijitTreeRow filterDisabled";
}, },
checkItemAcceptance: function(target, source, position) { checkItemAcceptance: function(target, source, position) {
const item = dijit.getEnclosingWidget(target).item; //const item = dijit.getEnclosingWidget(target).item;
// disable copying items // disable copying items
source.copyState = function() { return false; }; source.copyState = function() { return false; };

@ -1,6 +1,7 @@
'use strict'; '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 = { const Helpers = {
AppPasswords: { AppPasswords: {

@ -1,3 +1,4 @@
/* eslint-disable prefer-rest-params */
/* global __, define, lib, dijit, dojo, xhrPost, Notify, fox */ /* global __, define, lib, dijit, dojo, xhrPost, Notify, fox */
define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dijit/form/DropDownButton"], function (declare, domConstruct) { 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; return tnode;
}, },
getIconClass: function (item, opened) { getIconClass: function (item, opened) {
// eslint-disable-next-line no-nested-ternary
return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "invisible"; return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "invisible";
}, },
getSelectedLabels: function() { getSelectedLabels: function() {

@ -1,6 +1,7 @@
'use strict'; 'use strict';
/* global dijit, __, App, Ajax */ /* global dijit, __, App, Ajax */
/* eslint-disable no-new */
/* error reporting shim */ /* error reporting shim */
// TODO: deprecated; remove // TODO: deprecated; remove
@ -31,8 +32,8 @@ function xhrPost(url, params, complete) {
/* exported xhrJson */ /* exported xhrJson */
function xhrJson(url, params, complete) { function xhrJson(url, params, complete) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) =>
return xhrPost(url, params).then((reply) => { xhrPost(url, params).then((reply) => {
let obj = null; let obj = null;
try { try {
@ -44,8 +45,7 @@ function xhrJson(url, params, complete) {
if (complete != undefined) complete(obj); if (complete != undefined) complete(obj);
resolve(obj); resolve(obj);
}); }));
});
} }
/* add method to remove element from array */ /* add method to remove element from array */

@ -1,4 +1,5 @@
/* global dijit */ /* eslint-disable prefer-rest-params */
/* global dijit, define */
define(["dojo/_base/declare", "dijit/form/ComboButton"], function (declare) { define(["dojo/_base/declare", "dijit/form/ComboButton"], function (declare) {
return declare("fox.form.ComboButton", dijit.form.ComboButton, { return declare("fox.form.ComboButton", dijit.form.ComboButton, {
startup: function() { startup: function() {

@ -1,4 +1,5 @@
/* global dijit */ /* eslint-disable prefer-rest-params */
/* global dijit, define */
define(["dojo/_base/declare", "dijit/form/DropDownButton"], function (declare) { define(["dojo/_base/declare", "dijit/form/DropDownButton"], function (declare) {
return declare("fox.form.DropDownButton", dijit.form.DropDownButton, { return declare("fox.form.DropDownButton", dijit.form.DropDownButton, {
startup: function() { startup: function() {

@ -1,4 +1,4 @@
/* global dijit */ /* global dijit, define */
define(["dojo/_base/declare", "dijit/form/Select"], function (declare) { define(["dojo/_base/declare", "dijit/form/Select"], function (declare) {
return declare("fox.form.Select", dijit.form.Select, { return declare("fox.form.Select", dijit.form.Select, {
focus: function() { focus: function() {

@ -1,4 +1,6 @@
// https://stackoverflow.com/questions/19317258/how-to-use-dijit-textarea-validation-dojo-1-9 // 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"], define(["dojo/_base/declare", "dojo/_base/lang", "dijit/form/SimpleTextarea", "dijit/form/ValidationTextBox"],
function(declare, lang, SimpleTextarea, ValidationTextBox) { function(declare, lang, SimpleTextarea, ValidationTextBox) {
@ -8,6 +10,7 @@ define(["dojo/_base/declare", "dojo/_base/lang", "dijit/form/SimpleTextarea", "d
this.constraints = {}; this.constraints = {};
this.baseClass += ' dijitValidationTextArea'; 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>", templateString: "<textarea ${!nameAttrSetting} data-dojo-attach-point='focusNode,containerNode,textbox' autocomplete='off'></textarea>",
validator: function(value, constraints) { validator: function(value, constraints) {
//console.log(this, value, constraints); //console.log(this, value, constraints);

@ -1,6 +1,6 @@
'use strict' 'use strict'
/* global require, App */ /* global require, App, $H */
/* exported Plugins */ /* exported Plugins */
const Plugins = {}; const Plugins = {};

Loading…
Cancel
Save