FaxMe commited on
Commit
b893f3f
·
verified ·
1 Parent(s): dd49a39

change the timer to just minutes and seconds, and change the app name to Multi Timer

Browse files
Files changed (1) hide show
  1. index.html +18 -23
index.html CHANGED
@@ -29,9 +29,9 @@
29
  <body class="text-white">
30
  <div class="container mx-auto px-4 py-8 max-w-4xl">
31
  <header class="text-center mb-12">
32
- <h1 class="text-4xl font-bold mb-2 bg-clip-text text-transparent bg-gradient-to-r from-white to-gray-300">ChronoStacks</h1>
33
- <p class="text-gray-400">Track multiple timers simultaneously</p>
34
- </header>
35
 
36
  <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
37
  <!-- Timer 1 -->
@@ -39,8 +39,8 @@
39
  <div class="mb-4">
40
  <input type="text" placeholder="Timer Title" class="w-full bg-gray-800 border border-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500">
41
  </div>
42
- <div class="timer-display text-5xl font-bold text-center mb-6">00:00:00</div>
43
- <div class="flex items-center justify-center space-x-4 mb-4">
44
  <input type="time" class="bg-gray-800 border border-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500" step="1">
45
  </div>
46
  <div class="flex justify-center space-x-4">
@@ -118,30 +118,25 @@
118
  let countdown;
119
  let totalSeconds = 0;
120
  let isRunning = false;
121
-
122
- // Format time to HH:MM:SS
123
  function formatTime(seconds) {
124
- const hours = Math.floor(seconds / 3600);
125
- const minutes = Math.floor((seconds % 3600) / 60);
126
  const secs = seconds % 60;
127
 
128
  return [
129
- hours.toString().padStart(2, '0'),
130
  minutes.toString().padStart(2, '0'),
131
  secs.toString().padStart(2, '0')
132
  ].join(':');
133
  }
134
-
135
- // Start timer
136
  startBtn.addEventListener('click', () => {
137
  if (isRunning) return;
138
 
139
  // Parse time input
140
- const timeValue = timeInput.value || '00:00:00';
141
- const [hours, minutes, seconds] = timeValue.split(':').map(Number);
142
- totalSeconds = hours * 3600 + minutes * 60 + seconds;
143
-
144
- if (totalSeconds <= 0) {
145
  alert('Please enter a valid time');
146
  return;
147
  }
@@ -183,18 +178,18 @@
183
  clearInterval(countdown);
184
  isRunning = false;
185
  totalSeconds = 0;
186
- display.textContent = '00:00:00';
187
- timeInput.value = '';
188
  startBtn.classList.remove('hidden');
189
  pauseBtn.classList.add('hidden');
190
  });
191
 
192
  // Update display when time input changes
193
  timeInput.addEventListener('change', () => {
194
- const timeValue = timeInput.value || '00:00:00';
195
- const [hours, minutes, seconds] = timeValue.split(':').map(Number);
196
- totalSeconds = hours * 3600 + minutes * 60 + seconds;
197
- display.textContent = formatTime(totalSeconds);
198
  });
199
  });
200
  });
 
29
  <body class="text-white">
30
  <div class="container mx-auto px-4 py-8 max-w-4xl">
31
  <header class="text-center mb-12">
32
+ <h1 class="text-4xl font-bold mb-2 bg-clip-text text-transparent bg-gradient-to-r from-white to-gray-300">Multi Timer</h1>
33
+ <p class="text-gray-400">Simple countdown timers</p>
34
+ </header>
35
 
36
  <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
37
  <!-- Timer 1 -->
 
39
  <div class="mb-4">
40
  <input type="text" placeholder="Timer Title" class="w-full bg-gray-800 border border-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500">
41
  </div>
42
+ <div class="timer-display text-5xl font-bold text-center mb-6">00:00</div>
43
+ <div class="flex items-center justify-center space-x-4 mb-4">
44
  <input type="time" class="bg-gray-800 border border-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500" step="1">
45
  </div>
46
  <div class="flex justify-center space-x-4">
 
118
  let countdown;
119
  let totalSeconds = 0;
120
  let isRunning = false;
121
+ // Format time to MM:SS
 
122
  function formatTime(seconds) {
123
+ const minutes = Math.floor(seconds / 60);
 
124
  const secs = seconds % 60;
125
 
126
  return [
 
127
  minutes.toString().padStart(2, '0'),
128
  secs.toString().padStart(2, '0')
129
  ].join(':');
130
  }
131
+ // Start timer
 
132
  startBtn.addEventListener('click', () => {
133
  if (isRunning) return;
134
 
135
  // Parse time input
136
+ const timeValue = timeInput.value || '00:00';
137
+ const [minutes, seconds] = timeValue.split(':').map(Number);
138
+ totalSeconds = minutes * 60 + seconds;
139
+ if (totalSeconds <= 0) {
 
140
  alert('Please enter a valid time');
141
  return;
142
  }
 
178
  clearInterval(countdown);
179
  isRunning = false;
180
  totalSeconds = 0;
181
+ display.textContent = '00:00';
182
+ timeInput.value = '';
183
  startBtn.classList.remove('hidden');
184
  pauseBtn.classList.add('hidden');
185
  });
186
 
187
  // Update display when time input changes
188
  timeInput.addEventListener('change', () => {
189
+ const timeValue = timeInput.value || '00:00';
190
+ const [minutes, seconds] = timeValue.split(':').map(Number);
191
+ totalSeconds = minutes * 60 + seconds;
192
+ display.textContent = formatTime(totalSeconds);
193
  });
194
  });
195
  });