summaryrefslogtreecommitdiffhomepage
path: root/vhosts/blog/public/slide.js
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-05-29 02:29:40 +0900
committernsfisis <nsfisis@gmail.com>2024-05-29 02:29:44 +0900
commit6b54f395b0b9d29189fdf99cb2e84556c608686f (patch)
tree4882a5ddad21bfff07c68508c686652a9b820867 /vhosts/blog/public/slide.js
parentd71d7b6aa6b5081f94298cc037803fe6a6188498 (diff)
downloadnsfisis.dev-6b54f395b0b9d29189fdf99cb2e84556c608686f.tar.gz
nsfisis.dev-6b54f395b0b9d29189fdf99cb2e84556c608686f.tar.zst
nsfisis.dev-6b54f395b0b9d29189fdf99cb2e84556c608686f.zip
feat(blog/nuldoc): update PDF.js from 3.4.120 to 4.3.136
Diffstat (limited to 'vhosts/blog/public/slide.js')
-rw-r--r--vhosts/blog/public/slide.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/vhosts/blog/public/slide.js b/vhosts/blog/public/slide.js
index 77e49acc..4c7a0de8 100644
--- a/vhosts/blog/public/slide.js
+++ b/vhosts/blog/public/slide.js
@@ -1,6 +1,7 @@
+import { GlobalWorkerOptions, getDocument } from "/pdf.min.mjs";
+
document.addEventListener("DOMContentLoaded", async () => {
- const pdfjsLib = globalThis.pdfjsLib;
- pdfjsLib.GlobalWorkerOptions.workerSrc = "https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.4.120/pdf.worker.min.js";
+ GlobalWorkerOptions.workerSrc = "/pdf.worker.min.mjs";
const canvas = document.getElementById("slide");
const ctx = canvas.getContext("2d");
@@ -15,7 +16,7 @@ document.addEventListener("DOMContentLoaded", async () => {
pageRendering = true;
const page = await doc.getPage(num);
- var viewport = page.getViewport({ scale: 1.0 });
+ const viewport = page.getViewport({ scale: 1.0 });
canvas.height = viewport.height;
canvas.width = viewport.width;
@@ -54,6 +55,6 @@ document.addEventListener("DOMContentLoaded", async () => {
});
// TODO: error handling
- doc = await pdfjsLib.getDocument(url).promise;
+ doc = await getDocument(url).promise;
queueRenderPage(pageNum);
});