${ $item.homeScores } - ${ $item.awayScores }
`, "text/html").body.children.item(0);
cache.set($key, $item_el);
return $item_el;
}
})();
if (controller.signal.aborted) break;
// 1. 修复 pageYOffset 兼容性(核心)
Object.defineProperty(window, "pageYOffset", {
get: () => document.documentElement.scrollTop || document.body.scrollTop
});
if (controller.signal.aborted) break;
if ($item.isTop === 1) {
$item_el.classList.add("is_top");
for (const $el of wrapper.children) {
if ($el.classList.contains("is_top")) continue;
wrapper.insertBefore($item_el, $el);
break;
}
} else wrapper.appendChild($item_el);
// // 3. 确保渲染完成后初始化插件(关键)
requestAnimationFrame(() => {
$("img.lazy", $item_el)
.off('appear') // 避免重复绑定
.lazyload({ effect: "fadeIn", failurelimit: 10000 });
$(window).trigger('scroll'); // 强制触发检查
});
await new Promise((resolve) => window.setTimeout(resolve, 0, void 0));
if (controller.signal.aborted) break;
}
return data.length
}
let start = 0;
console.log(wrapper, 'wrapper')
start += await render(data.slice(0, end)).then((length) => (wrapper.nextElementSibling.style.setProperty("display", (data.length > (start + length) ? "block" : "none")), length));
controller.signal.addEventListener("abort", () => wrapper.nextElementSibling.style.setProperty("display", "none"), { once: true });
wrapper.nextElementSibling.addEventListener("click", async ($event) => {
$event.preventDefault();
start += await render(data.slice(start, start + 200)).then((length) => (wrapper.nextElementSibling.style.setProperty("display", (data.length > (start + length) ? "block" : "none")), length));
}, { signal: controller.signal });
console.timeEnd("update");
loading = false;
}
/**首次更新 => update() */
const hot_id = [/* */"competition_id=2&sport_id=1",/* */"competition_id=82&sport_id=1",/* */"competition_id=108&sport_id=1",/* */"competition_id=120&sport_id=1",/* */"competition_id=129&sport_id=1",/* */"competition_id=142&sport_id=1",/* */"competition_id=542&sport_id=1",/* */"competition_id=567&sport_id=1",/* */"competition_id=568&sport_id=1",/* */"competition_id=581&sport_id=1",/* */"competition_id=582&sport_id=1",/* */"competition_id=590&sport_id=1",/* */"competition_id=1788&sport_id=1",/* */"competition_id=1&sport_id=2",/* */"competition_id=3&sport_id=2",/* */];
const api_src = new URL("/getMatchListJsonp", location.origin);
api_src.searchParams.set("days", "1");
fetch(api_src).then((response) => response.json()).then(({ matchLiveList }) => {
const list = [];
for (let i = 0; i a.matchTs.getTime() - b.matchTs.getTime());
data.unshift({ type: "2", list: list.filter((v) => v.sportId === 2) });
data.unshift({ type: "1", list: list.filter((v) => v.sportId === 1) });
data.unshift({ type: "0", list });
for (let i = wrapper.children.length - 1; i >= 0; i--) wrapper.removeChild(wrapper.children[i]);
const type = "0";
for (let i = 0; i v.matchTs.getTime())) + (3.6e+6 * 4);
while (list[end] && list[end].matchTs.getTime()