From 37966e85064e52e750c26cf2ff98e3969c2619c2 Mon Sep 17 00:00:00 2001 From: tommy-mor Date: Fri, 8 Nov 2024 10:06:26 -0500 Subject: [PATCH] fixed --- index.html | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index e035b4b..04ce1a4 100644 --- a/index.html +++ b/index.html @@ -399,6 +399,7 @@

GitHub Repository File Viewer

this.remainingSeconds = this.totalSeconds; this.label = label; this.interval = null; + this.finishInterval = null; this.element = this.createTimerElement(); } @@ -461,16 +462,33 @@

GitHub Repository File Viewer

finish() { this.pause(); - playFinishSound(); this.element.classList.add('finished'); - this.element.querySelector('button').textContent = 'Done'; - this.element.querySelector('button').disabled = true; + + // Change button text to OK and keep it enabled + const button = this.element.querySelector('button'); + button.textContent = 'OK'; + button.disabled = false; + + playFinishSound(); + // Start playing repeating sound + this.finishInterval = setInterval(() => { + playFinishSound(); + }, 3000); // Repeat every second + + // Update button click handler + button.onclick = () => { + clearInterval(this.finishInterval); + clearInterval(this.interval); + button.disabled = true; + button.textContent = 'Done'; + button.onclick = null; + }; } } // Function to parse and replace timer blocks in text function parseTimerBlocks(text) { - const regex = /\[timer\s+(\d+)m(?:\s*(\d+)s)?\s+([^\]]+)\]/g; + const regex = /\[timer\s+(?:(\d+)m\s*)?(?:(\d+)s)?\s+([^\]]+)\]/g; const fragment = document.createDocumentFragment(); let lastIndex = 0;