From dfc0b1a4d978d5b574080d2f87dbf2cc3af5aca2 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Tue, 9 Oct 2012 17:45:41 -0400 Subject: [PATCH] Rename next_zephyr local variables to next_message. (imported from commit 88f3b5dc3fdde3340dcc4f040cf8ecc8554955bb) --- zephyr/static/js/hotkey.js | 10 ++++----- zephyr/static/js/zephyr.js | 44 +++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/zephyr/static/js/hotkey.js b/zephyr/static/js/hotkey.js index 76aec78687..4856464d4f 100644 --- a/zephyr/static/js/hotkey.js +++ b/zephyr/static/js/hotkey.js @@ -23,7 +23,7 @@ function simulate_keydown(keycode) { } function process_hotkey(code) { - var next_zephyr; + var next_message; // Disable hotkeys on settings page etc. if (!$('#home').hasClass('active')) { @@ -36,11 +36,11 @@ function process_hotkey(code) { } if (directional_hotkeys.hasOwnProperty(code)) { - next_zephyr = directional_hotkeys[code](selected_zephyr); - if (next_zephyr.length !== 0) { - select_zephyr(next_zephyr, true); + next_message = directional_hotkeys[code](selected_zephyr); + if (next_message.length !== 0) { + select_zephyr(next_message, true); } - if ((next_zephyr.length === 0) && (code === 40 || code === 106)) { + if ((next_message.length === 0) && (code === 40 || code === 106)) { // At the last zephyr, scroll to the bottom so we have // lots of nice whitespace for new zephyrs coming in. // diff --git a/zephyr/static/js/zephyr.js b/zephyr/static/js/zephyr.js index 5f723e4b60..17192da59c 100644 --- a/zephyr/static/js/zephyr.js +++ b/zephyr/static/js/zephyr.js @@ -172,27 +172,27 @@ function update_selected_zephyr(zephyr) { selected_zephyr = zephyr; } -function select_zephyr(next_zephyr, scroll_to) { +function select_zephyr(next_message, scroll_to) { var viewport = $(window); /* If the zephyr exists but is hidden, try to find the next visible one. */ - if (next_zephyr.length !== 0 && next_zephyr.is(':hidden')) { - next_zephyr = get_next_visible(next_zephyr); + if (next_message.length !== 0 && next_message.is(':hidden')) { + next_message = get_next_visible(next_message); } /* Fall back to the first visible zephyr. */ - if (next_zephyr.length === 0) { - next_zephyr = $('tr:not(:hidden):first'); + if (next_message.length === 0) { + next_message = $('tr:not(:hidden):first'); } - if (next_zephyr.length === 0) { + if (next_message.length === 0) { // There are no zephyrs! return false; } - update_selected_zephyr(next_zephyr); + update_selected_zephyr(next_message); if (scroll_to) { - recenter_view(next_zephyr); + recenter_view(next_message); } } @@ -494,40 +494,40 @@ function at_bottom_of_viewport() { function keep_pointer_in_view() { var candidate; var viewport = $(window); - var next_zephyr = get_zephyr_row(selected_zephyr_id); + var next_message = get_zephyr_row(selected_zephyr_id); - if (above_view_threshold(next_zephyr) && (!at_top_of_viewport())) { - while (above_view_threshold(next_zephyr)) { - candidate = get_next_visible(next_zephyr); + if (above_view_threshold(next_message) && (!at_top_of_viewport())) { + while (above_view_threshold(next_message)) { + candidate = get_next_visible(next_message); if (candidate.length === 0) { break; } else { - next_zephyr = candidate; + next_message = candidate; } } - } else if (below_view_threshold(next_zephyr) && (!at_bottom_of_viewport())) { - while (below_view_threshold(next_zephyr)) { - candidate = get_prev_visible(next_zephyr); + } else if (below_view_threshold(next_message) && (!at_bottom_of_viewport())) { + while (below_view_threshold(next_message)) { + candidate = get_prev_visible(next_message); if (candidate.length === 0) { break; } else { - next_zephyr = candidate; + next_message = candidate; } } } - if (at_top_of_viewport() && (parseInt(get_id(next_zephyr), 10) > + if (at_top_of_viewport() && (parseInt(get_id(next_message), 10) > parseInt(get_id(get_first_visible()), 10))) { // If we've scrolled to the top, keep inching the selected // zephyr up to the top instead of just the latest one that is // still on the screen. - next_zephyr = get_prev_visible(next_zephyr); - } else if (at_bottom_of_viewport() && (parseInt(get_id(next_zephyr), 10) < + next_message = get_prev_visible(next_message); + } else if (at_bottom_of_viewport() && (parseInt(get_id(next_message), 10) < parseInt(get_id(get_last_visible()), 10))) { // If we've scrolled to the bottom already, keep advancing the // pointer until we're at the last message (by analogue to the // above) - next_zephyr = get_next_visible(next_zephyr); + next_message = get_next_visible(next_message); } - update_selected_zephyr(next_zephyr); + update_selected_zephyr(next_message); }