Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add hotkey (f x) to reverse headlines order (closes #262)

  • Loading branch information...
commit 8a3e0b1aa6b60043ab1206458df6413bba2d9e89 1 parent fdf47b9
Andrew Dolgov authored
Showing with 37 additions and 4 deletions.
  1. +1 −0  help/3.php
  2. +16 −4 modules/backend-rpc.php
  3. +20 −0 tt-rss.js
View
1  help/3.php
@@ -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>
View
20 modules/backend-rpc.php
@@ -123,11 +123,23 @@ function handle_rpc_request($link) {
}
- 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"]);
View
20 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);
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.