Deem Worthy (127) Damaged
$0.49 Excl. tax
In stock (1)
/* KINGSLAYER CALENDARS - AUTOMATIC EXPIRED DAYS */
(function () {
"use strict";
function updateKingslayerCalendars() {
const parts = new Intl.DateTimeFormat("en-US", {
timeZone: "America/Los_Angeles",
year: "numeric",
month: "numeric",
day: "numeric"
}).formatToParts(new Date());
const getPart = type =>
Number(parts.find(p => p.type === type).value);
const today =
getPart("year") * 10000 +
getPart("month") * 100 +
getPart("day");
const monthNames = [
"JANUARY", "FEBRUARY", "MARCH",
"APRIL", "MAY", "JUNE",
"JULY", "AUGUST", "SEPTEMBER",
"OCTOBER", "NOVEMBER", "DECEMBER"
];
document.querySelectorAll("table").forEach(table => {
// Find the calendar heading above this table.
const calendar = table.parentElement?.parentElement;
if (!calendar) return;
const heading = calendar.querySelector("div");
if (!heading) return;
const match = heading.textContent.match(
/\b(JANUARY|FEBRUARY|MARCH|APRIL|MAY|JUNE|JULY|AUGUST|SEPTEMBER|OCTOBER|NOVEMBER|DECEMBER)\s+(20\d{2})\b/i
);
if (!match) return;
const month = monthNames.indexOf(
match[1].toUpperCase()
) + 1;
const year = Number(match[2]);
table.querySelectorAll("td").forEach(cell => {
const dateElement = cell.querySelector("div:first-child");
if (!dateElement) return;
const dateText = dateElement.textContent.trim();
if (!/^\d{1,2}$/.test(dateText)) return;
const day = Number(dateText);
const cellDate = year * 10000 + month * 100 + day;
const expired = cellDate < today;
cell.classList.toggle(
"ks-calendar-expired",
expired
);
cell.querySelectorAll("a").forEach(link => {
if (expired) {
link.setAttribute("tabindex", "-1");
link.setAttribute("aria-disabled", "true");
} else {
link.removeAttribute("tabindex");
link.removeAttribute("aria-disabled");
}
});
});
});
}
function initializeCalendarExpiration() {
updateKingslayerCalendars();
setInterval(updateKingslayerCalendars, 60000);
}
if (document.readyState === "loading") {
document.addEventListener(
"DOMContentLoaded",
initializeCalendarExpiration
);
} else {
initializeCalendarExpiration();
}
document.addEventListener("click", function (event) {
const link = event.target.closest(
".ks-calendar-expired a"
);
if (link) event.preventDefault();
});
})();