Sách Giáo Khoa Việt Nam - sachgiaokhoa.org

CodeIgniter 4 website:
- Catalog 999 SGK (lớp 1-12) từ API, lọc theo lớp/môn/NXB, tìm kiếm
- Trang chủ grouped browse (bậc học -> lớp -> môn, ưu tiên môn quan trọng)
- Chi tiết sách: metadata đầy đủ, cover nghệ thuật /thumb/{W}x{H}/
- Đọc online qua gate captcha + countdown, PDF viewer pdf.js
- Download: captcha + token một lần + auto cache-bust version
- Tự đồng bộ catalog/cover khi API thay đổi (refresh:catalog)
- Legal: DMCA, miễn trừ trách nhiệm, điều khoản, bảo mật, liên hệ
This commit is contained in:
sachgiaokhoaorg
2026-08-23 07:05:49 +00:00
commit e6b265db99
494 changed files with 134829 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
<!DOCTYPE html>
<html lang="vi">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Đọc online <?= esc($book['title']) ?></title>
<meta name="robots" content="noindex, nofollow">
<link rel="icon" type="image/svg+xml" href="/assets/favicon.svg">
<link href="https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700;800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/assets/app.css">
</head>
<body class="reader-body">
<header class="reader-header">
<a class="reader-back" href="/sach/<?= esc($book['id']) ?>" title="Về trang sách">←</a>
<div class="reader-title">
<strong><?= esc($book['title']) ?></strong>
<span><?= $book['grade'] ? 'Lớp ' . esc($book['grade']) . ' · ' : '' ?><?= esc($book['subject']) ?> · <?= esc($book['publisher']) ?></span>
</div>
<button class="btn btn-green reader-dl" id="dl-btn" data-id="<?= esc($book['id']) ?>">⬇ Tải PDF</button>
</header>
<main class="reader-main">
<div class="viewer-frame reader-frame" id="pdfViewer" data-src="/media/pdf/<?= esc($book['id']) ?>"></div>
</main>
<script>
(function () {
var el = document.getElementById('pdfViewer');
var iframe = document.createElement('iframe');
iframe.style.width = '100%';
iframe.style.height = '100%';
iframe.style.border = '0';
iframe.title = 'Trình đọc PDF';
iframe.src = '/assets/pdfjs/web/viewer.html?file=' + encodeURIComponent(el.dataset.src);
el.appendChild(iframe);
var dl = document.getElementById('dl-btn');
dl.addEventListener('click', function () {
dl.disabled = true; dl.textContent = 'Đang tạo liên kết…';
fetch('/pdf-token/' + dl.dataset.id, { method: 'POST', credentials: 'same-origin' })
.then(function (r) { return r.json(); })
.then(function (d) {
if (d.ok) { window.location.href = d.url; dl.textContent = '⬇ Đang tải xuống…'; }
else { dl.textContent = 'Hết phiên — tải lại trang'; }
})
.catch(function () { dl.textContent = 'Lỗi mạng, thử lại'; dl.disabled = false; });
});
})();
</script>
</body>
</html>