From: Andrew Dolgov Date: Fri, 9 Oct 2009 09:13:57 +0000 (+0400) Subject: display active hotkey prefix on screen X-Git-Tag: 1.3.4~15 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=78935092b540278e388749b7b0620fce62098fc9;p=tt-rss.git display active hotkey prefix on screen --- diff --git a/functions.js b/functions.js index 1e28f139..6ab23b0f 100644 --- a/functions.js +++ b/functions.js @@ -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); + } +} + + diff --git a/images/shadow_dark.png b/images/shadow_dark.png index a300e949..3a26b2a5 100644 Binary files a/images/shadow_dark.png and b/images/shadow_dark.png differ diff --git a/prefs.js b/prefs.js index 7f1f89df..820c31ea 100644 --- 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 diff --git a/prefs.php b/prefs.php index 99c00fd2..91f813b8 100644 --- a/prefs.php +++ b/prefs.php @@ -147,6 +147,8 @@ window.onload = init;
 
BAH
+ +