djaborolouai commited on
Commit
790fe48
·
verified ·
1 Parent(s): e0483a6

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +166 -19
  3. prompts.txt +1 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Timer
3
- emoji: 🐨
4
- colorFrom: yellow
5
- colorTo: indigo
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: timer
3
+ emoji: 🐳
4
+ colorFrom: red
5
+ colorTo: purple
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,166 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="fr">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Chronomètre Élégant</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
+ .glow-text {
11
+ text-shadow: 0 0 10px rgba(59, 130, 246, 0.7);
12
+ }
13
+ .btn-hover:hover {
14
+ transform: translateY(-2px);
15
+ box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
16
+ }
17
+ .btn-active:active {
18
+ transform: translateY(1px);
19
+ }
20
+ .timer-container {
21
+ perspective: 1000px;
22
+ }
23
+ .timer-display {
24
+ transform-style: preserve-3d;
25
+ transition: transform 0.5s;
26
+ }
27
+ </style>
28
+ </head>
29
+ <body class="bg-gradient-to-br from-gray-900 to-gray-800 min-h-screen flex items-center justify-center p-4">
30
+ <div class="timer-container text-center">
31
+ <h1 class="text-4xl md:text-5xl font-bold text-white mb-8 glow-text">Chronomètre</h1>
32
+
33
+ <div class="timer-display bg-gray-800 rounded-xl p-8 mb-10 shadow-2xl border border-gray-700">
34
+ <div class="text-6xl md:text-8xl font-mono font-bold text-blue-400">
35
+ <span id="hours">00</span>:<span id="minutes">00</span>:<span id="seconds">00</span>
36
+ <span class="text-4xl md:text-6xl" id="milliseconds">.00</span>
37
+ </div>
38
+ </div>
39
+
40
+ <div class="flex justify-center space-x-4 md:space-x-6">
41
+ <button id="startBtn" class="bg-green-600 hover:bg-green-700 text-white px-6 py-3 rounded-full text-lg font-semibold transition-all duration-300 btn-hover btn-active shadow-lg flex items-center">
42
+ <i class="fas fa-play mr-2"></i> Démarrer
43
+ </button>
44
+ <button id="stopBtn" class="bg-red-600 hover:bg-red-700 text-white px-6 py-3 rounded-full text-lg font-semibold transition-all duration-300 btn-hover btn-active shadow-lg flex items-center" disabled>
45
+ <i class="fas fa-stop mr-2"></i> Arrêter
46
+ </button>
47
+ <button id="resetBtn" class="bg-blue-600 hover:bg-blue-700 text-white px-6 py-3 rounded-full text-lg font-semibold transition-all duration-300 btn-hover btn-active shadow-lg flex items-center">
48
+ <i class="fas fa-redo mr-2"></i> Réinitialiser
49
+ </button>
50
+ </div>
51
+
52
+ <div class="mt-12 text-gray-400">
53
+ <p class="text-sm">Appuyez sur Démarrer pour commencer le chronomètre</p>
54
+ </div>
55
+ </div>
56
+
57
+ <script>
58
+ let startTime;
59
+ let elapsedTime = 0;
60
+ let timerInterval;
61
+ let isRunning = false;
62
+
63
+ const startBtn = document.getElementById('startBtn');
64
+ const stopBtn = document.getElementById('stopBtn');
65
+ const resetBtn = document.getElementById('resetBtn');
66
+ const hoursDisplay = document.getElementById('hours');
67
+ const minutesDisplay = document.getElementById('minutes');
68
+ const secondsDisplay = document.getElementById('seconds');
69
+ const millisecondsDisplay = document.getElementById('milliseconds');
70
+
71
+ function startTimer() {
72
+ if (!isRunning) {
73
+ startTime = Date.now() - elapsedTime;
74
+ timerInterval = setInterval(updateTimer, 10);
75
+ isRunning = true;
76
+ toggleButtons();
77
+
78
+ // Animation
79
+ document.querySelector('.timer-display').style.transform = 'rotateX(5deg)';
80
+ }
81
+ }
82
+
83
+ function stopTimer() {
84
+ if (isRunning) {
85
+ clearInterval(timerInterval);
86
+ elapsedTime = Date.now() - startTime;
87
+ isRunning = false;
88
+ toggleButtons();
89
+
90
+ // Animation
91
+ document.querySelector('.timer-display').style.transform = 'rotateX(0)';
92
+ }
93
+ }
94
+
95
+ function resetTimer() {
96
+ clearInterval(timerInterval);
97
+ elapsedTime = 0;
98
+ isRunning = false;
99
+ updateDisplay();
100
+ toggleButtons();
101
+
102
+ // Animation
103
+ document.querySelector('.timer-display').style.transform = 'rotateX(-5deg)';
104
+ setTimeout(() => {
105
+ document.querySelector('.timer-display').style.transform = 'rotateX(0)';
106
+ }, 300);
107
+ }
108
+
109
+ function updateTimer() {
110
+ const currentTime = Date.now();
111
+ elapsedTime = currentTime - startTime;
112
+ updateDisplay();
113
+ }
114
+
115
+ function updateDisplay() {
116
+ let totalMilliseconds = elapsedTime;
117
+ let totalSeconds = Math.floor(totalMilliseconds / 1000);
118
+ let totalMinutes = Math.floor(totalSeconds / 60);
119
+ let totalHours = Math.floor(totalMinutes / 60);
120
+
121
+ let milliseconds = Math.floor((totalMilliseconds % 1000) / 10);
122
+ let seconds = totalSeconds % 60;
123
+ let minutes = totalMinutes % 60;
124
+ let hours = totalHours % 24;
125
+
126
+ millisecondsDisplay.textContent = `.${milliseconds.toString().padStart(2, '0')}`;
127
+ secondsDisplay.textContent = seconds.toString().padStart(2, '0');
128
+ minutesDisplay.textContent = minutes.toString().padStart(2, '0');
129
+ hoursDisplay.textContent = hours.toString().padStart(2, '0');
130
+ }
131
+
132
+ function toggleButtons() {
133
+ startBtn.disabled = isRunning;
134
+ stopBtn.disabled = !isRunning;
135
+
136
+ if (isRunning) {
137
+ startBtn.classList.remove('bg-green-600', 'hover:bg-green-700');
138
+ startBtn.classList.add('bg-gray-500', 'cursor-not-allowed');
139
+ stopBtn.classList.remove('bg-gray-500', 'cursor-not-allowed');
140
+ stopBtn.classList.add('bg-red-600', 'hover:bg-red-700');
141
+ } else {
142
+ startBtn.classList.remove('bg-gray-500', 'cursor-not-allowed');
143
+ startBtn.classList.add('bg-green-600', 'hover:bg-green-700');
144
+ stopBtn.classList.remove('bg-red-600', 'hover:bg-red-700');
145
+ stopBtn.classList.add('bg-gray-500', 'cursor-not-allowed');
146
+ }
147
+ }
148
+
149
+ // Event listeners
150
+ startBtn.addEventListener('click', startTimer);
151
+ stopBtn.addEventListener('click', stopTimer);
152
+ resetBtn.addEventListener('click', resetTimer);
153
+
154
+ // Keyboard controls
155
+ document.addEventListener('keydown', (e) => {
156
+ if (e.code === 'Space') {
157
+ e.preventDefault();
158
+ if (isRunning) stopTimer();
159
+ else startTimer();
160
+ } else if (e.code === 'KeyR') {
161
+ resetTimer();
162
+ }
163
+ });
164
+ </script>
165
+ <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=djaborolouai/timer" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
166
+ </html>
prompts.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ Génère un site web avec un chronomètre simple pouvant démarrer, s’arrêter et se réinitialiser, affichant le temps écoulé.