Support PDF.js Map upsert in current browsers
Browse files- static/reader.js +8 -0
static/reader.js
CHANGED
|
@@ -3,6 +3,14 @@ const PDFJS_WORKER_URL = "/static/vendor/pdf.worker.min.mjs";
|
|
| 3 |
const EPUB_URL = "/static/vendor/epub.min.js";
|
| 4 |
const MARKED_URL = "/static/vendor/marked.min.js";
|
| 5 |
const PURIFY_URL = "/static/vendor/purify.min.js";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
const params = new URLSearchParams(location.search);
|
| 7 |
const sourceUrl = params.get("url") || "";
|
| 8 |
const downloadUrl = params.get("download") || sourceUrl;
|
|
|
|
| 3 |
const EPUB_URL = "/static/vendor/epub.min.js";
|
| 4 |
const MARKED_URL = "/static/vendor/marked.min.js";
|
| 5 |
const PURIFY_URL = "/static/vendor/purify.min.js";
|
| 6 |
+
if (!Map.prototype.getOrInsertComputed) {
|
| 7 |
+
Map.prototype.getOrInsertComputed = function(key, callback) {
|
| 8 |
+
if (this.has(key)) return this.get(key);
|
| 9 |
+
const value = callback(key);
|
| 10 |
+
this.set(key, value);
|
| 11 |
+
return value;
|
| 12 |
+
};
|
| 13 |
+
}
|
| 14 |
const params = new URLSearchParams(location.search);
|
| 15 |
const sourceUrl = params.get("url") || "";
|
| 16 |
const downloadUrl = params.get("download") || sourceUrl;
|