mirror of
https://git.tt-rss.org/fox/tt-rss.git
synced 2025-10-22 08:21:00 +02:00
Remove 'App.byId()', which was essentially an alias of 'document.getElementById()'.
This commit is contained in:
parent
6bd52b28c2
commit
f85559735b
@ -345,14 +345,14 @@ class Pref_Prefs extends Handler_Protected {
|
||||
Notify.close();
|
||||
if (reply.indexOf('ERROR: ') == 0) {
|
||||
|
||||
App.byId('pwd_change_infobox').innerHTML =
|
||||
document.getElementById('pwd_change_infobox').innerHTML =
|
||||
reply.replace('ERROR: ', '');
|
||||
|
||||
} else {
|
||||
App.byId('pwd_change_infobox').innerHTML =
|
||||
document.getElementById('pwd_change_infobox').innerHTML =
|
||||
reply.replace('ERROR: ', '');
|
||||
|
||||
const warn = App.byId('default_pass_warning');
|
||||
const warn = document.getElementById('default_pass_warning');
|
||||
if (warn) Element.hide(warn);
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ class Pref_System extends Handler_Administrative {
|
||||
evt.preventDefault();
|
||||
if (this.validate()) {
|
||||
xhr.json("backend.php", this.getValues(), (reply) => {
|
||||
const msg = App.byId("mail-test-result");
|
||||
const msg = document.getElementById("mail-test-result");
|
||||
|
||||
if (reply.rc) {
|
||||
msg.innerHTML = __("Mail sent.");
|
||||
|
19
js/App.js
19
js/App.js
@ -140,9 +140,6 @@ const App = {
|
||||
}
|
||||
}
|
||||
},
|
||||
byId: function(id) {
|
||||
return document.getElementById(id);
|
||||
},
|
||||
find: function(query) {
|
||||
return document.querySelector(query)
|
||||
},
|
||||
@ -190,12 +187,12 @@ const App = {
|
||||
}
|
||||
},
|
||||
setupNightModeDetection: function(callback) {
|
||||
if (!App.byId("theme_css")) {
|
||||
if (!document.getElementById("theme_css")) {
|
||||
const mql = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
|
||||
try {
|
||||
mql.addEventListener("change", () => {
|
||||
this.nightModeChanged(mql.matches, App.byId("theme_auto_css"));
|
||||
this.nightModeChanged(mql.matches, document.getElementById("theme_auto_css"));
|
||||
});
|
||||
} catch {
|
||||
console.warn("exception while trying to set MQL event listener");
|
||||
@ -295,7 +292,7 @@ const App = {
|
||||
dijit.byId("loading_bar").update({progress: this._loading_progress});
|
||||
|
||||
if (this._loading_progress >= 90) {
|
||||
App.byId("overlay").hide();
|
||||
document.getElementById("overlay").hide();
|
||||
}
|
||||
|
||||
},
|
||||
@ -352,7 +349,7 @@ const App = {
|
||||
if (!this.hotkey_prefix && hotkeys_map[0].indexOf(keychar) !== -1) {
|
||||
|
||||
this.hotkey_prefix = keychar;
|
||||
App.byId("cmdline").innerHTML = keychar;
|
||||
document.getElementById("cmdline").innerHTML = keychar;
|
||||
Element.show("cmdline");
|
||||
|
||||
window.clearTimeout(this.hotkey_prefix_timeout);
|
||||
@ -562,7 +559,7 @@ const App = {
|
||||
break;
|
||||
case "cdm_auto_catchup":
|
||||
{
|
||||
const headlines = App.byId("headlines-frame");
|
||||
const headlines = document.getElementById("headlines-frame");
|
||||
|
||||
// we could be in preferences
|
||||
if (headlines)
|
||||
@ -873,7 +870,7 @@ const App = {
|
||||
.then((reply) => {
|
||||
console.log('update reply', reply);
|
||||
|
||||
const icon = App.byId("updates-available");
|
||||
const icon = document.getElementById("updates-available");
|
||||
|
||||
if (reply.changeset.id || reply.plugins.length > 0) {
|
||||
icon.show();
|
||||
@ -933,7 +930,7 @@ const App = {
|
||||
this._widescreen_mode = wide;
|
||||
|
||||
const article_id = Article.getActive();
|
||||
const headlines_frame = App.byId("headlines-frame");
|
||||
const headlines_frame = document.getElementById("headlines-frame");
|
||||
const content_insert = dijit.byId("content-insert");
|
||||
|
||||
// TODO: setStyle stuff should probably be handled by CSS
|
||||
@ -1238,7 +1235,7 @@ const App = {
|
||||
this.hotkey_actions['select_article_cursor'] = () => {
|
||||
const id = Article.getUnderPointer();
|
||||
if (id)
|
||||
App.byId(`RROW-${id}`)?.classList.toggle('Selected');
|
||||
document.getElementById(`RROW-${id}`)?.classList.toggle('Selected');
|
||||
};
|
||||
this.hotkey_actions["create_label"] = () => {
|
||||
CommonDialogs.addLabel();
|
||||
|
@ -36,7 +36,7 @@ const Article = {
|
||||
|
||||
if (!isNaN(parseInt(score))) {
|
||||
ids.forEach((id) => {
|
||||
const row = App.byId(`RROW-${id}`);
|
||||
const row = document.getElementById(`RROW-${id}`);
|
||||
|
||||
if (row) {
|
||||
row.setAttribute("data-score", score);
|
||||
@ -88,7 +88,7 @@ const Article = {
|
||||
w.location = url;
|
||||
},
|
||||
cdmToggleGridSpan: function(id) {
|
||||
const row = App.byId(`RROW-${id}`);
|
||||
const row = document.getElementById(`RROW-${id}`);
|
||||
|
||||
if (row) {
|
||||
row.classList.toggle('grid-span-row');
|
||||
@ -98,7 +98,7 @@ const Article = {
|
||||
}
|
||||
},
|
||||
cdmUnsetActive: function (event) {
|
||||
const row = App.byId(`RROW-${Article.getActive()}`);
|
||||
const row = document.getElementById(`RROW-${Article.getActive()}`);
|
||||
|
||||
if (row) {
|
||||
row.classList.remove('active');
|
||||
@ -258,7 +258,7 @@ const Article = {
|
||||
container.innerHTML += " ";
|
||||
|
||||
// in expandable mode, save content for later, so that we can pack unfocused rows back
|
||||
if (App.isCombinedMode() && App.byId('main').classList.contains('expandable'))
|
||||
if (App.isCombinedMode() && document.getElementById('main').classList.contains('expandable'))
|
||||
row.setAttribute("data-content-original", row.getAttribute("data-content"));
|
||||
|
||||
row.setAttribute("data-is-packed", "0");
|
||||
@ -325,7 +325,7 @@ const Article = {
|
||||
return false;
|
||||
},
|
||||
autocompleteInject: function(elem, targetId) {
|
||||
const target = App.byId(targetId);
|
||||
const target = document.getElementById(targetId);
|
||||
|
||||
if (!target)
|
||||
return;
|
||||
@ -388,15 +388,15 @@ const Article = {
|
||||
|
||||
xhr.json("backend.php", {op: "Article", method: "printArticleTags", id: id}, (reply) => {
|
||||
|
||||
dijit.getEnclosingWidget(App.byId("tags_str"))
|
||||
dijit.getEnclosingWidget(document.getElementById("tags_str"))
|
||||
.attr('value', reply.tags.join(", "))
|
||||
.attr('disabled', false);
|
||||
|
||||
App.byId('tags_str').onkeyup = (e) => {
|
||||
document.getElementById('tags_str').onkeyup = (e) => {
|
||||
const last_tag = e.target.value.split(',').pop().trim();
|
||||
|
||||
xhr.json("backend.php", {op: 'Article', method: 'completeTags', search: last_tag}, (data) => {
|
||||
App.byId("tags_choices").innerHTML = `${data.map((tag) =>
|
||||
document.getElementById("tags_choices").innerHTML = `${data.map((tag) =>
|
||||
`<a href="#" onclick="Article.autocompleteInject(this, 'tags_str')">${tag}</a>` )
|
||||
.join(', ')}`
|
||||
});
|
||||
@ -410,8 +410,8 @@ const Article = {
|
||||
cdmMoveToId: function (id, params = {}) {
|
||||
const force_to_top = params.force_to_top || false;
|
||||
|
||||
const ctr = App.byId("headlines-frame");
|
||||
const row = App.byId(`RROW-${id}`);
|
||||
const ctr = document.getElementById("headlines-frame");
|
||||
const row = document.getElementById(`RROW-${id}`);
|
||||
|
||||
if (ctr && row) {
|
||||
const grid_gap = parseInt(window.getComputedStyle(ctr).gridGap) || 0;
|
||||
@ -432,7 +432,7 @@ const Article = {
|
||||
Article.pack(row);
|
||||
});
|
||||
|
||||
const row = App.byId(`RROW-${id}`);
|
||||
const row = document.getElementById(`RROW-${id}`);
|
||||
|
||||
if (row) {
|
||||
Article.unpack(row);
|
||||
@ -449,10 +449,10 @@ const Article = {
|
||||
return row ? parseInt(row.getAttribute('data-article-id')) : 0;
|
||||
},
|
||||
scrollByPages: function (page_offset) {
|
||||
App.Scrollable.scrollByPages(App.byId("content-insert"), page_offset);
|
||||
App.Scrollable.scrollByPages(document.getElementById("content-insert"), page_offset);
|
||||
},
|
||||
scroll: function (offset) {
|
||||
App.Scrollable.scroll(App.byId("content-insert"), offset);
|
||||
App.Scrollable.scroll(document.getElementById("content-insert"), offset);
|
||||
},
|
||||
mouseIn: function (id) {
|
||||
this.post_under_pointer = id;
|
||||
|
@ -116,7 +116,7 @@ const CommonDialogs = {
|
||||
</form>
|
||||
`,
|
||||
show_error: function (msg, additional_info) {
|
||||
const elem = App.byId("fadd_error_message");
|
||||
const elem = document.getElementById("fadd_error_message");
|
||||
|
||||
elem.innerHTML = `${msg}${additional_info ? `<br><br><h4>${__('Additional information')}</h4>${additional_info}` : ''}`;
|
||||
|
||||
|
@ -166,7 +166,7 @@ const Filters = {
|
||||
title: ruleStr ? __("Edit rule") : __("Add rule"),
|
||||
execute: function () {
|
||||
if (this.validate()) {
|
||||
dialog.insertRule(App.byId("filterDlg_Matches"), replaceNode);
|
||||
dialog.insertRule(document.getElementById("filterDlg_Matches"), replaceNode);
|
||||
this.hide();
|
||||
}
|
||||
},
|
||||
@ -262,7 +262,7 @@ const Filters = {
|
||||
},
|
||||
execute: function () {
|
||||
if (this.validate()) {
|
||||
dialog.insertAction(App.byId("filterDlg_Actions"), replaceNode);
|
||||
dialog.insertAction(document.getElementById("filterDlg_Actions"), replaceNode);
|
||||
this.hide();
|
||||
}
|
||||
},
|
||||
|
@ -309,7 +309,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dojo/_base/array", "dojo/co
|
||||
|
||||
// focus headlines to route key events there
|
||||
setTimeout(() => {
|
||||
App.byId("headlines-frame").focus();
|
||||
document.getElementById("headlines-frame").focus();
|
||||
|
||||
if (treeNode) {
|
||||
const node = treeNode.rowNode;
|
||||
@ -318,7 +318,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dojo/_base/array", "dojo/co
|
||||
if (node && tree) {
|
||||
// scroll tree to selection if needed
|
||||
if (node.offsetTop < tree.scrollTop || node.offsetTop > tree.scrollTop + tree.clientHeight) {
|
||||
App.byId("feedTree").scrollTop = node.offsetTop;
|
||||
document.getElementById("feedTree").scrollTop = node.offsetTop;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
10
js/Feeds.js
10
js/Feeds.js
@ -227,7 +227,7 @@ const Feeds = {
|
||||
dojo.disconnect(tmph);
|
||||
});
|
||||
|
||||
App.byId("feeds-holder").appendChild(tree.domNode);
|
||||
document.getElementById("feeds-holder").appendChild(tree.domNode);
|
||||
|
||||
const tmph2 = dojo.connect(tree, 'onLoad', function () {
|
||||
dojo.disconnect(tmph2);
|
||||
@ -247,13 +247,13 @@ const Feeds = {
|
||||
}
|
||||
},
|
||||
onHide: function() {
|
||||
App.byId("feeds-holder_splitter").hide();
|
||||
document.getElementById("feeds-holder_splitter").hide();
|
||||
|
||||
dijit.byId("main").resize();
|
||||
Headlines.updateCurrentUnread();
|
||||
},
|
||||
onShow: function() {
|
||||
App.byId("feeds-holder_splitter").show();
|
||||
document.getElementById("feeds-holder_splitter").show();
|
||||
|
||||
dijit.byId("main").resize();
|
||||
Headlines.updateCurrentUnread();
|
||||
@ -261,7 +261,7 @@ const Feeds = {
|
||||
init: function() {
|
||||
console.log("in feedlist init");
|
||||
|
||||
this._feeds_holder_observer.observe(App.byId("feeds-holder"));
|
||||
this._feeds_holder_observer.observe(document.getElementById("feeds-holder"));
|
||||
|
||||
App.setLoadingProgress(50);
|
||||
|
||||
@ -350,7 +350,7 @@ const Feeds = {
|
||||
this._active_feed_id = id;
|
||||
this._active_feed_is_cat = is_cat;
|
||||
|
||||
const container = App.byId("headlines-frame");
|
||||
const container = document.getElementById("headlines-frame");
|
||||
|
||||
// TODO @deprecated: these two should be removed (replaced with data- attributes below)
|
||||
container.setAttribute("feed-id", id);
|
||||
|
@ -239,7 +239,7 @@ const Headlines = {
|
||||
|
||||
Headlines.select('none');
|
||||
|
||||
const scroll_position_A = App.byId(`RROW-${id}`).offsetTop - App.byId("headlines-frame").scrollTop;
|
||||
const scroll_position_A = document.getElementById(`RROW-${id}`).offsetTop - document.getElementById("headlines-frame").scrollTop;
|
||||
|
||||
Article.setActive(id);
|
||||
|
||||
@ -250,10 +250,10 @@ const Headlines = {
|
||||
|
||||
Headlines.toggleUnread(id, 0);
|
||||
} else {
|
||||
const scroll_position_B = App.byId(`RROW-${id}`).offsetTop - App.byId("headlines-frame").scrollTop;
|
||||
const scroll_position_B = document.getElementById(`RROW-${id}`).offsetTop - document.getElementById("headlines-frame").scrollTop;
|
||||
|
||||
// this would only work if there's enough space
|
||||
App.byId("headlines-frame").scrollTop -= scroll_position_A-scroll_position_B;
|
||||
document.getElementById("headlines-frame").scrollTop -= scroll_position_A-scroll_position_B;
|
||||
|
||||
if (this.default_move_on_expand)
|
||||
Article.cdmMoveToId(id);
|
||||
@ -280,7 +280,7 @@ const Headlines = {
|
||||
return false;
|
||||
},
|
||||
initScrollHandler: function () {
|
||||
App.byId("headlines-frame").onscroll = (event) => {
|
||||
document.getElementById("headlines-frame").onscroll = (event) => {
|
||||
clearTimeout(this._headlines_scroll_timeout);
|
||||
this._headlines_scroll_timeout = window.setTimeout(function () {
|
||||
//console.log('done scrolling', event);
|
||||
@ -317,7 +317,7 @@ const Headlines = {
|
||||
Feeds.open({feed: Feeds.getActive(), is_cat: Feeds.activeIsCat(), offset: offset, append: true});
|
||||
},
|
||||
isChildVisible: function (elem) {
|
||||
return App.Scrollable.isChildVisible(elem, App.byId("headlines-frame"));
|
||||
return App.Scrollable.isChildVisible(elem, document.getElementById("headlines-frame"));
|
||||
},
|
||||
firstVisible: function () {
|
||||
const rows = document.querySelectorAll('#headlines-frame > div[id*=RROW]');
|
||||
@ -343,8 +343,8 @@ const Headlines = {
|
||||
scrollHandler: function (/*event*/) {
|
||||
try {
|
||||
if (!Feeds.infscroll_disabled && !Feeds.infscroll_in_progress) {
|
||||
const hsp = App.byId("headlines-spacer");
|
||||
const container = App.byId("headlines-frame");
|
||||
const hsp = document.getElementById("headlines-spacer");
|
||||
const container = document.getElementById("headlines-frame");
|
||||
|
||||
if (hsp && hsp.previousSibling) {
|
||||
const last_row = hsp.previousSibling;
|
||||
@ -361,7 +361,7 @@ const Headlines = {
|
||||
}
|
||||
|
||||
if (App.isCombinedMode() && App.getInitParam("cdm_expanded")) {
|
||||
const container = App.byId("headlines-frame")
|
||||
const container = document.getElementById("headlines-frame")
|
||||
|
||||
/* don't do anything until there was some scrolling */
|
||||
if (container.scrollTop > 0)
|
||||
@ -375,7 +375,7 @@ const Headlines = {
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
const row = rows[i];
|
||||
|
||||
if (App.byId("headlines-frame").scrollTop > (row.offsetTop + row.offsetHeight / 2)) {
|
||||
if (document.getElementById("headlines-frame").scrollTop > (row.offsetTop + row.offsetHeight / 2)) {
|
||||
row.classList.remove('Unread');
|
||||
} else {
|
||||
break;
|
||||
@ -393,7 +393,7 @@ const Headlines = {
|
||||
return this.headlines[id];
|
||||
},
|
||||
setCommonClasses: function (headlines_count) {
|
||||
const container = App.byId("headlines-frame");
|
||||
const container = document.getElementById("headlines-frame");
|
||||
|
||||
container.classList.remove('cdm', 'normal');
|
||||
|
||||
@ -404,10 +404,10 @@ const Headlines = {
|
||||
container.setAttribute("data-is-cdm-expanded", App.getInitParam("cdm_expanded"));
|
||||
|
||||
// for floating title because it's placed outside of headlines-frame
|
||||
App.byId('main').classList.remove('expandable', 'expanded');
|
||||
document.getElementById('main').classList.remove('expandable', 'expanded');
|
||||
|
||||
if (App.isCombinedMode())
|
||||
App.byId('main').classList.add(App.getInitParam('cdm_expanded') ? 'expanded' : 'expandable');
|
||||
document.getElementById('main').classList.add(App.getInitParam('cdm_expanded') ? 'expanded' : 'expandable');
|
||||
},
|
||||
renderAgain: function () {
|
||||
// TODO: wrap headline elements into a knockoutjs model to prevent all this stuff
|
||||
@ -476,7 +476,7 @@ const Headlines = {
|
||||
const tmp = document.createElement("div");
|
||||
tmp.innerHTML = vgrhdr;
|
||||
|
||||
App.byId("headlines-frame").appendChild(tmp.firstChild);
|
||||
document.getElementById("headlines-frame").appendChild(tmp.firstChild);
|
||||
|
||||
this.vgroup_last_feed = hl.feed_id;
|
||||
}
|
||||
@ -609,11 +609,11 @@ const Headlines = {
|
||||
return tmp.firstChild;
|
||||
},
|
||||
updateCurrentUnread: function () {
|
||||
if (App.byId("feed_current_unread")) {
|
||||
if (document.getElementById("feed_current_unread")) {
|
||||
const feed_unread = Feeds.getUnread(Feeds.getActive(), Feeds.activeIsCat());
|
||||
|
||||
if (feed_unread > 0 && !Element.visible("feeds-holder")) {
|
||||
App.byId("feed_current_unread").innerText = feed_unread;
|
||||
document.getElementById("feed_current_unread").innerText = feed_unread;
|
||||
Element.show("feed_current_unread");
|
||||
} else {
|
||||
Element.hide("feed_current_unread");
|
||||
@ -762,18 +762,18 @@ const Headlines = {
|
||||
Headlines.setCommonClasses(headlines_count);
|
||||
|
||||
/** TODO: remove @deprecated */
|
||||
App.byId("headlines-frame").setAttribute("is-vfeed",
|
||||
document.getElementById("headlines-frame").setAttribute("is-vfeed",
|
||||
reply['headlines']['is_vfeed'] ? 1 : 0);
|
||||
|
||||
App.byId("headlines-frame").setAttribute("data-is-vfeed",
|
||||
document.getElementById("headlines-frame").setAttribute("data-is-vfeed",
|
||||
reply['headlines']['is_vfeed'] ? "true" : "false");
|
||||
|
||||
Article.setActive(0);
|
||||
|
||||
try {
|
||||
App.byId('headlines-frame').classList.remove('smooth-scroll');
|
||||
App.byId('headlines-frame').scrollTop = 0;
|
||||
App.byId('headlines-frame').classList.add('smooth-scroll');
|
||||
document.getElementById('headlines-frame').classList.remove('smooth-scroll');
|
||||
document.getElementById('headlines-frame').scrollTop = 0;
|
||||
document.getElementById('headlines-frame').classList.add('smooth-scroll');
|
||||
} catch (e) {
|
||||
console.warn(e);
|
||||
}
|
||||
@ -781,27 +781,27 @@ const Headlines = {
|
||||
this.headlines = [];
|
||||
this.vgroup_last_feed = undefined;
|
||||
|
||||
/*dojo.html.set(App.byId("toolbar-headlines"),
|
||||
/*dojo.html.set(document.getElementById("toolbar-headlines"),
|
||||
reply['headlines']['toolbar'],
|
||||
{parseContent: true});*/
|
||||
|
||||
Headlines.renderToolbar(reply['headlines']);
|
||||
|
||||
if (typeof reply['headlines']['content'] === 'string') {
|
||||
App.byId("headlines-frame").innerHTML = reply['headlines']['content'];
|
||||
document.getElementById("headlines-frame").innerHTML = reply['headlines']['content'];
|
||||
} else {
|
||||
App.byId("headlines-frame").innerHTML = '';
|
||||
document.getElementById("headlines-frame").innerHTML = '';
|
||||
|
||||
for (let i = 0; i < reply['headlines']['content'].length; i++) {
|
||||
const hl = reply['headlines']['content'][i];
|
||||
|
||||
App.byId("headlines-frame").appendChild(this.render(reply['headlines'], hl));
|
||||
document.getElementById("headlines-frame").appendChild(this.render(reply['headlines'], hl));
|
||||
|
||||
this.headlines[parseInt(hl.id)] = hl;
|
||||
}
|
||||
}
|
||||
|
||||
let hsp = App.byId("headlines-spacer");
|
||||
let hsp = document.getElementById("headlines-spacer");
|
||||
|
||||
if (!hsp) {
|
||||
hsp = document.createElement("div");
|
||||
@ -821,7 +821,7 @@ const Headlines = {
|
||||
|
||||
/*
|
||||
if (Feeds._search_query) {
|
||||
App.byId("feed_title").innerHTML += "<span id='cancel_search'>" +
|
||||
document.getElementById("feed_title").innerHTML += "<span id='cancel_search'>" +
|
||||
" (<a href='#' onclick='Feeds.cancelSearch()'>" + __("Cancel search") + "</a>)" +
|
||||
"</span>";
|
||||
} */
|
||||
@ -831,7 +831,7 @@ const Headlines = {
|
||||
} else if (headlines_count > 0 && feed_id === Feeds.getActive() && is_cat === Feeds.activeIsCat()) {
|
||||
const c = dijit.byId("headlines-frame");
|
||||
|
||||
let hsp = App.byId("headlines-spacer");
|
||||
let hsp = document.getElementById("headlines-spacer");
|
||||
|
||||
if (hsp)
|
||||
c.domNode.removeChild(hsp);
|
||||
@ -839,13 +839,13 @@ const Headlines = {
|
||||
let headlines_appended = 0;
|
||||
|
||||
if (typeof reply['headlines']['content'] === 'string') {
|
||||
App.byId("headlines-frame").innerHTML = reply['headlines']['content'];
|
||||
document.getElementById("headlines-frame").innerHTML = reply['headlines']['content'];
|
||||
} else {
|
||||
for (let i = 0; i < reply['headlines']['content'].length; i++) {
|
||||
const hl = reply['headlines']['content'][i];
|
||||
|
||||
if (!this.headlines[parseInt(hl.id)]) {
|
||||
App.byId("headlines-frame").appendChild(this.render(reply['headlines'], hl));
|
||||
document.getElementById("headlines-frame").appendChild(this.render(reply['headlines'], hl));
|
||||
|
||||
this.headlines[parseInt(hl.id)] = hl;
|
||||
++headlines_appended;
|
||||
@ -880,7 +880,7 @@ const Headlines = {
|
||||
|
||||
console.log("no headlines received, infscroll_disabled=", Feeds.infscroll_disabled, 'first_id_changed=', first_id_changed);
|
||||
|
||||
const hsp = App.byId("headlines-spacer");
|
||||
const hsp = document.getElementById("headlines-spacer");
|
||||
|
||||
if (hsp) {
|
||||
if (first_id_changed) {
|
||||
@ -948,7 +948,7 @@ const Headlines = {
|
||||
}
|
||||
|
||||
ids.forEach((id) => {
|
||||
const row = App.byId(`RROW-${id}`);
|
||||
const row = document.getElementById(`RROW-${id}`);
|
||||
|
||||
if (row) {
|
||||
switch (cmode) {
|
||||
@ -987,11 +987,11 @@ const Headlines = {
|
||||
ids.forEach(id => this.togglePub(id));
|
||||
},
|
||||
toggleMark: function (id) {
|
||||
App.byId(`RROW-${id}`)?.classList.toggle('marked');
|
||||
document.getElementById(`RROW-${id}`)?.classList.toggle('marked');
|
||||
|
||||
},
|
||||
togglePub: function (id) {
|
||||
App.byId(`RROW-${id}`)?.classList.toggle('published');
|
||||
document.getElementById(`RROW-${id}`)?.classList.toggle('published');
|
||||
},
|
||||
move: function (mode, params = {}) {
|
||||
const no_expand = params.no_expand || false;
|
||||
@ -1002,7 +1002,7 @@ const Headlines = {
|
||||
let next_id = false;
|
||||
let current_id = Article.getActive();
|
||||
|
||||
if (!Headlines.isChildVisible(App.byId(`RROW-${current_id}`))) {
|
||||
if (!Headlines.isChildVisible(document.getElementById(`RROW-${current_id}`))) {
|
||||
console.log('active article is obscured, resetting to first visible...');
|
||||
current_id = Headlines.firstVisible();
|
||||
prev_id = current_id;
|
||||
@ -1041,15 +1041,15 @@ const Headlines = {
|
||||
}
|
||||
} else if (App.isCombinedMode()) {
|
||||
// try to show hsp if no next article exists, in case there's useful information like first_id_changed etc
|
||||
const row = App.byId(`RROW-${current_id}`);
|
||||
const ctr = App.byId("headlines-frame");
|
||||
const row = document.getElementById(`RROW-${current_id}`);
|
||||
const ctr = document.getElementById("headlines-frame");
|
||||
|
||||
if (row) {
|
||||
const next = row.nextSibling;
|
||||
|
||||
// hsp has half-screen height in auto catchup mode therefore we use its first child (normally A element)
|
||||
if (next && Element.visible(next) && next.id === "headlines-spacer" && next.firstChild) {
|
||||
const offset = App.byId("headlines-spacer").offsetTop - App.byId("headlines-frame").offsetHeight + next.firstChild.offsetHeight;
|
||||
const offset = document.getElementById("headlines-spacer").offsetTop - document.getElementById("headlines-frame").offsetHeight + next.firstChild.offsetHeight;
|
||||
|
||||
// don't jump back either
|
||||
if (ctr.scrollTop < offset)
|
||||
@ -1061,8 +1061,8 @@ const Headlines = {
|
||||
if (prev_id || current_id) {
|
||||
if (App.isCombinedMode()) {
|
||||
window.requestAnimationFrame(() => {
|
||||
const row = App.byId(`RROW-${current_id}`);
|
||||
const ctr = App.byId("headlines-frame");
|
||||
const row = document.getElementById(`RROW-${current_id}`);
|
||||
const ctr = document.getElementById("headlines-frame");
|
||||
const delta_px = Math.round(row.offsetTop) - Math.round(ctr.scrollTop);
|
||||
|
||||
console.log('moving back, delta_px', delta_px);
|
||||
@ -1083,7 +1083,7 @@ const Headlines = {
|
||||
},
|
||||
updateSelectedPrompt: function () {
|
||||
const count = Headlines.getSelected().length;
|
||||
const elem = App.byId("selected_prompt");
|
||||
const elem = document.getElementById("selected_prompt");
|
||||
|
||||
if (elem) {
|
||||
elem.innerHTML = ngettext("%d article selected",
|
||||
@ -1093,7 +1093,7 @@ const Headlines = {
|
||||
}
|
||||
},
|
||||
toggleUnread: function (id, cmode) {
|
||||
const row = App.byId(`RROW-${id}`);
|
||||
const row = document.getElementById(`RROW-${id}`);
|
||||
|
||||
if (row) {
|
||||
if (typeof cmode === "undefined") cmode = 2;
|
||||
@ -1316,7 +1316,7 @@ const Headlines = {
|
||||
if (!below) {
|
||||
for (let i = 0; i < visible_ids.length; i++) {
|
||||
if (visible_ids[i] !== id) {
|
||||
const e = App.byId(`RROW-${visible_ids[i]}`);
|
||||
const e = document.getElementById(`RROW-${visible_ids[i]}`);
|
||||
|
||||
if (e && e.classList.contains('Unread')) {
|
||||
ids_to_mark.push(visible_ids[i]);
|
||||
@ -1328,7 +1328,7 @@ const Headlines = {
|
||||
} else {
|
||||
for (let i = visible_ids.length - 1; i >= 0; i--) {
|
||||
if (visible_ids[i] !== id) {
|
||||
const e = App.byId(`RROW-${visible_ids[i]}`);
|
||||
const e = document.getElementById(`RROW-${visible_ids[i]}`);
|
||||
|
||||
if (e && e.classList.contains('Unread')) {
|
||||
ids_to_mark.push(visible_ids[i]);
|
||||
@ -1347,7 +1347,7 @@ const Headlines = {
|
||||
if (App.getInitParam("confirm_feed_catchup") !== 1 || confirm(msg)) {
|
||||
|
||||
for (let i = 0; i < ids_to_mark.length; i++) {
|
||||
const e = App.byId(`RROW-${ids_to_mark[i]}`);
|
||||
const e = document.getElementById(`RROW-${ids_to_mark[i]}`);
|
||||
e.classList.remove('Unread');
|
||||
}
|
||||
}
|
||||
@ -1379,8 +1379,8 @@ const Headlines = {
|
||||
}
|
||||
},
|
||||
scrollToArticleId: function (id) {
|
||||
const container = App.byId("headlines-frame");
|
||||
const row = App.byId(`RROW-${id}`);
|
||||
const container = document.getElementById("headlines-frame");
|
||||
const row = document.getElementById(`RROW-${id}`);
|
||||
|
||||
if (!container || !row) return;
|
||||
|
||||
@ -1525,10 +1525,10 @@ const Headlines = {
|
||||
}
|
||||
},
|
||||
scrollByPages: function (page_offset) {
|
||||
App.Scrollable.scrollByPages(App.byId("headlines-frame"), page_offset);
|
||||
App.Scrollable.scrollByPages(document.getElementById("headlines-frame"), page_offset);
|
||||
},
|
||||
scroll: function (offset) {
|
||||
App.Scrollable.scroll(App.byId("headlines-frame"), offset);
|
||||
App.Scrollable.scroll(document.getElementById("headlines-frame"), offset);
|
||||
},
|
||||
initHeadlinesMenu: function () {
|
||||
if (!dijit.byId("headlinesMenu")) {
|
||||
|
@ -144,7 +144,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dojo/_b
|
||||
return (!item || this.model.store.getValue(item, 'type') === 'category') ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "feed-icon";
|
||||
},
|
||||
reload: function() {
|
||||
const searchElem = App.byId("feed_search");
|
||||
const searchElem = document.getElementById("feed_search");
|
||||
const search = (searchElem) ? searchElem.value : "";
|
||||
|
||||
xhr.post("backend.php", { op: "Pref_Feeds", search: search }, (reply) => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* global __, define, lib, xhr, App, Notify, Filters */
|
||||
/* global __, define, lib, xhr, Notify, Filters */
|
||||
|
||||
define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], function (declare, domConstruct) {
|
||||
|
||||
@ -101,7 +101,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio
|
||||
return rv;
|
||||
},
|
||||
reload: function() {
|
||||
const user_search = App.byId("filter_search");
|
||||
const user_search = document.getElementById("filter_search");
|
||||
let search = "";
|
||||
if (user_search) { search = user_search.value; }
|
||||
|
||||
|
@ -8,7 +8,7 @@ const Helpers = {
|
||||
return Tables.getSelected("app-password-list");
|
||||
},
|
||||
updateContent: function(data) {
|
||||
App.byId("app_passwords_holder").innerHTML = data;
|
||||
document.getElementById("app_passwords_holder").innerHTML = data;
|
||||
dojo.parser.parse("app_passwords_holder");
|
||||
},
|
||||
removeSelected: function() {
|
||||
@ -264,7 +264,7 @@ const Helpers = {
|
||||
apply: function() {
|
||||
xhr.post("backend.php", this.attr('value'), () => {
|
||||
Element.show("css_edit_apply_msg");
|
||||
App.byId("user_css_style").innerText = this.attr('value');
|
||||
document.getElementById("user_css_style").innerText = this.attr('value');
|
||||
});
|
||||
},
|
||||
execute: function () {
|
||||
@ -784,7 +784,7 @@ const Helpers = {
|
||||
},
|
||||
OPML: {
|
||||
import: function() {
|
||||
const opml_file = App.byId("opml_file");
|
||||
const opml_file = document.getElementById("opml_file");
|
||||
|
||||
if (opml_file.value.length === 0) {
|
||||
alert(__("Please choose an OPML file first."));
|
||||
@ -826,7 +826,7 @@ const Helpers = {
|
||||
dialog.show();
|
||||
};
|
||||
|
||||
xhr.send(new FormData(App.byId("opml_import_form")));
|
||||
xhr.send(new FormData(document.getElementById("opml_import_form")));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dijit/f
|
||||
color = bg;
|
||||
}
|
||||
|
||||
const e = App.byId(`icon-label-${id}`);
|
||||
const e = document.getElementById(`icon-label-${id}`);
|
||||
|
||||
if (e) {
|
||||
if (bg) e.style.color = bg;
|
||||
|
@ -5,7 +5,7 @@
|
||||
const Users = {
|
||||
reload: function(sort) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const user_search = App.byId("user_search");
|
||||
const user_search = document.getElementById("user_search");
|
||||
const search = user_search ? user_search.value : "";
|
||||
|
||||
xhr.post("backend.php", { op: "Pref_Users", sort: sort, search: search }, (reply) => {
|
||||
|
@ -16,12 +16,6 @@ function ngettext(msg1, msg2, n) {
|
||||
return __((parseInt(n) > 1) ? msg2 : msg1);
|
||||
}
|
||||
|
||||
/* exported $ */
|
||||
function $(id) {
|
||||
console.warn("FIXME: please use App.byId() or document.getElementById() instead of $():", id);
|
||||
return document.getElementById(id);
|
||||
}
|
||||
|
||||
// polyfill for safari https://raw.githubusercontent.com/pladaria/requestidlecallback-polyfill/master/index.js
|
||||
window.requestIdleCallback =
|
||||
window.requestIdleCallback ||
|
||||
@ -364,7 +358,7 @@ const Notify = {
|
||||
kind = kind || this.KIND_GENERIC;
|
||||
keep = keep || false;
|
||||
|
||||
const notify = App.byId("notify");
|
||||
const notify = document.getElementById("notify");
|
||||
|
||||
window.clearTimeout(this.timeout);
|
||||
|
||||
|
@ -52,7 +52,7 @@ Plugins.Shorten_Expanded = {
|
||||
this.observer.observe(row);
|
||||
},
|
||||
expand: function(id) {
|
||||
const row = App.byId(id);
|
||||
const row = document.getElementById(id);
|
||||
|
||||
if (row) {
|
||||
const link = row.querySelector('.expand-prompt');
|
||||
|
Loading…
x
Reference in New Issue
Block a user