]> git.wh0rd.org - tt-rss.git/commitdiff
display active hotkey prefix on screen
authorAndrew Dolgov <fox@bah.org.ru>
Fri, 9 Oct 2009 09:13:57 +0000 (13:13 +0400)
committerAndrew Dolgov <fox@bah.org.ru>
Fri, 9 Oct 2009 09:13:57 +0000 (13:13 +0400)
functions.js
images/shadow_dark.png
prefs.js
prefs.php
tt-rss.css
tt-rss.js
tt-rss.php

index 1e28f1392c27758358f8f8db427957b4ae660210..6ab23b0f2b55022c8b806094414f40b50aa819d4 100644 (file)
@@ -2169,3 +2169,25 @@ function html5AudioOrFlash(type) {
                }
        }
 } */
+
+function hotkey_prefix_timeout() {
+       try {
+
+               var date = new Date();
+               var ts = Math.round(date.getTime() / 1000);
+
+               if (hotkey_prefix_pressed && ts - hotkey_prefix_pressed >= 5) {
+                       debug("hotkey_prefix seems to be stuck, aborting");
+                       hotkey_prefix_pressed = false;
+                       hotkey_prefix = false;
+                       Element.hide('cmdline');
+               }
+
+               setTimeout("hotkey_prefix_timeout()", 1000);
+
+       } catch  (e) {
+               exception_error("hotkey_prefix_timeout", e);
+       }
+}
+
+
index a300e9492b1371f6e8d79ae3d1f2ddd17c4092ae..3a26b2a5c4bf7613bb373921a74a6fd504b9d2bf 100644 (file)
Binary files a/images/shadow_dark.png and b/images/shadow_dark.png differ
index 7f1f89dfb612507632c3e98b7ac62afec24d1999..820c31eacccb56002873155d490f6cb4c4a20851 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -6,6 +6,7 @@ var init_params = new Array();
 var caller_subop = false;
 var sanity_check_done = false;
 var hotkey_prefix = false;
+var hotkey_prefix_pressed = false;
 
 var color_picker_active = false;
 var selection_disabled = false;
@@ -1205,6 +1206,8 @@ function init_second_stage() {
 
                loading_set_progress(60);
 
+               setTimeout("hotkey_prefix_timeout()", 5*1000);
+
        } catch (e) {
                exception_error("init_second_stage", e);
        }
@@ -1408,6 +1411,8 @@ function pref_hotkey_handler(e) {
                var keycode;
                var shift_key = false;
 
+               var cmdline = $('cmdline');
+
                try {
                        shift_key = e.shiftKey;
                } catch (e) {
@@ -1440,6 +1445,15 @@ function pref_hotkey_handler(e) {
 
                if ((keycode == 67 || keycode == 71) && !hotkey_prefix) {
                        hotkey_prefix = keycode;
+
+                       var date = new Date();
+                       var ts = Math.round(date.getTime() / 1000);
+
+                       hotkey_prefix_pressed = ts;
+
+                       cmdline.innerHTML = keychar;
+                       Element.show(cmdline);
+
                        debug("KP: PREFIX=" + keycode + " CHAR=" + keychar);
                        return;
                }
@@ -1456,6 +1470,8 @@ function pref_hotkey_handler(e) {
 
                /* Global hotkeys */
 
+               Element.hide(cmdline);
+
                if (!hotkey_prefix) {
 
                        if (keycode == 68 && shift_key) { // d
index 99c00fd21f931bb88a7501fb7cfdb7405a088e1a..91f813b85818c187a3f6c9cacbb9982a651f3824 100644 (file)
--- a/prefs.php
+++ b/prefs.php
@@ -147,6 +147,8 @@ window.onload = init;
 <div id="notify" class="notify"><span id="notify_body">&nbsp;</span></div>
 <div id="infoBoxShadow"><div id="infoBox">BAH</div></div>
 
+<div id="cmdline" style="display : none"></div>
+
 <div id="errorBoxShadow" style="display : none">
        <div id="errorBox">
                <div id="xebTitle">Fatal Exception</div><div id="xebContent">&nbsp;</div>
index 2d4f2c23a5aac196902454a1779e4132575e943a..f188967847089f9d401323c4d82238fe132219ee 100644 (file)
@@ -2214,3 +2214,15 @@ option {
        color : black;
 }
 
+div#cmdline {
+       position : absolute;
+       left : 5px;
+       bottom : 5px;
+       font-size : 11px;
+       color : gray;
+       font-weight : bold;
+       background-color : white;
+       border : 1px solid #88b0f0;
+       padding : 3px 5px 3px 5px;
+       z-index : 5;
+}
index cb008c10eb75bb45bfbd29cfb22610736ae5707d..408eb3913ed91a55e6c736b0bf41ed3ec98ab6e3 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -314,25 +314,6 @@ function viewfeed(feed, subop) {
        f.viewfeed(feed, subop);
 }
 
-function hotkey_prefix_timeout() {
-       try {
-
-               var date = new Date();
-               var ts = Math.round(date.getTime() / 1000);
-
-               if (hotkey_prefix_pressed && ts - hotkey_prefix_pressed >= 5) {
-                       debug("hotkey_prefix seems to be stuck, aborting");
-                       hotkey_prefix_pressed = false;
-                       hotkey_prefix = false;
-               }
-
-               setTimeout("hotkey_prefix_timeout()", 10);
-
-       } catch  (e) {
-               exception_error("hotkey_prefix_timeout", e);
-       }
-}
-
 function timeout() {
        if (getInitParam("bw_limit") == "1") return;
 
@@ -1060,6 +1041,7 @@ function hotkey_handler(e) {
                var keycode;
                var shift_key = false;
 
+               var cmdline = $('cmdline');
                var feedlist = $('feedList');
 
                try {
@@ -1099,6 +1081,10 @@ function hotkey_handler(e) {
 
                        hotkey_prefix = keycode;
                        hotkey_prefix_pressed = ts;
+
+                       cmdline.innerHTML = keychar;
+                       Element.show(cmdline);
+
                        debug("KP: PREFIX=" + keycode + " CHAR=" + keychar + " TS=" + ts);
                        return true;
                }
@@ -1109,6 +1095,8 @@ function hotkey_handler(e) {
 
                /* Global hotkeys */
 
+               Element.hide(cmdline);
+
                if (!hotkey_prefix) {
 
                        if (keycode == 68 && shift_key) { // d
index baf58a088e45f19d706029ac290924b39ddd9bc4..607bedb1da68c029445823713f6ab268d91687df 100644 (file)
@@ -104,6 +104,8 @@ window.onload = init;
 
 <div id="infoBoxShadow" style="display : none"><div id="infoBox">&nbsp;</div></div>
 
+<div id="cmdline" style="display : none"></div>
+
 <div id="errorBoxShadow" style="display : none">
        <div id="errorBox">
                <div id="xebTitle">Fatal Exception</div><div id="xebContent">&nbsp;</div>