From ae97a88e7210e50d2663b497d20a84a02dad2bf1 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Tue, 9 Oct 2012 18:09:25 -0400 Subject: [PATCH] Rename selected_zephyr_id to selected_message_id. (imported from commit bbb368efdd5010b6dfdaaf60f3f48904b40671af) --- tools/jslint/check-all.js | 2 +- zephyr/static/js/narrow.js | 14 +++++++------- zephyr/static/js/zephyr.js | 20 ++++++++++---------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tools/jslint/check-all.js b/tools/jslint/check-all.js index b9566b88ef..b61a156263 100644 --- a/tools/jslint/check-all.js +++ b/tools/jslint/check-all.js @@ -42,7 +42,7 @@ var globals = + ' keep_pointer_in_view respond_to_zephyr' + ' select_message select_message_by_id' + ' scroll_to_selected select_and_show_by_id' - + ' selected_zephyr selected_zephyr_id' + + ' selected_zephyr selected_message_id' + ' at_top_of_viewport at_bottom_of_viewport' ; diff --git a/zephyr/static/js/narrow.js b/zephyr/static/js/narrow.js index ecfd9e00d2..328e103de5 100644 --- a/zephyr/static/js/narrow.js +++ b/zephyr/static/js/narrow.js @@ -8,7 +8,7 @@ function do_narrow(description, filter_function) { narrowed = filter_function; // Your pointer isn't changed when narrowed. - persistent_zephyr_id = selected_zephyr_id; + persistent_zephyr_id = selected_message_id; // Empty the filtered table right before we fill it again clear_table('zfilt'); @@ -23,12 +23,12 @@ function do_narrow(description, filter_function) { $("#currently_narrowed_to").html(description).attr("title", description); $("#zhome").removeClass("focused_table"); - select_and_show_by_id(selected_zephyr_id); + select_and_show_by_id(selected_message_id); scroll_to_selected(); } function narrow_huddle() { - var original = message_dict[selected_zephyr_id]; + var original = message_dict[selected_message_id]; do_narrow("Huddles with " + original.reply_to, function (other) { return other.reply_to === original.reply_to; }); @@ -42,7 +42,7 @@ function narrow_all_personals() { function narrow_personals() { // Narrow to personals with a specific user - var original = message_dict[selected_zephyr_id]; + var original = message_dict[selected_message_id]; var other_party; if (original.display_recipient === email) { other_party = original.sender_email; @@ -59,7 +59,7 @@ function narrow_personals() { } function narrow_class() { - var original = message_dict[selected_zephyr_id]; + var original = message_dict[selected_message_id]; var message = original.display_recipient; do_narrow(message, function (other) { return (other.type === 'class' && @@ -68,7 +68,7 @@ function narrow_class() { } function narrow_instance() { - var original = message_dict[selected_zephyr_id]; + var original = message_dict[selected_message_id]; if (original.type !== 'class') return; @@ -82,7 +82,7 @@ function narrow_instance() { // Called for the 'narrow by class' hotkey. function narrow_by_recipient() { - switch (message_dict[selected_zephyr_id].type) { + switch (message_dict[selected_message_id].type) { case 'personal': narrow_personals(); break; case 'huddle': narrow_huddle(); break; case 'class': narrow_class(); break; diff --git a/zephyr/static/js/zephyr.js b/zephyr/static/js/zephyr.js index de95ee2b10..92e814867e 100644 --- a/zephyr/static/js/zephyr.js +++ b/zephyr/static/js/zephyr.js @@ -44,8 +44,8 @@ $(function () { } }); -var selected_zephyr_id = -1; /* to be filled in on document.ready */ -var selected_zephyr; // = get_zephyr_row(selected_zephyr_id) +var selected_message_id = -1; /* to be filled in on document.ready */ +var selected_zephyr; // = get_zephyr_row(selected_message_id) var received = { first: -1, last: -1, @@ -115,7 +115,7 @@ function get_huddle_recipient_names(zephyr) { function respond_to_zephyr(reply_type) { var zephyr, tabname; - zephyr = message_dict[selected_zephyr_id]; + zephyr = message_dict[selected_message_id]; if (zephyr.type === "class") { $("#class").val(zephyr.display_recipient); $("#instance").val(zephyr.instance); @@ -143,7 +143,7 @@ function respond_to_zephyr(reply_type) { // Called by mouseover etc. function select_message_by_id(zephyr_id) { - if (zephyr_id === selected_zephyr_id) { + if (zephyr_id === selected_message_id) { return; } select_message(get_zephyr_row(zephyr_id), false); @@ -161,14 +161,14 @@ function update_selected_zephyr(zephyr) { zephyr.addClass('selected_zephyr'); var new_selected_id = get_id(zephyr); - if (!narrowed && new_selected_id !== selected_zephyr_id) { + if (!narrowed && new_selected_id !== selected_message_id) { // Narrowing is a temporary view on top of the home view and // doesn't permanently affect where you are. // // We also don't want to post if there's no effective change. $.post("update", {pointer: new_selected_id}); } - selected_zephyr_id = new_selected_id; + selected_message_id = new_selected_id; selected_zephyr = zephyr; } @@ -426,7 +426,7 @@ function add_messages(data) { // If we received the initially selected message, select it on the client side, // but not if the user has already selected another one during load. - if ((selected_zephyr_id === -1) && (message_dict.hasOwnProperty(initial_pointer))) { + if ((selected_message_id === -1) && (message_dict.hasOwnProperty(initial_pointer))) { select_and_show_by_id(initial_pointer); } @@ -437,8 +437,8 @@ function add_messages(data) { // // We also need to re-select the message by ID, because we might have // removed and re-added the row as part of prepend collapsing. - if ((data.where === 'top') && (selected_zephyr_id >= 0)) { - select_and_show_by_id(selected_zephyr_id); + if ((data.where === 'top') && (selected_message_id >= 0)) { + select_and_show_by_id(selected_message_id); } if (autocomplete_needs_update) @@ -494,7 +494,7 @@ function at_bottom_of_viewport() { function keep_pointer_in_view() { var candidate; var viewport = $(window); - var next_message = get_zephyr_row(selected_zephyr_id); + var next_message = get_zephyr_row(selected_message_id); if (above_view_threshold(next_message) && (!at_top_of_viewport())) { while (above_view_threshold(next_message)) {