Use 'undefined' instead of -1 as sentinel

(imported from commit 30cc280d89cf0c290459f9d90960cd8eaf76a22f)
This commit is contained in:
Leo Franchi 2013-03-15 10:51:25 -04:00
parent 79dfe57840
commit 96041be75c
1 changed files with 4 additions and 4 deletions

View File

@ -512,7 +512,7 @@ $(function () {
function () { $('#send-status').stop(true).fadeOut(500); } function () { $('#send-status').stop(true).fadeOut(500); }
); );
var scroll_start_message = -1; var scroll_start_message;
function scroll_finished() { function scroll_finished() {
if ($('#home').hasClass('active')) { if ($('#home').hasClass('active')) {
@ -534,7 +534,7 @@ $(function () {
notifications_bar.update(); notifications_bar.update();
var new_selected = current_msg_list.selected_id(); var new_selected = current_msg_list.selected_id();
if (scroll_start_message === -1) { if (scroll_start_message === undefined) {
blueslip.error("Got a scroll finish with no saved message from scroll start"); blueslip.error("Got a scroll finish with no saved message from scroll start");
} else if (new_selected > scroll_start_message) { } else if (new_selected > scroll_start_message) {
var mark_as_read = []; var mark_as_read = [];
@ -546,7 +546,7 @@ $(function () {
}); });
process_read_messages(mark_as_read); process_read_messages(mark_as_read);
} }
scroll_start_message = -1; scroll_start_message = undefined;
setTimeout(process_visible_unread_messages, 0); setTimeout(process_visible_unread_messages, 0);
} }
@ -559,7 +559,7 @@ $(function () {
} }
$(window).scroll(function () { $(window).scroll(function () {
if (scroll_start_message === -1) { if (scroll_start_message === undefined) {
scroll_start_message = current_msg_list.selected_id(); scroll_start_message = current_msg_list.selected_id();
} }
process_visible_unread_messages(); process_visible_unread_messages();