Add Google Style 2 key shortcuts for main pages

This commit is contained in:
chrislemonier 2013-09-11 15:00:00 -07:00
parent a596472100
commit 95fb7882dc

View File

@ -3,6 +3,8 @@
var feeds = []; var feeds = [];
var queue = []; var queue = [];
var queue_length = 5; var queue_length = 5;
var keyqueue = [];
function download_item() function download_item()
@ -507,7 +509,40 @@
}; };
document.onkeypress = function(e) { document.onkeypress = function(e) {
keyqueue.push(e.keyCode);
if (keyqueue[0]==103)
{
switch (keyqueue[1]) {
case undefined:
break;
case 117: //u
window.location.href = "?action=unread";
keyqueue = [];
break;
case 98: //b
window.location.href = "?action=bookmarks";
keyqueue = [];
break;
case 104: //h
window.location.href = "?action=history";
keyqueue = [];
break;
case 115: //s
window.location.href = "?action=feeds";
keyqueue = [];
break;
case 112: //p
window.location.href = "?action=config";
keyqueue = [];
break;
default:
keyqueue = [];
break;
}
}
else
{
keyqueue = [];
switch (e.keyCode || e.which) { switch (e.keyCode || e.which) {
case 100: // d case 100: // d
download_item(); download_item();
@ -539,9 +574,10 @@
open_next_page(); open_next_page();
break; break;
case 63: // ? case 63: // ?
open("?action=show-help", "Help", "width=320,height=400,location=no,scrollbars=no,status=no,toolbar=no"); open("?action=show-help", "Help", "width=320,height=450,location=no,scrollbars=no,status=no,toolbar=no");
break; break;
} }
}
}; };
})(); })();