diff --git a/index.html b/index.html index e2c499d..2e179f1 100644 --- a/index.html +++ b/index.html @@ -1,635 +1,682 @@ - - - - 便签墙 - - - -
- - - + `; + + const state = { + angle, + scale: entryScale, + left, + top, + maximized: false, + closing: false, + }; + + cardStates.set(card, state); + applyTransform(card, state); + board.appendChild(card); + + requestAnimationFrame(() => { + requestAnimationFrame(() => { + state.scale = 1; + applyTransform(card, state); + card.style.opacity = "1"; + }); + }); + + if (board.children.length > maxCards) { + const oldest = board.firstElementChild; + if (oldest && oldest !== card) { + oldest.remove(); + } + } + } + + for (let i = 0; i < initialCardCount; i++) { + setTimeout(createCard, i * (isMobile ? 60 : 40)); + } + + scheduleNextSpawn(); + + document.addEventListener("visibilitychange", () => { + if (!document.hidden) { + scheduleNextSpawn(); + } + }); + + if (typeof pointerMediaQuery.addEventListener === "function") { + pointerMediaQuery.addEventListener("change", syncMobileMode); + } else if (typeof pointerMediaQuery.addListener === "function") { + pointerMediaQuery.addListener(syncMobileMode); + } + + window.addEventListener("resize", syncMobileMode); + +