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

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +58 -33
index.html CHANGED
@@ -3,7 +3,7 @@
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;
@@ -175,9 +175,9 @@
175
  }
176
  }
177
 
178
- iframe {
179
  width: 100%;
180
- height: 600px;
181
  border: 2px solid #e9ecef;
182
  border-radius: 10px;
183
  background: white;
@@ -205,18 +205,28 @@
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>
@@ -227,11 +237,14 @@
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>
@@ -242,14 +255,14 @@
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 = [];
@@ -258,15 +271,15 @@
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}`;
@@ -293,7 +306,7 @@
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');
@@ -315,19 +328,28 @@
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);
@@ -365,11 +387,14 @@
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
  }
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>PDF Tab Viewer</title>
7
  <style>
8
  * {
9
  margin: 0;
 
175
  }
176
  }
177
 
178
+ .pdf-viewer {
179
  width: 100%;
180
+ height: 700px;
181
  border: 2px solid #e9ecef;
182
  border-radius: 10px;
183
  background: white;
 
205
  .empty-state p {
206
  font-size: 1.1em;
207
  }
208
+
209
+ .error-message {
210
+ text-align: center;
211
+ padding: 50px;
212
+ color: #dc3545;
213
+ }
214
+
215
+ .error-message h2 {
216
+ margin-bottom: 10px;
217
+ }
218
  </style>
219
  </head>
220
  <body>
221
  <div class="container">
222
  <div class="header">
223
+ <h1>📄 PDF Auto Loader</h1>
224
+ <p>Tự động load tất cả file PDF trong thư mục</p>
225
  </div>
226
 
227
  <div class="file-list-section">
228
  <div class="file-list-title">
229
+ <span>📁 File PDF trong thư mục:</span>
230
  <span class="file-count" id="fileCount">Đang tìm...</span>
231
  </div>
232
  <div class="file-list" id="fileList"></div>
 
237
  <div class="content" id="content">
238
  <div class="empty-state">
239
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
240
+ <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
241
+ <polyline points="14 2 14 8 20 8"></polyline>
242
+ <line x1="16" y1="13" x2="8" y2="13"></line>
243
+ <line x1="16" y1="17" x2="8" y2="17"></line>
244
+ <polyline points="10 9 9 9 8 9"></polyline>
245
  </svg>
246
  <h2>Chưa có file nào được chọn</h2>
247
+ <p>Nhấn vào tên file ở trên để xem PDF</p>
248
  </div>
249
  </div>
250
  </div>
 
255
  const contentContainer = document.getElementById('content');
256
  const fileCount = document.getElementById('fileCount');
257
 
258
+ // Danh sách file PDF trong thư mục (thêm tên file của bạn vào đây)
259
+ const pdfFiles = [
260
+ 'document1.pdf',
261
+ 'report.pdf',
262
+ 'presentation.pdf',
263
+ 'manual.pdf',
264
+ 'guide.pdf'
265
+ // Thêm tên file PDF của bạn vào đây
266
  ];
267
 
268
  let activeFiles = [];
 
271
  init();
272
 
273
  function init() {
274
+ if (pdfFiles.length === 0) {
275
  fileCount.textContent = 'Không có file';
276
  return;
277
  }
278
 
279
+ fileCount.textContent = `${pdfFiles.length} file`;
280
 
281
  // Create file list
282
+ pdfFiles.forEach((fileName, index) => {
283
  const fileItem = document.createElement('div');
284
  fileItem.className = 'file-item';
285
  fileItem.innerHTML = `📄 ${fileName}`;
 
306
  }
307
 
308
  function loadAllFiles() {
309
+ pdfFiles.forEach((fileName, index) => {
310
  activeFiles.push(fileName);
311
  const fileItems = fileListContainer.querySelectorAll('.file-item');
312
  fileItems[index].classList.add('active');
 
328
  tabContent.className = 'tab-content' + (index === 0 ? ' active' : '');
329
  tabContent.dataset.file = fileName;
330
 
331
+ // Create embed/object to display PDF
332
+ const pdfEmbed = document.createElement('embed');
333
+ pdfEmbed.src = fileName;
334
+ pdfEmbed.type = 'application/pdf';
335
+ pdfEmbed.className = 'pdf-viewer';
336
+
337
+ // Fallback if PDF can't be displayed
338
+ pdfEmbed.onerror = function() {
339
  tabContent.innerHTML = `
340
+ <div class="error-message">
341
+ <h2>❌ Không thể hiển thị PDF</h2>
342
+ <p><strong>${fileName}</strong> không tồn tại hoặc không thể truy cập</p>
343
+ <p style="margin-top: 15px;">
344
+ <a href="${fileName}" target="_blank" style="color: #667eea; text-decoration: none; font-weight: bold;">
345
+ 🔗 Thử mở trực tiếp file này
346
+ </a>
347
+ </p>
348
  </div>
349
  `;
350
  };
351
+
352
+ tabContent.appendChild(pdfEmbed);
353
 
354
  contentContainer.innerHTML = '';
355
  contentContainer.appendChild(tabContent);
 
387
  contentContainer.innerHTML = `
388
  <div class="empty-state">
389
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
390
+ <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
391
+ <polyline points="14 2 14 8 20 8"></polyline>
392
+ <line x1="16" y1="13" x2="8" y2="13"></line>
393
+ <line x1="16" y1="17" x2="8" y2="17"></line>
394
+ <polyline points="10 9 9 9 8 9"></polyline>
395
  </svg>
396
  <h2>Chưa có file nào được chọn</h2>
397
+ <p>Nhấn vào tên file ở trên để xem PDF</p>
398
  </div>
399
  `;
400
  }