`;
}
function renderScrollList(track, data, type) {
const doubled = data.concat(data);
track.innerHTML = doubled.map((item, index) => {
const name = escapeHtml(item.name);
const money = escapeHtml(item.money);
let media;
if (type === "left") {
media = item.icon
? `
`
: ``;
} else {
media = item.avatar
? `
`
: fallbackAvatar(item.name);
}
if (type === "right") {
return `${media}`;
}
ibalik `
`).join("");
requestAnimationFrame(() => setJackpot(value, true));
}
function setJackpot(value, firstRun = false) {
const digits = String(value).padStart(8, "0").slice(-8).split("");
const digitWindow = jackpotBox.querySelector(".jp-digit-window");
if (!digitWindow) return;
const strips = jackpotBox.querySelectorAll(".jp-digit-strip");
const digitHeight = digitWindow.clientHeight;
strips.forEach((strip, i) => {
const nextDigit = Number(digits[i]);
const currentDigit = Number(strip.dataset.currentDigit || 0);
strip.style.transition = "none";
strip.style.transform = `translateY(-${currentDigit * digitHeight}px)`;
window.requestAnimationFrame(() => {
const rounds = firstRun ? 2 + (i % 2) : 4 + (i % 3);
const targetIndex = rounds * 10 + nextDigit;
strip.style.transition = `transform ${firstRun ? 900 : 1250}ms cubic-bezier(.17,.67,.22,1.12)`;
strip.style.transitionDelay = `${i * 70}ms`;
strip.style.transform = `translateY(-${targetIndex * digitHeight}px)`;
strip.dataset.currentDigit = String(nextDigit);
});
});
jackpotBox.setAttribute("aria-label", String(value));
}
initDigits(config.jackpotValue);
if (config.autoIncrease) {
window.setInterval(() => {
config.jackpotValue += Math.floor(Math.random() * 60) + 8;
setJackpot(config.jackpotValue);
}, 5200);
}
if (window.ResizeObserver) {
const ro = new ResizeObserver(() => setJackpot(config.jackpotValue, true));
ro.observe(root);
} else {
window.addEventListener("resize", () => setJackpot(config.jackpotValue, true));
}
root.querySelector("[data-jp-button]").addEventListener("click", (event) => {
event.stopPropagation();
if (config.openInNewTab) {
window.open(config.targetLink, "_blank", "noopener,noreferrer");
} else {
window.location.href = config.targetLink;
}
});
});
})();
${name}
${money}
${media}
`;
}).join("");
track.querySelectorAll("img[data-fallback]").forEach((img) => {
img.addEventListener("error", () => {
const fallbackText = img.getAttribute("data-fallback") || "U";
const div = document.createElement("div");
div.className = img.className;
div.innerHTML = fallbackText;
img.replaceWith(div);
}, { once: true });
});
}
renderScrollList(root.querySelector("[data-jp-left-track]"), leftData, "left");
renderScrollList(root.querySelector("[data-jp-right-track]"), rightData, "right");
const jackpotBox = root.querySelector("[data-jp-number]");
function buildDigitColumn() {
let html = "";
for (let r = 0; r < 8; r++) {
for (let d = 0; d <= 9; d++) html += `${d}`;
}
return html;
}
function initDigits(value) {
const digits = String(value).padStart(8, "0").slice(-8).split("");
jackpotBox.innerHTML = digits.map(() => `
${name}
${money}
${buildDigitColumn()}




