check for stuck hotkey prefixe sequences and abort them
This commit is contained in:
parent
c9f185bd28
commit
164469f902
|
@ -454,6 +454,8 @@ function feedlist_init() {
|
|||
|
||||
if (!offline_mode) setTimeout("timeout()", 1);
|
||||
|
||||
setTimeout("hotkey_prefix_timeout()", 5*1000);
|
||||
|
||||
if (typeof correctPNG != 'undefined') {
|
||||
correctPNG();
|
||||
}
|
||||
|
|
26
tt-rss.js
26
tt-rss.js
|
@ -15,6 +15,7 @@ var number_of_feeds = 0;
|
|||
var sanity_check_done = false;
|
||||
var _hfd_scrolltop = 0;
|
||||
var hotkey_prefix = false;
|
||||
var hotkey_prefix_pressed = false;
|
||||
var init_params = new Object();
|
||||
var ver_offset = 0;
|
||||
var hor_offset = 0;
|
||||
|
@ -313,6 +314,25 @@ 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;
|
||||
|
||||
|
@ -1072,8 +1092,12 @@ function hotkey_handler(e) {
|
|||
if ((keycode == 70 || keycode == 67 || keycode == 71)
|
||||
&& !hotkey_prefix) {
|
||||
|
||||
var date = new Date();
|
||||
var ts = Math.round(date.getTime() / 1000);
|
||||
|
||||
hotkey_prefix = keycode;
|
||||
debug("KP: PREFIX=" + keycode + " CHAR=" + keychar);
|
||||
hotkey_prefix_pressed = ts;
|
||||
debug("KP: PREFIX=" + keycode + " CHAR=" + keychar + " TS=" + ts);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue