mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 13:45:56 +00:00
further effocts to wrap JS stuff into objects
This commit is contained in:
@@ -207,8 +207,8 @@ const Feeds = {
|
||||
Utils.setLoadingProgress(50);
|
||||
|
||||
document.onkeydown = App.hotkeyHandler;
|
||||
setInterval(hotkeyPrefixTimeout, 3 * 1000);
|
||||
setInterval(catchupBatchedArticles, 10 * 1000);
|
||||
window.setInterval(() => { hotkeyPrefixTimeout() }, 3 * 1000);
|
||||
window.setInterval(() => { Headlines.catchupBatchedArticles() }, 10 * 1000);
|
||||
|
||||
if (!this.getActiveFeedId()) {
|
||||
this.viewfeed({feed: -3});
|
||||
@@ -246,10 +246,7 @@ const Feeds = {
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
this.requestCounters(true);
|
||||
|
||||
setInterval(() => {
|
||||
this.requestCounters();
|
||||
}, 60 * 1000)
|
||||
setInterval(() => { this.requestCounters(); }, 60 * 1000)
|
||||
}, 250);
|
||||
}
|
||||
},
|
||||
@@ -271,7 +268,7 @@ const Feeds = {
|
||||
|
||||
this.selectFeed(id, is_cat);
|
||||
|
||||
PluginHost.run(PluginHost.HOOK_FEED_SET_ACTIVE, _active_article_id);
|
||||
PluginHost.run(PluginHost.HOOK_FEED_SET_ACTIVE, [this._active_feed_id, this._active_feed_is_cat]);
|
||||
},
|
||||
selectFeed: function(feed, is_cat) {
|
||||
const tree = dijit.byId("feedTree");
|
||||
@@ -303,7 +300,7 @@ const Feeds = {
|
||||
|
||||
if (feed != this.getActiveFeedId() || this.activeFeedIsCat() != is_cat) {
|
||||
this._search_query = false;
|
||||
setActiveArticleId(0);
|
||||
Article.setActiveArticleId(0);
|
||||
}
|
||||
|
||||
if (offset != 0) {
|
||||
@@ -330,8 +327,8 @@ const Feeds = {
|
||||
if (method) query.m = method;
|
||||
|
||||
if (offset > 0) {
|
||||
if (current_first_id) {
|
||||
query.fid = current_first_id;
|
||||
if (Headlines.current_first_id) {
|
||||
query.fid = Headlines.current_first_id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,8 +340,8 @@ const Feeds = {
|
||||
query.skip = offset;
|
||||
|
||||
// to prevent duplicate feed titles when showing grouped vfeeds
|
||||
if (vgroup_last_feed) {
|
||||
query.vgrlf = vgroup_last_feed;
|
||||
if (Headlines.vgroup_last_feed != undefined) {
|
||||
query.vgrlf = Headlines.vgroup_last_feed;
|
||||
}
|
||||
} else if (!is_cat && feed == this.getActiveFeedId() && !params.method) {
|
||||
query.m = "ForceUpdate";
|
||||
@@ -370,7 +367,7 @@ const Feeds = {
|
||||
|
||||
window.clearTimeout(this._viewfeed_wait_timeout);
|
||||
this._viewfeed_wait_timeout = window.setTimeout(() => {
|
||||
catchupBatchedArticles(() => {
|
||||
Headlines.catchupBatchedArticles(() => {
|
||||
xhrPost("backend.php", query, (transport) => {
|
||||
try {
|
||||
this.setFeedExpandoIcon(feed, is_cat, 'images/blank_icon.gif');
|
||||
@@ -492,7 +489,7 @@ const Feeds = {
|
||||
rows.each(function (row) {
|
||||
row.removeClassName("Unread");
|
||||
|
||||
if (row.getAttribute("data-article-id") != getActiveArticleId()) {
|
||||
if (row.getAttribute("data-article-id") != Article.getActiveArticleId()) {
|
||||
new Effect.Fade(row, {duration: 0.5});
|
||||
}
|
||||
|
||||
|
||||
@@ -878,7 +878,7 @@ function toggleSelectRow2(sender, row, is_cdm) {
|
||||
row.removeClassName('Selected');
|
||||
|
||||
if (typeof updateSelectedPrompt != undefined)
|
||||
updateSelectedPrompt();
|
||||
Headlines.updateSelectedPrompt();
|
||||
}
|
||||
|
||||
|
||||
@@ -892,7 +892,7 @@ function toggleSelectRow(sender, row) {
|
||||
row.removeClassName('Selected');
|
||||
|
||||
if (typeof updateSelectedPrompt != undefined)
|
||||
updateSelectedPrompt();
|
||||
Headlines.updateSelectedPrompt();
|
||||
}
|
||||
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
@@ -1412,7 +1412,7 @@ function quickAddFilter() {
|
||||
|
||||
} else {
|
||||
|
||||
const query = { op: "rpc", method: "getlinktitlebyid", id: getActiveArticleId() };
|
||||
const query = { op: "rpc", method: "getlinktitlebyid", id: Article.getActiveArticleId() };
|
||||
|
||||
xhrPost("backend.php", query, (transport) => {
|
||||
const reply = JSON.parse(transport.responseText);
|
||||
|
||||
@@ -86,7 +86,7 @@ const App = {
|
||||
}, 100);
|
||||
}
|
||||
|
||||
setInterval(hotkeyPrefixTimeout, 5 * 1000);
|
||||
setInterval(() => { hotkeyPrefixTimeout() }, 5 * 1000);
|
||||
},
|
||||
hotkeyHandler: function (event) {
|
||||
if (event.target.nodeName == "INPUT" || event.target.nodeName == "TEXTAREA") return;
|
||||
|
||||
46
js/tt-rss.js
46
js/tt-rss.js
@@ -143,7 +143,7 @@ const App = {
|
||||
|
||||
if (getInitParam("simple_update")) {
|
||||
console.log("scheduling simple feed updater...");
|
||||
window.setInterval(Feeds.updateRandomFeed, 30 * 1000);
|
||||
window.setInterval(() => { Feeds.updateRandomFeed() }, 30 * 1000);
|
||||
}
|
||||
|
||||
console.log("second stage ok");
|
||||
@@ -191,7 +191,7 @@ const App = {
|
||||
switchPanelMode: function(wide) {
|
||||
if (App.isCombinedMode()) return;
|
||||
|
||||
const article_id = getActiveArticleId();
|
||||
const article_id = Article.getActiveArticleId();
|
||||
|
||||
if (wide) {
|
||||
dijit.byId("headlines-wrap-inner").attr("design", 'sidebar');
|
||||
@@ -249,44 +249,44 @@ function init_hotkey_actions() {
|
||||
if (rv) Feeds.viewfeed({feed: rv[0], is_cat: rv[1], delayed: true})
|
||||
};
|
||||
hotkey_actions["next_article"] = function () {
|
||||
moveToPost('next');
|
||||
Headlines.moveToPost('next');
|
||||
};
|
||||
hotkey_actions["prev_article"] = function () {
|
||||
moveToPost('prev');
|
||||
Headlines.moveToPost('prev');
|
||||
};
|
||||
hotkey_actions["next_article_noscroll"] = function () {
|
||||
moveToPost('next', true);
|
||||
Headlines.moveToPost('next', true);
|
||||
};
|
||||
hotkey_actions["prev_article_noscroll"] = function () {
|
||||
moveToPost('prev', true);
|
||||
Headlines.moveToPost('prev', true);
|
||||
};
|
||||
hotkey_actions["next_article_noexpand"] = function () {
|
||||
moveToPost('next', true, true);
|
||||
Headlines.moveToPost('next', true, true);
|
||||
};
|
||||
hotkey_actions["prev_article_noexpand"] = function () {
|
||||
moveToPost('prev', true, true);
|
||||
Headlines.moveToPost('prev', true, true);
|
||||
};
|
||||
hotkey_actions["search_dialog"] = function () {
|
||||
Feeds.search();
|
||||
};
|
||||
hotkey_actions["toggle_mark"] = function () {
|
||||
selectionToggleMarked();
|
||||
Headlines.selectionToggleMarked();
|
||||
};
|
||||
hotkey_actions["toggle_publ"] = function () {
|
||||
selectionTogglePublished();
|
||||
Headlines.selectionTogglePublished();
|
||||
};
|
||||
hotkey_actions["toggle_unread"] = function () {
|
||||
selectionToggleUnread({no_error: 1});
|
||||
Headlines.selectionToggleUnread({no_error: 1});
|
||||
};
|
||||
hotkey_actions["edit_tags"] = function () {
|
||||
const id = getActiveArticleId();
|
||||
const id = Article.getActiveArticleId();
|
||||
if (id) {
|
||||
editArticleTags(id);
|
||||
Article.editArticleTags(id);
|
||||
}
|
||||
}
|
||||
hotkey_actions["open_in_new_window"] = function () {
|
||||
if (getActiveArticleId()) {
|
||||
Article.openArticleInNewWindow(getActiveArticleId());
|
||||
if (Article.getActiveArticleId()) {
|
||||
Article.openArticleInNewWindow(Article.getActiveArticleId());
|
||||
}
|
||||
};
|
||||
hotkey_actions["catchup_below"] = function () {
|
||||
@@ -318,22 +318,22 @@ function init_hotkey_actions() {
|
||||
}
|
||||
};
|
||||
hotkey_actions["select_all"] = function () {
|
||||
selectArticles('all');
|
||||
Headlines.selectArticles('all');
|
||||
};
|
||||
hotkey_actions["select_unread"] = function () {
|
||||
selectArticles('unread');
|
||||
Headlines.selectArticles('unread');
|
||||
};
|
||||
hotkey_actions["select_marked"] = function () {
|
||||
selectArticles('marked');
|
||||
Headlines.selectArticles('marked');
|
||||
};
|
||||
hotkey_actions["select_published"] = function () {
|
||||
selectArticles('published');
|
||||
Headlines.selectArticles('published');
|
||||
};
|
||||
hotkey_actions["select_invert"] = function () {
|
||||
selectArticles('invert');
|
||||
Headlines.selectArticles('invert');
|
||||
};
|
||||
hotkey_actions["select_none"] = function () {
|
||||
selectArticles('none');
|
||||
Headlines.selectArticles('none');
|
||||
};
|
||||
hotkey_actions["feed_refresh"] = function () {
|
||||
if (Feeds.getActiveFeedId() != undefined) {
|
||||
@@ -434,8 +434,8 @@ function init_hotkey_actions() {
|
||||
};
|
||||
hotkey_actions["toggle_embed_original"] = function () {
|
||||
if (typeof embedOriginalArticle != "undefined") {
|
||||
if (getActiveArticleId())
|
||||
embedOriginalArticle(getActiveArticleId());
|
||||
if (Article.getActiveArticleId())
|
||||
embedOriginalArticle(Article.getActiveArticleId());
|
||||
} else {
|
||||
alert(__("Please enable embed_original plugin first."));
|
||||
}
|
||||
|
||||
1223
js/viewfeed.js
1223
js/viewfeed.js
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user