Gcuore commited on
Commit
7c4fa85
·
verified ·
1 Parent(s): 06110c3

NOW I DONT SEE THE CONTROLS - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +225 -7
index.html CHANGED
@@ -4,6 +4,7 @@
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>iOS 18 Clock</title>
 
7
  <style>
8
  @font-face {
9
  font-family: 'SF Pro Display';
@@ -19,9 +20,6 @@
19
  background-repeat: no-repeat;
20
  color: #fff;
21
  font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
22
- display: flex;
23
- justify-content: center;
24
- align-items: flex-start;
25
  height: 100vh;
26
  margin: 0;
27
  -webkit-app-region: drag;
@@ -35,16 +33,41 @@
35
  <div id="date" class="clock-date">Monday, September 25</div>
36
  </div>
37
 
38
- <button id="settings-button" style="position: fixed; bottom: 20px; right: 20px; background: rgba(30,30,30,0.7); color: white; border: none; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; -webkit-app-region: no-drag;">
39
 
40
  </button>
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  <style>
43
  .clock-container {
 
 
 
 
44
  display: flex;
45
- flex-direction: column;
46
  align-items: center;
47
- padding-top: 40px;
48
  background-color: transparent;
49
  border-radius: 12px;
50
  padding: 20px;
@@ -56,12 +79,12 @@
56
  font-weight: 700;
57
  letter-spacing: -2px;
58
  opacity: 0.55;
 
59
  }
60
 
61
  .clock-date {
62
  font-size: 18px;
63
  font-weight: 600;
64
- margin-top: -8px;
65
  letter-spacing: -0.3px;
66
  opacity: 0.55;
67
  }
@@ -74,6 +97,10 @@
74
  <button onclick="document.getElementById('wallpaper-input').click()" style="background: #2c2c2e; color: white; border: none; padding: 10px 15px; border-radius: 8px; cursor: pointer;">
75
  Upload Wallpaper
76
  </button>
 
 
 
 
77
  <button onclick="document.getElementById('settings-modal').style.display = 'none'" style="background: #2c2c2e; color: white; border: none; padding: 10px 15px; border-radius: 8px; cursor: pointer; margin-left: 10px;">
78
  Close
79
  </button>
@@ -81,6 +108,76 @@
81
  </div>
82
 
83
  <script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  let clickCount = 0;
85
  let clickTimer;
86
 
@@ -88,6 +185,126 @@
88
  document.getElementById('settings-modal').style.display = 'block';
89
  });
