]> git.wh0rd.org Git - tt-rss.git/commitdiff
add hotkey (f x) to reverse headlines order (closes #262)
authorAndrew Dolgov <fox@bah.org.ru>
Thu, 18 Feb 2010 13:05:35 +0000 (16:05 +0300)
committerAndrew Dolgov <fox@bah.org.ru>
Thu, 18 Feb 2010 13:05:35 +0000 (16:05 +0300)
help/3.php
modules/backend-rpc.php
tt-rss.js

index 64ea490d8a6977be10394f1518d9cbbfb7c4d784..52aabc88fec1844b21d946b3f0442ed92f179097 100644 (file)
@@ -47,6 +47,7 @@
                <tr><td class='n'>f w</td><td><?php echo __("Sort by name or unread count") ?></td></tr>
                <tr><td class='n'>f h</td><td><?php echo __("Hide visible read articles") ?></td></tr>
                <tr><td class='n'>f q</td><td><?php echo __("Mark feed as read") ?></td></tr>
+               <tr><td class='n'>f x</td><td><?php echo __("Reverse headlines order") ?></td></tr>
                <tr><td class='n'>Q</td><td><?php echo __("Mark all feeds as read") ?></td></tr>
                <tr><td class='n'>x</td><td><?php echo __("If viewing category, (un)collapse it") ?></td></tr>
        </table>
index d95685a72eb55c0bdeb821b9ca670932338ce187..6f70f07a5c59716f848598998ff05edf89c94935 100644 (file)
 
                }
 
-               if ($subop == "setpref") {
-                       if (WEB_DEMO_MODE) {
-                               return;
-                       }
+               if ($subop == "togglepref") {
+                       print "<rpc-reply>";
+
+                       $key = db_escape_string($_REQUEST["key"]);
+
+                       set_pref($link, $key, !get_pref($link, $key));
+
+                       $value = get_pref($link, $key);
 
+                       print "<param-set key=\"$key\" value=\"$value\"/>";
+
+                       print "</rpc-reply>";
+
+                       return;
+               }
+
+               if ($subop == "setpref") {
                        print "<rpc-reply>";
 
                        $key = db_escape_string($_REQUEST["key"]);
index 81a40f21130e825f638206cd27232d96bbb699aa..4b463cf3b213b1ab35cca54814d0397b43e7b591 100644 (file)
--- 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);
+       }
+}