Add 2 files
Browse files- README.md +7 -5
- index.html +233 -19
README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: static
|
7 |
pinned: false
|
|
|
|
|
8 |
---
|
9 |
|
10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: my-clock
|
3 |
+
emoji: 🐳
|
4 |
+
colorFrom: pink
|
5 |
+
colorTo: green
|
6 |
sdk: static
|
7 |
pinned: false
|
8 |
+
tags:
|
9 |
+
- deepsite
|
10 |
---
|
11 |
|
12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
@@ -1,19 +1,233 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Elegant Digital Clock</title>
|
7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
9 |
+
<style>
|
10 |
+
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap');
|
11 |
+
|
12 |
+
.clock-container {
|
13 |
+
font-family: 'Orbitron', sans-serif;
|
14 |
+
text-shadow: 0 0 10px rgba(0, 255, 255, 0.7);
|
15 |
+
transition: all 0.5s ease;
|
16 |
+
}
|
17 |
+
|
18 |
+
.clock-face {
|
19 |
+
box-shadow: 0 0 20px rgba(0, 255, 255, 0.5),
|
20 |
+
inset 0 0 10px rgba(0, 0, 0, 0.5);
|
21 |
+
backdrop-filter: blur(5px);
|
22 |
+
}
|
23 |
+
|
24 |
+
.time-segment {
|
25 |
+
transition: all 0.3s ease;
|
26 |
+
}
|
27 |
+
|
28 |
+
.time-segment:hover {
|
29 |
+
transform: scale(1.05);
|
30 |
+
text-shadow: 0 0 15px rgba(0, 255, 255, 1);
|
31 |
+
}
|
32 |
+
|
33 |
+
.date-display {
|
34 |
+
letter-spacing: 2px;
|
35 |
+
text-shadow: 0 0 5px rgba(255, 255, 255, 0.7);
|
36 |
+
}
|
37 |
+
|
38 |
+
.theme-btn {
|
39 |
+
transition: all 0.3s ease;
|
40 |
+
}
|
41 |
+
|
42 |
+
.theme-btn:hover {
|
43 |
+
transform: rotate(15deg) scale(1.1);
|
44 |
+
}
|
45 |
+
|
46 |
+
.glow {
|
47 |
+
animation: glow 2s infinite alternate;
|
48 |
+
}
|
49 |
+
|
50 |
+
@keyframes glow {
|
51 |
+
from {
|
52 |
+
box-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
|
53 |
+
}
|
54 |
+
to {
|
55 |
+
box-shadow: 0 0 20px rgba(0, 255, 255, 0.8);
|
56 |
+
}
|
57 |
+
}
|
58 |
+
</style>
|
59 |
+
</head>
|
60 |
+
<body class="bg-gray-900 min-h-screen flex items-center justify-center p-4 transition-colors duration-500">
|
61 |
+
<div class="clock-container w-full max-w-md">
|
62 |
+
<div class="clock-face bg-gray-800 bg-opacity-70 rounded-2xl p-8 border border-cyan-400 border-opacity-30 relative overflow-hidden">
|
63 |
+
<!-- Theme toggle button -->
|
64 |
+
<button id="themeToggle" class="theme-btn absolute top-4 right-4 text-cyan-400 text-xl hover:text-cyan-300">
|
65 |
+
<i class="fas fa-moon"></i>
|
66 |
+
</button>
|
67 |
+
|
68 |
+
<!-- Time display -->
|
69 |
+
<div class="time-display flex justify-center items-center mb-6">
|
70 |
+
<div id="hours" class="time-segment text-6xl font-bold text-cyan-400 mr-2">00</div>
|
71 |
+
<div class="text-6xl font-bold text-cyan-400 opacity-70">:</div>
|
72 |
+
<div id="minutes" class="time-segment text-6xl font-bold text-cyan-400 mx-2">00</div>
|
73 |
+
<div class="text-6xl font-bold text-cyan-400 opacity-70">:</div>
|
74 |
+
<div id="seconds" class="time-segment text-6xl font-bold text-cyan-400 ml-2">00</div>
|
75 |
+
</div>
|
76 |
+
|
77 |
+
<!-- AM/PM indicator -->
|
78 |
+
<div id="ampm" class="text-xl font-semibold text-cyan-300 text-center mb-1">AM</div>
|
79 |
+
|
80 |
+
<!-- Date display -->
|
81 |
+
<div id="date" class="date-display text-lg text-gray-300 text-center mt-4"></div>
|
82 |
+
|
83 |
+
<!-- Additional features -->
|
84 |
+
<div class="flex justify-center mt-6 space-x-4">
|
85 |
+
<button id="formatToggle" class="glow bg-cyan-800 bg-opacity-50 hover:bg-opacity-70 text-cyan-300 px-4 py-2 rounded-full flex items-center">
|
86 |
+
<i class="fas fa-exchange-alt mr-2"></i> 24H/12H
|
87 |
+
</button>
|
88 |
+
<button id="stopwatchBtn" class="glow bg-cyan-800 bg-opacity-50 hover:bg-opacity-70 text-cyan-300 px-4 py-2 rounded-full flex items-center">
|
89 |
+
<i class="fas fa-stopwatch mr-2"></i> Stopwatch
|
90 |
+
</button>
|
91 |
+
</div>
|
92 |
+
</div>
|
93 |
+
|
94 |
+
<!-- Footer with greeting -->
|
95 |
+
<div id="greeting" class="text-center mt-6 text-xl text-gray-300"></div>
|
96 |
+
</div>
|
97 |
+
|
98 |
+
<script>
|
99 |
+
// DOM elements
|
100 |
+
const hoursElement = document.getElementById('hours');
|
101 |
+
const minutesElement = document.getElementById('minutes');
|
102 |
+
const secondsElement = document.getElementById('seconds');
|
103 |
+
const ampmElement = document.getElementById('ampm');
|
104 |
+
const dateElement = document.getElementById('date');
|
105 |
+
const greetingElement = document.getElementById('greeting');
|
106 |
+
const themeToggle = document.getElementById('themeToggle');
|
107 |
+
const formatToggle = document.getElementById('formatToggle');
|
108 |
+
const stopwatchBtn = document.getElementById('stopwatchBtn');
|
109 |
+
const body = document.body;
|
110 |
+
const clockFace = document.querySelector('.clock-face');
|
111 |
+
|
112 |
+
// State variables
|
113 |
+
let is24HourFormat = true;
|
114 |
+
let isDarkTheme = true;
|
115 |
+
let isStopwatchMode = false;
|
116 |
+
let stopwatchStartTime = 0;
|
117 |
+
let stopwatchInterval = null;
|
118 |
+
|
119 |
+
// Initialize clock
|
120 |
+
updateClock();
|
121 |
+
setInterval(updateClock, 1000);
|
122 |
+
|
123 |
+
// Theme toggle
|
124 |
+
themeToggle.addEventListener('click', () => {
|
125 |
+
isDarkTheme = !isDarkTheme;
|
126 |
+
|
127 |
+
if (isDarkTheme) {
|
128 |
+
body.classList.remove('bg-gray-100');
|
129 |
+
body.classList.add('bg-gray-900');
|
130 |
+
clockFace.classList.remove('bg-gray-200', 'text-gray-800');
|
131 |
+
clockFace.classList.add('bg-gray-800', 'text-cyan-400');
|
132 |
+
themeToggle.innerHTML = '<i class="fas fa-moon"></i>';
|
133 |
+
document.querySelectorAll('.glow').forEach(el => {
|
134 |
+
el.classList.remove('bg-gray-300', 'text-gray-800');
|
135 |
+
el.classList.add('bg-cyan-800', 'text-cyan-300');
|
136 |
+
});
|
137 |
+
} else {
|
138 |
+
body.classList.remove('bg-gray-900');
|
139 |
+
body.classList.add('bg-gray-100');
|
140 |
+
clockFace.classList.remove('bg-gray-800', 'text-cyan-400');
|
141 |
+
clockFace.classList.add('bg-gray-200', 'text-gray-800');
|
142 |
+
themeToggle.innerHTML = '<i class="fas fa-sun"></i>';
|
143 |
+
document.querySelectorAll('.glow').forEach(el => {
|
144 |
+
el.classList.remove('bg-cyan-800', 'text-cyan-300');
|
145 |
+
el.classList.add('bg-gray-300', 'text-gray-800');
|
146 |
+
});
|
147 |
+
}
|
148 |
+
});
|
149 |
+
|
150 |
+
// Format toggle
|
151 |
+
formatToggle.addEventListener('click', () => {
|
152 |
+
is24HourFormat = !is24HourFormat;
|
153 |
+
updateClock();
|
154 |
+
});
|
155 |
+
|
156 |
+
// Stopwatch toggle
|
157 |
+
stopwatchBtn.addEventListener('click', () => {
|
158 |
+
isStopwatchMode = !isStopwatchMode;
|
159 |
+
|
160 |
+
if (isStopwatchMode) {
|
161 |
+
stopwatchStartTime = Date.now();
|
162 |
+
stopwatchInterval = setInterval(updateStopwatch, 10);
|
163 |
+
stopwatchBtn.innerHTML = '<i class="fas fa-stop mr-2"></i> Stop';
|
164 |
+
} else {
|
165 |
+
clearInterval(stopwatchInterval);
|
166 |
+
stopwatchBtn.innerHTML = '<i class="fas fa-stopwatch mr-2"></i> Stopwatch';
|
167 |
+
setTimeout(updateClock, 100); // Return to normal clock
|
168 |
+
}
|
169 |
+
});
|
170 |
+
|
171 |
+
// Update clock function
|
172 |
+
function updateClock() {
|
173 |
+
if (isStopwatchMode) return;
|
174 |
+
|
175 |
+
const now = new Date();
|
176 |
+
let hours = now.getHours();
|
177 |
+
const minutes = now.getMinutes();
|
178 |
+
const seconds = now.getSeconds();
|
179 |
+
const ampm = hours >= 12 ? 'PM' : 'AM';
|
180 |
+
|
181 |
+
// Format hours based on 12/24 hour setting
|
182 |
+
if (!is24HourFormat) {
|
183 |
+
hours = hours % 12 || 12;
|
184 |
+
}
|
185 |
+
|
186 |
+
// Update time display
|
187 |
+
hoursElement.textContent = hours.toString().padStart(2, '0');
|
188 |
+
minutesElement.textContent = minutes.toString().padStart(2, '0');
|
189 |
+
secondsElement.textContent = seconds.toString().padStart(2, '0');
|
190 |
+
|
191 |
+
// Update AM/PM display
|
192 |
+
ampmElement.textContent = is24HourFormat ? '' : ampm;
|
193 |
+
|
194 |
+
// Update date
|
195 |
+
const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
|
196 |
+
dateElement.textContent = now.toLocaleDateString(undefined, options);
|
197 |
+
|
198 |
+
// Update greeting
|
199 |
+
updateGreeting(hours);
|
200 |
+
}
|
201 |
+
|
202 |
+
// Update stopwatch function
|
203 |
+
function updateStopwatch() {
|
204 |
+
const elapsed = Date.now() - stopwatchStartTime;
|
205 |
+
const milliseconds = Math.floor(elapsed % 1000 / 10);
|
206 |
+
const seconds = Math.floor(elapsed / 1000) % 60;
|
207 |
+
const minutes = Math.floor(elapsed / (1000 * 60)) % 60;
|
208 |
+
const hours = Math.floor(elapsed / (1000 * 60 * 60));
|
209 |
+
|
210 |
+
hoursElement.textContent = hours.toString().padStart(2, '0');
|
211 |
+
minutesElement.textContent = minutes.toString().padStart(2, '0');
|
212 |
+
secondsElement.textContent = seconds.toString().padStart(2, '0');
|
213 |
+
ampmElement.textContent = milliseconds.toString().padStart(2, '0');
|
214 |
+
dateElement.textContent = 'Stopwatch';
|
215 |
+
}
|
216 |
+
|
217 |
+
// Update greeting based on time of day
|
218 |
+
function updateGreeting(hours) {
|
219 |
+
let greeting = '';
|
220 |
+
|
221 |
+
if (hours < 12) {
|
222 |
+
greeting = 'Good Morning!';
|
223 |
+
} else if (hours < 18) {
|
224 |
+
greeting = 'Good Afternoon!';
|
225 |
+
} else {
|
226 |
+
greeting = 'Good Evening!';
|
227 |
+
}
|
228 |
+
|
229 |
+
greetingElement.textContent = greeting;
|
230 |
+
}
|
231 |
+
</script>
|
232 |
+
<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=lior007/my-clock" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
233 |
+
</html>
|