From e67d6ba62c586b1a1efcd3e05b8ce3bd063d3c83 Mon Sep 17 00:00:00 2001 From: dsyoon Date: Fri, 24 Jul 2026 09:10:54 +0900 Subject: [PATCH] =?UTF-8?q?start/stop=EC=9D=B4=20=EC=9D=B4=EB=AF=B8?= =?UTF-8?q?=EC=A7=80=20=EC=8A=AC=EB=9D=BC=EC=9D=B4=EB=93=9C=EC=87=BC?= =?UTF-8?q?=EB=8F=84=20=ED=95=A8=EA=BB=98=20=EC=A0=9C=EC=96=B4=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 기존에는 음악 음소거만 바뀌어 롤링이 멈추지 않던 문제를 고친다. Co-authored-by: Cursor --- js/bestpic.js | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/js/bestpic.js b/js/bestpic.js index 29ceb41..2a1d70e 100644 --- a/js/bestpic.js +++ b/js/bestpic.js @@ -246,18 +246,36 @@ function onLoad() { function toggle() { - if (!document.getElementById('betoven').muted) { - document.getElementById('betoven').muted = true; + var audio = document.getElementById('betoven'); + var gallery = window.dreamgirlGallery; + var isRunning = gallery + ? !!gallery.isSlideshowRunning + : !!(audio && !audio.muted); + + if (isRunning) { + if (audio) { + audio.muted = true; + try { audio.pause(); } catch (e) {} + } + if (gallery && typeof gallery.pause === 'function') { + gallery.pause(); + } clearInterval(refreshIntervalId); + refreshIntervalId = null; $("#toggle").html("start"); } else { - document.getElementById('betoven').muted = false; - /* - refreshIntervalId = setInterval(function() { - var index = Math.floor(Math.random()*278) + 1; - $("#thumbs").html(""); - }, 3000); - */ + if (audio) { + audio.muted = false; + try { + var playPromise = audio.play(); + if (playPromise && typeof playPromise.catch === 'function') { + playPromise.catch(function () {}); + } + } catch (e) {} + } + if (gallery && typeof gallery.play === 'function') { + gallery.play(); + } $("#toggle").html("stop"); } }