mirror of
http://nostr-git-proxy.forgejo.svc.cluster.local/git/45387ca441053e230b2126802005eb03767ab59d84555e8bac86b6e7def14e27/myadhd
synced 2026-09-23 20:23:10 +00:00
fix(sprint4): logic for Visual pie clock & interval grounding chimes
This commit is contained in:
parent
c8bb985212
commit
c654e85c8d
3 changed files with 34 additions and 14 deletions
|
|
@ -322,7 +322,8 @@
|
|||
}
|
||||
}
|
||||
|
||||
function timerStop() { clearInterval(timer.iv); timer.iv = null; timer.running = false; timerPersist(); }
|
||||
function timerStop() { clearInterval(timer.iv); timer.iv = null; timer.running = false;
|
||||
if (window.groundingIv) clearInterval(groundingIv); timerPersist(); }
|
||||
|
||||
function timerComplete() {
|
||||
timerStop(); beep();
|
||||
|
|
@ -356,8 +357,10 @@
|
|||
}
|
||||
|
||||
$('#timer-start').addEventListener('click', function () {
|
||||
if (window.setGroundingInterval) setGroundingInterval();
|
||||
if (timer.running) { timerStop(); $('#timer-start').textContent = 'resume'; timerPaint(); return; }
|
||||
timer.running = true;
|
||||
if (window.setGroundingInterval) setGroundingInterval();
|
||||
$('#timer-start').textContent = 'pause';
|
||||
timer.iv = setInterval(function () {
|
||||
timer.left--;
|
||||
|
|
@ -365,6 +368,7 @@
|
|||
if (timer.left <= 0) {
|
||||
timerComplete();
|
||||
return;
|
||||
if (window.groundingIv) clearInterval(groundingIv);
|
||||
}
|
||||
timerPaint();
|
||||
}, 1000);
|
||||
|
|
|
|||
|
|
@ -109,3 +109,19 @@ function setupAudioUI() {
|
|||
document.addEventListener('DOMContentLoaded', () => {
|
||||
setupAudioUI();
|
||||
});
|
||||
|
||||
|
||||
window.playGroundingPing = function() {
|
||||
if (!audioCtx) initAudio();
|
||||
var osc = audioCtx.createOscillator();
|
||||
var gain = audioCtx.createGain();
|
||||
osc.type = 'sine';
|
||||
osc.frequency.setValueAtTime(528, audioCtx.currentTime); // 528hz droplet
|
||||
gain.gain.setValueAtTime(0, audioCtx.currentTime);
|
||||
gain.gain.linearRampToValueAtTime(0.3, audioCtx.currentTime + 0.1);
|
||||
gain.gain.exponentialRampToValueAtTime(0.001, audioCtx.currentTime + 1.5);
|
||||
osc.connect(gain);
|
||||
gain.connect(masterGain);
|
||||
osc.start();
|
||||
osc.stop(audioCtx.currentTime + 1.5);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue