silence (or fix) a bunch of eslint warnings

master
Andrew Dolgov 4 years ago
parent ad7842c98a
commit 7f0800537e

@ -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 */

@ -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 || {};

@ -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);

@ -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);

@ -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) {

@ -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; };

@ -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: {

@ -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() {

@ -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 */

@ -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() {

@ -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() {

@ -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() {

@ -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);

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

Loading…
Cancel
Save