Use flag to avoid loop:
evento.add(window, "load", function () { var w = window, d = document, a = d.getElementById("disqus_thread") || "", disqus_shortname = a ? (a.dataset.shortname || "") : "", embed_js_src = ("https:" == w.location.protocol ? "https" : "http") + "://" + disqus_shortname + ".disqus.com/embed.js", g = ".grid", h = ".grid-item", k = ".grid-sizer", grid = d.querySelector(g) || ""; function build_layout() { if (grid) { if (w.Packery) { var pckry = new Packery(grid, { itemSelector : h, gutter : 0 }); } else if (w.Masonry) { var msnry = new Masonry(grid, { itemSelector : h, columnWidth : k }); } } } build_layout(); if (a && disqus_shortname) { w.loadJS && loadJS(embed_js_src, function () { if (grid) { var f = !1; setInterval(function () { var disqus_thread_height = a.clientHeight || a.offsetHeight || ""; if (108 < disqus_thread_height && !1 === f) { build_layout(); f = !0; } }, 100); } }); } });
source share