Translsis commited on
Commit
5e1a369
·
verified ·
1 Parent(s): 8afa753

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +393 -19
index.html CHANGED
@@ -1,19 +1,393 @@
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="vi">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>HTML Tab Viewer</title>
7
+ <style>
8
+ * {
9
+ margin: 0;
10
+ padding: 0;
11
+ box-sizing: border-box;
12
+ }
13
+
14
+ body {
15
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
16
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
17
+ min-height: 100vh;
18
+ padding: 20px;
19
+ }
20
+
21
+ .container {
22
+ max-width: 1400px;
23
+ margin: 0 auto;
24
+ background: white;
25
+ border-radius: 20px;
26
+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
27
+ overflow: hidden;
28
+ }
29
+
30
+ .header {
31
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
32
+ padding: 30px;
33
+ color: white;
34
+ text-align: center;
35
+ }
36
+
37
+ .header h1 {
38
+ font-size: 2.5em;
39
+ margin-bottom: 10px;
40
+ text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
41
+ }
42
+
43
+ .file-list-section {
44
+ padding: 20px 30px;
45
+ background: #f8f9fa;
46
+ border-bottom: 2px solid #e9ecef;
47
+ }
48
+
49
+ .file-list-title {
50
+ font-size: 1.2em;
51
+ color: #495057;
52
+ margin-bottom: 15px;
53
+ font-weight: 600;
54
+ }
55
+
56
+ .file-list {
57
+ display: grid;
58
+ grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
59
+ gap: 10px;
60
+ }
61
+
62
+ .file-item {
63
+ background: white;
64
+ padding: 12px 18px;
65
+ border-radius: 8px;
66
+ cursor: pointer;
67
+ transition: all 0.3s ease;
68
+ border: 2px solid #e9ecef;
69
+ display: flex;
70
+ align-items: center;
71
+ gap: 8px;
72
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
73
+ }
74
+
75
+ .file-item:hover {
76
+ border-color: #667eea;
77
+ transform: translateY(-2px);
78
+ box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
79
+ }
80
+
81
+ .file-item.active {
82
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
83
+ color: white;
84
+ border-color: #667eea;
85
+ }
86
+
87
+ .file-count {
88
+ background: white;
89
+ padding: 8px 15px;
90
+ border-radius: 20px;
91
+ font-weight: bold;
92
+ color: #667eea;
93
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
94
+ display: inline-block;
95
+ }
96
+
97
+ .tabs {
98
+ display: flex;
99
+ background: #f8f9fa;
100
+ padding: 0 20px;
101
+ overflow-x: auto;
102
+ border-bottom: 3px solid #e9ecef;
103
+ }
104
+
105
+ .tabs::-webkit-scrollbar {
106
+ height: 8px;
107
+ }
108
+
109
+ .tabs::-webkit-scrollbar-track {
110
+ background: #f1f1f1;
111
+ }
112
+
113
+ .tabs::-webkit-scrollbar-thumb {
114
+ background: #667eea;
115
+ border-radius: 4px;
116
+ }
117
+
118
+ .tab {
119
+ padding: 15px 25px;
120
+ cursor: pointer;
121
+ border: none;
122
+ background: transparent;
123
+ color: #6c757d;
124
+ font-weight: 600;
125
+ transition: all 0.3s ease;
126
+ white-space: nowrap;
127
+ position: relative;
128
+ border-radius: 10px 10px 0 0;
129
+ margin-top: 5px;
130
+ }
131
+
132
+ .tab:hover {
133
+ background: rgba(102, 126, 234, 0.1);
134
+ color: #667eea;
135
+ }
136
+
137
+ .tab.active {
138
+ background: white;
139
+ color: #667eea;
140
+ box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
141
+ }
142
+
143
+ .tab.active::after {
144
+ content: '';
145
+ position: absolute;
146
+ bottom: -3px;
147
+ left: 0;
148
+ right: 0;
149
+ height: 3px;
150
+ background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
151
+ }
152
+
153
+ .content {
154
+ padding: 30px;
155
+ min-height: 500px;
156
+ }
157
+
158
+ .tab-content {
159
+ display: none;
160
+ animation: fadeIn 0.3s ease;
161
+ }
162
+
163
+ .tab-content.active {
164
+ display: block;
165
+ }
166
+
167
+ @keyframes fadeIn {
168
+ from {
169
+ opacity: 0;
170
+ transform: translateY(10px);
171
+ }
172
+ to {
173
+ opacity: 1;
174
+ transform: translateY(0);
175
+ }
176
+ }
177
+
178
+ iframe {
179
+ width: 100%;
180
+ height: 600px;
181
+ border: 2px solid #e9ecef;
182
+ border-radius: 10px;
183
+ background: white;
184
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
185
+ }
186
+
187
+ .empty-state {
188
+ text-align: center;
189
+ padding: 100px 20px;
190
+ color: #6c757d;
191
+ }
192
+
193
+ .empty-state svg {
194
+ width: 150px;
195
+ height: 150px;
196
+ margin-bottom: 20px;
197
+ opacity: 0.5;
198
+ }
199
+
200
+ .empty-state h2 {
201
+ font-size: 1.8em;
202
+ margin-bottom: 10px;
203
+ }
204
+
205
+ .empty-state p {
206
+ font-size: 1.1em;
207
+ }
208
+ </style>
209
+ </head>
210
+ <body>
211
+ <div class="container">
212
+ <div class="header">
213
+ <h1>📂 HTML Auto Loader</h1>
214
+ <p>Tự động load tất cả file HTML trong thư mục</p>
215
+ </div>
216
+
217
+ <div class="file-list-section">
218
+ <div class="file-list-title">
219
+ <span>📁 File HTML trong thư mục:</span>
220
+ <span class="file-count" id="fileCount">Đang tìm...</span>
221
+ </div>
222
+ <div class="file-list" id="fileList"></div>
223
+ </div>
224
+
225
+ <div class="tabs" id="tabs"></div>
226
+
227
+ <div class="content" id="content">
228
+ <div class="empty-state">
229
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
230
+ <path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"></path>
231
+ <polyline points="13 2 13 9 20 9"></polyline>
232
+ </svg>
233
+ <h2>Chưa có file nào được chọn</h2>
234
+ <p>Nhấn nút "Chọn file HTML" ở trên để bắt đầu</p>
235
+ </div>
236
+ </div>
237
+ </div>
238
+
239
+ <script>
240
+ const fileListContainer = document.getElementById('fileList');
241
+ const tabsContainer = document.getElementById('tabs');
242
+ const contentContainer = document.getElementById('content');
243
+ const fileCount = document.getElementById('fileCount');
244
+
245
+ // Danh sách file HTML trong thư mục (thêm tên file của bạn vào đây)
246
+ const htmlFiles = [
247
+ 'index.html',
248
+ 'page1.html',
249
+ 'page2.html',
250
+ 'contact.html',
251
+ 'about.html'
252
+ // Thêm tên file HTML của bạn vào đây
253
+ ];
254
+
255
+ let activeFiles = [];
256
+
257
+ // Initialize
258
+ init();
259
+
260
+ function init() {
261
+ if (htmlFiles.length === 0) {
262
+ fileCount.textContent = 'Không có file';
263
+ return;
264
+ }
265
+
266
+ fileCount.textContent = `${htmlFiles.length} file`;
267
+
268
+ // Create file list
269
+ htmlFiles.forEach((fileName, index) => {
270
+ const fileItem = document.createElement('div');
271
+ fileItem.className = 'file-item';
272
+ fileItem.innerHTML = `📄 ${fileName}`;
273
+ fileItem.onclick = () => toggleFile(fileName, index, fileItem);
274
+ fileListContainer.appendChild(fileItem);
275
+ });
276
+
277
+ // Auto load all files
278
+ loadAllFiles();
279
+ }
280
+
281
+ function toggleFile(fileName, index, element) {
282
+ if (activeFiles.includes(fileName)) {
283
+ // Remove file
284
+ activeFiles = activeFiles.filter(f => f !== fileName);
285
+ element.classList.remove('active');
286
+ removeTab(fileName);
287
+ } else {
288
+ // Add file
289
+ activeFiles.push(fileName);
290
+ element.classList.add('active');
291
+ addTab(fileName, activeFiles.length - 1);
292
+ }
293
+ }
294
+
295
+ function loadAllFiles() {
296
+ htmlFiles.forEach((fileName, index) => {
297
+ activeFiles.push(fileName);
298
+ const fileItems = fileListContainer.querySelectorAll('.file-item');
299
+ fileItems[index].classList.add('active');
300
+ addTab(fileName, index);
301
+ });
302
+ }
303
+
304
+ function addTab(fileName, index) {
305
+ // Create tab
306
+ const tab = document.createElement('button');
307
+ tab.className = 'tab' + (index === 0 ? ' active' : '');
308
+ tab.textContent = fileName;
309
+ tab.dataset.file = fileName;
310
+ tab.onclick = () => switchTab(fileName);
311
+ tabsContainer.appendChild(tab);
312
+
313
+ // Create content
314
+ const tabContent = document.createElement('div');
315
+ tabContent.className = 'tab-content' + (index === 0 ? ' active' : '');
316
+ tabContent.dataset.file = fileName;
317
+
318
+ // Create iframe to load the file
319
+ const iframe = document.createElement('iframe');
320
+ iframe.src = fileName;
321
+ iframe.sandbox = 'allow-scripts allow-same-origin allow-forms allow-modals allow-popups';
322
+ iframe.onerror = function() {
323
+ tabContent.innerHTML = `
324
+ <div style="text-align: center; padding: 50px; color: #dc3545;">
325
+ <h2>❌ Không thể load file</h2>
326
+ <p>${fileName} không tồn tại hoặc không thể truy cập</p>
327
+ </div>
328
+ `;
329
+ };
330
+ tabContent.appendChild(iframe);
331
+
332
+ contentContainer.innerHTML = '';
333
+ contentContainer.appendChild(tabContent);
334
+
335
+ // Update content container
336
+ const existingContents = contentContainer.querySelectorAll('.tab-content');
337
+ if (existingContents.length > 0) {
338
+ existingContents.forEach(content => {
339
+ if (content !== tabContent) {
340
+ contentContainer.appendChild(content);
341
+ }
342
+ });
343
+ }
344
+ }
345
+
346
+ function removeTab(fileName) {
347
+ // Remove tab
348
+ const tab = tabsContainer.querySelector(`[data-file="${fileName}"]`);
349
+ if (tab) {
350
+ const wasActive = tab.classList.contains('active');
351
+ tab.remove();
352
+
353
+ // If removed tab was active, activate first remaining tab
354
+ if (wasActive && activeFiles.length > 0) {
355
+ switchTab(activeFiles[0]);
356
+ }
357
+ }
358
+
359
+ // Remove content
360
+ const content = contentContainer.querySelector(`[data-file="${fileName}"]`);
361
+ if (content) content.remove();
362
+
363
+ // Show empty state if no files
364
+ if (activeFiles.length === 0) {
365
+ contentContainer.innerHTML = `
366
+ <div class="empty-state">
367
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
368
+ <path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"></path>
369
+ <polyline points="13 2 13 9 20 9"></polyline>
370
+ </svg>
371
+ <h2>Chưa có file nào được chọn</h2>
372
+ <p>Nhấn vào tên file ở trên để xem</p>
373
+ </div>
374
+ `;
375
+ }
376
+ }
377
+
378
+ function switchTab(fileName) {
379
+ // Update tabs
380
+ const tabs = tabsContainer.querySelectorAll('.tab');
381
+ tabs.forEach(tab => {
382
+ tab.classList.toggle('active', tab.dataset.file === fileName);
383
+ });
384
+
385
+ // Update content
386
+ const contents = contentContainer.querySelectorAll('.tab-content');
387
+ contents.forEach(content => {
388
+ content.classList.toggle('active', content.dataset.file === fileName);
389
+ });
390
+ }
391
+ </script>
392
+ </body>
393
+ </html>