90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  document.getElementById('wallpaper-input').addEventListener('change', function(e) {
92
  const file = e.target.files[0];
93
  if (file) {
@@ -97,6 +314,7 @@
97
  document.body.style.backgroundSize = 'cover';
98
  document.body.style.backgroundPosition = 'center';
99
  document.body.style.backgroundRepeat = 'no-repeat';
 
100
  };
101
  reader.readAsDataURL(file);
102
  }
 
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>iOS 18 Clock</title>
7
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/jsmediatags/3.9.5/jsmediatags.min.js"></script>
8
  <style>
9
  @font-face {
10
  font-family: 'SF Pro Display';
 
20
  background-repeat: no-repeat;
21
  color: #fff;
22
  font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
 
 
 
23
  height: 100vh;
24
  margin: 0;
25
  -webkit-app-region: drag;
 
33
  <div id="date" class="clock-date">Monday, September 25</div>
34
  </div>
35
 
36
+ <button id="settings-button" style="position: fixed; bottom: 20px; right: 20px; background: rgba(30,30,30,0.7); color: white; border: none; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; -webkit-app-region: no-drag; z-index: 100;">
37
 
38
  </button>
39
 
40
+ <div id="music-player" style="display: none; position: fixed; top: 300px; left: 50%; transform: translateX(-50%); background: transparent; padding: 10px; width: 250px; z-index: 50;">
41
+ <div style="display: flex; flex-direction: column; align-items: center; gap: 8px;">
42
+ <div id="album-art-container" style="width: 150px; height: 150px; margin-bottom: 10px;">
43
+ <img id="album-art" src="" style="width: 100%; height: 100%; object-fit: cover; border-radius: 10px;">
44
+ </div>
45
+ <div id="track-info" style="text-align: center; color: white; text-shadow: 0 1px 3px rgba(0,0,0,0.5);">
46
+ <div id="track-title" style="font-size: 18px; font-weight: bold;">No song playing</div>
47
+ <div id="track-artist" style="font-size: 14px; opacity: 0.8;">Upload a song to begin</div>
48
+ </div>
49
+ <div style="display: flex; align-items: center; gap: 15px; width: 100%; max-width: 400px;">
50
+ <span id="current-time">0:00</span>
51
+ <input type="range" id="progress-bar" style="flex-grow: 1;" min="0" max="100" value="0">
52
+ <span id="duration">0:00</span>
53
+ </div>
54
+ <div style="display: flex; justify-content: center; gap: 20px;">
55
+ <button id="prev-btn" style="background: none; border: none; color: white; font-size: 20px;">⏮</button>
56
+ <button id="play-btn" style="background: none; border: none; color: white; font-size: 30px;">▶</button>
57
+ <button id="next-btn" style="background: none; border: none; color: white; font-size: 20px;">⏭</button>
58
+ </div>
59
+ </div>
60
+ </div>
61
+
62
  <style>
63
  .clock-container {
64
+ position: fixed;
65
+ top: 20px;
66
+ left: 50%;
67
+ transform: translateX(-50%);
68
  display: flex;
69
+ flex-direction: column-reverse;
70
  align-items: center;
 
71
  background-color: transparent;
72
  border-radius: 12px;
73
  padding: 20px;
 
79
  font-weight: 700;
80
  letter-spacing: -2px;
81
  opacity: 0.55;
82
+ margin-top: -8px;
83
  }
84
 
85
  .clock-date {
86
  font-size: 18px;
87
  font-weight: 600;
 
88
  letter-spacing: -0.3px;
89
  opacity: 0.55;
90
  }
 
97
  <button onclick="document.getElementById('wallpaper-input').click()" style="background: #2c2c2e; color: white; border: none; padding: 10px 15px; border-radius: 8px; cursor: pointer;">
98
  Upload Wallpaper
99
  </button>
100
+ <input type="file" id="music-input" accept="audio/*" style="display: none;">
101
+ <button onclick="document.getElementById('music-input').click()" style="background: #2c2c2e; color: white; border: none; padding: 10px 15px; border-radius: 8px; cursor: pointer; margin-left: 10px;">
102
+ Upload Music
103
+ </button>
104
  <button onclick="document.getElementById('settings-modal').style.display = 'none'" style="background: #2c2c2e; color: white; border: none; padding: 10px 15px; border-radius: 8px; cursor: pointer; margin-left: 10px;">
105
  Close
106
  </button>
 
108
  </div>
109
 
110
  <script>
111
+ // Check if this is first visit and prompt for wallpaper
112
+ if (!localStorage.getItem('wallpaperSet')) {
113
+ setTimeout(() => {
114
+ document.getElementById('settings-modal').style.display = 'block';
115
+ localStorage.setItem('wallpaperSet', 'true');
116
+ }, 500);
117
+ }
118
+
119
+ const audio = new Audio();
120
+ let currentTrack = null;
121
+ let isPlaying = false;
122
+
123
+ // Initialize player with empty state
124
+ document.getElementById('track-title').textContent = 'No song playing';
125
+ document.getElementById('track-artist').textContent = 'Upload a song to begin';
126
+ document.getElementById('album-art').src = '';
127
+ document.getElementById('music-player').style.display = 'none';
128
+
129
+ // Music player controls
130
+ document.getElementById('play-btn').addEventListener('click', function() {
131
+ if (!currentTrack) return;
132
+
133
+ if (isPlaying) {
134
+ audio.pause();
135
+ document.getElementById('play-btn').textContent = '▶';
136
+ } else {
137
+ audio.play()
138
+ .then(() => {
139
+ document.getElementById('play-btn').textContent = '⏸';
140
+ })
141
+ .catch(error => {
142
+ console.error('Playback failed:', error);
143
+ alert('Playback failed. Please try again.');
144
+ });
145
+ }
146
+ isPlaying = !isPlaying;
147
+ });
148
+
149
+ document.getElementById('progress-bar').addEventListener('input', function() {
150
+ if (currentTrack) {
151
+ const seekTime = (audio.duration * this.value) / 100;
152
+ audio.currentTime = seekTime;
153
+ }
154
+ });
155
+
156
+ audio.addEventListener('timeupdate', function() {
157
+ if (currentTrack) {
158
+ const progress = (audio.currentTime / audio.duration) * 100;
159
+ document.getElementById('progress-bar').value = progress;
160
+ document.getElementById('current-time').textContent = formatTime(audio.currentTime);
161
+ }
162
+ });
163
+
164
+ audio.addEventListener('loadedmetadata', function() {
165
+ if (currentTrack) {
166
+ document.getElementById('duration').textContent = formatTime(audio.duration);
167
+ }
168
+ });
169
+
170
+ audio.addEventListener('ended', function() {
171
+ document.getElementById('play-btn').textContent = '▶';
172
+ isPlaying = false;
173
+ });
174
+
175
+ function formatTime(seconds) {
176
+ const minutes = Math.floor(seconds / 60);
177
+ const secs = Math.floor(seconds % 60);
178
+ return `${minutes}:${secs < 10 ? '0' : ''}${secs}`;
179
+ }
180
+
181
  let clickCount = 0;
182
  let clickTimer;
183
 
 
185
  document.getElementById('settings-modal').style.display = 'block';
186
  });
