Spaces:
Running
Running
File size: 27,145 Bytes
48266ea | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ZenPomo Pro - Advanced Focus Timer</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.05); }
100% { transform: scale(1); }
}
.pulse-animation {
animation: pulse 2s infinite;
}
.progress-ring__circle {
transition: stroke-dashoffset 0.35s;
transform: rotate(-90deg);
transform-origin: 50% 50%;
}
.tab-active {
background-color: rgba(255, 255, 255, 0.2);
}
.volume-slider {
-webkit-appearance: none;
width: 100%;
height: 6px;
border-radius: 3px;
background: rgba(255, 255, 255, 0.2);
outline: none;
}
.volume-slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 16px;
height: 16px;
border-radius: 50%;
background: white;
cursor: pointer;
}
.volume-slider::-moz-range-thumb {
width: 16px;
height: 16px;
border-radius: 50%;
background: white;
cursor: pointer;
}
</style>
</head>
<body class="bg-gradient-to-br from-indigo-900 to-purple-800 min-h-screen text-white font-sans">
<div class="container mx-auto px-4 py-8 flex flex-col items-center">
<header class="mb-8 text-center">
<h1 class="text-4xl font-bold mb-2">ZenPomo Pro</h1>
<p class="text-indigo-200">Enhance your focus with ambient sounds</p>
</header>
<div class="bg-white/10 backdrop-blur-sm rounded-2xl p-6 w-full max-w-md shadow-xl">
<!-- Timer Modes -->
<div class="flex justify-center mb-6 bg-indigo-800/30 rounded-full p-1">
<button id="pomodoro-btn" class="tab-active px-4 py-2 rounded-full font-medium transition-all">Pomodoro</button>
<button id="short-break-btn" class="px-4 py-2 rounded-full font-medium transition-all">Short Break</button>
<button id="long-break-btn" class="px-4 py-2 rounded-full font-medium transition-all">Long Break</button>
<button id="custom-btn" class="px-4 py-2 rounded-full font-medium transition-all">Custom</button>
</div>
<!-- Timer Display -->
<div class="relative flex justify-center mb-8">
<svg class="w-64 h-64">
<circle
class="text-indigo-700/30"
stroke-width="8"
stroke="currentColor"
fill="transparent"
r="112"
cx="128"
cy="128"
/>
<circle
id="progress-ring"
class="progress-ring__circle text-indigo-400"
stroke-width="8"
stroke-linecap="round"
stroke="currentColor"
fill="transparent"
r="112"
cx="128"
cy="128"
stroke-dasharray="704"
stroke-dashoffset="0"
/>
</svg>
<div class="absolute inset-0 flex flex-col items-center justify-center">
<div id="time-display" class="text-6xl font-bold mb-2">25:00</div>
<div class="flex space-x-3">
<button id="start-btn" class="bg-white text-indigo-800 px-6 py-3 rounded-full font-bold hover:bg-indigo-100 transition-all">
START
</button>
<button id="reset-btn" class="bg-indigo-800/30 text-white px-4 py-3 rounded-full font-bold hover:bg-indigo-800/50 transition-all">
<i class="fas fa-redo"></i>
</button>
</div>
</div>
</div>
<!-- Custom Time Input (Hidden by default) -->
<div id="custom-time-container" class="hidden bg-indigo-800/20 rounded-xl p-4 mb-6">
<h3 class="font-medium mb-3 text-center">Set Custom Time</h3>
<div class="flex items-center justify-center space-x-4">
<div class="flex items-center">
<button id="custom-decrease" class="bg-indigo-800/30 rounded-l-md px-3 py-2 hover:bg-indigo-800/50">
<i class="fas fa-minus"></i>
</button>
<input id="custom-time" type="number" min="1" max="120" value="25"
class="w-16 bg-indigo-800/30 px-3 py-2 text-center border-l-0 border-r-0">
<button id="custom-increase" class="bg-indigo-800/30 rounded-r-md px-3 py-2 hover:bg-indigo-800/50">
<i class="fas fa-plus"></i>
</button>
</div>
<button id="apply-custom-time" class="bg-indigo-600 px-4 py-2 rounded-md hover:bg-indigo-700">
Apply
</button>
</div>
</div>
<!-- Ambient Sounds -->
<div class="bg-indigo-800/20 rounded-xl p-4 mb-6">
<h3 class="font-medium mb-3 text-center">Ambient Sounds</h3>
<div class="grid grid-cols-2 gap-3 mb-3">
<button id="rain-sound-btn" class="sound-btn bg-indigo-800/30 rounded-md px-3 py-2 hover:bg-indigo-800/50 transition-all flex items-center justify-center">
<i class="fas fa-cloud-rain mr-2"></i> Rain
</button>
<button id="forest-sound-btn" class="sound-btn bg-indigo-800/30 rounded-md px-3 py-2 hover:bg-indigo-800/50 transition-all flex items-center justify-center">
<i class="fas fa-tree mr-2"></i> Forest
</button>
<button id="coffee-sound-btn" class="sound-btn bg-indigo-800/30 rounded-md px-3 py-2 hover:bg-indigo-800/50 transition-all flex items-center justify-center">
<i class="fas fa-coffee mr-2"></i> Café
</button>
<button id="waves-sound-btn" class="sound-btn bg-indigo-800/30 rounded-md px-3 py-2 hover:bg-indigo-800/50 transition-all flex items-center justify-center">
<i class="fas fa-water mr-2"></i> Waves
</button>
</div>
<div class="flex items-center space-x-2">
<i class="fas fa-volume-down text-indigo-200"></i>
<input type="range" id="volume-slider" class="volume-slider" min="0" max="1" step="0.1" value="0.5">
<i class="fas fa-volume-up text-indigo-200"></i>
</div>
</div>
<!-- Timer Settings -->
<div class="bg-indigo-800/20 rounded-xl p-4 mb-6">
<h3 class="font-medium mb-3 text-center">Timer Settings</h3>
<div class="grid grid-cols-3 gap-4">
<div>
<label class="block text-sm text-indigo-200 mb-1">Pomodoro</label>
<input id="pomodoro-time" type="number" min="1" max="60" value="25" class="w-full bg-indigo-800/30 rounded-md px-3 py-2 text-center">
</div>
<div>
<label class="block text-sm text-indigo-200 mb-1">Short Break</label>
<input id="short-break-time" type="number" min="1" max="30" value="5" class="w-full bg-indigo-800/30 rounded-md px-3 py-2 text-center">
</div>
<div>
<label class="block text-sm text-indigo-200 mb-1">Long Break</label>
<input id="long-break-time" type="number" min="1" max="60" value="15" class="w-full bg-indigo-800/30 rounded-md px-3 py-2 text-center">
</div>
</div>
</div>
<!-- Task List -->
<div class="bg-indigo-800/20 rounded-xl p-4">
<h3 class="font-medium mb-3 text-center">Today's Tasks</h3>
<div class="flex mb-3">
<input id="task-input" type="text" placeholder="Add a task..." class="flex-1 bg-indigo-800/30 rounded-l-md px-3 py-2 focus:outline-none">
<button id="add-task-btn" class="bg-indigo-600 px-4 rounded-r-md hover:bg-indigo-700 transition-all">
<i class="fas fa-plus"></i>
</button>
</div>
<ul id="task-list" class="space-y-2 max-h-40 overflow-y-auto">
<!-- Tasks will be added here -->
</ul>
</div>
</div>
<!-- Stats -->
<div class="mt-6 text-center text-indigo-200">
<p>Pomodoros completed today: <span id="pomo-count" class="font-bold">0</span></p>
</div>
</div>
<!-- Audio Elements -->
<audio id="alarm-sound" src="https://assets.mixkit.co/sfx/preview/mixkit-alarm-digital-clock-beep-989.mp3" preload="auto"></audio>
<audio id="rain-sound" loop src="https://assets.mixkit.co/sfx/preview/mixkit-rain-loop-1243.mp3" preload="auto"></audio>
<audio id="forest-sound" loop src="https://assets.mixkit.co/sfx/preview/mixkit-forest-ambience-1681.mp3" preload="auto"></audio>
<audio id="coffee-sound" loop src="https://assets.mixkit.co/sfx/preview/mixkit-coffee-shop-ambience-170.mp3" preload="auto"></audio>
<audio id="waves-sound" loop src="https://assets.mixkit.co/sfx/preview/mixkit-waves-on-the-beach-1864.mp3" preload="auto"></audio>
<script>
// DOM Elements
const timeDisplay = document.getElementById('time-display');
const startBtn = document.getElementById('start-btn');
const resetBtn = document.getElementById('reset-btn');
const pomodoroBtn = document.getElementById('pomodoro-btn');
const shortBreakBtn = document.getElementById('short-break-btn');
const longBreakBtn = document.getElementById('long-break-btn');
const customBtn = document.getElementById('custom-btn');
const progressRing = document.getElementById('progress-ring');
const alarmSound = document.getElementById('alarm-sound');
const pomodoroTimeInput = document.getElementById('pomodoro-time');
const shortBreakTimeInput = document.getElementById('short-break-time');
const longBreakTimeInput = document.getElementById('long-break-time');
const taskInput = document.getElementById('task-input');
const addTaskBtn = document.getElementById('add-task-btn');
const taskList = document.getElementById('task-list');
const pomoCount = document.getElementById('pomo-count');
const customTimeContainer = document.getElementById('custom-time-container');
const customTimeInput = document.getElementById('custom-time');
const customDecreaseBtn = document.getElementById('custom-decrease');
const customIncreaseBtn = document.getElementById('custom-increase');
const applyCustomTimeBtn = document.getElementById('apply-custom-time');
const volumeSlider = document.getElementById('volume-slider');
// Sound buttons
const rainSoundBtn = document.getElementById('rain-sound-btn');
const forestSoundBtn = document.getElementById('forest-sound-btn');
const coffeeSoundBtn = document.getElementById('coffee-sound-btn');
const wavesSoundBtn = document.getElementById('waves-sound-btn');
const rainSound = document.getElementById('rain-sound');
const forestSound = document.getElementById('forest-sound');
const coffeeSound = document.getElementById('coffee-sound');
const wavesSound = document.getElementById('waves-sound');
// Timer variables
let timer;
let timeLeft = 25 * 60; // 25 minutes in seconds
let isRunning = false;
let currentMode = 'pomodoro'; // 'pomodoro', 'shortBreak', 'longBreak', 'custom'
let pomodorosCompleted = 0;
let pomodoroLength = 25;
let shortBreakLength = 5;
let longBreakLength = 15;
let customLength = 25;
const circumference = 2 * Math.PI * 112;
// Sound variables
let activeSound = null;
let volume = 0.5;
// Initialize
updateDisplay();
updateProgressRing();
updateVolume();
// Event Listeners
startBtn.addEventListener('click', toggleTimer);
resetBtn.addEventListener('click', resetTimer);
pomodoroBtn.addEventListener('click', () => switchMode('pomodoro'));
shortBreakBtn.addEventListener('click', () => switchMode('shortBreak'));
longBreakBtn.addEventListener('click', () => switchMode('longBreak'));
customBtn.addEventListener('click', () => switchMode('custom'));
pomodoroTimeInput.addEventListener('change', updateTimerSettings);
shortBreakTimeInput.addEventListener('change', updateTimerSettings);
longBreakTimeInput.addEventListener('change', updateTimerSettings);
addTaskBtn.addEventListener('click', addTask);
taskInput.addEventListener('keypress', (e) => {
if (e.key === 'Enter') addTask();
});
// Custom time controls
customDecreaseBtn.addEventListener('click', () => {
customTimeInput.value = Math.max(1, parseInt(customTimeInput.value) - 1);
});
customIncreaseBtn.addEventListener('click', () => {
customTimeInput.value = Math.min(120, parseInt(customTimeInput.value) + 1);
});
applyCustomTimeBtn.addEventListener('click', () => {
customLength = parseInt(customTimeInput.value) || 25;
timeLeft = customLength * 60;
updateDisplay();
updateProgressRing();
});
// Sound controls
rainSoundBtn.addEventListener('click', () => toggleSound('rain'));
forestSoundBtn.addEventListener('click', () => toggleSound('forest'));
coffeeSoundBtn.addEventListener('click', () => toggleSound('coffee'));
wavesSoundBtn.addEventListener('click', () => toggleSound('waves'));
volumeSlider.addEventListener('input', updateVolume);
// Functions
function toggleTimer() {
if (isRunning) {
pauseTimer();
} else {
startTimer();
}
}
function resetTimer() {
pauseTimer();
if (currentMode === 'pomodoro') timeLeft = pomodoroLength * 60;
else if (currentMode === 'shortBreak') timeLeft = shortBreakLength * 60;
else if (currentMode === 'longBreak') timeLeft = longBreakLength * 60;
else timeLeft = customLength * 60;
updateDisplay();
updateProgressRing();
}
function startTimer() {
isRunning = true;
startBtn.textContent = 'PAUSE';
startBtn.classList.remove('bg-white', 'text-indigo-800');
startBtn.classList.add('bg-amber-400', 'text-amber-900');
timer = setInterval(() => {
timeLeft--;
updateDisplay();
updateProgressRing();
if (timeLeft <= 0) {
clearInterval(timer);
playAlarm();
isRunning = false;
startBtn.textContent = 'START';
startBtn.classList.remove('bg-amber-400', 'text-amber-900');
startBtn.classList.add('bg-white', 'text-indigo-800');
if (currentMode === 'pomodoro') {
pomodorosCompleted++;
pomoCount.textContent = pomodorosCompleted;
// Auto-switch to short break after 4 pomodoros
if (pomodorosCompleted % 4 === 0) {
setTimeout(() => switchMode('longBreak'), 1000);
} else {
setTimeout(() => switchMode('shortBreak'), 1000);
}
} else {
setTimeout(() => switchMode('pomodoro'), 1000);
}
}
}, 1000);
}
function playAlarm() {
// Stop any ambient sound when alarm plays
stopAllSounds();
// Play alarm sound at full volume
alarmSound.volume = 1;
alarmSound.play();
// Flash the screen
document.body.classList.add('bg-amber-500');
setTimeout(() => {
document.body.classList.remove('bg-amber-500');
}, 300);
setTimeout(() => {
document.body.classList.add('bg-amber-500');
}, 600);
setTimeout(() => {
document.body.classList.remove('bg-amber-500');
}, 900);
// Resume ambient sound after alarm
setTimeout(() => {
if (activeSound) {
activeSound.play();
}
}, 3000);
}
function pauseTimer() {
clearInterval(timer);
isRunning = false;
startBtn.textContent = 'START';
startBtn.classList.remove('bg-amber-400', 'text-amber-900');
startBtn.classList.add('bg-white', 'text-indigo-800');
}
function updateDisplay() {
const minutes = Math.floor(timeLeft / 60);
const seconds = timeLeft % 60;
timeDisplay.textContent = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
// Add pulse animation when time is running low
if (timeLeft <= 60 && isRunning) {
timeDisplay.classList.add('pulse-animation', 'text-amber-400');
} else {
timeDisplay.classList.remove('pulse-animation', 'text-amber-400');
}
}
function updateProgressRing() {
let totalTime;
if (currentMode === 'pomodoro') totalTime = pomodoroLength * 60;
else if (currentMode === 'shortBreak') totalTime = shortBreakLength * 60;
else if (currentMode === 'longBreak') totalTime = longBreakLength * 60;
else totalTime = customLength * 60;
const offset = circumference - (timeLeft / totalTime) * circumference;
progressRing.style.strokeDashoffset = offset;
}
function switchMode(mode) {
currentMode = mode;
// Update active tab
pomodoroBtn.classList.remove('tab-active');
shortBreakBtn.classList.remove('tab-active');
longBreakBtn.classList.remove('tab-active');
customBtn.classList.remove('tab-active');
if (mode === 'pomodoro') {
pomodoroBtn.classList.add('tab-active');
timeLeft = pomodoroLength * 60;
progressRing.classList.remove('text-emerald-400', 'text-amber-400');
progressRing.classList.add('text-indigo-400');
customTimeContainer.classList.add('hidden');
} else if (mode === 'shortBreak') {
shortBreakBtn.classList.add('tab-active');
timeLeft = shortBreakLength * 60;
progressRing.classList.remove('text-indigo-400', 'text-amber-400');
progressRing.classList.add('text-emerald-400');
customTimeContainer.classList.add('hidden');
} else if (mode === 'longBreak') {
longBreakBtn.classList.add('tab-active');
timeLeft = longBreakLength * 60;
progressRing.classList.remove('text-indigo-400', 'text-emerald-400');
progressRing.classList.add('text-amber-400');
customTimeContainer.classList.add('hidden');
} else {
customBtn.classList.add('tab-active');
timeLeft = customLength * 60;
progressRing.classList.remove('text-indigo-400', 'text-emerald-400', 'text-amber-400');
progressRing.classList.add('text-purple-400');
customTimeContainer.classList.remove('hidden');
}
if (isRunning) {
pauseTimer();
}
updateDisplay();
updateProgressRing();
}
function updateTimerSettings() {
pomodoroLength = parseInt(pomodoroTimeInput.value) || 25;
shortBreakLength = parseInt(shortBreakTimeInput.value) || 5;
longBreakLength = parseInt(longBreakTimeInput.value) || 15;
if (!isRunning) {
if (currentMode === 'pomodoro') timeLeft = pomodoroLength * 60;
else if (currentMode === 'shortBreak') timeLeft = shortBreakLength * 60;
else if (currentMode === 'longBreak') timeLeft = longBreakLength * 60;
else timeLeft = customLength * 60;
updateDisplay();
updateProgressRing();
}
}
function addTask() {
const taskText = taskInput.value.trim();
if (taskText) {
const taskItem = document.createElement('li');
taskItem.className = 'flex items-center bg-indigo-800/30 rounded-md px-3 py-2';
const checkbox = document.createElement('input');
checkbox.type = 'checkbox';
checkbox.className = 'mr-2';
checkbox.addEventListener('change', function() {
if (this.checked) {
taskTextSpan.style.textDecoration = 'line-through';
taskTextSpan.style.opacity = '0.7';
} else {
taskTextSpan.style.textDecoration = 'none';
taskTextSpan.style.opacity = '1';
}
});
const taskTextSpan = document.createElement('span');
taskTextSpan.className = 'flex-1';
taskTextSpan.textContent = taskText;
const deleteBtn = document.createElement('button');
deleteBtn.className = 'text-indigo-300 hover:text-white ml-2';
deleteBtn.innerHTML = '<i class="fas fa-trash-alt"></i>';
deleteBtn.addEventListener('click', function() {
taskItem.remove();
});
taskItem.appendChild(checkbox);
taskItem.appendChild(taskTextSpan);
taskItem.appendChild(deleteBtn);
taskList.appendChild(taskItem);
taskInput.value = '';
}
}
// Sound functions
function toggleSound(soundType) {
const soundBtns = document.querySelectorAll('.sound-btn');
soundBtns.forEach(btn => {
btn.classList.remove('bg-indigo-600');
btn.classList.add('bg-indigo-800/30');
});
// Stop any currently playing sound
stopAllSounds();
// If clicking the same sound button, just stop it
if (activeSound === soundType) {
activeSound = null;
return;
}
// Start the selected sound
activeSound = soundType;
let soundElement;
switch(soundType) {
case 'rain':
soundElement = rainSound;
rainSoundBtn.classList.add('bg-indigo-600');
rainSoundBtn.classList.remove('bg-indigo-800/30');
break;
case 'forest':
soundElement = forestSound;
forestSoundBtn.classList.add('bg-indigo-600');
forestSoundBtn.classList.remove('bg-indigo-800/30');
break;
case 'coffee':
soundElement = coffeeSound;
coffeeSoundBtn.classList.add('bg-indigo-600');
coffeeSoundBtn.classList.remove('bg-indigo-800/30');
break;
case 'waves':
soundElement = wavesSound;
wavesSoundBtn.classList.add('bg-indigo-600');
wavesSoundBtn.classList.remove('bg-indigo-800/30');
break;
}
soundElement.volume = volume;
soundElement.play();
}
function stopAllSounds() {
rainSound.pause();
forestSound.pause();
coffeeSound.pause();
wavesSound.pause();
}
function updateVolume() {
volume = parseFloat(volumeSlider.value);
// Update all sounds with new volume
if (activeSound) {
switch(activeSound) {
case 'rain':
rainSound.volume = volume;
break;
case 'forest':
forestSound.volume = volume;
break;
case 'coffee':
coffeeSound.volume = volume;
break;
case 'waves':
wavesSound.volume = volume;
break;
}
}
}
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=FaxMe/zenpomodor-timer" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |