Zum Hauptinhalt springen
clawam tools
Werkzeuge Dokumente Daoark EN Startseite Startseite / Leben & Alltag › Startseite manifest.json totalRounds) { clearInterval(timer); showResult(' 全部 ' + totalRounds + ' 轮完成!', '总计: ' + (totalRounds * workMin) + ' 分钟工作'); beep(880, 0.15); setTimeout(function() { beep(1100, 0.15); }, 200); setTimeout(function() { beep(1320, 0.4); }, 400); return; } phase = 'work'; totalSec = workMin * 60; remainSec = totalSec; } } updateDisplay(); } function start() { workMin = parseInt(getVal('work-min'), 10); restMin = parseInt(getVal('rest-min'), 10); totalRounds = parseInt(getVal('rounds'), 10); if (!(workMin >= 1 && workMin <= 120)) { showError('工作时间 1-120'); return; } if (!(restMin >= 1 && restMin <= 60)) { showError('休息时间 1-60'); return; } if (!(totalRounds >= 1 && totalRounds <= 20)) { showError('轮数 1-20'); return; } if (timer) { clearInterval(timer); timer = null; } if (phase === 'work' && remainSec === 0) { phase = 'work'; round = 1; totalSec = workMin * 60; remainSec = totalSec; } timer = setInterval(tick, 1000); updateDisplay(); } function pause() { if (timer) { clearInterval(timer); timer = null; showResult('已暂停: ' + formatTime(remainSec) + ' / ' + formatTime(totalSec), ''); } } function reset() { if (timer) { clearInterval(timer); timer = null; } phase = 'work'; round = 1; remainSec = 0; totalSec = 0; var ra = $('result-area'); ra.hidden = true; ra.style.display = 'none'; } $('btn-start').addEventListener('click', start); $('btn-pause').addEventListener('click', pause); $('btn-reset').addEventListener('click', reset); })();