Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
tommy-mor committed Nov 8, 2024
1 parent 90c1cc1 commit 37966e8
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ <h1>GitHub Repository File Viewer</h1>
this.remainingSeconds = this.totalSeconds;
this.label = label;
this.interval = null;
this.finishInterval = null;
this.element = this.createTimerElement();
}

Expand Down Expand Up @@ -461,16 +462,33 @@ <h1>GitHub Repository File Viewer</h1>

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;

Expand Down

0 comments on commit 37966e8

Please sign in to comment.