From e6f7299c71df47c28f3fa21b1443678c618291be Mon Sep 17 00:00:00 2001 From: Will Faught Date: Sun, 1 Jan 2023 12:24:46 -0800 Subject: [PATCH] Resize only divs that have iframes --- layouts/partials/paige/scripts.html | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/layouts/partials/paige/scripts.html b/layouts/partials/paige/scripts.html index d462436f..31eb6a2a 100644 --- a/layouts/partials/paige/scripts.html +++ b/layouts/partials/paige/scripts.html @@ -15,10 +15,17 @@ function paigeResize() { } else { w = parseFloat(mw.substring(0, mw.length - 2)); } - var es = document.querySelectorAll('section[class="paige-content"] > div:not([class="footnotes"], [class="highlight"])'); + var es = document.querySelectorAll('section[class="paige-content"] > div'); for (var i = 0; i < es.length; i++) { var e = es[i]; - if (e.offsetWidth !== w) { + var iframe = false; + for (var j = 0; j < e.children.length; j++) { + if (e.children.item(j).tagName.toLowerCase() === "iframe") { + iframe = true; + break; + } + } + if (iframe && e.offsetWidth !== w) { e.style.width = w + "px"; } }