From a1cea767fe5d06968a07ee571e541486aa2f60d8 Mon Sep 17 00:00:00 2001 From: Jessica McKellar Date: Thu, 11 Jul 2013 15:36:42 -0400 Subject: [PATCH] Reduce repeated height calculations in get_new_heights. (imported from commit bc5422519d048d6be6bc53e16bd1597d704c1ff5) --- zephyr/static/js/ui.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/zephyr/static/js/ui.js b/zephyr/static/js/ui.js index afe46f12c3..8ccb8c43f8 100644 --- a/zephyr/static/js/ui.js +++ b/zephyr/static/js/ui.js @@ -267,23 +267,19 @@ function need_skinny_mode() { function get_new_heights() { var res = {}; + var viewport_height = viewport.height(); + var top_navbar_height = $("#top_navbar").height(); - res.bottom_whitespace_height = - viewport.height() * 0.4; + res.bottom_whitespace_height = viewport_height * 0.4; - res.main_div_min_height = - viewport.height() - - $("#top_navbar").height(); + res.main_div_min_height = viewport_height - top_navbar_height; - res.bottom_sidebar_height = - viewport.height() - - $("#top_navbar").height() + res.bottom_sidebar_height = viewport_height - top_navbar_height - $(".upper_sidebar").height() - 40; res.right_sidebar_height = - viewport.height() - - $("#top_navbar").height() + viewport_height - top_navbar_height - $("#notifications-area").height() - 14 // margin for right sidebar - 10; // padding on notifications bar