commento.js: compute mobileView only once

This commit is contained in:
Adhityaa Chandrasekar 2019-02-20 10:55:51 -05:00
parent 352c93bf88
commit f4489c9921

View File

@ -85,6 +85,7 @@
var popupBoxType = "login"; var popupBoxType = "login";
var oauthButtonsShown = false; var oauthButtonsShown = false;
var selfHex = undefined; var selfHex = undefined;
var mobileView = null;
function $(id) { function $(id) {
@ -661,7 +662,6 @@
var cards = create("div"); var cards = create("div");
cur.forEach(function(comment) { cur.forEach(function(comment) {
var mobileView = root.getBoundingClientRect()["width"] < 450;
var commenter = commenters[comment.commenterHex]; var commenter = commenters[comment.commenterHex];
var avatar; var avatar;
var card = create("div"); var card = create("div");
@ -1619,6 +1619,10 @@
return; return;
} }
if (mobileView === null) {
mobileView = root.getBoundingClientRect()["width"] < 450;
}
classAdd(root, "root"); classAdd(root, "root");
loginBoxCreate(); loginBoxCreate();