From 1f669e1c85646fe6d66a068c6cd1c6c41ca8e36c Mon Sep 17 00:00:00 2001 From: Waseem Daher Date: Wed, 3 Oct 2012 17:47:15 -0400 Subject: [PATCH] Do a little handling of Home, End, PgUp, PgDn ourselves. It turns out it's marginally easier for us to completely handle Home and End ourselves rather than let the browser do it, because home scrolls to the top of the page, but it does not select the topmost message. With PgUp and PgDn, the default browser behavior is fine, but it seems like PgUp on a screen where you're already "scrolled to the top" should not be a no-op. (imported from commit 609d639f3a4313e75e1fd6138966f15447b70f2e) --- zephyr/static/js/hotkey.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/zephyr/static/js/hotkey.js b/zephyr/static/js/hotkey.js index d74d67f77c..a3c72573e9 100644 --- a/zephyr/static/js/hotkey.js +++ b/zephyr/static/js/hotkey.js @@ -32,7 +32,7 @@ function simulate_keypress(keycode) { } function process_hotkey(code) { - var next_zephyr, window_to_scroll; + var next_zephyr; if (directional_hotkeys.hasOwnProperty(code)) { next_zephyr = directional_hotkeys[code](selected_zephyr); if (next_zephyr.length !== 0) { @@ -49,11 +49,6 @@ function process_hotkey(code) { return process_hotkey; } - window_to_scroll = $(".active.scrolling_tab"); - if (window_to_scroll.length === 0) { - window_to_scroll = $(".active").find(".scrolling-tab"); - } - if (num_pressed_keys() > 1) { // If you are already holding down another key, none of these // actions apply. @@ -62,13 +57,11 @@ function process_hotkey(code) { switch (code) { case 33: // Page Up - window_to_scroll.scrollTop(window_to_scroll.scrollTop() - window_to_scroll.height()); keep_pointer_in_view(); - return process_hotkey; + return false; // We want the browser to actually page up and down case 34: // Page Down - window_to_scroll.scrollTop(window_to_scroll.scrollTop() + window_to_scroll.height()); keep_pointer_in_view(); - return process_hotkey; + return false; case 27: // Esc: hide compose pane hide_compose(); return process_hotkey;