]> git.wh0rd.org - tt-rss.git/commitdiff
add hack to support arbitrary key descriptions for hotkeys
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 22 Jan 2013 08:52:52 +0000 (12:52 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 22 Jan 2013 08:52:52 +0000 (12:52 +0400)
classes/backend.php
include/functions.php
js/tt-rss.js

index 6fa31864d6bcc507c7e801ad7eb7c57cde2386e3..0b6e6bd30117b4857cfb80531cd27db51880ef2c 100644 (file)
@@ -44,6 +44,12 @@ class Backend extends Handler {
                        print "<li><h3>" . $section . "</h3></li>";
 
                        foreach ($hotkeys as $action => $description) {
+                               if (strpos($omap[$action], "|") !== FALSE) {
+                                       $omap[$action] = substr($omap[$action],
+                                               strpos($omap[$action], "|")+1,
+                                               strlen($omap[$action]));
+                               }
+
                                print "<li>";
                                print "<span class='hksequence'>" . $omap[$action] . "</span>";
                                print $description;
index b564caf1efc1b2dba92d7de374c57bcbc199a1db..ac3a8861e0cc33c633ca60f9d330e118dc3b2e3e 100644 (file)
                                "j" => "prev_feed",
                                "n" => "next_article",
                                "p" => "prev_article",
-                               "(38)" => "prev_article",
-                               "(40)" => "next_article",
-                               "(191)" => "search_dialog",
+                               "(38)|up" => "prev_article",
+                               "(40)|down" => "next_article",
+                               "(191)|/" => "search_dialog",
 //                     "article" => array(
                                "s" => "toggle_mark",
                                "S" => "toggle_publ",
                                "g t" => "goto_tagcloud",
                                "g P" => "goto_prefs",
 //                     "other" => array(
-                               "(9)" => "select_article_cursor", // tab
+                               "(9)|tab" => "select_article_cursor", // tab
                                "c l" => "create_label",
                                "c f" => "create_filter",
                                "c s" => "collapse_sidebar",
index 78f7a867d07cd41d14b976538d8ee85531f918b5..13181c4212c5de1bad21b50162d631a4edae2094 100644 (file)
@@ -366,6 +366,17 @@ function init_second_stage() {
                if ('sessionStorage' in window && window['sessionStorage'] !== null)
                        sessionStorage.clear();
 
+               var hotkeys = getInitParam("hotkeys");
+               var tmp = [];
+
+               for (sequence in hotkeys[1]) {
+                       filtered = sequence.replace(/\|.*$/, "");
+                       tmp[filtered] = hotkeys[1][sequence];
+               }
+
+               hotkeys[1] = tmp;
+               setInitParam("hotkeys", hotkeys);
+
                console.log("second stage ok");
 
        } catch (e) {