$(document).ready(function() {
// console.log($('.main-section').css('background-image', 'url(("https://tigerbeercny26.skale.today/file/images/asset6.png") !important)'));
if(window.location.pathname !== '/') {
$('.main-section').css({
'background-image': 'url("https://tigerbeercny26.skale.today/file/images/asset6.png")',
'background-size': 'cover',
'background-position': 'center',
'background-repeat': 'no-repeat'
});
$('.voucher_single-claimable').text('CLICK TO REDEEM');
}
let pathname = window?.location?.pathname;
if (pathname.indexOf('2iger-122025-6') !== -1) {
$('.voucher_single-tc.default-font-color').html("
It cannot be used in conjunction with other discounts or promotions.
The voucher is applicable exclusively to the Tiger 24 Regular (24-can pack).
Terms & Conditions apply.
");
$('#voucher_single span:contains("This voucher is only applicable at")').html("This voucher is valid at all FairPrice outlets nationwide until 4 March 2026.");
}
if (pathname.indexOf('2iger-122025-8') !== -1) {
$('.voucher_single-tc.default-font-color').html("It cannot be used in conjunction with other discounts or promotions.
The voucher is applicable exclusively to the Tiger 24 Regular (24-can pack).
Terms & Conditions apply.
");
$('#voucher_single span:contains("This voucher is only applicable at")').html("This voucher is valid at all ShengSiong outlets nationwide until 4 March 2026.");
}
if (pathname.indexOf('2iger-122025-9') !== -1) {
$('.voucher_single-tc.default-font-color').html("It cannot be used in conjunction with other discounts or promotions.
The voucher is applicable exclusively to the Tiger Original 2-can Pack.
Terms & Conditions apply.
");
$('#voucher_single span:contains("This voucher is only applicable at")').html("This voucher is valid at all 7-Eleven outlets nationwide until 4 March 2026.");
}
if (pathname.indexOf('2iger-122025-14') !== -1) {
$('.voucher_single-tc.default-font-color').html("It cannot be used in conjunction with other discounts or promotions.
The voucher is applicable exclusively to the Tiger 24 Regular (24-can pack).
Terms & Conditions apply.
");
$('#voucher_single span:contains("This voucher is only applicable at")').html("This voucher is valid at all Giant outlets nationwide until 4 March 2026.");
}
if (pathname.indexOf('2iger-122025-7') !== -1) {
$('.voucher_single-tc.default-font-color').html("It cannot be used in conjunction with other discounts or promotions.
The voucher is applicable exclusively to the Tiger 24 Regular (24-can pack).
Terms & Conditions apply.
");
$('#voucher_single span:contains("This voucher is only applicable at")').html("This voucher is valid at all Cold Storage outlets nationwide until 4 March 2026.");
}
if (pathname.indexOf('2iger-122025-11') !== -1) {
$('.voucher_single-location.default-font-color').css('display', 'none');
$('.voucher_single-tc.default-font-color').html("Click the link below to view the roadshow schedules.
https://tigerbeercny26.skale.today/file/images/roadshow-schedule.jpeg
Terms & Conditions apply.
");
$('#voucher_single span:contains("This voucher is only applicable at")').html("This voucher is valid only on the roadshow dates and schedules listed below.");
}
const TARGET_SERIES = "2iger-122025-6";
const NEW_TEXT = "Click the button link below to go to the Fairprice App";
function getVoucherSeriesFromUrl() {
const lastSegment = (window.location.pathname.split("/").filter(Boolean).pop() || "").trim();
if (!lastSegment) return "";
const parts = lastSegment.split("-");
return parts.length >= 3 ? parts.slice(0, 3).join("-") : lastSegment;
}
function setPromoMechTitle() {
const el = document.querySelector("#use_voucher-modal #promo_mech_title");
if (!el) return false;
if (el.textContent.trim() !== NEW_TEXT) {
el.textContent = NEW_TEXT;
}
return true;
}
function runOnlyForTargetSeries() {
return getVoucherSeriesFromUrl() === TARGET_SERIES;
}
function installHooks() {
setPromoMechTitle();
// update text every time the modal is shown
const modal = document.getElementById("use_voucher-modal");
if (modal) {
modal.addEventListener("shown.bs.modal", () => setPromoMechTitle());
}
// If modal content is replaced after claim/scan states, re-apply the text
const root = document.body;
const observer = new MutationObserver(() => {
const modalEl = document.getElementById("use_voucher-modal");
if (modalEl && modalEl.classList.contains("show")) {
setPromoMechTitle();
}
});
observer.observe(root, {
childList: true,
subtree: true,
attributes: true,
attributeFilter: ["class"],
});
}
if (!runOnlyForTargetSeries()) return;
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", installHooks);
} else {
installHooks();
}
});
// only affects pages whose URL path contains "/use", the image asset change is done in the frontend-custom.css
// here is just to add a class on /use page for the body
(function () {
function isUsePage() {
return window.location.pathname.indexOf("/use") !== -1;
}
function markUsePage() {
if (isUsePage()) {
document.body.classList.add("is-use-page");
} else {
document.body.classList.remove("is-use-page");
}
}
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", markUsePage);
} else {
markUsePage();
}
// handle if site changes routes without full reload
var _pushState = history.pushState;
history.pushState = function () {
_pushState.apply(history, arguments);
setTimeout(markUsePage, 0);
};
window.addEventListener("popstate", function () {
setTimeout(markUsePage, 0);
});
})();