mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +02:00
[GENERIC viewer] Re-factor the fileInput
initialization
*This is yet another installment in a never-ending series of patches that attempt to simplify and improve old code.* The `fileInput`-element is used to support the "Open file"-button in the `GENERIC` viewer, however this is very old code. Rather than creating the element dynamically in JavaScript, we can simply define it conditionally in the HTML code thanks to the pre-processor. Furthermore, the `fileInput`-element currently has a number of unnecessary CSS rules, since the element is *purposely* never made visibly. Note that with these changes, the `fileInput`-element will now *always* have `display: none;` set. This shouldn't matter, since we can still trigger the `click`-event of the element just fine (via JavaScript) and this patch has been successfully tested in both Mozilla Firefox and Google Chrome.
This commit is contained in:
parent
2b673a6941
commit
5390d2b377
4 changed files with 17 additions and 30 deletions
|
@ -189,7 +189,10 @@ function getViewerConfiguration() {
|
|||
},
|
||||
errorWrapper,
|
||||
printContainer: document.getElementById("printContainer"),
|
||||
openFileInputName: "fileInput",
|
||||
openFileInput:
|
||||
typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")
|
||||
? document.getElementById("fileInput")
|
||||
: null,
|
||||
debuggerScriptPath: "./debugger.js",
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue