From 26e635d27802ddfc924de732c25c787661b110f4 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 23 Jun 2026 10:56:08 -0300 Subject: [PATCH] =?UTF-8?q?Guard=20pricing-coupon=20and=20UTM=20element=20?= =?UTF-8?q?access=20in=20script.js=20=E2=80=94=20fixes=20crash=20on=20page?= =?UTF-8?q?s=20without=20pricing=20section?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/js/script.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/assets/js/script.js b/assets/js/script.js index d13ac13..841dbee 100644 --- a/assets/js/script.js +++ b/assets/js/script.js @@ -296,7 +296,8 @@ initServerLocations(); // fetch live server availability const params = new URLSearchParams(window.location.search); ["source", "medium", "campaign", "term", "content"].forEach(function (key) { const val = params.get("utm_" + key); - if (val) document.getElementById("utm_" + key).value = val; + const el = document.getElementById("utm_" + key); + if (val && el) el.value = val; }); })(); @@ -754,9 +755,10 @@ function updateCouponBadges() { } }); } -document - .getElementById("pricing-coupon") - .addEventListener("input", updateCouponBadges); +const pricingCoupon = document.getElementById("pricing-coupon"); +if (pricingCoupon) { + pricingCoupon.addEventListener("input", updateCouponBadges); +} /* ── Blog ──────────────────────────────────────────────── */ const BLOG_POSTS_PER_PAGE = 6;