4 var display_tags = false;
5 var global_unread = -1;
6 var active_title_text = "";
7 var current_subtitle = "";
8 var daemon_enabled = false;
9 var daemon_refresh_only = false;
10 //var _qfd_deleted_feed = 0;
11 var firsttime_update = true;
12 var _active_feed_id = 0;
13 var _active_feed_is_cat = false;
14 var number_of_feeds = 0;
15 var sanity_check_done = false;
16 var _hfd_scrolltop = 0;
17 var hotkey_prefix = false;
18 var hotkey_prefix_pressed = false;
19 var init_params = new Object();
22 var feeds_sort_by_unread = false;
23 var feedlist_sortable_enabled = false;
25 function activeFeedIsCat() {
26 return _active_feed_is_cat;
29 function getActiveFeedId() {
31 debug("gAFID: " + _active_feed_id);
32 return _active_feed_id;
34 exception_error("getActiveFeedId", e);
38 function setActiveFeedId(id, is_cat) {
40 debug("sAFID(" + id + ", " + is_cat + ")");
43 if (is_cat != undefined) {
44 _active_feed_is_cat = is_cat;
48 exception_error("setActiveFeedId", e);
53 function isFeedlistSortable() {
54 return feedlist_sortable_enabled;
57 function tagsAreDisplayed() {
61 function toggleTags(show_all) {
65 debug("toggleTags: " + show_all + "; " + display_tags);
67 var p = $("dispSwitchPrompt");
69 if (!show_all && !display_tags) {
70 displayDlg("printTagCloud");
71 } else if (show_all) {
74 p.innerHTML = __("display feeds");
75 notify_progress("Loading, please wait...", true);
77 } else if (display_tags) {
79 p.innerHTML = __("tag cloud");
80 notify_progress("Loading, please wait...", true);
85 exception_error("toggleTags", e);
89 function dlg_frefresh_callback(transport, deleted_feed) {
90 if (getActiveFeedId() == deleted_feed) {
91 var h = $("headlines-frame");
93 h.innerHTML = "<div class='whiteBox'>" + __('No feed selected.') + "</div>";
97 setTimeout('updateFeedList(false, false)', 50);
101 function backend_sanity_check_callback(transport) {
105 if (sanity_check_done) {
106 fatalError(11, "Sanity check request received twice. This can indicate "+
107 "presence of Firebug or some other disrupting extension. "+
108 "Please disable it and try again.");
112 if (!transport.responseXML) {
114 fatalError(3, "Sanity check: Received reply is not XML",
115 transport.responseText);
123 if (getURLParam("offline")) {
124 return init_offline();
127 var reply = transport.responseXML.firstChild.firstChild;
130 fatalError(3, "Sanity check: invalid RPC reply", transport.responseText);
134 var error_code = reply.getAttribute("error-code");
136 if (error_code && error_code != 0) {
137 return fatalError(error_code, reply.getAttribute("error-msg"));
140 debug("sanity check ok");
142 var params = reply.nextSibling;
145 debug('reading init-params...');
146 var param = params.firstChild;
149 var k = param.getAttribute("key");
150 var v = param.getAttribute("value");
151 debug(k + " => " + v);
155 db.execute("DELETE FROM init_params WHERE key = ?", [k]);
156 db.execute("INSERT INTO init_params (key,value) VALUES (?, ?)",
160 param = param.nextSibling;
164 sanity_check_done = true;
169 exception_error("backend_sanity_check_callback", e, transport);
173 function scheduleFeedUpdate(force) {
175 debug("in scheduleFeedUpdate");
177 /* if (!daemon_enabled && !daemon_refresh_only) {
178 notify_progress("Updating feeds...", true);
181 var query_str = "backend.php?op=rpc&subop=";
184 query_str = query_str + "forceUpdateAllFeeds";
186 query_str = query_str + "updateAllFeeds";
191 if (firsttime_update && !navigator.userAgent.match("Opera")) {
192 firsttime_update = false;
202 query_str = query_str + "&omode=" + omode;
203 query_str = query_str + "&uctr=" + global_unread;
205 var date = new Date();
206 var timestamp = Math.round(date.getTime() / 1000);
207 query_str = query_str + "&ts=" + timestamp
209 debug("REFETCH query: " + query_str);
211 new Ajax.Request("backend.php", {
212 parameters: query_str,
213 onComplete: function(transport) {
214 parse_counters_reply(transport, true);
218 function updateFeedList(silent, fetch) {
220 // if (silent != true) {
221 // notify("Loading feed list...");
224 debug("<b>updateFeedList</b>");
226 if (offline_mode) return render_offline_feedlist();
228 var query_str = "backend.php?op=feeds";
231 query_str = query_str + "&tags=1";
234 if (getActiveFeedId() && !activeFeedIsCat()) {
235 query_str = query_str + "&actid=" + getActiveFeedId();
238 var date = new Date();
239 var timestamp = Math.round(date.getTime() / 1000);
240 query_str = query_str + "&ts=" + timestamp
242 if (fetch) query_str = query_str + "&fetch=yes";
244 // var feeds_frame = $("feeds-frame");
245 // feeds_frame.src = query_str;
247 debug("updateFeedList Q=" + query_str);
249 new Ajax.Request("backend.php", {
250 parameters: query_str,
251 onComplete: function(transport) {
252 feedlist_callback2(transport);
257 function catchupAllFeeds() {
259 var str = __("Mark all articles as read?");
261 if (getInitParam("confirm_feed_catchup") != 1 || confirm(str)) {
263 var query_str = "backend.php?op=feeds&subop=catchupAll";
265 notify_progress("Marking all feeds as read...");
267 debug("catchupAllFeeds Q=" + query_str);
269 new Ajax.Request("backend.php", {
270 parameters: query_str,
271 onComplete: function(transport) {
272 feedlist_callback2(transport);
280 function viewCurrentFeed(subop) {
282 // if (getActiveFeedId()) {
283 if (getActiveFeedId() != undefined) {
284 viewfeed(getActiveFeedId(), subop, activeFeedIsCat());
286 disableContainerChildren("headlinesToolbar", false, document);
287 // viewfeed(-1, subop); // FIXME
289 return false; // block unneeded form submits
292 function viewfeed(feed, subop) {
293 var f = window.frames["feeds-frame"];
294 f.viewfeed(feed, subop);
298 if (getInitParam("bw_limit") == "1") return;
300 scheduleFeedUpdate(false);
302 var refresh_time = getInitParam("feeds_frame_refresh");
304 if (!refresh_time) refresh_time = 600;
306 setTimeout("timeout()", refresh_time*1000);
309 function resetSearch() {
310 var searchbox = $("searchbox")
312 if (searchbox.value != "" && getActiveFeedId()) {
313 searchbox.value = "";
314 viewfeed(getActiveFeedId(), "");
318 function searchCancel() {
324 viewCurrentFeed(0, "");
327 // if argument is undefined, current subtitle is not updated
328 // use blank string to clear subtitle
329 function updateTitle(s) {
330 var tmp = "Tiny Tiny RSS";
332 if (s != undefined) {
333 current_subtitle = s;
336 if (global_unread > 0) {
337 tmp = tmp + " (" + global_unread + ")";
340 if (current_subtitle) {
341 tmp = tmp + " - " + current_subtitle;
344 if (active_title_text.length > 0) {
345 tmp = tmp + " > " + active_title_text;
348 document.title = tmp;
351 function genericSanityCheck() {
353 // if (!Ajax.getTransport()) fatalError(1);
355 setCookie("ttrss_test", "TEST");
357 if (getCookie("ttrss_test") != "TEST") {
370 disableContainerChildren("headlinesToolbar", true);
372 Form.disable("main_toolbar_form");
374 if (!genericSanityCheck())
377 if (getURLParam('debug')) {
378 Element.show("debug_output");
379 debug('debug mode activated');
382 var params = "&ua=" + param_escape(navigator.userAgent);
384 loading_set_progress(30);
386 new Ajax.Request("backend.php", {
387 parameters: "backend.php?op=rpc&subop=sanityCheck" + params,
388 onComplete: function(transport) {
389 backend_sanity_check_callback(transport);
393 exception_error("init", e);
397 function resize_headlines(delta_x, delta_y) {
401 debug("resize_headlines: " + delta_x + ":" + delta_y);
403 var h_frame = $("headlines-frame");
404 var c_frame = $("content-frame");
405 var f_frame = $("footer");
406 var feeds_frame = $("feeds-holder");
407 var resize_grab = $("resize-grabber");
408 var resize_handle = $("resize-handle");
410 if (!c_frame || !h_frame) return;
412 if (feeds_frame && getInitParam("theme") == "old-skool") {
413 feeds_frame.style.bottom = f_frame.offsetHeight + "px";
416 if (getInitParam("theme_options").match("horiz_resize")) {
418 if (delta_x != undefined) {
419 if (c_frame.offsetLeft - delta_x > feeds_frame.offsetWidth + feeds_frame.offsetLeft + 100 && c_frame.offsetWidth + delta_x > 100) {
420 hor_offset = hor_offset + delta_x;
424 debug("resize_headlines: HOR-mode: " + hor_offset);
426 c_frame.style.width = (400 + hor_offset) + "px";
427 h_frame.style.right = c_frame.offsetWidth - 1 + "px";
429 resize_grab.style.top = (h_frame.offsetTop + h_frame.offsetHeight - 60) + "px";
430 resize_grab.style.left = (h_frame.offsetLeft + h_frame.offsetWidth -
432 resize_grab.style.display = "block";
434 resize_handle.src = "themes/"+getInitParam('theme')+"/images/resize_handle_vert.png";
435 resize_handle.style.paddingTop = (resize_grab.offsetHeight / 2 - 7) + "px";
439 if (delta_y != undefined) {
440 if (c_frame.offsetHeight + delta_y > 100 && h_frame.offsetHeight - delta_y > 100) {
441 ver_offset = ver_offset + delta_y;
445 debug("resize_headlines: VER-mode: " + ver_offset);
447 h_frame.style.height = (300 - ver_offset) + "px";
449 c_frame.style.top = (h_frame.offsetTop + h_frame.offsetHeight + 0) + "px";
450 h_frame.style.height = h_frame.offsetHeight + "px";
454 if (getInitParam("cookie_lifetime") != 0) {
455 setCookie("ttrss_offset_ver", ver_offset,
456 getInitParam("cookie_lifetime"));
457 setCookie("ttrss_offset_hor", hor_offset,
458 getInitParam("cookie_lifetime"));
460 setCookie("ttrss_offset_ver", ver_offset);
461 setCookie("ttrss_offset_hor", hor_offset);
465 exception_error("resize_headlines", e);
470 function init_second_stage() {
474 delCookie("ttrss_test");
476 // document.onresize = resize_headlines;
477 window.onresize=resize_headlines;
479 var toolbar = document.forms["main_toolbar_form"];
481 dropboxSelect(toolbar.view_mode, getInitParam("default_view_mode"));
482 dropboxSelect(toolbar.order_by, getInitParam("default_view_order_by"));
484 daemon_enabled = getInitParam("daemon_enabled") == 1;
485 daemon_refresh_only = getInitParam("daemon_refresh_only") == 1;
486 feeds_sort_by_unread = getInitParam("feeds_sort_by_unread") == 1;
488 /* var fl = cache_find_param("FEEDLIST", getInitParam("num_feeds"));
495 setTimeout('updateFeedList(false, false)', 50);
498 setTimeout('updateFeedList(false, false)', 50);
501 setTimeout('updateFeedList(false, false)', 50);
503 debug("second stage ok");
505 loading_set_progress(60);
507 ver_offset = parseInt(getCookie("ttrss_offset_ver"));
508 hor_offset = parseInt(getCookie("ttrss_offset_hor"));
510 debug("got offsets from cookies: ver " + ver_offset + " hor " + hor_offset);
514 if (isNaN(hor_offset)) hor_offset = 0;
515 if (isNaN(ver_offset)) ver_offset = 0;
517 debug("offsets from cookies [x:y]: " + hor_offset + ":" + ver_offset);
521 enable_offline_reading();
524 exception_error("init_second_stage", e);
528 function quickMenuChange() {
529 var chooser = $("quickMenuChooser");
530 var opid = chooser[chooser.selectedIndex].value;
532 chooser.selectedIndex = 0;
536 function quickMenuGo(opid) {
539 if (opid == "qmcPrefs") {
543 if (opid == "qmcSearch") {
544 displayDlg("search", getActiveFeedId() + ":" + activeFeedIsCat());
548 if (opid == "qmcAddFeed") {
549 displayDlg('quickAddFeed', '',
550 function () {$('feed_url').focus();});
554 if (opid == "qmcEditFeed") {
555 editFeedDlg(getActiveFeedId());
558 if (opid == "qmcRemoveFeed") {
559 var actid = getActiveFeedId();
561 if (activeFeedIsCat()) {
562 alert(__("You can't unsubscribe from the category."));
567 alert(__("Please select some feed first."));
571 var fn = getFeedName(actid);
573 var pr = __("Unsubscribe from %s?").replace("%s", fn);
576 unsubscribeFeed(actid);
582 if (opid == "qmcClearFeed") {
583 var actid = getActiveFeedId();
586 alert(__("Please select some feed first."));
590 if (activeFeedIsCat() || actid < 0) {
591 alert(__("You can't clear this type of feed."));
595 var fn = getFeedName(actid);
597 var pr = __("Erase all non-starred articles in %s?").replace("%s", fn);
600 clearFeedArticles(actid);
607 if (opid == "qmcUpdateFeeds") {
608 scheduleFeedUpdate(true);
612 if (opid == "qmcCatchupAll") {
617 if (opid == "qmcShowOnlyUnread") {
622 if (opid == "qmcAddFilter") {
623 displayDlg("quickAddFilter", getActiveFeedId());
626 if (opid == "qmcAddLabel") {
630 if (opid == "qmcRescoreFeed") {
631 rescoreCurrentFeed();
634 if (opid == "qmcHKhelp") {
635 //Element.show("hotkey_help_overlay");
636 Effect.Appear("hotkey_help_overlay", {duration : 0.3});
639 if (opid == "qmcResetUI") {
645 if (opid == "qmcResetCats") {
647 if (confirm(__("Reset category order?"))) {
649 var query = "?op=feeds&subop=catsortreset";
651 notify_progress("Loading, please wait...", true);
653 new Ajax.Request("backend.php", {
655 onComplete: function(transport) {
656 window.setTimeout('updateFeedList(false, false)', 50);
662 exception_error("quickMenuGo", e);
666 function unsubscribeFeed(feed_id, title) {
669 var msg = __("Unsubscribe from %s?").replace("%s", title);
671 if (title == undefined || confirm(msg)) {
672 notify_progress("Removing feed...");
674 var query = "?op=pref-feeds&quiet=1&subop=remove&ids=" + feed_id;
676 new Ajax.Request("backend.php", {
678 onComplete: function(transport) {
679 dlg_frefresh_callback(transport, feed_id);
687 function updateFeedTitle(t) {
688 active_title_text = t;
692 function toggleDispRead() {
695 var hide = !(getInitParam("hide_read_feeds") == "1");
697 hideOrShowFeeds(hide);
699 var query = "?op=rpc&subop=setpref&key=HIDE_READ_FEEDS&value=" +
702 new Ajax.Request("backend.php", {
704 onComplete: function(transport) {
705 setInitParam("hide_read_feeds", hide);
709 exception_error("toggleDispRead", e);
713 function parse_runtime_info(elem) {
715 debug("parse_runtime_info: elem is null, aborting");
719 var param = elem.firstChild;
721 debug("parse_runtime_info: " + param);
724 var k = param.getAttribute("key");
725 var v = param.getAttribute("value");
727 debug("RI: " + k + " => " + v);
729 if (k == "num_feeds") {
733 if (k == "new_version_available") {
734 var icon = $("newVersionIcon");
737 icon.style.display = "inline";
739 icon.style.display = "none";
746 if (k == "daemon_is_running" && v != 1) {
747 notify_error("<span onclick=\"javascript:explainError(1)\">Update daemon is not running.</span>", true);
751 if (k == "daemon_stamp_ok" && v != 1) {
752 notify_error("<span onclick=\"javascript:explainError(3)\">Update daemon is not updating feeds.</span>", true);
760 /* var w = $("noDaemonWarning");
763 if (k == "daemon_is_running" && v != 1) {
764 w.style.display = "block";
766 w.style.display = "none";
769 param = param.nextSibling;
773 function catchupCurrentFeed() {
775 var fn = getFeedName(getActiveFeedId(), activeFeedIsCat());
777 var str = __("Mark all articles in %s as read?").replace("%s", fn);
779 if (getInitParam("confirm_feed_catchup") != 1 || confirm(str)) {
780 return viewCurrentFeed('MarkAllRead')
784 function catchupFeedInGroup(id) {
788 var title = getFeedName(id);
790 var str = __("Mark all articles in %s as read?").replace("%s", title);
792 if (getInitParam("confirm_feed_catchup") != 1 || confirm(str)) {
793 return viewCurrentFeed('MarkAllReadGR:' + id)
797 exception_error("catchupFeedInGroup", e);
801 function editFeedDlg(feed) {
805 alert(__("Please select some feed first."));
809 if ((feed <= 0) || activeFeedIsCat() || tagsAreDisplayed()) {
810 alert(__("You can't edit this kind of feed."));
817 query = "?op=pref-feeds&subop=editfeed&id=" + param_escape(feed);
819 query = "?op=pref-labels&subop=edit&id=" + param_escape(-feed-11);
824 notify_progress("Loading, please wait...", true);
826 new Ajax.Request("backend.php", {
828 onComplete: function(transport) {
829 infobox_callback2(transport);
833 exception_error("editFeedDlg", e);
837 /* this functions duplicate those of prefs.js feed editor, with
838 some differences because there is no feedlist */
840 function feedEditCancel() {
845 function feedEditSave() {
849 // FIXME: add parameter validation
851 var query = Form.serialize("edit_feed_form");
853 notify_progress("Saving feed...");
855 new Ajax.Request("backend.php", {
857 onComplete: function(transport) {
858 dlg_frefresh_callback(transport);
867 exception_error("feedEditSave (main)", e);
871 function clearFeedArticles(feed_id) {
873 notify_progress("Clearing feed...");
875 var query = "?op=pref-feeds&quiet=1&subop=clear&id=" + feed_id;
877 new Ajax.Request("backend.php", {
879 onComplete: function(transport) {
880 dlg_frefresh_callback(transport, feed_id);
886 function collapse_feedlist() {
888 debug("collapse_feedlist");
890 var theme = getInitParam("theme");
891 if (theme != "" && theme != "compact" && theme != "graycube" &&
892 theme != "old-skool") return;
894 var fl = $("feeds-holder");
895 var fh = $("headlines-frame");
896 var fc = $("content-frame");
897 var ft = $("toolbar");
898 var ff = $("footer");
899 var fhdr = $("header");
900 var fbtn = $("collapse_feeds_btn");
902 if (!Element.visible(fl)) {
904 fbtn.innerHTML = "<<";
906 if (theme != "graycube") {
908 fh.style.left = fl.offsetWidth + "px";
909 ft.style.left = fl.offsetWidth + "px";
910 if (fc) fc.style.left = fl.offsetWidth + "px";
911 if (ff && theme != "compat") ff.style.left = (fl.offsetWidth-1) + "px";
913 if (theme == "compact") fhdr.style.left = (fl.offsetWidth + 10) + "px";
915 fh.style.left = fl.offsetWidth + 40 + "px";
916 ft.style.left = fl.offsetWidth + 40 +"px";
917 if (fc) fc.style.left = fl.offsetWidth + 40 + "px";
920 query = "?op=rpc&subop=setpref&key=_COLLAPSED_FEEDLIST&value=false";
922 new Ajax.Request("backend.php", { parameters: query });
926 fbtn.innerHTML = ">>";
928 if (theme != "graycube") {
930 fh.style.left = "0px";
931 ft.style.left = "0px";
932 if (fc) fc.style.left = "0px";
933 if (ff) ff.style.left = "0px";
935 if (theme == "compact") fhdr.style.left = "10px";
938 fh.style.left = "20px";
939 ft.style.left = "20px";
940 if (fc) fc.style.left = "20px";
944 query = "?op=rpc&subop=setpref&key=_COLLAPSED_FEEDLIST&value=true";
946 new Ajax.Request("backend.php", { parameters: query });
950 exception_error("collapse_feedlist", e);
954 function viewModeChanged() {
956 return viewCurrentFeed(0, '')
959 function viewLimitChanged() {
961 return viewCurrentFeed(0, '')
964 /* function adjustArticleScore(id, score) {
967 var pr = prompt(__("Assign score to article:"), score);
969 if (pr != undefined) {
970 var query = "?op=rpc&subop=setScore&id=" + id + "&score=" + pr;
972 new Ajax.Request("backend.php", {
974 onComplete: function(transport) {
980 exception_error("adjustArticleScore", e);
984 function rescoreCurrentFeed() {
986 var actid = getActiveFeedId();
988 if (activeFeedIsCat() || actid < 0 || tagsAreDisplayed()) {
989 alert(__("You can't rescore this kind of feed."));
994 alert(__("Please select some feed first."));
998 var fn = getFeedName(actid);
999 var pr = __("Rescore articles in %s?").replace("%s", fn);
1002 notify_progress("Rescoring articles...");
1004 var query = "?op=pref-feeds&subop=rescore&quiet=1&ids=" + actid;
1006 new Ajax.Request("backend.php", {
1008 onComplete: function(transport) {
1014 function hotkey_handler(e) {
1019 var shift_key = false;
1021 var cmdline = $('cmdline');
1022 var feedlist = $('feedList');
1025 shift_key = e.shiftKey;
1031 keycode = window.event.keyCode;
1036 var keychar = String.fromCharCode(keycode);
1038 if (keycode == 27) { // escape
1039 if (Element.visible("hotkey_help_overlay")) {
1040 Element.hide("hotkey_help_overlay");
1042 hotkey_prefix = false;
1046 if (!hotkeys_enabled) {
1047 debug("hotkeys disabled");
1051 if (keycode == 16) return; // ignore lone shift
1053 if ((keycode == 70 || keycode == 67 || keycode == 71)
1054 && !hotkey_prefix) {
1056 var date = new Date();
1057 var ts = Math.round(date.getTime() / 1000);
1059 hotkey_prefix = keycode;
1060 hotkey_prefix_pressed = ts;
1062 cmdline.innerHTML = keychar;
1063 Element.show(cmdline);
1065 debug("KP: PREFIX=" + keycode + " CHAR=" + keychar + " TS=" + ts);
1069 if (Element.visible("hotkey_help_overlay")) {
1070 Element.hide("hotkey_help_overlay");
1073 /* Global hotkeys */
1075 Element.hide(cmdline);
1077 if (!hotkey_prefix) {
1079 if (keycode == 68 && shift_key) { // d
1080 if (!Element.visible("debug_output")) {
1081 Element.show("debug_output");
1082 debug('debug mode activated');
1084 Element.hide("debug_output");
1090 if ((keycode == 191 || keychar == '?') && shift_key) { // ?
1091 if (!Element.visible("hotkey_help_overlay")) {
1092 //Element.show("hotkey_help_overlay");
1093 Effect.Appear("hotkey_help_overlay", {duration : 0.3});
1095 Element.hide("hotkey_help_overlay");
1100 if (keycode == 191 || keychar == '/') { // /
1101 displayDlg("search", getActiveFeedId() + ":" + activeFeedIsCat());
1105 if (keycode == 82 && shift_key) { // R
1106 scheduleFeedUpdate(true);
1110 if (keycode == 74) { // j
1111 var feed = getActiveFeedId();
1112 var new_feed = getRelativeFeedId2(feed, activeFeedIsCat(), 'prev');
1113 // alert(feed + " IC: " + activeFeedIsCat() + " => " + new_feed);
1115 var is_cat = new_feed.match("CAT:");
1117 new_feed = new_feed.replace("CAT:", "");
1118 viewCategory(new_feed);
1120 viewfeed(new_feed, '', false);
1126 if (keycode == 75) { // k
1127 var feed = getActiveFeedId();
1128 var new_feed = getRelativeFeedId2(feed, activeFeedIsCat(), 'next');
1129 // alert(feed + " IC: " + activeFeedIsCat() + " => " + new_feed);
1131 var is_cat = new_feed.match("CAT:");
1132 if (is_cat == "CAT:") {
1133 new_feed = new_feed.replace("CAT:", "");
1134 viewCategory(new_feed);
1136 viewfeed(new_feed, '', false);
1142 if (shift_key && keycode == 40) { // shift-down
1143 catchupRelativeToArticle(1);
1147 if (shift_key && keycode == 38) { // shift-up
1148 catchupRelativeToArticle(0);
1152 if (shift_key && keycode == 78) { // N
1157 if (shift_key && keycode == 80) { // P
1163 if (keycode == 78 || keycode == 40) { // n, down
1164 if (typeof moveToPost != 'undefined') {
1170 if (keycode == 80 || keycode == 38) { // p, up
1171 if (typeof moveToPost != 'undefined') {
1177 if (keycode == 83 && shift_key) { // S
1178 var id = getActiveArticleId();
1185 if (keycode == 83) { // s
1186 var id = getActiveArticleId();
1194 if (keycode == 85) { // u
1195 var id = getActiveArticleId();
1202 if (keycode == 84 && shift_key) { // T
1203 var id = getActiveArticleId();
1205 editArticleTags(id, getActiveFeedId(), isCdmMode());
1210 if (keycode == 9) { // tab
1211 var id = getArticleUnderPointer();
1213 var cb = $("RCHK-" + id);
1216 cb.checked = !cb.checked;
1217 toggleSelectRowById(cb, "RROW-" + id);
1223 if (keycode == 79) { // o
1224 if (getActiveArticleId()) {
1225 openArticleInNewWindow(getActiveArticleId());
1230 if (keycode == 81 && shift_key) { // Q
1231 if (typeof catchupAllFeeds != 'undefined') {
1237 if (keycode == 88) { // x
1238 if (activeFeedIsCat()) {
1239 toggleCollapseCat(getActiveFeedId());
1246 if (hotkey_prefix == 70) { // f
1248 hotkey_prefix = false;
1250 if (keycode == 81) { // q
1251 if (getActiveFeedId()) {
1252 catchupCurrentFeed();
1257 if (keycode == 82) { // r
1258 if (getActiveFeedId()) {
1259 viewfeed(getActiveFeedId(), "ForceUpdate", activeFeedIsCat());
1264 if (keycode == 65) { // a
1269 if (keycode == 85 && shift_key) { // U
1270 scheduleFeedUpdate(true);
1274 if (keycode == 85) { // u
1275 if (getActiveFeedId()) {
1276 viewfeed(getActiveFeedId(), "ForceUpdate");
1281 if (keycode == 69) { // e
1282 editFeedDlg(getActiveFeedId());
1286 if (keycode == 83) { // s
1287 displayDlg("quickAddFeed");
1291 if (keycode == 67 && shift_key) { // C
1292 if (typeof catchupAllFeeds != 'undefined') {
1298 if (keycode == 67) { // c
1299 if (getActiveFeedId()) {
1300 catchupCurrentFeed();
1305 if (keycode == 87) { // w
1306 feeds_sort_by_unread = !feeds_sort_by_unread;
1307 return resort_feedlist();
1310 if (keycode == 72) { // h
1311 hideReadHeadlines();
1319 if (hotkey_prefix == 67) { // c
1320 hotkey_prefix = false;
1322 if (keycode == 70) { // f
1323 displayDlg("quickAddFilter", getActiveFeedId());
1327 if (keycode == 76) { // l
1332 if (keycode == 83) { // s
1333 if (typeof collapse_feedlist != 'undefined') {
1334 collapse_feedlist();
1339 if (keycode == 77) { // m
1340 feedlist_sortable_enabled = !feedlist_sortable_enabled;
1341 if (feedlist_sortable_enabled) {
1342 notify_info("Category reordering enabled");
1343 toggle_sortable_feedlist(true);
1345 notify_info("Category reordering disabled");
1346 toggle_sortable_feedlist(false);
1350 if (keycode == 78) { // n
1351 catchupRelativeToArticle(1);
1355 if (keycode == 80) { // p
1356 catchupRelativeToArticle(0);
1365 if (hotkey_prefix == 71) { // g
1367 hotkey_prefix = false;
1370 if (keycode == 65) { // a
1375 if (keycode == 83) { // s
1380 if (keycode == 80 && shift_key) { // P
1385 if (keycode == 80) { // p
1390 if (keycode == 70) { // f
1395 if (keycode == 84 && shift_key) { // T
1403 if (hotkey_prefix == 224 || hotkey_prefix == 91) { // f
1404 hotkey_prefix = false;
1408 if (hotkey_prefix) {
1409 debug("KP: PREFIX=" + hotkey_prefix + " CODE=" + keycode + " CHAR=" + keychar);
1411 debug("KP: CODE=" + keycode + " CHAR=" + keychar);
1416 exception_error("hotkey_handler", e);
1420 function feedsSortByUnread() {
1421 return feeds_sort_by_unread;
1424 function addLabel() {
1428 var caption = prompt(__("Please enter label caption:"), "");
1430 if (caption != undefined) {
1432 if (caption == "") {
1433 alert(__("Can't create label: missing caption."));
1437 var query = "?op=pref-labels&subop=add&caption=" +
1438 param_escape(caption);
1440 notify_progress("Loading, please wait...", true);
1442 new Ajax.Request("backend.php", {
1444 onComplete: function(transport) {
1451 exception_error("addLabel", e);
1455 function visitOfficialSite() {
1456 window.open("http://tt-rss.org/");
1459 function inPreferences() {