Guard pricing-coupon and UTM element access in script.js — fixes crash on pages without pricing section

This commit is contained in:
Oliver
2026-06-23 10:56:08 -03:00
parent b6c72e159a
commit 26e635d278
+6 -4
View File
@@ -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;