From f4489c99210f64429060a492132bfd2cccb69394 Mon Sep 17 00:00:00 2001 From: Adhityaa Chandrasekar Date: Wed, 20 Feb 2019 10:55:51 -0500 Subject: [PATCH] commento.js: compute mobileView only once --- frontend/js/commento.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/js/commento.js b/frontend/js/commento.js index 1b4935d..2bd913f 100644 --- a/frontend/js/commento.js +++ b/frontend/js/commento.js @@ -85,6 +85,7 @@ var popupBoxType = "login"; var oauthButtonsShown = false; var selfHex = undefined; + var mobileView = null; function $(id) { @@ -661,7 +662,6 @@ var cards = create("div"); cur.forEach(function(comment) { - var mobileView = root.getBoundingClientRect()["width"] < 450; var commenter = commenters[comment.commenterHex]; var avatar; var card = create("div"); @@ -1619,6 +1619,10 @@ return; } + if (mobileView === null) { + mobileView = root.getBoundingClientRect()["width"] < 450; + } + classAdd(root, "root"); loginBoxCreate();