Krikoset commited on
Commit
4b2205b
·
verified ·
1 Parent(s): d866813

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +225 -18
index.html CHANGED
@@ -1,19 +1,226 @@
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="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>ASCII Art Clock</title>
7
+ <style>
8
+ body {
9
+ display: flex;
10
+ justify-content: center;
11
+ align-items: center;
12
+ height: 100vh;
13
+ background-color: #000;
14
+ color: #fff;
15
+ font-family: monospace;
16
+ margin: 0;
17
+ position: relative;
18
+ }
19
+ .clock {
20
+ white-space: pre;
21
+ text-align: center;
22
+ font-size: 4vw;
23
+ line-height: 0.8;
24
+ }
25
+ .blink {
26
+ animation: blink-animation 1s steps(1, end) infinite;
27
+ }
28
+ @keyframes blink-animation {
29
+ 50% {
30
+ visibility: hidden;
31
+ }
32
+ }
33
+ #editor, #style-selector {
34
+ position: fixed;
35
+ top: 10px;
36
+ right: 10px;
37
+ background-color: rgba(50, 50, 50, 0.9);
38
+ color: #fff;
39
+ padding: 20px;
40
+ border-radius: 10px;
41
+ border: 1px solid #fff;
42
+ display: none;
43
+ z-index: 1000;
44
+ font-family: Arial, sans-serif;
45
+ }
46
+ #editor textarea {
47
+ width: 100%;
48
+ height: 200px;
49
+ background-color: #222;
50
+ color: #fff;
51
+ font-family: monospace;
52
+ border: none;
53
+ padding: 10px;
54
+ border-radius: 5px;
55
+ }
56
+ #open-editor, #open-style-selector {
57
+ position: fixed;
58
+ top: 10px;
59
+ right: 10px;
60
+ color: #fff;
61
+ cursor: pointer;
62
+ z-index: 1000;
63
+ font-size: 24px;
64
+ }
65
+ #style-selector select {
66
+ width: 100%;
67
+ padding: 10px;
68
+ margin-top: 10px;
69
+ background-color: #333;
70
+ color: #fff;
71
+ border: none;
72
+ border-radius: 5px;
73
+ }
74
+ #style-selector button, #editor button {
75
+ background-color: #444;
76
+ color: #fff;
77
+ border: none;
78
+ padding: 10px 20px;
79
+ margin-top: 10px;
80
+ cursor: pointer;
81
+ border-radius: 5px;
82
+ width: 100%;
83
+ }
84
+ </style>
85
+ </head>
86
+ <body>
87
+ <div class="clock" id="clock"></div>
88
+ <div id="open-editor">*</div>
89
+ <div id="style-selector">
90
+ <label for="styles">Choose a style:</label>
91
+ <select id="styles">
92
+ <option value="default">Default</option>
93
+ <option value="style1">Style 1</option>
94
+ <option value="style2">Style 2</option>
95
+ </select>
96
+ <button onclick="closeStyleSelector()">Close</button>
97
+ </div>
98
+ <div id="editor">
99
+ <h3>Edit ASCII Art</h3>
100
+ <textarea id="custom-style"></textarea>
101
+ <button onclick="saveCustomStyle()">Save</button>
102
+ <button onclick="closeEditor()">Close</button>
103
+ </div>
104
+
105
+ <script>
106
+ const asciiArtStyles = {
107
+ "default": {
108
+ "0": "###\n# #\n# #\n# #\n###",
109
+ "1": " #\n #\n #\n #\n #",
110
+ "2": "###\n #\n###\n# \n###",
111
+ "3": "###\n #\n###\n #\n###",
112
+ "4": "# #\n# #\n###\n #\n #",
113
+ "5": "###\n# \n###\n #\n###",
114
+ "6": "###\n# \n###\n# #\n###",
115
+ "7": "###\n #\n #\n #\n #",
116
+ "8": "###\n# #\n###\n# #\n###",
117
+ "9": "###\n# #\n###\n #\n###",
118
+ ":": " \n # \n \n # \n "
119
+ },
120
+ "style1": {
121
+ "0": "@@@\n@ @\n@ @\n@ @\n@@@",
122
+ "1": " @\n @\n @\n @\n @",
123
+ "2": "@@@\n @\n@@@\n@ \n@@@",
124
+ "3": "@@@\n @\n@@@\n @\n@@@",
125
+ "4": "@ @\n@ @\n@@@\n @\n @",
126
+ "5": "@@@\n@ \n@@@\n @\n@@@",
127
+ "6": "@@@\n@ \n@@@\n@ @\n@@@",
128
+ "7": "@@@\n @\n @\n @\n @",
129
+ "8": "@@@\n@ @\n@@@\n@ @\n@@@",
130
+ "9": "@@@\n@ @\n@@@\n @\n@@@",
131
+ ":": " \n @ \n \n @ \n "
132
+ },
133
+ "style5": {
134
+ "0": "OOO\nO O\nO O\nO O\nOOO",
135
+ "1": " O\n O\n O\n O\n O",
136
+ "2": "OOO\n O\nOOO\nO \nOOO",
137
+ "3": "OOO\n O\nOOO\n O\nOOO",
138
+ "4": "O O\nO O\nOOO\n O\n O",
139
+ "5": "OOO\nO \nOOO\n O\nOOO",
140
+ "6": "OOO\nO \nOOO\nO O\nOOO",
141
+ "7": "OOO\n O\n O\n O\n O",
142
+ "8": "OOO\nO O\nOOO\nO O\nOOO",
143
+ "9": "OOO\nO O\nOOO\n O\nOOO",
144
+ ":": " \n O \n \n O \n "
145
+ }
146
+ };
147
+
148
+ let currentStyle = "default";
149
+
150
+ function updateClock() {
151
+ const currentTime = new Date();
152
+ const hours = String(currentTime.getHours()).padStart(2, '0');
153
+ const minutes = String(currentTime.getMinutes()).padStart(2, '0');
154
+ const seconds = String(currentTime.getSeconds()).padStart(2, '0');
155
+
156
+ const timeString = `${hours}:${minutes}:${seconds}`;
157
+ const lines = ["", "", "", "", ""];
158
+
159
+ for (let char of timeString) {
160
+ const charLines = asciiArtStyles[currentStyle][char].split('\n');
161
+ for (let i = 0; i < 5; i++) {
162
+ lines[i] += char === ':' ? `<span class="blink">${charLines[i]}</span> ` : `${charLines[i]} `;
163
+ }
164
+ }
165
+
166
+ document.getElementById('clock').innerHTML = lines.join('\n');
167
+ }
168
+
169
+ function openStyleSelector() {
170
+ document.getElementById('style-selector').style.display = 'block';
171
+ }
172
+
173
+ function closeStyleSelector() {
174
+ document.getElementById('style-selector').style.display = 'none';
175
+ }
176
+
177
+ function openEditor() {
178
+ document.getElementById('editor').style.display = 'block';
179
+ }
180
+
181
+ function closeEditor() {
182
+ document.getElementById('editor').style.display = 'none';
183
+ }
184
+
185
+ function saveCustomStyle() {
186
+ const customStyle = document.getElementById('custom-style').value;
187
+ const customStyleLines = customStyle.split('\n');
188
+ const customAsciiArt = {};
189
+ let currentChar = null;
190
+ let currentArt = [];
191
+
192
+ for (let line of customStyleLines) {
193
+ if (line.length === 1 && line.match(/[0-9:]/)) {
194
+ if (currentChar) {
195
+ customAsciiArt[currentChar] = currentArt.join('\n');
196
+ }
197
+ currentChar = line;
198
+ currentArt = [];
199
+ } else {
200
+ currentArt.push(line);
201
+ }
202
+ }
203
+ if (currentChar) {
204
+ customAsciiArt[currentChar] = currentArt.join('\n');
205
+ }
206
+
207
+ asciiArtStyles.custom = customAsciiArt;
208
+ currentStyle = 'custom';
209
+ closeEditor();
210
+ updateClock();
211
+ }
212
+
213
+ document.getElementById('open-editor').addEventListener('click', () => {
214
+ openStyleSelector();
215
+ });
216
+
217
+ document.getElementById('styles').addEventListener('change', (event) => {
218
+ currentStyle = event.target.value;
219
+ updateClock();
220
+ });
221
+
222
+ setInterval(updateClock, 1000);
223
+ updateClock(); // Initial call to display the clock immediately
224
+ </script>
225
+ </body>
226
  </html>