XXXMARK commited on
Commit
81f7d3f
·
verified ·
1 Parent(s): 614dd38

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +532 -18
index.html CHANGED
@@ -1,19 +1,533 @@
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>Code Terminal with Line Numbers</title>
7
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
8
+ <style>
9
+ :root {
10
+ --primary-color: #6c5ce7;
11
+ --secondary-color: #a29bfe;
12
+ --background-color: #1e1e1e;
13
+ --text-color: #e8e8e8;
14
+ --line-number-color: #666;
15
+ --highlight-color: rgba(108, 92, 231, 0.2);
16
+ --border-color: #333;
17
+ --active-tab-color: #2d2d2d;
18
+ }
19
+
20
+ * {
21
+ margin: 0;
22
+ padding: 0;
23
+ box-sizing: border-box;
24
+ font-family: 'Courier New', monospace;
25
+ }
26
+
27
+ body {
28
+ background-color: #121212;
29
+ color: var(--text-color);
30
+ min-height: 100vh;
31
+ display: flex;
32
+ flex-direction: column;
33
+ }
34
+
35
+ header {
36
+ background-color: var(--background-color);
37
+ padding: 1rem 2rem;
38
+ display: flex;
39
+ justify-content: space-between;
40
+ align-items: center;
41
+ border-bottom: 1px solid var(--border-color);
42
+ }
43
+
44
+ .logo {
45
+ font-size: 1.5rem;
46
+ font-weight: bold;
47
+ color: var(--primary-color);
48
+ text-decoration: none;
49
+ display: flex;
50
+ align-items: center;
51
+ gap: 0.5rem;
52
+ }
53
+
54
+ .logo i {
55
+ color: var(--secondary-color);
56
+ }
57
+
58
+ .header-right {
59
+ display: flex;
60
+ align-items: center;
61
+ gap: 1rem;
62
+ }
63
+
64
+ .built-with {
65
+ font-size: 0.8rem;
66
+ color: var(--line-number-color);
67
+ text-decoration: none;
68
+ }
69
+
70
+ .built-with:hover {
71
+ color: var(--secondary-color);
72
+ }
73
+
74
+ .theme-toggle {
75
+ background: none;
76
+ border: none;
77
+ color: var(--text-color);
78
+ cursor: pointer;
79
+ font-size: 1.2rem;
80
+ }
81
+
82
+ .container {
83
+ display: flex;
84
+ flex: 1;
85
+ overflow: hidden;
86
+ }
87
+
88
+ .sidebar {
89
+ width: 250px;
90
+ background-color: var(--background-color);
91
+ border-right: 1px solid var(--border-color);
92
+ display: flex;
93
+ flex-direction: column;
94
+ }
95
+
96
+ .file-explorer {
97
+ padding: 1rem;
98
+ flex: 1;
99
+ overflow-y: auto;
100
+ }
101
+
102
+ .file-explorer-title {
103
+ font-size: 0.9rem;
104
+ color: var(--line-number-color);
105
+ margin-bottom: 0.5rem;
106
+ text-transform: uppercase;
107
+ letter-spacing: 1px;
108
+ }
109
+
110
+ .file-item {
111
+ padding: 0.5rem;
112
+ border-radius: 4px;
113
+ cursor: pointer;
114
+ display: flex;
115
+ align-items: center;
116
+ gap: 0.5rem;
117
+ }
118
+
119
+ .file-item:hover {
120
+ background-color: var(--active-tab-color);
121
+ }
122
+
123
+ .file-item.active {
124
+ background-color: var(--highlight-color);
125
+ }
126
+
127
+ .file-item i {
128
+ color: var(--secondary-color);
129
+ width: 1rem;
130
+ }
131
+
132
+ .editor-container {
133
+ flex: 1;
134
+ display: flex;
135
+ flex-direction: column;
136
+ overflow: hidden;
137
+ }
138
+
139
+ .editor-tabs {
140
+ display: flex;
141
+ background-color: var(--background-color);
142
+ border-bottom: 1px solid var(--border-color);
143
+ padding-left: 1rem;
144
+ }
145
+
146
+ .tab {
147
+ padding: 0.75rem 1.5rem;
148
+ cursor: pointer;
149
+ display: flex;
150
+ align-items: center;
151
+ gap: 0.5rem;
152
+ border-right: 1px solid var(--border-color);
153
+ }
154
+
155
+ .tab:hover {
156
+ background-color: var(--active-tab-color);
157
+ }
158
+
159
+ .tab.active {
160
+ background-color: var(--active-tab-color);
161
+ border-bottom: 2px solid var(--primary-color);
162
+ }
163
+
164
+ .tab-close {
165
+ opacity: 0;
166
+ transition: opacity 0.2s;
167
+ }
168
+
169
+ .tab:hover .tab-close {
170
+ opacity: 1;
171
+ }
172
+
173
+ .tab-close:hover {
174
+ color: #ff5555;
175
+ }
176
+
177
+ .editor {
178
+ flex: 1;
179
+ display: flex;
180
+ overflow: hidden;
181
+ }
182
+
183
+ .line-numbers {
184
+ width: 4rem;
185
+ background-color: #1e1e1e;
186
+ color: var(--line-number-color);
187
+ text-align: right;
188
+ padding: 0.5rem 1rem;
189
+ font-size: 0.9rem;
190
+ user-select: none;
191
+ border-right: 1px solid var(--border-color);
192
+ overflow-y: auto;
193
+ scrollbar-width: thin;
194
+ }
195
+
196
+ .line-numbers::-webkit-scrollbar {
197
+ width: 6px;
198
+ }
199
+
200
+ .line-numbers::-webkit-scrollbar-thumb {
201
+ background-color: var(--border-color);
202
+ border-radius: 3px;
203
+ }
204
+
205
+ .code-area {
206
+ flex: 1;
207
+ padding: 0.5rem 1rem;
208
+ overflow-y: auto;
209
+ font-size: 0.9rem;
210
+ line-height: 1.5;
211
+ tab-size: 4;
212
+ scrollbar-width: thin;
213
+ }
214
+
215
+ .code-area::-webkit-scrollbar {
216
+ width: 8px;
217
+ }
218
+
219
+ .code-area::-webkit-scrollbar-thumb {
220
+ background-color: var(--border-color);
221
+ border-radius: 4px;
222
+ }
223
+
224
+ .code-area:focus {
225
+ outline: none;
226
+ }
227
+
228
+ .line {
229
+ display: block;
230
+ white-space: pre;
231
+ }
232
+
233
+ .line-highlight {
234
+ background-color: var(--highlight-color);
235
+ }
236
+
237
+ .status-bar {
238
+ background-color: var(--background-color);
239
+ padding: 0.5rem 1rem;
240
+ font-size: 0.8rem;
241
+ color: var(--line-number-color);
242
+ border-top: 1px solid var(--border-color);
243
+ display: flex;
244
+ justify-content: space-between;
245
+ }
246
+
247
+ @media (max-width: 768px) {
248
+ .sidebar {
249
+ width: 60px;
250
+ }
251
+
252
+ .file-explorer-title {
253
+ display: none;
254
+ }
255
+
256
+ .file-item span {
257
+ display: none;
258
+ }
259
+
260
+ .line-numbers {
261
+ width: 3rem;
262
+ padding: 0.5rem 0.5rem;
263
+ }
264
+
265
+ header {
266
+ padding: 1rem;
267
+ }
268
+ }
269
+ </style>
270
+ </head>
271
+ <body>
272
+ <header>
273
+ <a href="#" class="logo">
274
+ <i class="fas fa-code"></i>
275
+ <span>CodeTerminal</span>
276
+ </a>
277
+ <div class="header-right">
278
+ <a href="https://huggingface.co/spaces/akhaliq/anycoder" class="built-with" target="_blank">Built with anycoder</a>
279
+ <button class="theme-toggle" id="themeToggle">
280
+ <i class="fas fa-moon"></i>
281
+ </button>
282
+ </div>
283
+ </header>
284
+
285
+ <div class="container">
286
+ <div class="sidebar">
287
+ <div class="file-explorer">
288
+ <div class="file-explorer-title">Explorer</div>
289
+ <div class="file-item active" data-file="index.html">
290
+ <i class="fas fa-file-code"></i>
291
+ <span>index.html</span>
292
+ </div>
293
+ <div class="file-item" data-file="style.css">
294
+ <i class="fas fa-file-code"></i>
295
+ <span>style.css</span>
296
+ </div>
297
+ <div class="file-item" data-file="script.js">
298
+ <i class="fas fa-file-code"></i>
299
+ <span>script.js</span>
300
+ </div>
301
+ <div class="file-explorer-title">Folders</div>
302
+ <div class="file-item">
303
+ <i class="fas fa-folder"></i>
304
+ <span>src</span>
305
+ </div>
306
+ <div class="file-item">
307
+ <i class="fas fa-folder"></i>
308
+ <span>components</span>
309
+ </div>
310
+ </div>
311
+ </div>
312
+
313
+ <div class="editor-container">
314
+ <div class="editor-tabs">
315
+ <div class="tab active" data-file="index.html">
316
+ <i class="fas fa-file-code"></i>
317
+ <span>index.html</span>
318
+ <i class="fas fa-times tab-close"></i>
319
+ </div>
320
+ </div>
321
+ <div class="editor">
322
+ <div class="line-numbers" id="lineNumbers"></div>
323
+ <div class="code-area" id="codeArea" contenteditable="true" spellcheck="false">
324
+ <!DOCTYPE html>
325
+ <html lang="en">
326
+ <head>
327
+ <meta charset="UTF-8">
328
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
329
+ <title>Document</title>
330
+ </head>
331
+ <body>
332
+ <h1>Hello World!</h1>
333
+ <p>This is a sample HTML file.</p>
334
+ </body>
335
  </html>
