- new Ajax.Request("backend.php", {
- parameters: {op: "rpc", method: "sanityCheck", hasAudio: hasAudio,
- hasMp3: hasMp3,
- clientTzOffset: clientTzOffset,
- hasSandbox: hasSandbox},
- onComplete: function(transport) {
- backend_sanity_check_callback(transport);
- } });
-
- hotkey_actions["next_feed"] = function() {
- var rv = dijit.byId("feedTree").getNextFeed(
- getActiveFeedId(), activeFeedIsCat());
-
- if (rv) viewfeed(rv[0], '', rv[1], null, null, null, true);
- };
- hotkey_actions["prev_feed"] = function() {
- var rv = dijit.byId("feedTree").getPreviousFeed(
- getActiveFeedId(), activeFeedIsCat());
-
- if (rv) viewfeed(rv[0], '', rv[1], null, null, null, true);
- };
- hotkey_actions["next_article"] = function() {
- moveToPost('next');
- };
- hotkey_actions["prev_article"] = function() {
- moveToPost('prev');
- };
- hotkey_actions["next_article_noscroll"] = function() {
- moveToPost('next', true);
- };
- hotkey_actions["prev_article_noscroll"] = function() {
- moveToPost('prev', true);
- };
- hotkey_actions["next_article_noexpand"] = function() {
- moveToPost('next', true, true);
- };
- hotkey_actions["prev_article_noexpand"] = function() {
- moveToPost('prev', true, true);
- };
- hotkey_actions["collapse_article"] = function() {
- var id = getActiveArticleId();
- var elem = $("CICD-"+id);
- if(elem.visible()) {
- cdmCollapseArticle(null, id);
- }
- else {
- cdmExpandArticle(id);
- }
- };
- hotkey_actions["toggle_expand"] = function() {
- var id = getActiveArticleId();
- var elem = $("CICD-"+id);
- if(elem.visible()) {
- cdmCollapseArticle(null, id, false);
- }
- else {
- cdmExpandArticle(id);
+
+ });
+}
+
+function init_hotkey_actions() {
+ hotkey_actions["next_feed"] = function() {
+ const rv = dijit.byId("feedTree").getNextFeed(
+ getActiveFeedId(), activeFeedIsCat());
+
+ if (rv) viewfeed({feed: rv[0], is_cat: rv[1], can_wait: true})
+ };
+ hotkey_actions["prev_feed"] = function() {
+ const rv = dijit.byId("feedTree").getPreviousFeed(
+ getActiveFeedId(), activeFeedIsCat());
+
+ if (rv) viewfeed({feed: rv[0], is_cat: rv[1], can_wait: true})
+ };
+ hotkey_actions["next_article"] = function() {
+ moveToPost('next');
+ };
+ hotkey_actions["prev_article"] = function() {
+ moveToPost('prev');
+ };
+ hotkey_actions["next_article_noscroll"] = function() {
+ moveToPost('next', true);
+ };
+ hotkey_actions["prev_article_noscroll"] = function() {
+ moveToPost('prev', true);
+ };
+ hotkey_actions["next_article_noexpand"] = function() {
+ moveToPost('next', true, true);
+ };
+ hotkey_actions["prev_article_noexpand"] = function() {
+ moveToPost('prev', true, true);
+ };
+ hotkey_actions["search_dialog"] = function() {
+ search();
+ };
+ hotkey_actions["toggle_mark"] = function() {
+ selectionToggleMarked(undefined, false, true);
+ };
+ hotkey_actions["toggle_publ"] = function() {
+ selectionTogglePublished(undefined, false, true);
+ };
+ hotkey_actions["toggle_unread"] = function() {
+ selectionToggleUnread(undefined, false, true);
+ };
+ hotkey_actions["edit_tags"] = function() {
+ const id = getActiveArticleId();
+ if (id) {
+ editArticleTags(id);
+ }
+ }
+ hotkey_actions["open_in_new_window"] = function() {
+ if (getActiveArticleId()) {
+ openArticleInNewWindow(getActiveArticleId());
+ }
+ };
+ hotkey_actions["catchup_below"] = function() {
+ catchupRelativeToArticle(1);
+ };
+ hotkey_actions["catchup_above"] = function() {
+ catchupRelativeToArticle(0);
+ };
+ hotkey_actions["article_scroll_down"] = function() {
+ scrollArticle(40);
+ };
+ hotkey_actions["article_scroll_up"] = function() {
+ scrollArticle(-40);
+ };
+ hotkey_actions["close_article"] = function() {
+ if (isCdmMode()) {
+ cdmCollapseActive();
+ } else {
+ closeArticlePanel();
+ }
+ };
+ hotkey_actions["email_article"] = function() {
+ if (typeof emailArticle != "undefined") {
+ emailArticle();
+ } else if (typeof mailtoArticle != "undefined") {
+ mailtoArticle();
+ } else {
+ alert(__("Please enable mail plugin first."));
+ }
+ };
+ hotkey_actions["select_all"] = function() {
+ selectArticles('all');
+ };
+ hotkey_actions["select_unread"] = function() {
+ selectArticles('unread');
+ };
+ hotkey_actions["select_marked"] = function() {
+ selectArticles('marked');
+ };
+ hotkey_actions["select_published"] = function() {
+ selectArticles('published');
+ };
+ hotkey_actions["select_invert"] = function() {
+ selectArticles('invert');
+ };
+ hotkey_actions["select_none"] = function() {
+ selectArticles('none');
+ };
+ hotkey_actions["feed_refresh"] = function() {
+ if (getActiveFeedId() != undefined) {
+ viewfeed({feed: getActiveFeedId(), is_cat: activeFeedIsCat()});
+ return;
+ }
+ };
+ hotkey_actions["feed_unhide_read"] = function() {
+ toggleDispRead();
+ };
+ hotkey_actions["feed_subscribe"] = function() {
+ quickAddFeed();
+ };
+ hotkey_actions["feed_debug_update"] = function() {
+ if (!activeFeedIsCat() && parseInt(getActiveFeedId()) > 0) {
+ window.open("backend.php?op=feeds&method=update_debugger&feed_id=" + getActiveFeedId() +
+ "&csrf_token=" + getInitParam("csrf_token"));
+ } else {
+ alert("You can't debug this kind of feed.");
+ }
+ };
+
+ hotkey_actions["feed_debug_viewfeed"] = function() {
+ viewfeed({feed: getActiveFeedId(), is_cat: activeFeedIsCat(), viewfeed_debug: true});
+ };
+
+ hotkey_actions["feed_edit"] = function() {
+ if (activeFeedIsCat())
+ alert(__("You can't edit this kind of feed."));
+ else
+ editFeed(getActiveFeedId());
+ };
+ hotkey_actions["feed_catchup"] = function() {
+ if (getActiveFeedId() != undefined) {
+ catchupCurrentFeed();
+ return;
+ }
+ };
+ hotkey_actions["feed_reverse"] = function() {
+ reverseHeadlineOrder();
+ };
+ hotkey_actions["feed_toggle_vgroup"] = function() {
+ xhrPost("backend.php", {op: "rpc", method: "togglepref", key: "VFEED_GROUP_BY_FEED"}, () => {
+ viewCurrentFeed();
+ })
+ };
+ hotkey_actions["catchup_all"] = function() {
+ catchupAllFeeds();
+ };
+ hotkey_actions["cat_toggle_collapse"] = function() {
+ if (activeFeedIsCat()) {
+ dijit.byId("feedTree").collapseCat(getActiveFeedId());
+ return;
+ }
+ };
+ hotkey_actions["goto_all"] = function() {
+ viewfeed({feed: -4});
+ };
+ hotkey_actions["goto_fresh"] = function() {
+ viewfeed({feed: -3});
+ };
+ hotkey_actions["goto_marked"] = function() {
+ viewfeed({feed: -1});
+ };
+ hotkey_actions["goto_published"] = function() {
+ viewfeed({feed: -2});
+ };
+ hotkey_actions["goto_tagcloud"] = function() {
+ displayDlg(__("Tag cloud"), "printTagCloud");
+ };
+ hotkey_actions["goto_prefs"] = function() {
+ gotoPreferences();
+ };
+ hotkey_actions["select_article_cursor"] = function() {
+ const id = getArticleUnderPointer();
+ if (id) {
+ const row = $("RROW-" + id);
+
+ if (row) {
+ const cb = dijit.getEnclosingWidget(
+ row.select(".rchk")[0]);
+
+ if (cb) {
+ if (!row.hasClassName("active"))
+ cb.attr("checked", !cb.attr("checked"));
+
+ toggleSelectRowById(cb, "RROW-" + id);
+ return false;