From bb089191b3c83bb065b5d466d75ab68bea2bfb1b Mon Sep 17 00:00:00 2001 From: gm Date: Sat, 25 Jul 2026 23:25:33 +0900 Subject: [PATCH] =?UTF-8?q?=EB=AA=85=EC=96=B8=EC=9D=84=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EB=A1=9C=EB=93=9C=20=EC=8B=9C=20=EB=AF=B8?= =?UTF-8?q?=EB=A6=AC=20=EB=B0=9B=EC=95=84=20=EC=A0=84=EC=97=AD=20=EB=B3=80?= =?UTF-8?q?=EC=88=98=EB=A1=9C=20=EB=93=A4=EA=B3=A0=20=EC=9E=88=EB=8D=98=20?= =?UTF-8?q?=EB=B0=A9=EC=8B=9D=EC=9D=84=20=EB=B2=84=EB=A6=AC=EA=B3=A0,=20?= =?UTF-8?q?=EB=B0=94=EA=B5=AC=EB=8B=88=EA=B0=80=20=EC=B0=B0=20=EB=95=8C?= =?UTF-8?q?=EB=A7=8C=20quotes.txt=EB=A5=BC=20fetch=ED=95=B4=EC=84=9C=20?= =?UTF-8?q?=EA=B7=B8=20=EC=9E=90=EB=A6=AC=EC=97=90=EC=84=9C=20=EC=93=B0?= =?UTF-8?q?=EA=B3=A0=20=EB=B2=84=EB=A6=AC=EB=8F=84=EB=A1=9D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20(=EC=A7=80=EC=97=AD=20=EB=B3=80=EC=88=98=EB=9D=BC?= =?UTF-8?q?=20=EC=82=AC=EC=9A=A9=20=ED=9B=84=20=EC=B0=B8=EC=A1=B0=EA=B0=80?= =?UTF-8?q?=20=EC=95=88=20=EB=82=A8=EC=9D=8C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5 --- index.html | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/index.html b/index.html index 01d74e5..c05af09 100644 --- a/index.html +++ b/index.html @@ -137,12 +137,6 @@ const confettiLayer = document.getElementById('confettiLayer'); const basketCountEl = document.getElementById('basketCount'); const quoteEl = document.getElementById('quoteText'); -let quotes = []; -fetch('./quotes.txt') - .then(r => (r.ok ? r.text() : '')) - .then(text => { quotes = text.split('\n').map(s => s.trim()).filter(Boolean); }) - .catch(() => {}); - // ---------- renderer / scene / camera ---------- const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: false, powerPreference: 'low-power' }); renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)); @@ -591,16 +585,24 @@ function catchInBasket(apple){ if (basketCount >= BASKET_FULL) celebrate(); } -function celebrate(){ +// 명언은 축하 화면이 뜰 때만 그 자리에서 불러와 쓰고, 목록을 어디에도 저장해두지 +// 않는다 — 함수가 끝나면 로컬 변수(list)라 참조가 안 남아 바로 GC 대상이 된다. +async function celebrate(){ celebrateEl.classList.add('show'); - if (quotes.length){ - quoteEl.textContent = quotes[Math.floor(Math.random() * quotes.length)]; - quoteEl.classList.add('show'); - } else { - quoteEl.classList.remove('show'); - } + quoteEl.classList.remove('show'); spawnConfetti(); setTimeout(clearBasket, 2800); + + try { + const res = await fetch('./quotes.txt'); + if (!res.ok) return; + const text = await res.text(); + const list = text.split('\n').map(s => s.trim()).filter(Boolean); + if (list.length){ + quoteEl.textContent = list[Math.floor(Math.random() * list.length)]; + quoteEl.classList.add('show'); + } + } catch {} } function spawnConfetti(){