336
+ </div>
337
+ </div>
338
+ <div class="status-bar">
339
+ <span>Line: 1, Column: 1</span>
340
+ <span>UTF-8 | LF | HTML</span>
341
+ </div>
342
+ </div>
343
+ </div>
344
+
345
+ <script>
346
+ document.addEventListener('DOMContentLoaded', function() {
347
+ const codeArea = document.getElementById('codeArea');
348
+ const lineNumbers = document.getElementById('lineNumbers');
349
+ const themeToggle = document.getElementById('themeToggle');
350
+ const fileItems = document.querySelectorAll('.file-item');
351
+ const tabsContainer = document.querySelector('.editor-tabs');
352
+
353
+ // Initialize line numbers
354
+ updateLineNumbers();
355
+
356
+ // Sync scrolling between code area and line numbers
357
+ codeArea.addEventListener('scroll', function() {
358
+ lineNumbers.scrollTop = codeArea.scrollTop;
359
+ });
360
+
361
+ // Update line numbers when content changes
362
+ codeArea.addEventListener('input', function() {
363
+ updateLineNumbers();
364
+ updateStatusBar();
365
+ });
366
+
367
+ // Update line numbers when window is resized
368
+ window.addEventListener('resize', updateLineNumbers);
369
+
370
+ // Handle keyboard events
371
+ codeArea.addEventListener('keydown', function(e) {
372
+ // Handle Tab key
373
+ if (e.key === 'Tab') {
374
+ e.preventDefault();
375
+ const start = codeArea.selectionStart;
376
+ const end = codeArea.selectionEnd;
377
+
378
+ // Insert tab character
379
+ codeArea.value = codeArea.value.substring(0, start) + '\t' + codeArea.value.substring(end);
380
+ codeArea.selectionStart = codeArea.selectionEnd = start + 1;
381
+ }
382
+
383
+ // Update status bar on any key press
384
+ setTimeout(updateStatusBar, 0);
385
+ });
386
+
387
+ // File navigation
388
+ fileItems.forEach(item => {
389
+ item.addEventListener('click', function() {
390
+ fileItems.forEach(i => i.classList.remove('active'));
391
+ this.classList.add('active');
392
+
393
+ // Check if tab already exists
394
+ const fileName = this.dataset.file;
395
+ const existingTab = document.querySelector(`.tab[data-file="${fileName}"]`);
396
+
397
+ if (!existingTab) {
398
+ // Create new tab
399
+ const newTab = document.createElement('div');
400
+ newTab.className = 'tab active';
401
+ newTab.dataset.file = fileName;
402
+ newTab.innerHTML = `
403
+ <i class="fas fa-file-code"></i>
404
+ <span>${fileName}</span>
405
+ <i class="fas fa-times tab-close"></i>
406
+ `;
407
+
408
+ // Add close event listener
409
+ newTab.querySelector('.tab-close').addEventListener('click', function(e) {
410
+ e.stopPropagation();
411
+ closeTab(newTab);
412
+ });
413
+
414
+ // Add click event listener
415
+ newTab.addEventListener('click', function() {
416
+ activateTab(this);
417
+ });
418
+
419
+ tabsContainer.appendChild(newTab);
420
+
421
+ // Deactivate other tabs
422
+ document.querySelectorAll('.tab').forEach(tab => {
423
+ if (tab !== newTab) {
424
+ tab.classList.remove('active');
425
+ }
426
+ });
427
+ } else {
428
+ activateTab(existingTab);
429
+ }
430
+ });
431
+ });
432
+
433
+ // Tab close functionality
434
+ function closeTab(tab) {
435
+ if (document.querySelectorAll('.tab').length <= 1) {
436
+ // Don't allow closing the last tab
437
+ return;
438
+ }
439
+
440
+ tab.remove();
441
+ // Activate the first remaining tab
442
+ const remainingTabs = document.querySelectorAll('.tab');
443
+ if (remainingTabs.length > 0) {
444
+ activateTab(remainingTabs[0]);
445
+ }
446
+ }
447
+
448
+ // Activate tab
449
+ function activateTab(tab) {
450
+ document.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
451
+ tab.classList.add('active');
452
+ }
453
+
454
+ // Theme toggle
455
+ themeToggle.addEventListener('click', function() {
456
+ document.body.classList.toggle('light-theme');
457
+ const icon = this.querySelector('i');
458
+ if (document.body.classList.contains('light-theme')) {
459
+ icon.className = 'fas fa-sun';
460
+ } else {
461
+ icon.className = 'fas fa-moon';
462
+ }
463
+ });
464
+
465
+ // Update line numbers
466
+ function updateLineNumbers() {
467
+ const lines = codeArea.value.split('\n');
468
+ const lineCount = lines.length;
469
+
470
+ let lineNumbersHTML = '';
471
+ for (let i = 1; i <= lineCount; i++) {
472
+ lineNumbersHTML += `<div>${i}</div>`;
473
+ }
474
+
475
+ lineNumbers.innerHTML = lineNumbersHTML;
476
+
477
+ // Highlight current line
478
+ highlightCurrentLine();
479
+ }
480
+
481
+ // Highlight current line
482
+ function highlightCurrentLine() {
483
+ const lines = codeArea.value.split('\n');
484
+ let lineNumber = 0;
485
+ let charCount = 0;
486
+
487
+ // Find which line the cursor is on
488
+ for (let i = 0; i < lines.length; i++) {
489
+ charCount += lines[i].length + 1; // +1 for newline character
490
+ if (charCount > codeArea.selectionStart) {
491
+ lineNumber = i;
492
+ break;
493
+ }
494
+ }
495
+
496
+ // Remove previous highlights
497
+ document.querySelectorAll('.line-highlight').forEach(el => {
498
+ el.classList.remove('line-highlight');
499
+ });
500
+
501
+ // Add highlight to current line
502
+ if (lineNumbers.children[lineNumber]) {
503
+ lineNumbers.children[lineNumber].classList.add('line-highlight');
504
+ }
505
+ }
506
+
507
+ // Update status bar
508
+ function updateStatusBar() {
509
+ const statusBar = document.querySelector('.status-bar');
510
+ const lines = codeArea.value.split('\n');
511
+ let lineNumber = 1;
512
+ let columnNumber = 1;
513
+ let charCount = 0;
514
+
515
+ // Find line and column numbers
516
+ for (let i = 0; i < lines.length; i++) {
517
+ charCount += lines[i].length + 1; // +1 for newline character
518
+ if (charCount > codeArea.selectionStart) {
519
+ lineNumber = i + 1;
520
+ columnNumber = codeArea.selectionStart - (charCount - lines[i].length - 1) + 1;
521
+ break;
522
+ }
523
+ }
524
+
525
+ statusBar.children[0].textContent = `Line: ${lineNumber}, Column: ${columnNumber}`;
526
+ }
527
+
528
+ // Initialize status bar
529
+ updateStatusBar();
530
+ });
531
+ </script>
532
+ </body>
533
+ </html>