]> git.wh0rd.org Git - tt-rss.git/commitdiff
tweak hotkey map notation to allow stuff like shift-arrows
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 18 Mar 2013 16:59:48 +0000 (20:59 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 18 Mar 2013 16:59:48 +0000 (20:59 +0400)
classes/backend.php
include/functions.php
js/tt-rss.js
plugins/googlereaderkeys/init.php

index 5473c5c796aa0a726a84ca072d35582463e9bd46..7848b071435037ad436782bdeb616b14caccc155 100644 (file)
@@ -45,6 +45,28 @@ class Backend extends Handler {
                                                        $sequence = substr($sequence,
                                                                strpos($sequence, "|")+1,
                                                                strlen($sequence));
+                                               } else {
+                                                       $keys = explode(" ", $sequence);
+
+                                                       for ($i = 0; $i < count($keys); $i++) {
+                                                               if (strlen($keys[$i]) > 1) {
+                                                                       $tmp = '';
+                                                                       foreach (str_split($keys[$i]) as $c) {
+                                                                               switch ($c) {
+                                                                               case '*':
+                                                                                       $tmp .= __('Shift') . '+';
+                                                                                       break;
+                                                                               case '^':
+                                                                                       $tmp .= __('Ctrl') . '+';
+                                                                                       break;
+                                                                               default:
+                                                                                       $tmp .= $c;
+                                                                               }
+                                                                       }
+                                                                       $keys[$i] = $tmp;
+                                                               }
+                                                       }
+                                                       $sequence = join(" ", $keys);
                                                }
 
                                                print "<li>";
index 8c2ced801d6469b6caaaf538cb9aa3eb9c0612e1..2120a96b92bba3c6142ff0dcd6fd0cfa4c4d7a1a 100644 (file)
                                "(191)|/" => "search_dialog",
 //                     "article" => array(
                                "s" => "toggle_mark",
-                               "S" => "toggle_publ",
+                               "*s" => "toggle_publ",
                                "u" => "toggle_unread",
-                               "T" => "edit_tags",
-                               "D" => "dismiss_selected",
-                               "X" => "dismiss_read",
+                               "*t" => "edit_tags",
+                               "*d" => "dismiss_selected",
+                               "*x" => "dismiss_read",
                                "o" => "open_in_new_window",
                                "c p" => "catchup_below",
                                "c n" => "catchup_above",
-                               "N" => "article_scroll_down",
-                               "P" => "article_scroll_up",
-                               "a W" => "toggle_widescreen",
+                               "*n" => "article_scroll_down",
+                               "*p" => "article_scroll_up",
+                               "a *w" => "toggle_widescreen",
                                "e" => "email_article",
                                "a q" => "close_article",
 //                     "article_selection" => array(
                                "a a" => "select_all",
                                "a u" => "select_unread",
-                               "a U" => "select_marked",
+                               "a *u" => "select_marked",
                                "a p" => "select_published",
                                "a i" => "select_invert",
                                "a n" => "select_none",
                                "f e" => "feed_edit",
                                "f q" => "feed_catchup",
                                "f x" => "feed_reverse",
-                               "f D" => "feed_debug_update",
-                               "f C" => "toggle_combined_mode",
-                               "Q" => "catchup_all",
+                               "f *d" => "feed_debug_update",
+                               "f *c" => "toggle_combined_mode",
+                               "*q" => "catchup_all",
                                "x" => "cat_toggle_collapse",
 //                     "goto" => array(
                                "g a" => "goto_all",
                                "g s" => "goto_marked",
                                "g p" => "goto_published",
                                "g t" => "goto_tagcloud",
-                               "g P" => "goto_prefs",
+                               "g *p" => "goto_prefs",
 //                     "other" => array(
                                "(9)|Tab" => "select_article_cursor", // tab
                                "c l" => "create_label",
index badfe8707440a1d423017f1bb1d230cede90ed38..5ada64d316309c1b2affc6bcf95588841cf56a72 100644 (file)
@@ -556,7 +556,7 @@ function hotkey_handler(e) {
                if (keycode == 16) return; // ignore lone shift
                if (keycode == 17) return; // ignore lone ctrl
 
-               if (!shift_key) keychar = keychar.toLowerCase();
+               keychar = keychar.toLowerCase();
 
                var hotkeys = getInitParam("hotkeys");
 
@@ -577,7 +577,11 @@ function hotkey_handler(e) {
                Element.hide(cmdline);
 
                var hotkey = keychar.search(/[a-zA-Z0-9]/) != -1 ? keychar : "(" + keycode + ")";
+
+               // ensure ^*char notation
+               if (shift_key) hotkey = "*" + hotkey;
                if (ctrl_key) hotkey = "^" + hotkey;
+
                hotkey = hotkey_prefix ? hotkey_prefix + " " + hotkey : hotkey;
                hotkey_prefix = false;
 
index 97133d3058398601bc505ae7a00798d386288fc1..92bf626e605f475053b733218c51dcad6e0b139b 100644 (file)
@@ -21,8 +21,8 @@ class GoogleReaderKeys extends Plugin {
 
                $hotkeys["j"]           = "next_article_noscroll";
                $hotkeys["k"]           = "prev_article_noscroll";
-               $hotkeys["N"]           = "next_feed";
-               $hotkeys["P"]           = "prev_feed";
+               $hotkeys["*n"]          = "next_feed";
+               $hotkeys["*p"]          = "prev_feed";
                $hotkeys["v"]           = "open_in_new_window";
                $hotkeys["r"]           = "feed_refresh";
                $hotkeys["(32)|space"]  = "next_article";