summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/App.js5
-rw-r--r--js/Article.js2
-rw-r--r--js/CommonFilters.js8
-rw-r--r--js/Feeds.js12
-rwxr-xr-xjs/Headlines.js40
-rw-r--r--js/PrefFilterTree.js2
-rwxr-xr-xjs/common.js6
-rw-r--r--plugins/note/note.js12
8 files changed, 33 insertions, 54 deletions
diff --git a/js/App.js b/js/App.js
index b88c08062..05816516e 100644
--- a/js/App.js
+++ b/js/App.js
@@ -146,9 +146,6 @@ const App = {
find: function(query) {
return document.querySelector(query)
},
- findAll: function(query) {
- return document.querySelectorAll(query);
- },
dialogOf: function (elem) {
// elem could be a Dijit widget
@@ -408,7 +405,7 @@ const App = {
dojo.destroy(d.domNode);
});
- App.findAll("#" + root + " *").forEach(function (i) {
+ document.querySelectorAll(`#${root} *`).forEach(function (i) {
i.parentNode ? i.parentNode.removeChild(i) : true;
});
},
diff --git a/js/Article.js b/js/Article.js
index a9684c755..4a640ce43 100644
--- a/js/Article.js
+++ b/js/Article.js
@@ -425,7 +425,7 @@ const Article = {
if (id !== Article.getActive()) {
console.log("setActive", id, "was", Article.getActive());
- App.findAll("div[id*=RROW][class*=active]").forEach((row) => {
+ document.querySelectorAll('div[id*=RROW][class*=active]').forEach((row) => {
row.classList.remove('active');
if (App.isCombinedMode() && !App.getInitParam("cdm_expanded"))
diff --git a/js/CommonFilters.js b/js/CommonFilters.js
index 460107c58..8054e4212 100644
--- a/js/CommonFilters.js
+++ b/js/CommonFilters.js
@@ -374,14 +374,10 @@ const Filters = {
this.editRule();
},
deleteAction: function () {
- App.findAll("#filterDlg_Actions li[class*=Selected]").forEach(function (e) {
- e.parentNode.removeChild(e)
- });
+ document.querySelectorAll('#filterDlg_Actions li[class*=Selected]').forEach(e => e.parentNode.removeChild(e));
},
deleteRule: function () {
- App.findAll("#filterDlg_Matches li[class*=Selected]").forEach(function (e) {
- e.parentNode.removeChild(e)
- });
+ document.querySelectorAll('#filterDlg_Matches li[class*=Selected]').forEach(e => e.parentNode.removeChild(e));
},
execute: function () {
if (this.validate()) {
diff --git a/js/Feeds.js b/js/Feeds.js
index 29ae72558..69c2cf986 100644
--- a/js/Feeds.js
+++ b/js/Feeds.js
@@ -383,8 +383,8 @@ const Feeds = {
if (tree)
return tree.hideRead(hide, App.getInitParam("hide_read_shows_special"));*/
- App.findAll("body")[0].setAttribute("hide-read-feeds", !!hide);
- App.findAll("body")[0].setAttribute("hide-read-shows-special", !!App.getInitParam("hide_read_shows_special"));
+ document.body.setAttribute('hide-read-feeds', !!hide);
+ document.body.setAttribute('hide-read-shows-special', !!App.getInitParam('hide_read_shows_special'));
},
open: function(params) {
const feed = params.feed;
@@ -531,12 +531,8 @@ const Feeds = {
const str = __("Mark all articles in %s as read?").replace("%s", title);
if (App.getInitParam("confirm_feed_catchup") !== 1 || confirm(str)) {
-
- const rows = App.findAll("#headlines-frame > div[id*=RROW][class*=Unread][data-orig-feed-id='" + id + "']");
-
- rows.forEach((row) => {
- row.classList.remove('Unread');
- })
+ document.querySelectorAll("#headlines-frame > div[id*=RROW][class*=Unread][data-orig-feed-id='" + id + "']")
+ .forEach(row => row.classList.remove('Unread'));
}
},
getUnread: function(feed, is_cat) {
diff --git a/js/Headlines.js b/js/Headlines.js
index 1cc91f04a..2a7831651 100755
--- a/js/Headlines.js
+++ b/js/Headlines.js
@@ -290,8 +290,8 @@ const Headlines = {
},
loadMore: function () {
const view_mode = dijit.byId("toolbar-main").getValues().view_mode;
- const unread_in_buffer = App.findAll("#headlines-frame > div[id*=RROW][class*=Unread]").length;
- const num_all = App.findAll("#headlines-frame > div[id*=RROW]").length;
+ const unread_in_buffer = document.querySelectorAll('#headlines-frame > div[id*=RROW][class*=Unread]').length;
+ const num_all = document.querySelectorAll('#headlines-frame > div[id*=RROW]').length;
const num_unread = Feeds.getUnread(Feeds.getActive(), Feeds.activeIsCat());
// TODO implement marked & published
@@ -320,7 +320,7 @@ const Headlines = {
return App.Scrollable.isChildVisible(elem, App.byId("headlines-frame"));
},
firstVisible: function () {
- const rows = App.findAll("#headlines-frame > div[id*=RROW]");
+ const rows = document.querySelectorAll('#headlines-frame > div[id*=RROW]');
for (let i = 0; i < rows.length; i++) {
const row = rows[i];
@@ -331,7 +331,7 @@ const Headlines = {
}
},
unpackVisible: function(container) {
- const rows = App.findAll("#headlines-frame > div[id*=RROW][data-content].cdm");
+ const rows = document.querySelectorAll('#headlines-frame > div[id*=RROW][data-content].cdm');
for (let i = 0; i < rows.length; i++) {
if (App.Scrollable.isChildVisible(rows[i], container)) {
@@ -370,7 +370,7 @@ const Headlines = {
if (App.getInitParam("cdm_auto_catchup")) {
- const rows = App.findAll("#headlines-frame > div[id*=RROW][class*=Unread]");
+ const rows = document.querySelectorAll('#headlines-frame > div[id*=RROW][class*=Unread]');
for (let i = 0; i < rows.length; i++) {
const row = rows[i];
@@ -413,7 +413,7 @@ const Headlines = {
// TODO: wrap headline elements into a knockoutjs model to prevent all this stuff
Headlines.setCommonClasses(this.headlines.filter((h) => h.id).length);
- App.findAll("#headlines-frame > div[id*=RROW]").forEach((row) => {
+ document.querySelectorAll('#headlines-frame > div[id*=RROW]').forEach((row) => {
const id = parseInt(row.getAttribute('data-article-id'));
const hl = this.headlines[id];
@@ -436,16 +436,16 @@ const Headlines = {
}
});
- App.findAll(".cdm .header-sticky-guard").forEach((e) => {
+ document.querySelectorAll('.cdm .header-sticky-guard').forEach((e) => {
this.sticky_header_observer.observe(e)
});
- App.findAll(".cdm .content").forEach((e) => {
+ document.querySelectorAll('.cdm .content').forEach((e) => {
this.sticky_content_observer.observe(e)
});
if (App.getInitParam("cdm_expanded"))
- App.findAll("#headlines-frame > div[id*=RROW].cdm").forEach((e) => {
+ document.querySelectorAll('#headlines-frame > div[id*=RROW].cdm').forEach((e) => {
this.unpack_observer.observe(e)
});
@@ -893,16 +893,16 @@ const Headlines = {
}
}
- App.findAll(".cdm .header-sticky-guard").forEach((e) => {
+ document.querySelectorAll('.cdm .header-sticky-guard').forEach((e) => {
this.sticky_header_observer.observe(e)
});
- App.findAll(".cdm .content").forEach((e) => {
+ document.querySelectorAll('.cdm .content').forEach((e) => {
this.sticky_content_observer.observe(e)
});
- if (App.getInitParam("cdm_expanded"))
- App.findAll("#headlines-frame > div[id*=RROW].cdm").forEach((e) => {
+ if (App.getInitParam('cdm_expanded'))
+ document.querySelectorAll('#headlines-frame > div[id*=RROW].cdm').forEach((e) => {
this.unpack_observer.observe(e)
});
@@ -1176,8 +1176,8 @@ const Headlines = {
});
},
getSelected: function () {
- const selected = App.findAll("#headlines-frame > div[id*=RROW][class*=Selected]")
- .map(child => parseInt(child.getAttribute('data-article-id')));
+ const selected = Array.from(document.querySelectorAll('#headlines-frame > div[id*=RROW][class*=Selected]'),
+ child => parseInt(child.getAttribute('data-article-id')));
const active = Article.getActive();
@@ -1189,7 +1189,7 @@ const Headlines = {
getLoaded: function () {
const rv = [];
- const children = App.findAll("#headlines-frame > div[id*=RROW-]");
+ const children = document.querySelectorAll('#headlines-frame > div[id*=RROW-]');
children.forEach(function (child) {
if (Element.visible(child)) {
@@ -1218,7 +1218,7 @@ const Headlines = {
if (start === stop)
return [start];
- const rows = App.findAll("#headlines-frame > div[id*=RROW]");
+ const rows = document.querySelectorAll('#headlines-frame > div[id*=RROW]');
const results = [];
let collecting = false;
@@ -1265,7 +1265,7 @@ const Headlines = {
console.warn("select: unknown mode", mode);
}
- App.findAll(query).forEach((row) => {
+ document.querySelectorAll(query).forEach((row) => {
switch (mode) {
case 'none':
@@ -1359,7 +1359,7 @@ const Headlines = {
this.headlines[data.id].tags = data.tags;
}
- App.findAll(`span[data-tags-for="${data.id}"`).forEach((ctr) => {
+ document.querySelectorAll(`span[data-tags-for="${data.id}"`).forEach((ctr) => {
ctr.innerHTML = Article.renderTags(data.id, data.tags);
});
}
@@ -1372,7 +1372,7 @@ const Headlines = {
this.headlines[row.id].labels = row.labels;
}
- App.findAll(`span[data-labels-for="${row.id}"]`).forEach((ctr) => {
+ document.querySelectorAll(`span[data-labels-for="${row.id}"]`).forEach((ctr) => {
ctr.innerHTML = Article.renderLabels(row.id, row.labels);
});
});
diff --git a/js/PrefFilterTree.js b/js/PrefFilterTree.js
index 4b077259a..ade44dc0a 100644
--- a/js/PrefFilterTree.js
+++ b/js/PrefFilterTree.js
@@ -111,7 +111,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio
});
},
hideOrShowFilterRules(hide) {
- App.findAll("body")[0].setAttribute("hide-filter-rules", !!hide);
+ document.body.setAttribute('hide-filter-rules', !!hide);
},
toggleRules: function() {
const hide = !parseInt(localStorage.getItem("ttrss:hide-filter-rules"));
diff --git a/js/common.js b/js/common.js
index b981f0141..2d5e63f44 100755
--- a/js/common.js
+++ b/js/common.js
@@ -22,12 +22,6 @@ function $(id) {
return document.getElementById(id);
}
-/* exported $$ */
-function $$(query) {
- console.warn("FIXME: please use App.findAll() or document.querySelectorAll() instead of $$():", query);
- return document.querySelectorAll(query);
-}
-
// polyfill for safari https://raw.githubusercontent.com/pladaria/requestidlecallback-polyfill/master/index.js
window.requestIdleCallback =
window.requestIdleCallback ||
diff --git a/plugins/note/note.js b/plugins/note/note.js
index 00deb0543..98b639358 100644
--- a/plugins/note/note.js
+++ b/plugins/note/note.js
@@ -5,7 +5,7 @@ require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) {
Plugins.Note = {
set_click_handler: function() {
- App.findAll(".article-note[data-note-for]").forEach((note) => {
+ document.querySelectorAll('.article-note[data-note-for]').forEach((note) => {
note.onclick = function() {
Plugins.Note.edit(this.getAttribute('data-note-for'));
}
@@ -23,13 +23,9 @@ require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) {
dialog.hide();
if (reply) {
- App.findAll(`div[data-note-for="${reply.id}"]`).forEach((elem) => {
- elem.querySelector(".body").innerHTML = reply.note;
-
- if (reply.note)
- elem.show();
- else
- elem.hide();
+ document.querySelectorAll(`div[data-note-for="${reply.id}"]`).forEach((elem) => {
+ elem.querySelector('.body').innerHTML = reply.note;
+ reply.note ? elem.show() : elem.hide();
});
}
});