getItemsInCategory: function (id) {
if (!this.store._itemsByIdentity) return undefined;
- cat = this.store._itemsByIdentity['CAT:' + id];
+ let cat = this.store._itemsByIdentity['CAT:' + id];
if (cat && cat.items)
return cat.items;
return this.getFeedValue(feed, is_cat, 'name');
},
getFeedUnread: function (feed, is_cat) {
- var unread = parseInt(this.getFeedValue(feed, is_cat, 'unread'));
+ const unread = parseInt(this.getFeedValue(feed, is_cat, 'unread'));
return (isNaN(unread)) ? 0 : unread;
},
setFeedUnread: function (feed, is_cat, unread) {
treeItem = this.store._itemsByIdentity['FEED:' + feed];
}
- items = this.store._arrayOfAllItems;
+ let items = this.store._arrayOfAllItems;
- for (var i = 0; i < items.length; i++) {
+ for (let i = 0; i < items.length; i++) {
if (items[i] == treeItem) {
for (var j = i + 1; j < items.length; j++) {
- var unread = this.store.getValue(items[j], 'unread');
- var id = this.store.getValue(items[j], 'id');
+ let unread = this.store.getValue(items[j], 'unread');
+ let 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++) {
- var unread = this.store.getValue(items[j], 'unread');
- var id = this.store.getValue(items[j], 'id');
+ let unread = this.store.getValue(items[j], 'unread');
+ let 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];
+/* global dijit */
define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"], function (declare, domConstruct) {
return declare("fox.FeedTree", dijit.Tree, {
return; // Stop dijit.Tree from interpreting keystrokes
},
_createTreeNode: function(args) {
- var tnode = new dijit._TreeNode(args);
+ const tnode = new dijit._TreeNode(args);
- var icon = dojo.doc.createElement('img');
+ const icon = dojo.doc.createElement('img');
if (args.item.icon && args.item.icon[0]) {
icon.src = args.item.icon[0];
} else {
icon.className = 'tinyFeedIcon';
domConstruct.place(icon, tnode.iconNode, 'only');
- var id = args.item.id[0];
- var bare_id = parseInt(id.substr(id.indexOf(':')+1));
+ const id = args.item.id[0];
+ const bare_id = parseInt(id.substr(id.indexOf(':')+1));
if (bare_id < _label_base_index) {
- var span = dojo.doc.createElement('span');
- var fg_color = args.item.fg_color[0];
- var bg_color = args.item.bg_color[0];
+ const span = dojo.doc.createElement('span');
+ const fg_color = args.item.fg_color[0];
+ const bg_color = args.item.bg_color[0];
span.innerHTML = "α";
span.className = 'labelColorIndicator';
}
if (id.match("FEED:")) {
- var menu = new dijit.Menu();
+ let menu = new dijit.Menu();
menu.row_id = bare_id;
menu.addChild(new dijit.MenuItem({
}
if (id.match("CAT:") && bare_id >= 0) {
- var menu = new dijit.Menu();
+ let menu = new dijit.Menu();
menu.row_id = bare_id;
menu.addChild(new dijit.MenuItem({
}
if (id.match("CAT:") && bare_id == -1) {
- var menu = new dijit.Menu();
+ let menu = new dijit.Menu();
menu.row_id = bare_id;
menu.addChild(new dijit.MenuItem({
this.inherited(arguments);
},
updateCounter: function (item) {
- var tree = this;
+ const tree = this;
//console.log("updateCounter: " + item.id[0] + " " + item.unread + " " + tree);
- var node = tree._itemNodesMap[item.id];
+ let node = tree._itemNodesMap[item.id];
if (node) {
node = node[0];
return (item.unread == 0) ? "dijitTreeLabel" : "dijitTreeLabel Unread";
},
getRowClass: function (item, opened) {
- var rc = (!item.error || item.error == '') ? "dijitTreeRow" :
+ let rc = (!item.error || item.error == '') ? "dijitTreeRow" :
"dijitTreeRow Error";
if (item.unread > 0) rc += " Unread";
return rc;
},
getLabel: function(item) {
- var name = String(item.name);
+ let name = String(item.name);
/* Horrible */
name = name.replace(/"/g, "\"");
},
expandParentNodes: function(feed, is_cat, list) {
try {
- for (var i = 0; i < list.length; i++) {
- var id = String(list[i].id);
- var item = this._itemNodesMap[id];
+ for (let i = 0; i < list.length; i++) {
+ const id = String(list[i].id);
+ let item = this._itemNodesMap[id];
if (item) {
item = item[0];
// expands all parents of specified feed to properly mark it as active
// my fav thing about frameworks is doing everything myself
try {
- var test_id = is_cat ? 'CAT:' + feed : 'FEED:' + feed;
+ const test_id = is_cat ? 'CAT:' + feed : 'FEED:' + feed;
if (!root) {
if (!this.model || !this.model.store) return false;
- var items = this.model.store._arrayOfTopLevelItems;
+ const items = this.model.store._arrayOfTopLevelItems;
- for (var i = 0; i < items.length; i++) {
+ for (let i = 0; i < items.length; i++) {
if (String(items[i].id) == test_id) {
this.expandParentNodes(feed, is_cat, parents);
} else {
this.findNodeParentsAndExpandThem(feed, is_cat, items[i], []);
}
}
- } else {
- if (root.items) {
+ } else if (root.items) {
parents.push(root);
- for (var i = 0; i < root.items.length; i++) {
+ for (let i = 0; i < root.items.length; i++) {
if (String(root.items[i].id) == test_id) {
this.expandParentNodes(feed, is_cat, parents);
} else {
this.findNodeParentsAndExpandThem(feed, is_cat, root.items[i], parents.slice(0));
}
}
- } else {
- if (String(root.id) == test_id) {
+ } else if (String(root.id) == test_id) {
this.expandParentNodes(feed, is_cat, parents.slice(0));
}
- }
- }
} catch (e) {
exception_error(e);
}
if (treeNode) {
treeNode = treeNode[0];
- var icon = dojo.doc.createElement('img');
+ const icon = dojo.doc.createElement('img');
icon.src = src;
icon.className = 'tinyFeedIcon';
domConstruct.place(icon, treeNode.iconNode, 'only');
treeNode.loadingNode.src = src;
return true;
} else {
- var icon = dojo.doc.createElement('img');
+ const icon = dojo.doc.createElement('img');
icon.src = src;
icon.className = 'loadingExpando';
domConstruct.place(icon, treeNode.expandoNode, 'only');
},
hideReadCat: function (cat, hide, show_special) {
if (this.hasCats()) {
- var tree = this;
+ const tree = this;
if (cat && cat.items) {
- var cat_unread = tree.hideReadFeeds(cat.items, hide, show_special);
+ let cat_unread = tree.hideReadFeeds(cat.items, hide, show_special);
- var id = String(cat.id);
- var node = tree._itemNodesMap[id];
- var bare_id = parseInt(id.substr(id.indexOf(":")+1));
+ const id = String(cat.id);
+ const node = tree._itemNodesMap[id];
+ const bare_id = parseInt(id.substr(id.indexOf(":")+1));
if (node) {
- var check_unread = tree.model.getFeedUnread(bare_id, true);
+ const check_unread = tree.model.getFeedUnread(bare_id, true);
if (hide && cat_unread == 0 && check_unread == 0 && (id != "CAT:-1" || !show_special)) {
Effect.Fade(node[0].rowNode, {duration : 0.3,
hideRead: function (hide, show_special) {
if (this.hasCats()) {
- var tree = this;
- var cats = this.model.store._arrayOfTopLevelItems;
+ const tree = this;
+ const cats = this.model.store._arrayOfTopLevelItems;
cats.each(function(cat) {
tree.hideReadCat(cat, hide, show_special);
}
},
hideReadFeeds: function (items, hide, show_special) {
- var tree = this;
- var cat_unread = 0;
+ const tree = this;
+ let cat_unread = 0;
items.each(function(feed) {
- var id = String(feed.id);
+ const id = String(feed.id);
// it's a subcategory
if (feed.items) {
tree.hideReadCat(feed, hide, show_special);
} else { // it's a feed
- var bare_id = parseInt(feed.bare_id);;
+ const bare_id = parseInt(feed.bare_id);
- var unread = feed.unread[0];
- var has_error = feed.error[0] != '';
- var node = tree._itemNodesMap[id];
+ const unread = feed.unread[0];
+ const has_error = feed.error[0] != '';
+ const node = tree._itemNodesMap[id];
if (node) {
if (hide && unread == 0 && !has_error && (bare_id > 0 || bare_id < _label_base_index || !show_special)) {
collapseCat: function(id) {
if (!this.model.hasCats()) return;
- var tree = this;
+ const tree = this;
- var node = tree._itemNodesMap['CAT:' + id][0];
- var item = tree.model.store._itemsByIdentity['CAT:' + id];
+ const node = tree._itemNodesMap['CAT:' + id][0];
+ const item = tree.model.store._itemsByIdentity['CAT:' + id];
if (node && item) {
if (!node.isExpanded)
}
},
getVisibleUnreadFeeds: function() {
- var items = this.model.store._arrayOfAllItems;
- var rv = [];
+ const items = this.model.store._arrayOfAllItems;
+ const rv = [];
- for (var i = 0; i < items.length; i++) {
- var id = String(items[i].id);
- var box = this._itemNodesMap[id];
+ for (let i = 0; i < items.length; i++) {
+ const id = String(items[i].id);
+ const box = this._itemNodesMap[id];
if (box) {
- var row = box[0].rowNode;
- var cat = false;
+ const row = box[0].rowNode;
+ let cat = false;
try {
cat = box[0].rowNode.parentNode.parentNode;
if (row) {
if (Element.visible(row) && (!cat || Element.visible(cat))) {
- var feed_id = String(items[i].bare_id);
- var is_cat = !id.match('FEED:');
- var unread = this.model.getFeedUnread(feed_id, is_cat);
+ const feed_id = String(items[i].bare_id);
+ const is_cat = !id.match('FEED:');
+ const unread = this.model.getFeedUnread(feed_id, is_cat);
if (unread > 0)
rv.push([feed_id, is_cat]);
treeItem = this.model.store._itemsByIdentity['FEED:' + feed];
}
- items = this.model.store._arrayOfAllItems;
- var item = items[0];
+ const items = this.model.store._arrayOfAllItems;
+ let item = items[0];
- for (var i = 0; i < items.length; i++) {
+ for (let i = 0; i < items.length; i++) {
if (items[i] == treeItem) {
- for (var j = i+1; j < items.length; j++) {
- var id = String(items[j].id);
- var box = this._itemNodesMap[id];
+ for (let j = i+1; j < items.length; j++) {
+ const id = String(items[j].id);
+ const box = this._itemNodesMap[id];
if (box) {
- var row = box[0].rowNode;
- var cat = box[0].rowNode.parentNode.parentNode;
+ const row = box[0].rowNode;
+ const cat = box[0].rowNode.parentNode.parentNode;
if (Element.visible(cat) && Element.visible(row)) {
item = items[j];
treeItem = this.model.store._itemsByIdentity['FEED:' + feed];
}
- items = this.model.store._arrayOfAllItems;
- var item = items[0] == treeItem ? items[items.length-1] : items[0];
+ const items = this.model.store._arrayOfAllItems;
+ let item = items[0] == treeItem ? items[items.length-1] : items[0];
- for (var i = 0; i < items.length; i++) {
+ for (let i = 0; i < items.length; i++) {
if (items[i] == treeItem) {
- for (var j = i-1; j > 0; j--) {
- var id = String(items[j].id);
- var box = this._itemNodesMap[id];
+ for (let j = i-1; j > 0; j--) {
+ const id = String(items[j].id);
+ const box = this._itemNodesMap[id];
if (box) {
- var row = box[0].rowNode;
- var cat = box[0].rowNode.parentNode.parentNode;
+ const row = box[0].rowNode;
+ const cat = box[0].rowNode.parentNode.parentNode;
if (Element.visible(cat) && Element.visible(row)) {
item = items[j];
+/* global lib,dijit */
define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], function (declare, domConstruct) {
return declare("fox.PrefFeedTree", lib.CheckBoxTree, {
_createTreeNode: function(args) {
- var tnode = this.inherited(arguments);
+ const tnode = this.inherited(arguments);
- var icon = dojo.doc.createElement('img');
+ const icon = dojo.doc.createElement('img');
if (args.item.icon && args.item.icon[0]) {
icon.src = args.item.icon[0];
} else {
icon.className = 'tinyFeedIcon';
domConstruct.place(icon, tnode.iconNode, 'only');
- var param = this.model.store.getValue(args.item, 'param');
+ let param = this.model.store.getValue(args.item, 'param');
if (param) {
param = dojo.doc.createElement('span');
domConstruct.place(param, tnode.rowNode, 'first');
}
- var id = args.item.id[0];
- var bare_id = parseInt(id.substr(id.indexOf(':')+1));
+ const id = args.item.id[0];
+ const bare_id = parseInt(id.substr(id.indexOf(':')+1));
if (id.match("CAT:") && bare_id > 0) {
var menu = new dijit.Menu();
return (!item || this.model.store.getValue(item, 'type') == 'category') ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "feedIcon";
},
checkItemAcceptance: function(target, source, position) {
- var item = dijit.getEnclosingWidget(target).item;
+ const item = dijit.getEnclosingWidget(target).item;
// disable copying items
source.copyState = function() { return false; };
- var source_item = false;
+ let source_item = false;
source.forInSelectedItems(function(node) {
source_item = node.data.item;
if (!source_item || !item) return false;
- var id = this.tree.model.store.getValue(item, 'id');
- var source_id = source.tree.model.store.getValue(source_item, 'id');
+ const id = this.tree.model.store.getValue(item, 'id');
+ const source_id = source.tree.model.store.getValue(source_item, 'id');
//console.log(id + " " + position + " " + source_id);
+/* global dijit,lib */
define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], function (declare, domConstruct) {
return declare("fox.PrefFilterTree", lib.CheckBoxTree, {
_createTreeNode: function(args) {
- var tnode = this.inherited(arguments);
+ const tnode = this.inherited(arguments);
- var enabled = this.model.store.getValue(args.item, 'enabled');
- var param = this.model.store.getValue(args.item, 'param');
- var rules = this.model.store.getValue(args.item, 'rules');
+ const enabled = this.model.store.getValue(args.item, 'enabled');
+ let param = this.model.store.getValue(args.item, 'param');
+ const rules = this.model.store.getValue(args.item, 'rules');
if (param) {
param = dojo.doc.createElement('span');
}
if (this.model.store.getValue(args.item, 'id') != 'root') {
- var img = dojo.doc.createElement('img');
+ const img = dojo.doc.createElement('img');
img.src ='images/filter.png';
img.className = 'markedPic';
tnode._filterIconNode = img;
},
getLabel: function(item) {
- var label = item.name;
+ let label = item.name;
- var feed = this.model.store.getValue(item, 'feed');
- var inverse = this.model.store.getValue(item, 'inverse');
+ const feed = this.model.store.getValue(item, 'feed');
+ const inverse = this.model.store.getValue(item, 'inverse');
if (feed)
label += " (" + __("in") + " " + feed + ")";
return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "invisible";
},
getLabelClass: function (item, opened) {
- var enabled = this.model.store.getValue(item, 'enabled');
+ const enabled = this.model.store.getValue(item, 'enabled');
return (enabled != false) ? "dijitTreeLabel labelFixedLength" : "dijitTreeLabel labelFixedLength filterDisabled";
},
getRowClass: function (item, opened) {
"dijitTreeRow Error";
},
checkItemAcceptance: function(target, source, position) {
- var item = dijit.getEnclosingWidget(target).item;
+ const item = dijit.getEnclosingWidget(target).item;
// disable copying items
source.copyState = function() { return false; };