mirror of https://github.com/zulip/zulip.git
Limit jQuery calls in ui.left_userlist_get_new_heights().
Calling $('#foo') is expensive, so if you need it twice, you should store it in a variable. I did this for stream_filters and user_presences, and added the expectOne() call for them as well. (imported from commit 69e689e28b1248a93ef426a89c14033d2fb36104)
This commit is contained in:
parent
2f6d722d9b
commit
6354b712fc
|
@ -419,8 +419,11 @@ function left_userlist_get_new_heights() {
|
|||
var invite_user_link_height = $("#invite-user-link").outerHeight(true) || 0;
|
||||
var share_the_love_height = $("#share-the-love").is(":visible") ? $("#share-the-love").outerHeight(true) : 0;
|
||||
|
||||
var stream_filters_real_height = $("#stream_filters").prop("scrollHeight");
|
||||
var user_list_real_height = $("#user_presences").prop("scrollHeight");
|
||||
var stream_filters = $('#stream_filters').expectOne();
|
||||
var user_presences = $('#user_presences').expectOne();
|
||||
|
||||
var stream_filters_real_height = stream_filters.prop("scrollHeight");
|
||||
var user_list_real_height = user_presences.prop("scrollHeight");
|
||||
|
||||
res.bottom_whitespace_height = viewport_height * 0.4;
|
||||
|
||||
|
@ -435,9 +438,9 @@ function left_userlist_get_new_heights() {
|
|||
- $("#global_filters").outerHeight(true)
|
||||
- $("#streams_header").outerHeight(true)
|
||||
- $("#userlist-header").outerHeight(true)
|
||||
- parseInt($("#stream_filters").css("marginBottom"),10)
|
||||
- parseInt($("#user_presences").css("marginTop"), 10)
|
||||
- parseInt($("#user_presences").css("marginBottom"), 10)
|
||||
- parseInt(stream_filters.css("marginBottom"),10)
|
||||
- parseInt(user_presences.css("marginTop"), 10)
|
||||
- parseInt(user_presences.css("marginBottom"), 10)
|
||||
- invite_user_link_height
|
||||
- share_the_love_height
|
||||
- 15;
|
||||
|
|
Loading…
Reference in New Issue