From 95fb7882dc70ad345580524787972d32e7eae911 Mon Sep 17 00:00:00 2001 From: chrislemonier Date: Wed, 11 Sep 2013 15:00:00 -0700 Subject: [PATCH 1/2] Add Google Style 2 key shortcuts for main pages --- assets/js/app.js | 106 +++++++++++++++++++++++++++++++---------------- 1 file changed, 71 insertions(+), 35 deletions(-) diff --git a/assets/js/app.js b/assets/js/app.js index 773a122..427c1ca 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -3,6 +3,8 @@ var feeds = []; var queue = []; var queue_length = 5; + var keyqueue = []; + function download_item() @@ -507,41 +509,75 @@ }; document.onkeypress = function(e) { - - switch (e.keyCode || e.which) { - case 100: // d - download_item(); - break; - case 112: // p - case 107: // k - open_previous_item(); - break; - case 110: // n - case 106: // j - open_next_item(); - break; - case 118: // v - open_original_item(); - break; - case 111: // o - open_item(); - break; - case 109: // m - change_item_status(); - break; - case 102: // f - bookmark_item(); - break; - case 104: // h - open_previous_page(); - break - case 108: // l - open_next_page(); - break; - case 63: // ? - open("?action=show-help", "Help", "width=320,height=400,location=no,scrollbars=no,status=no,toolbar=no"); - break; - } + 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) { + case 100: // d + download_item(); + break; + case 112: // p + case 107: // k + open_previous_item(); + break; + case 110: // n + case 106: // j + open_next_item(); + break; + case 118: // v + open_original_item(); + break; + case 111: // o + open_item(); + break; + case 109: // m + change_item_status(); + break; + case 102: // f + bookmark_item(); + break; + case 104: // h + open_previous_page(); + break + case 108: // l + open_next_page(); + break; + case 63: // ? + open("?action=show-help", "Help", "width=320,height=450,location=no,scrollbars=no,status=no,toolbar=no"); + break; + } + } }; })(); From 96d978f894f90cf411a5ae9bb1f8fa5cfe14b591 Mon Sep 17 00:00:00 2001 From: chrislemonier Date: Wed, 11 Sep 2013 15:02:07 -0700 Subject: [PATCH 2/2] Add Google Style 2 key shortcuts for main pages --- templates/keyboard_shortcuts.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/templates/keyboard_shortcuts.php b/templates/keyboard_shortcuts.php index 856cf2c..e51bdb5 100644 --- a/templates/keyboard_shortcuts.php +++ b/templates/keyboard_shortcuts.php @@ -1,6 +1,11 @@

    +
  • = gu
  • +
  • = gb
  • +
  • = gh
  • +
  • = gs
  • +
  • = gp
  • = d
  • = p j
  • = n k
  • @@ -13,4 +18,4 @@
  • = ?
  • = q
-
\ No newline at end of file +