mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 14:35:27 +00:00
Clean up select_zephyr
Eliminate some global variables, and other style fixes. (imported from commit 95dfbaa024d709f5b98238afcf904f3e92c8a260)
This commit is contained in:
@@ -87,19 +87,23 @@ selected_tag = '<p id="selected">▶</p>'
|
|||||||
var allow_hotkeys = true;
|
var allow_hotkeys = true;
|
||||||
|
|
||||||
function select_zephyr(next_zephyr) {
|
function select_zephyr(next_zephyr) {
|
||||||
p = $("#selected");
|
if (next_zephyr.length == 0) {
|
||||||
td = $(p).closest("td");
|
// No match, e.g. bottom or top of page
|
||||||
if (next_zephyr.length != 0) { // We are not at the bottom or top of the zephyrs.
|
return;
|
||||||
td.empty(); // Clear the previous arrow.
|
}
|
||||||
|
|
||||||
|
// Clear the previous arrow.
|
||||||
|
$("#selected").closest("td").empty();
|
||||||
|
|
||||||
next_zephyr.children("td:first").html(selected_tag);
|
next_zephyr.children("td:first").html(selected_tag);
|
||||||
$.post("update", {pointer: next_zephyr.attr("id")});
|
$.post("update", {pointer: next_zephyr.attr("id")});
|
||||||
|
|
||||||
if (($(next_zephyr).offset().top < $("#main_div").offset().top) ||
|
if (($(next_zephyr).offset().top < $("#main_div").offset().top) ||
|
||||||
($(next_zephyr).offset().top + $(next_zephyr).height() > $("#main_div").offset().top + $("#main_div").height())) {
|
($(next_zephyr).offset().top + $(next_zephyr).height() >
|
||||||
|
$("#main_div").offset().top + $("#main_div").height())) {
|
||||||
scroll_to_selected();
|
scroll_to_selected();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// NB: This just binds to current elements, and won't bind to elements
|
// NB: This just binds to current elements, and won't bind to elements
|
||||||
// created after ready() is called.
|
// created after ready() is called.
|
||||||
|
|||||||
Reference in New Issue
Block a user