mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 17:36:27 +00:00
Optimize update_floating_recipient_bar's showing-and-hiding code.
(imported from commit 6cd67d9c7bf418ae78288363636ee75fdc3fcada)
This commit is contained in:
@@ -126,22 +126,33 @@ function update_autocomplete() {
|
|||||||
autocomplete_needs_update = false;
|
autocomplete_needs_update = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var old_label;
|
||||||
|
var is_narrowbar_showing = false;
|
||||||
function replace_narrowbar(desired_label) {
|
function replace_narrowbar(desired_label) {
|
||||||
if (desired_label.children(".message_newstyle_stream").length !== 0) {
|
if (desired_label !== old_label) {
|
||||||
$("#current_label_stream td:first").replaceWith(desired_label.children(".message_newstyle_stream").clone());
|
if (desired_label.children(".message_newstyle_stream").length !== 0) {
|
||||||
$("#current_label_stream td:last").replaceWith(desired_label.children(".message_newstyle_subject").clone());
|
$("#current_label_stream td:first").replaceWith(desired_label.children(".message_newstyle_stream").clone());
|
||||||
$("#current_label_huddle").css('display', 'none');
|
$("#current_label_stream td:last").replaceWith(desired_label.children(".message_newstyle_subject").clone());
|
||||||
$("#current_label_stream").css('display', 'table-row');
|
$("#current_label_huddle").css('display', 'none');
|
||||||
} else {
|
$("#current_label_stream").css('display', 'table-row');
|
||||||
$("#current_label_huddle td:first").replaceWith(desired_label.children(".message_newstyle_pm").clone());
|
} else {
|
||||||
$("#current_label_stream").css('display', 'none');
|
$("#current_label_huddle td:first").replaceWith(desired_label.children(".message_newstyle_pm").clone());
|
||||||
$("#current_label_huddle").css('display', 'table-row');
|
$("#current_label_stream").css('display', 'none');
|
||||||
|
$("#current_label_huddle").css('display', 'table-row');
|
||||||
|
}
|
||||||
|
old_label = desired_label;
|
||||||
|
}
|
||||||
|
if (!is_narrowbar_showing) {
|
||||||
|
$(".floating_recipient_bar").css('visibility', 'visible');
|
||||||
|
is_narrowbar_showing = true;
|
||||||
}
|
}
|
||||||
$(".floating_recipient_bar").css('visibility', 'visible');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function hide_narrowbar() {
|
function hide_narrowbar() {
|
||||||
$(".floating_recipient_bar").css('visibility', 'hidden');
|
if (is_narrowbar_showing) {
|
||||||
|
$(".floating_recipient_bar").css('visibility', 'hidden');
|
||||||
|
is_narrowbar_showing = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_floating_recipient_bar() {
|
function update_floating_recipient_bar() {
|
||||||
|
|||||||
Reference in New Issue
Block a user