Rename zephyr_dict and zephyr_array.

(imported from commit 5d93fddc1758c0ee47390cfe599732a60a8d817a)
This commit is contained in:
Tim Abbott 2012-10-09 17:48:41 -04:00
parent 78c303e44a
commit f1e90cde8c
3 changed files with 16 additions and 16 deletions

View File

@ -37,7 +37,7 @@ var globals =
+ ' update_autocomplete autocomplete_needs_update' + ' update_autocomplete autocomplete_needs_update'
// zephyr.js // zephyr.js
+ ' zephyr_array zephyr_dict' + ' message_array message_dict'
+ ' status_classes clear_table add_to_table instance_list' + ' status_classes clear_table add_to_table instance_list'
+ ' keep_pointer_in_view respond_to_zephyr' + ' keep_pointer_in_view respond_to_zephyr'
+ ' select_zephyr select_zephyr_by_id' + ' select_zephyr select_zephyr_by_id'

View File

@ -12,7 +12,7 @@ function do_narrow(description, filter_function) {
// Empty the filtered table right before we fill it again // Empty the filtered table right before we fill it again
clear_table('zfilt'); clear_table('zfilt');
add_to_table(zephyr_array, 'zfilt', filter_function, 'bottom'); add_to_table(message_array, 'zfilt', filter_function, 'bottom');
// Show the new set of messages. // Show the new set of messages.
$("#zfilt").addClass("focused_table"); $("#zfilt").addClass("focused_table");
@ -28,7 +28,7 @@ function do_narrow(description, filter_function) {
} }
function narrow_huddle() { function narrow_huddle() {
var original = zephyr_dict[selected_zephyr_id]; var original = message_dict[selected_zephyr_id];
do_narrow("Huddles with " + original.reply_to, function (other) { do_narrow("Huddles with " + original.reply_to, function (other) {
return other.reply_to === original.reply_to; return other.reply_to === original.reply_to;
}); });
@ -42,7 +42,7 @@ function narrow_all_personals() {
function narrow_personals() { function narrow_personals() {
// Narrow to personals with a specific user // Narrow to personals with a specific user
var original = zephyr_dict[selected_zephyr_id]; var original = message_dict[selected_zephyr_id];
var other_party; var other_party;
if (original.display_recipient === email) { if (original.display_recipient === email) {
other_party = original.sender_email; other_party = original.sender_email;
@ -59,7 +59,7 @@ function narrow_personals() {
} }
function narrow_class() { function narrow_class() {
var original = zephyr_dict[selected_zephyr_id]; var original = message_dict[selected_zephyr_id];
var message = original.display_recipient; var message = original.display_recipient;
do_narrow(message, function (other) { do_narrow(message, function (other) {
return (other.type === 'class' && return (other.type === 'class' &&
@ -68,7 +68,7 @@ function narrow_class() {
} }
function narrow_instance() { function narrow_instance() {
var original = zephyr_dict[selected_zephyr_id]; var original = message_dict[selected_zephyr_id];
if (original.type !== 'class') if (original.type !== 'class')
return; return;
@ -82,7 +82,7 @@ function narrow_instance() {
// Called for the 'narrow by class' hotkey. // Called for the 'narrow by class' hotkey.
function narrow_by_recipient() { function narrow_by_recipient() {
switch (zephyr_dict[selected_zephyr_id].type) { switch (message_dict[selected_zephyr_id].type) {
case 'personal': narrow_personals(); break; case 'personal': narrow_personals(); break;
case 'huddle': narrow_huddle(); break; case 'huddle': narrow_huddle(); break;
case 'class': narrow_class(); break; case 'class': narrow_class(); break;

View File

@ -1,5 +1,5 @@
var zephyr_array = []; var message_array = [];
var zephyr_dict = {}; var message_dict = {};
var instance_list = []; var instance_list = [];
$(function () { $(function () {
@ -115,7 +115,7 @@ function get_huddle_recipient_names(zephyr) {
function respond_to_zephyr(reply_type) { function respond_to_zephyr(reply_type) {
var zephyr, tabname; var zephyr, tabname;
zephyr = zephyr_dict[selected_zephyr_id]; zephyr = message_dict[selected_zephyr_id];
if (zephyr.type === "class") { if (zephyr.type === "class") {
$("#class").val(zephyr.display_recipient); $("#class").val(zephyr.display_recipient);
$("#instance").val(zephyr.instance); $("#instance").val(zephyr.instance);
@ -273,14 +273,14 @@ function add_to_table(zephyrs, table_name, filter_function, where) {
var top_messages = []; var top_messages = [];
$.each(top_group, function (index, id) { $.each(top_group, function (index, id) {
get_zephyr_row(id, table_name).remove(); get_zephyr_row(id, table_name).remove();
top_messages.push(zephyr_dict[id]); top_messages.push(message_dict[id]);
}); });
zephyrs = zephyrs.concat(top_messages); zephyrs = zephyrs.concat(top_messages);
// Delete the leftover recipient label. // Delete the leftover recipient label.
table.find('.recipient_row:first').remove(); table.find('.recipient_row:first').remove();
} else { } else {
prev = zephyr_dict[table.find('tr:last-child').attr('zid')]; prev = message_dict[table.find('tr:last-child').attr('zid')];
} }
$.each(zephyrs, function (index, zephyr) { $.each(zephyrs, function (index, zephyr) {
@ -397,7 +397,7 @@ function add_zephyr_metadata(dummy, zephyr) {
break; break;
} }
zephyr_dict[zephyr.id] = zephyr; message_dict[zephyr.id] = zephyr;
} }
function add_messages(data) { function add_messages(data) {
@ -413,9 +413,9 @@ function add_messages(data) {
} }
if (data.where === 'top') { if (data.where === 'top') {
zephyr_array = data.messages.concat(zephyr_array); message_array = data.messages.concat(message_array);
} else { } else {
zephyr_array = zephyr_array.concat(data.messages); message_array = message_array.concat(data.messages);
} }
if (narrowed) if (narrowed)
@ -426,7 +426,7 @@ function add_messages(data) {
// If we received the initially selected message, select it on the client side, // 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. // but not if the user has already selected another one during load.
if ((selected_zephyr_id === -1) && (zephyr_dict.hasOwnProperty(initial_pointer))) { if ((selected_zephyr_id === -1) && (message_dict.hasOwnProperty(initial_pointer))) {
select_and_show_by_id(initial_pointer); select_and_show_by_id(initial_pointer);
} }