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);
|
const params = new URLSearchParams(window.location.search);
|
||||||
["source", "medium", "campaign", "term", "content"].forEach(function (key) {
|
["source", "medium", "campaign", "term", "content"].forEach(function (key) {
|
||||||
const val = params.get("utm_" + 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
|
const pricingCoupon = document.getElementById("pricing-coupon");
|
||||||
.getElementById("pricing-coupon")
|
if (pricingCoupon) {
|
||||||
.addEventListener("input", updateCouponBadges);
|
pricingCoupon.addEventListener("input", updateCouponBadges);
|
||||||
|
}
|
||||||
|
|
||||||
/* ── Blog ──────────────────────────────────────────────── */
|
/* ── Blog ──────────────────────────────────────────────── */
|
||||||
const BLOG_POSTS_PER_PAGE = 6;
|
const BLOG_POSTS_PER_PAGE = 6;
|
||||||
|
|||||||
Reference in New Issue
Block a user