Guard pricing-coupon and UTM element access in script.js — fixes crash on pages without pricing section
This commit is contained in:
+6
-4
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user