Spaces:
Running
Running
in white bold great looking text with timer stop pause re everything
Browse files- index.html +88 -36
index.html
CHANGED
|
@@ -9,14 +9,14 @@
|
|
| 9 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 10 |
<style>
|
| 11 |
#live-clock {
|
| 12 |
-
font-family: '
|
| 13 |
-
|
| 14 |
-
-
|
| 15 |
-
|
| 16 |
-
-
|
| 17 |
-
text-shadow: 0 0
|
| 18 |
}
|
| 19 |
-
|
| 20 |
transition: all 0.2s ease;
|
| 21 |
}
|
| 22 |
#time-note:focus {
|
|
@@ -28,39 +28,88 @@
|
|
| 28 |
<body class="bg-gray-900">
|
| 29 |
<!-- Floating Time Widget -->
|
| 30 |
<div class="fixed bottom-4 right-4 z-50">
|
| 31 |
-
<div class="bg-black bg-opacity-80 rounded-xl shadow-xl p-
|
| 32 |
-
<div class="
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
placeholder="Add note...">
|
| 37 |
</div>
|
| 38 |
</div>
|
| 39 |
</div>
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
day: 'numeric'
|
| 54 |
-
});
|
| 55 |
-
|
| 56 |
-
document.getElementById('live-clock').textContent = timeStr;
|
| 57 |
-
document.getElementById('live-date').textContent = dateStr;
|
| 58 |
}
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
// Save notes to localStorage
|
| 65 |
const noteInput = document.getElementById('time-note');
|
| 66 |
noteInput.addEventListener('change', () => {
|
|
@@ -72,6 +121,9 @@
|
|
| 72 |
if (savedNote) {
|
| 73 |
noteInput.value = savedNote;
|
| 74 |
}
|
| 75 |
-
|
|
|
|
|
|
|
|
|
|
| 76 |
</body>
|
| 77 |
</html>
|
|
|
|
| 9 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 10 |
<style>
|
| 11 |
#live-clock {
|
| 12 |
+
font-family: 'Arial', sans-serif;
|
| 13 |
+
color: #ffffff;
|
| 14 |
+
font-weight: 800;
|
| 15 |
+
letter-spacing: 2px;
|
| 16 |
+
font-size: 3rem;
|
| 17 |
+
text-shadow: 0 0 10px rgba(255, 255, 255, 0.7);
|
| 18 |
}
|
| 19 |
+
#time-note {
|
| 20 |
transition: all 0.2s ease;
|
| 21 |
}
|
| 22 |
#time-note:focus {
|
|
|
|
| 28 |
<body class="bg-gray-900">
|
| 29 |
<!-- Floating Time Widget -->
|
| 30 |
<div class="fixed bottom-4 right-4 z-50">
|
| 31 |
+
<div class="bg-black bg-opacity-80 rounded-xl shadow-xl p-6 text-white">
|
| 32 |
+
<div class="flex flex-col items-center">
|
| 33 |
+
<div id="live-clock">00:00:00</div>
|
| 34 |
+
<div class="text-sm opacity-80 mt-1" id="live-date">Loading...</div>
|
| 35 |
+
<div class="flex space-x-4 mt-4">
|
| 36 |
+
<button id="start-btn" class="bg-green-500 hover:bg-green-600 px-4 py-2 rounded-full">
|
| 37 |
+
<i class="fas fa-play"></i>
|
| 38 |
+
</button>
|
| 39 |
+
<button id="stop-btn" class="bg-red-500 hover:bg-red-600 px-4 py-2 rounded-full">
|
| 40 |
+
<i class="fas fa-stop"></i>
|
| 41 |
+
</button>
|
| 42 |
+
<button id="reset-btn" class="bg-blue-500 hover:bg-blue-600 px-4 py-2 rounded-full">
|
| 43 |
+
<i class="fas fa-undo"></i>
|
| 44 |
+
</button>
|
| 45 |
+
</div>
|
| 46 |
+
</div>
|
| 47 |
+
<div class="mt-4">
|
| 48 |
+
<input type="text" id="time-note" class="bg-gray-700 bg-opacity-50 text-white text-sm rounded px-3 py-2 w-full"
|
| 49 |
placeholder="Add note...">
|
| 50 |
</div>
|
| 51 |
</div>
|
| 52 |
</div>
|
| 53 |
+
<script>
|
| 54 |
+
let timerInterval;
|
| 55 |
+
let isRunning = false;
|
| 56 |
+
let startTime;
|
| 57 |
+
let elapsedTime = 0;
|
| 58 |
+
|
| 59 |
+
// Timer functions
|
| 60 |
+
function startTimer() {
|
| 61 |
+
if (!isRunning) {
|
| 62 |
+
startTime = Date.now() - elapsedTime;
|
| 63 |
+
timerInterval = setInterval(updateTimer, 1000);
|
| 64 |
+
isRunning = true;
|
| 65 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
}
|
| 67 |
+
|
| 68 |
+
function stopTimer() {
|
| 69 |
+
if (isRunning) {
|
| 70 |
+
clearInterval(timerInterval);
|
| 71 |
+
isRunning = false;
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
function resetTimer() {
|
| 76 |
+
stopTimer();
|
| 77 |
+
elapsedTime = 0;
|
| 78 |
+
updateDisplay(0);
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
function updateTimer() {
|
| 82 |
+
elapsedTime = Date.now() - startTime;
|
| 83 |
+
updateDisplay(elapsedTime);
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
function updateDisplay(time) {
|
| 87 |
+
const seconds = Math.floor((time / 1000) % 60);
|
| 88 |
+
const minutes = Math.floor((time / (1000 * 60)) % 60);
|
| 89 |
+
const hours = Math.floor((time / (1000 * 60 * 60)) % 24);
|
| 90 |
+
|
| 91 |
+
const formattedTime = [
|
| 92 |
+
hours.toString().padStart(2, '0'),
|
| 93 |
+
minutes.toString().padStart(2, '0'),
|
| 94 |
+
seconds.toString().padStart(2, '0')
|
| 95 |
+
].join(':');
|
| 96 |
+
|
| 97 |
+
document.getElementById('live-clock').textContent = formattedTime;
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
// Button event listeners
|
| 101 |
+
document.getElementById('start-btn').addEventListener('click', startTimer);
|
| 102 |
+
document.getElementById('stop-btn').addEventListener('click', stopTimer);
|
| 103 |
+
document.getElementById('reset-btn').addEventListener('click', resetTimer);
|
| 104 |
+
|
| 105 |
+
// Initialize with current time
|
| 106 |
+
const now = new Date();
|
| 107 |
+
const dateStr = now.toLocaleDateString('en-US', {
|
| 108 |
+
weekday: 'short',
|
| 109 |
+
month: 'short',
|
| 110 |
+
day: 'numeric'
|
| 111 |
+
});
|
| 112 |
+
document.getElementById('live-date').textContent = dateStr;
|
| 113 |
// Save notes to localStorage
|
| 114 |
const noteInput = document.getElementById('time-note');
|
| 115 |
noteInput.addEventListener('change', () => {
|
|
|
|
| 121 |
if (savedNote) {
|
| 122 |
noteInput.value = savedNote;
|
| 123 |
}
|
| 124 |
+
|
| 125 |
+
// Initialize with stopped state
|
| 126 |
+
resetTimer();
|
| 127 |
+
</script>
|
| 128 |
</body>
|
| 129 |
</html>
|