Update index.html
Browse files- 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>
|
| 7 |
<style>
|
| 8 |
* {
|
| 9 |
margin: 0;
|
|
@@ -175,9 +175,9 @@
|
|
| 175 |
}
|
| 176 |
}
|
| 177 |
|
| 178 |
-
|
| 179 |
width: 100%;
|
| 180 |
-
height:
|
| 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
|
| 214 |
-
<p>Tự động load tất cả file
|
| 215 |
</div>
|
| 216 |
|
| 217 |
<div class="file-list-section">
|
| 218 |
<div class="file-list-title">
|
| 219 |
-
<span>📁 File
|
| 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="
|
| 231 |
-
<polyline points="
|
|
|
|
|
|
|
|
|
|
| 232 |
</svg>
|
| 233 |
<h2>Chưa có file nào được chọn</h2>
|
| 234 |
-
<p>Nhấn
|
| 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
|
| 246 |
-
const
|
| 247 |
-
'
|
| 248 |
-
'
|
| 249 |
-
'
|
| 250 |
-
'
|
| 251 |
-
'
|
| 252 |
-
// Thêm tên file
|
| 253 |
];
|
| 254 |
|
| 255 |
let activeFiles = [];
|
|
@@ -258,15 +271,15 @@
|
|
| 258 |
init();
|
| 259 |
|
| 260 |
function init() {
|
| 261 |
-
if (
|
| 262 |
fileCount.textContent = 'Không có file';
|
| 263 |
return;
|
| 264 |
}
|
| 265 |
|
| 266 |
-
fileCount.textContent = `${
|
| 267 |
|
| 268 |
// Create file list
|
| 269 |
-
|
| 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 |
-
|
| 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
|
| 319 |
-
const
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
|
|
|
|
|
|
|
|
|
| 323 |
tabContent.innerHTML = `
|
| 324 |
-
<div
|
| 325 |
-
<h2>❌ Không thể
|
| 326 |
-
<p>${fileName} không tồn tại hoặc không thể truy cập</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 327 |
</div>
|
| 328 |
`;
|
| 329 |
};
|
| 330 |
-
|
|
|
|
| 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="
|
| 369 |
-
<polyline points="
|
|
|
|
|
|
|
|
|
|
| 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 |
}
|