187
 
188
+ document.getElementById('music-input').addEventListener('change', function(e) {
189
+ const file = e.target.files[0];
190
+ if (file) {
191
+ // Reset player state
192
+ document.getElementById('track-title').textContent = file.name.replace(/\.[^/.]+$/, "");
193
+ document.getElementById('track-artist').textContent = 'Unknown Artist';
194
+ document.getElementById('album-art').src = '';
195
+ document.getElementById('music-player').style.display = 'block';
196
+
197
+ currentTrack = file;
198
+ const url = URL.createObjectURL(file);
199
+ audio.src = url;
200
+ audio.load();
201
+ audio.play().catch(error => console.log('Autoplay prevented:', error));
202
+ document.getElementById('play-btn').textContent = '⏸';
203
+ isPlaying = true;
204
+
205
+ // Read metadata
206
+ const reader = new FileReader();
207
+ reader.onload = function(event) {
208
+ try {
209
+ jsmediatags.read(file, {
210
+ onSuccess: function(tag) {
211
+ const tags = tag.tags;
212
+ document.getElementById('track-title').textContent = tags.title || file.name.replace(/\.[^/.]+$/, "");
213
+ document.getElementById('track-artist').textContent = tags.artist || 'Unknown Artist';
214
+
215
+ if (tags.picture) {
216
+ const base64String = arrayBufferToBase64(tags.picture.data);
217
+ const imageUrl = `data:${tags.picture.format};base64,${base64String}`;
218
+ document.getElementById('album-art').src = imageUrl;
219
+ } else {
220
+ document.getElementById('album-art').src = '';
221
+ }
222
+
223
+ document.getElementById('music-player').style.display = 'block';
224
+ audio.play().catch(e => console.log('Autoplay prevented:', e));
225
+ document.getElementById('play-btn').textContent = '⏸';
226
+ isPlaying = true;
227
+ },
228
+ onError: function(error) {
229
+ console.log('Error reading metadata:', error);
230
+ document.getElementById('track-title').textContent = file.name.replace(/\.[^/.]+$/, "");
231
+ document.getElementById('track-artist').textContent = 'Unknown Artist';
232
+ document.getElementById('album-art').src = '';
233
+ document.getElementById('music-player').style.display = 'block';
234
+ audio.play().catch(e => console.log('Autoplay prevented:', e));
235
+ document.getElementById('play-btn').textContent = '⏸';
236
+ isPlaying = true;
237
+ }
238
+ });
239
+ } catch (error) {
240
+ console.log('Error processing file:', error);
241
+ document.getElementById('track-title').textContent = file.name.replace(/\.[^/.]+$/, "");
242
+ document.getElementById('track-artist').textContent = 'Unknown Artist';
243
+ document.getElementById('album-art').src = '';
244
+ document.getElementById('music-player').style.display = 'block';
245
+ audio.play().catch(e => console.log('Autoplay prevented:', e));
246
+ document.getElementById('play-btn').textContent = '⏸';
247
+ isPlaying = true;
248
+ }
249
+ };
250
+ reader.onerror = function() {
251
+ console.log('FileReader error');
252
+ document.getElementById('track-title').textContent = file.name.replace(/\.[^/.]+$/, "");
253
+ document.getElementById('track-artist').textContent = 'Unknown Artist';
254
+ document.getElementById('album-art').src = '';
255
+ document.getElementById('music-player').style.display = 'block';
256
+ audio.play().catch(e => console.log('Autoplay prevented:', e));
257
+ document.getElementById('play-btn').textContent = '⏸';
258
+ isPlaying = true;
259
+ };
260
+ reader.readAsArrayBuffer(file);
261
+ }
262
+ });
263
+
264
+ function arrayBufferToBase64(buffer) {
265
+ let binary = '';
266
+ const bytes = new Uint8Array(buffer);
267
+ for (let i = 0; i < bytes.byteLength; i++) {
268
+ binary += String.fromCharCode(bytes[i]);
269
+ }
270
+ return window.btoa(binary);
271
+ }
272
+
273
+ function setBackgroundFromImage(imageUrl) {
274
+ const img = new Image();
275
+ img.src = imageUrl;
276
+ img.onload = function() {
277
+ // Create a small canvas to analyze the image
278
+ const canvas = document.createElement('canvas');
279
+ const ctx = canvas.getContext('2d');
280
+ canvas.width = 16;
281
+ canvas.height = 16;
282
+ ctx.drawImage(img, 0, 0, 16, 16);
283
+
284
+ // Get dominant color
285
+ const pixelData = ctx.getImageData(0, 0, 16, 16).data;
286
+ let r = 0, g = 0, b = 0;
287
+ for (let i = 0; i < pixelData.length; i += 4) {
288
+ r += pixelData[i];
289
+ g += pixelData[i + 1];
290
+ b += pixelData[i + 2];
291
+ }
292
+ r = Math.floor(r / (pixelData.length / 4));
293
+ g = Math.floor(g / (pixelData.length / 4));
294
+ b = Math.floor(b / (pixelData.length / 4));
295
+
296
+ // Apply background with blur
297
+ document.body.style.background = `
298
+ linear-gradient(rgba(${r}, ${g}, ${b}, 0.7), rgba(${r}, ${g}, ${b}, 0.9)),
299
+ url(${imageUrl})
300
+ `;
301
+ document.body.style.backgroundSize = 'cover';
302
+ document.body.style.backgroundPosition = 'center';
303
+ document.body.style.backgroundRepeat = 'no-repeat';
304
+ document.body.style.backdropFilter = 'blur(20px)';
305
+ };
306
+ }
307
+
308
  document.getElementById('wallpaper-input').addEventListener('change', function(e) {
309
  const file = e.target.files[0];
310
  if (file) {
 
314
  document.body.style.backgroundSize = 'cover';
315
  document.body.style.backgroundPosition = 'center';
316
  document.body.style.backgroundRepeat = 'no-repeat';
317
+ localStorage.setItem('wallpaperSet', 'true');
318
  };
319
  reader.readAsDataURL(file);
320
  }