]> git.wh0rd.org Git - tt-rss.git/commitdiff
hotkey support for prefs
authorAndrew Dolgov <fox@madoka.spb.ru>
Fri, 16 May 2008 06:05:12 +0000 (07:05 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Fri, 16 May 2008 06:05:12 +0000 (07:05 +0100)
help/4.php [new file with mode: 0644]
modules/pref-labels.php
prefs.js
prefs.php
tt-rss.css
tt-rss.js

diff --git a/help/4.php b/help/4.php
new file mode 100644 (file)
index 0000000..78eed93
--- /dev/null
@@ -0,0 +1,37 @@
+<h1><?php echo __("Keyboard Shortcuts") ?></h1>
+
+<table width='100%'><tr><td width='50%' valign='top'>
+
+       <h2><?php echo __("Navigation") ?></h2>
+
+       <table>
+               <tr><td class='n'>1</td><td><?php echo __("Preferences") ?></td></tr>
+               <tr><td class='n'>2</td><td><?php echo __("My Feeds") ?></td></tr>
+               <tr><td class='n'>3</td><td><?php echo __("Other Feeds") ?></td></tr>
+               <tr><td class='n'>4</td><td><?php echo __("Content Filtering") ?></td></tr>
+               <tr><td class='n'>5</td><td><?php echo __("Label Editor") ?></td></tr>
+               <tr><td class='n'>6</td><td><?php echo __("User Manager") ?></td></tr>
+       </table>
+
+</td><td valign='top'>
+
+       <h2><?php echo __("Panel actions") ?></h2>
+
+       <table>
+               <tr><td class='n'>c s</td><td><?php echo __("Subscribe to feed") ?></td></tr>
+               <tr><td class='n'>c f</td><td><?php echo __("Create filter") ?></td></tr>
+               <tr><td class='n'>c l</td><td><?php echo __("Create label") ?></td></tr>
+               <tr><td class='n'>c u</td><td><?php echo __("Create user") ?></td></tr>
+       </table>
+
+       <h2><?php echo __("Other actions") ?></h2>
+
+       <table>
+               <tr><td class='n'>g x</td><td><?php echo __("Exit preferences") ?></td></tr>
+       </table>
+
+</td></tr></table>
+
+<p class='insensitive'><span class='small'>Note: not all actions may be available, depending on Tiny Tiny RSS configuration and your access level.</span></p>
+
+<p class="small"><?php echo __("Press any key to close this window.") ?></p>
index 65948ce433447aebfe3e329e4abf6e5e24bf944d..e9e6ee86040084ae1a182ef2b053a60f41af9f4a 100644 (file)
@@ -6,7 +6,7 @@
        function module_pref_labels($link) {
                if (!GLOBAL_ENABLE_LABELS) { 
 
-                       print "<p>Sorry, labels have been administratively disabled for this installation. Please contact instance owner or edit configuration file to enable this functionality.</p>";
+                       print __("Sorry, labels have been administratively disabled for this installation. Please contact instance owner or edit configuration file to enable this functionality.");
                        return; 
                }
 
index e3449a238f03f5bc880a23cb9665d9d637624d9f..308c7b7aa4199a04febe1092cea2c30cff05cdce 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -10,8 +10,8 @@ var xmlhttp = Ajax.getTransport();
 var init_params = new Array();
 
 var caller_subop = false;
-
 var sanity_check_done = false;
+var hotkey_prefix = false;
 
 function infobox_callback() {
        if (xmlhttp.readyState == 4) {
@@ -1654,31 +1654,111 @@ function pref_hotkey_handler(e) {
        try {
 
                var keycode;
-       
-               if (!hotkeys_enabled) return;
-       
+               var shift_key = false;
+
+               try {
+                       shift_key = e.shiftKey;
+               } catch (e) {
+
+               }
+
                if (window.event) {
                        keycode = window.event.keyCode;
                } else if (e) {
                        keycode = e.which;
                }
-       
+
+               if (keycode == 27) { // escape
+                       if (Element.visible("hotkey_help_overlay")) {
+                               Element.hide("hotkey_help_overlay");
+                       }
+                       hotkey_prefix = false;
+                       closeInfoBox();
+               } 
+
+               if (!hotkeys_enabled) {
+                       debug("hotkeys disabled");
+                       return;
+               }
+
+               if (keycode == 16) return; // ignore lone shift
+
+               if (Element.visible("hotkey_help_overlay")) {
+                       Element.hide("hotkey_help_overlay");
+               }
+
                if (keycode == 13 || keycode == 27) {
                        seq = "";
                } else {
                        seq = seq + "" + keycode;
                }
 
+               /* Global hotkeys */
 
-       if (document.getElementById("piggie")) {
+               if (!hotkey_prefix) {
+
+                       if (keycode == 68 && shift_key) { // d
+                               if (!debug_mode_enabled) {
+                                       document.getElementById('debug_output').style.display = 'block';
+                                       debug('debug mode activated');
+                               } else {
+                                       document.getElementById('debug_output').style.display = 'none';
+                               }
        
-               if (seq.match("807371717369")) {
-                       seq = "";
-                       localPiggieFunction(true);
+                               debug_mode_enabled = !debug_mode_enabled;
+                               return;
+                       }
+       
+                       if (keycode == 191 && shift_key) { // ?
+                               if (!Element.visible("hotkey_help_overlay")) {
+                                       Element.show("hotkey_help_overlay");
+                               } else {
+                                       Element.hide("hotkey_help_overlay");
+                               }
+                               return;
+                       }
+
+                       if (keycode == 49) { // 1
+                               selectTab("genConfig");
+                       }
+
+                       if (keycode == 50 && document.getElementById("feedConfigTab")) { // 2
+                               return selectTab("feedConfig");
+                       }
+
+                       if (keycode == 51 && document.getElementById("feedBrowserTab")) { // 3
+                               return selectTab("feedBrowser");
+                       }
+
+                       if (keycode == 52 && document.getElementById("filterConfigTab")) { // 4
+                               return selectTab("filterConfig");
+                       }
+
+                       if (keycode == 53 && document.getElementById("labelConfigTab")) { // 5
+                               return selectTab("labelConfig");
+                       }
+
+                       if (keycode == 54 && document.getElementById("userConfigTab")) { // 6
+                               return selectTab("userConfig");
+                       }
+
+               }
+
+               if (document.getElementById("piggie")) {
+       
+                       if (seq.match("807371717369")) {
+                               seq = "";
+                               localPiggieFunction(true);
+                       } else {
+                               localPiggieFunction(false);
+                       }
+               }
+
+               if (hotkey_prefix) {
+                       debug("KP: PREFIX=" + hotkey_prefix + " CODE=" + keycode);
                } else {
-                       localPiggieFunction(false);
+                       debug("KP: CODE=" + keycode);
                }
-       }
 
        } catch (e) {
                exception_error("pref_hotkey_handler", e);
index bf58aa3bd9def4cf69608b91d66efbf92c63021c..908f66f2cce3332acaa98e5391fe4c77c38dca6e 100644 (file)
--- a/prefs.php
+++ b/prefs.php
 
 <body>
 
-<img id="piggie" src="images/piggie.png" style="display : none" alt="piggie">
-
 <div id="hotkey_help_overlay" style="display : none" onclick="Element.hide(this)">
+       <?php rounded_table_start("hho"); ?>
        <?php include "help/4.php" ?>
+       <?php rounded_table_end(); ?>
 </div>
 
+<img id="piggie" src="images/piggie.png" style="display : none" alt="piggie">
+
 <script type="text/javascript">
 if (document.addEventListener) {
        document.addEventListener("DOMContentLoaded", init, null);
index 32ccfde3b14f18544f80a195d41ea5915ba6fe25..f47e436343938599217ab6f5d47a02ce38036210 100644 (file)
@@ -674,7 +674,7 @@ span.feed_error {
        color : red;
 }
 
-span.insensitive, div.insensitive, li.insensitive, label.insensitive, td.insensitive {
+.insensitive {
        color : gray;
 }
 
index 2a0fc8626926819f0091f4a03f49fc1ba2a2c06b..47b2a14cb87e2b7587310ee1a76308849aecf653 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -1302,7 +1302,7 @@ function hotkey_handler(e) {
                        if (Element.visible("hotkey_help_overlay")) {
                                Element.hide("hotkey_help_overlay");
                        }
-               } */
+               } 
 
                if (typeof localHotkeyHandler != 'undefined') {
                        try {
@@ -1310,7 +1310,7 @@ function hotkey_handler(e) {
                        } catch (e) {
                                exception_error("hotkey_handler, local:", e);
                        }
-               }
+               } */
 
                if (hotkey_prefix) {
                        debug("KP: PREFIX=" + hotkey_prefix + " CODE=" + keycode);