Add Viewer.js library and update asset URLs in history sidebar
This commit is contained in:
@@ -20,10 +20,8 @@ function ensureStylesheet() {
|
||||
document.head.appendChild(link);
|
||||
}
|
||||
|
||||
const VIEWERJS_VERSION = "1.11.6";
|
||||
const VIEWERJS_BASE_URL = `https://cdn.jsdelivr.net/npm/viewerjs@${VIEWERJS_VERSION}/dist`;
|
||||
const VIEWERJS_CSS_URL = `${VIEWERJS_BASE_URL}/viewer.min.css`;
|
||||
const VIEWERJS_CORE_URL = `${VIEWERJS_BASE_URL}/viewer.min.js`;
|
||||
const VIEWER_CSS_URL = new URL("./vendor/viewerjs/viewer.min.css", import.meta.url).href;
|
||||
const VIEWER_JS_URL = new URL("./vendor/viewerjs/viewer.min.js", import.meta.url).href;
|
||||
|
||||
const externalAssetPromises = new Map();
|
||||
|
||||
@@ -109,8 +107,8 @@ let viewerLoader = null;
|
||||
async function ensureViewer() {
|
||||
if (viewerLoader) return viewerLoader;
|
||||
viewerLoader = (async () => {
|
||||
await ensureExternalStylesheet(VIEWERJS_CSS_URL);
|
||||
await ensureExternalScript(VIEWERJS_CORE_URL);
|
||||
await ensureExternalStylesheet(VIEWER_CSS_URL);
|
||||
await ensureExternalScript(VIEWER_JS_URL);
|
||||
if (typeof window.Viewer !== "function") {
|
||||
throw new Error("Viewer global was not found after loading assets.");
|
||||
}
|
||||
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2015-present Chen Fengyuan
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
Vendored
+9
File diff suppressed because one or more lines are too long
Vendored
+10
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user