@tindtechnologies/pdfjs-viewer 5.4.624-tind.0 → 5.4.624
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
document.addEventListener("webviewerloaded", (evt) => {
|
|
2
2
|
const win = evt.detail?.source || window;
|
|
3
3
|
const app = win.PDFViewerApplication;
|
|
4
4
|
if (!app) {
|
|
@@ -15,6 +15,4 @@ function patchPDFViewerApplicationOpen() {
|
|
|
15
15
|
|
|
16
16
|
const originalOpen = app.open.bind(app);
|
|
17
17
|
app.open = (args) => originalOpen({ ...args, rangeChunkSize, disableStream });
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
document.addEventListener("webviewerloaded", patchPDFViewerApplicationOpen);
|
|
18
|
+
});
|
package/web/pdf_viewer.html
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<meta charset="utf-8">
|
|
3
3
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
|
4
4
|
<meta name="google" content="notranslate">
|
|
5
|
-
<title>PDF.js viewer</title><script src="
|
|
5
|
+
<title>PDF.js viewer</title><script src="override-pdf-viewer-application-open.js"></script>
|
|
6
6
|
|
|
7
7
|
<!-- This snippet is used in production (included from viewer.html) -->
|
|
8
8
|
<link rel="resource" type="application/l10n" href="locale/locale.json">
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<meta charset="utf-8">
|
|
3
3
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
|
4
4
|
<meta name="google" content="notranslate">
|
|
5
|
-
<title>PDF.js viewer</title><script src="
|
|
5
|
+
<title>PDF.js viewer</title><script src="override-pdf-viewer-application-open.js"></script>
|
|
6
6
|
|
|
7
7
|
<!-- This snippet is used in production (included from viewer.html) -->
|
|
8
8
|
<link rel="resource" type="application/l10n" href="locale/locale.json">
|
package/README.md
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
async function onlyRegisterDownload() {
|
|
2
|
-
// get the current url of iframe
|
|
3
|
-
const url = new URL(window.location.href);
|
|
4
|
-
const fileUrlEncoded = url.searchParams.get("file");
|
|
5
|
-
const fileUrl = new URL(decodeURIComponent(fileUrlEncoded));
|
|
6
|
-
|
|
7
|
-
// Clear the search params
|
|
8
|
-
fileUrl.search = "";
|
|
9
|
-
|
|
10
|
-
fileUrl.searchParams.append("register_download", "1");
|
|
11
|
-
fileUrl.searchParams.append("no_download", "1");
|
|
12
|
-
|
|
13
|
-
const response = await fetch(fileUrl, { cache: "no-store" });
|
|
14
|
-
const HTTP_NO_CONTENT = 204;
|
|
15
|
-
if (response.status !== HTTP_NO_CONTENT) {
|
|
16
|
-
console.log(`Error registering download at URL '${fileUrl.toString()}'
|
|
17
|
-
Expected status ${HTTP_NO_CONTENT}, got ${response.status}
|
|
18
|
-
`);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
document.addEventListener("click", (evt) => {
|
|
23
|
-
// Only fire when user clicked on button with id "download"
|
|
24
|
-
const target = evt.target;
|
|
25
|
-
if (target instanceof HTMLElement && target.id === "download") {
|
|
26
|
-
onlyRegisterDownload();
|
|
27
|
-
}
|
|
28
|
-
});
|