Re-factor the pre-processor statements used with webViewerOpenFileViaURL
Given that the `webViewerOpenFileViaURL` helper function is being defined in *all* builds anyway, the current pre-processor usage doesn't really improve readability in my opinion.
This commit is contained in:
parent
1a2cdaffc5
commit
0a03843e5f
11
web/app.js
11
web/app.js
@ -2274,10 +2274,9 @@ function webViewerInitialized() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let webViewerOpenFileViaURL;
|
function webViewerOpenFileViaURL(file) {
|
||||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
webViewerOpenFileViaURL = function (file) {
|
if (file?.lastIndexOf("file:", 0) === 0) {
|
||||||
if (file && file.lastIndexOf("file:", 0) === 0) {
|
|
||||||
// file:-scheme. Load the contents in the main thread because QtWebKit
|
// file:-scheme. Load the contents in the main thread because QtWebKit
|
||||||
// cannot load file:-URLs in a Web Worker. file:-URLs are usually loaded
|
// cannot load file:-URLs in a Web Worker. file:-URLs are usually loaded
|
||||||
// very quickly, so there is no need to set up progress event listeners.
|
// very quickly, so there is no need to set up progress event listeners.
|
||||||
@ -2295,18 +2294,14 @@ if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
|||||||
if (file) {
|
if (file) {
|
||||||
PDFViewerApplication.open(file);
|
PDFViewerApplication.open(file);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
} else if (PDFJSDev.test("MOZCENTRAL || CHROME")) {
|
} else if (PDFJSDev.test("MOZCENTRAL || CHROME")) {
|
||||||
webViewerOpenFileViaURL = function (file) {
|
|
||||||
PDFViewerApplication.setTitleUsingUrl(file);
|
PDFViewerApplication.setTitleUsingUrl(file);
|
||||||
PDFViewerApplication.initPassiveLoading();
|
PDFViewerApplication.initPassiveLoading();
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
webViewerOpenFileViaURL = function (file) {
|
|
||||||
if (file) {
|
if (file) {
|
||||||
throw new Error("Not implemented: webViewerOpenFileViaURL");
|
throw new Error("Not implemented: webViewerOpenFileViaURL");
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function webViewerResetPermissions() {
|
function webViewerResetPermissions() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user