more eslint fixes

This commit is contained in:
Andrew Dolgov 2020-06-05 07:54:32 +03:00
parent d01ad09800
commit 697418f863
3 changed files with 28 additions and 18 deletions

View File

@ -1,10 +1,12 @@
/* global define, dijit */
define(["dojo/_base/declare", "dijit/tree/ForestStoreModel"], function (declare) {
return declare("fox.FeedStoreModel", dijit.tree.ForestStoreModel, {
getItemsInCategory: function (id) {
if (!this.store._itemsByIdentity) return undefined;
let cat = this.store._itemsByIdentity['CAT:' + id];
const cat = this.store._itemsByIdentity['CAT:' + id];
if (cat && cat.items)
return cat.items;
@ -18,6 +20,8 @@ define(["dojo/_base/declare", "dijit/tree/ForestStoreModel"], function (declare)
getFeedValue: function (feed, is_cat, key) {
if (!this.store._itemsByIdentity) return undefined;
let treeItem;
if (is_cat)
treeItem = this.store._itemsByIdentity['CAT:' + feed];
else
@ -40,6 +44,8 @@ define(["dojo/_base/declare", "dijit/tree/ForestStoreModel"], function (declare)
if (!value) value = '';
if (!this.store._itemsByIdentity) return undefined;
let treeItem;
if (is_cat)
treeItem = this.store._itemsByIdentity['CAT:' + feed];
else
@ -52,29 +58,31 @@ define(["dojo/_base/declare", "dijit/tree/ForestStoreModel"], function (declare)
if (!this.store._itemsByIdentity)
return null;
let treeItem;
if (is_cat) {
treeItem = this.store._itemsByIdentity['CAT:' + feed];
} else {
treeItem = this.store._itemsByIdentity['FEED:' + feed];
}
let items = this.store._arrayOfAllItems;
const items = this.store._arrayOfAllItems;
for (let i = 0; i < items.length; i++) {
if (items[i] == treeItem) {
for (var j = i + 1; j < items.length; j++) {
let unread = this.store.getValue(items[j], 'unread');
let id = this.store.getValue(items[j], 'id');
for (let j = i + 1; j < items.length; j++) {
const unread = this.store.getValue(items[j], 'unread');
const id = this.store.getValue(items[j], 'id');
if (unread > 0 && ((is_cat && id.match("CAT:")) || (!is_cat && id.match("FEED:")))) {
if (!is_cat || !(this.store.hasAttribute(items[j], 'parent_id') && this.store.getValue(items[j], 'parent_id') == feed)) return items[j];
}
}
for (var j = 0; j < i; j++) {
let unread = this.store.getValue(items[j], 'unread');
let id = this.store.getValue(items[j], 'id');
for (let j = 0; j < i; j++) {
const unread = this.store.getValue(items[j], 'unread');
const id = this.store.getValue(items[j], 'id');
if (unread > 0 && ((is_cat && id.match("CAT:")) || (!is_cat && id.match("FEED:")))) {
if (!is_cat || !(this.store.hasAttribute(items[j], 'parent_id') && this.store.getValue(items[j], 'parent_id') == feed)) return items[j];

View File

@ -1,12 +1,13 @@
/* global dojo, dijit, define, App, Feeds, CommonDialogs */
/* eslint-disable prefer-rest-params */
/* global __, dojo, dijit, define, App, Feeds, CommonDialogs */
define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"], function (declare, domConstruct) {
return declare("fox.FeedTree", dijit.Tree, {
_onContainerKeydown: function(/* Event */ e) {
_onContainerKeydown: function(/* Event */ /* e */) {
return; // Stop dijit.Tree from interpreting keystrokes
},
_onContainerKeypress: function(/* Event */ e) {
_onContainerKeypress: function(/* Event */ /* e */) {
return; // Stop dijit.Tree from interpreting keystrokes
},
_createTreeNode: function(args) {
@ -48,7 +49,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"],
}
if (id.match("FEED:")) {
let menu = new dijit.Menu();
const menu = new dijit.Menu();
menu.row_id = bare_id;
menu.addChild(new dijit.MenuItem({
@ -77,7 +78,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"],
}
if (id.match("CAT:") && bare_id >= 0) {
let menu = new dijit.Menu();
const menu = new dijit.Menu();
menu.row_id = bare_id;
menu.addChild(new dijit.MenuItem({
@ -102,7 +103,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"],
}
if (id.match("CAT:") && bare_id == -1) {
let menu = new dijit.Menu();
const menu = new dijit.Menu();
menu.row_id = bare_id;
menu.addChild(new dijit.MenuItem({
@ -146,15 +147,16 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"],
}
},
getTooltip: function (item) {
return [item.updated, item.error].filter(x => x && x != "").join(" - ");
return [item.updated, item.error].filter((x) => x && x != "").join(" - ");
},
getIconClass: function (item, opened) {
// eslint-disable-next-line no-nested-ternary
return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "feed-icon";
},
getLabelClass: function (item, opened) {
getLabelClass: function (item/* , opened */) {
return (item.unread <= 0) ? "dijitTreeLabel" : "dijitTreeLabel Unread";
},
getRowClass: function (item, opened) {
getRowClass: function (item/*, opened */) {
let rc = "dijitTreeRow";
const is_cat = String(item.id).indexOf('CAT:') != -1;

View File

@ -1,6 +1,6 @@
'use strict'
/* global __, ngettext, App, Headlines, xhrPost, dojo, dijit, Form, fox, PluginHost, Notify, $$ */
/* global __, App, Headlines, xhrPost, dojo, dijit, Form, fox, PluginHost, Notify, $$ */
const Feeds = {
counters_last_request: 0,