From: Andrew Dolgov Date: Thu, 18 Feb 2010 13:05:35 +0000 (+0300) Subject: add hotkey (f x) to reverse headlines order (closes #262) X-Git-Tag: 1.4.1~4 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=8a3e0b1aa6b60043ab1206458df6413bba2d9e89;p=tt-rss.git add hotkey (f x) to reverse headlines order (closes #262) --- diff --git a/help/3.php b/help/3.php index 64ea490d..52aabc88 100644 --- a/help/3.php +++ b/help/3.php @@ -47,6 +47,7 @@ f w f h f q + f x Q x diff --git a/modules/backend-rpc.php b/modules/backend-rpc.php index d95685a7..6f70f07a 100644 --- a/modules/backend-rpc.php +++ b/modules/backend-rpc.php @@ -123,11 +123,23 @@ } - if ($subop == "setpref") { - if (WEB_DEMO_MODE) { - return; - } + if ($subop == "togglepref") { + print ""; + + $key = db_escape_string($_REQUEST["key"]); + + set_pref($link, $key, !get_pref($link, $key)); + + $value = get_pref($link, $key); + print ""; + + print ""; + + return; + } + + if ($subop == "setpref") { print ""; $key = db_escape_string($_REQUEST["key"]); diff --git a/tt-rss.js b/tt-rss.js index 81a40f21..4b463cf3 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -1251,6 +1251,10 @@ function hotkey_handler(e) { return; } + if (keycode == 88) { // x + reverseHeadlineOrder(); + return; + } } /* Prefix c */ @@ -1364,3 +1368,19 @@ function feedsSortByUnread() { function inPreferences() { return false; } + +function reverseHeadlineOrder() { + try { + + var query_str = "?op=rpc&subop=togglepref&key=REVERSE_HEADLINES"; + + new Ajax.Request("backend.php", { + parameters: query_str, + onComplete: function(transport) { + viewCurrentFeed(); + } }); + + } catch (e) { + exception_error("reverseHeadlineOrder", e); + } +}