跳至主要內容
Skip to content
const url = new URL(/tag/電子老虎機爆分規律/window.location.href);
let needClean = false;
// 3. 找 / 建立分頁按鈕容器
let pager = document.querySelector('.at99-pagination');
if (!pager) {
pager = document.createElement('div');
pager.className = 'at99-pagination';
list.parentNode.insertBefore(pager, list.nextSibling);
}
const pageCount = Math.ceil(total / perPage);
function showPage(page) {
const p = Math.max(1, Math.min(page, pageCount));
const start = (p - 1) * perPage;
const end = start + perPage;
items.forEach((item, i) => {
item.style.display = (i >= start && i < end) ? '' : 'none';
});
pager.querySelectorAll('button').forEach(btn => {
btn.classList.toggle('is-active', Number(btn.dataset.page) === p);
});
// 再保險一次:切頁時永遠把網址鎖在原本路徑(不帶任何參數)
try {
const url = new URL(/tag/電子老虎機爆分規律/window.location.href);
history.replaceState(null, '', url.pathname + url.hash);
} catch (e) {
// ignore
}
}