aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpacien2023-10-23 23:40:53 +0200
committerpacien2023-10-23 23:40:53 +0200
commitb1161cee7cb0599c64fd85528d74e664329a4286 (patch)
tree5181abd102ac9bd639088985bd7f6c40b2e51fe5
parent0f7daaa9b59e400f77969515aec63d4dfca036d9 (diff)
downloadbeamer-viewer-b1161cee7cb0599c64fd85528d74e664329a4286.tar.gz
startscreen: lock UI until all scripts are loaded and ready
-rw-r--r--beamer/viewer/viewer.js5
-rw-r--r--index.html2
2 files changed, 6 insertions, 1 deletions
diff --git a/beamer/viewer/viewer.js b/beamer/viewer/viewer.js
index e9c6d65..a614c88 100644
--- a/beamer/viewer/viewer.js
+++ b/beamer/viewer/viewer.js
@@ -26,9 +26,14 @@ class Viewer {
26 this.fileReader = new FileReader(); 26 this.fileReader = new FileReader();
27 this.presentation = null; 27 this.presentation = null;
28 28
29 document.addEventListener("DOMContentLoaded", () => this._unlockUi());
29 this._listenForInput(); 30 this._listenForInput();
30 } 31 }
31 32
33 _unlockUi() {
34 this.fileInput.disabled = false;
35 }
36
32 _preparePresentation(source) { 37 _preparePresentation(source) {
33 const self = this; 38 const self = this;
34 pdfjsLib.getDocument(source).then(function(pdf) { 39 pdfjsLib.getDocument(source).then(function(pdf) {
diff --git a/index.html b/index.html
index f92f772..7259fe9 100644
--- a/index.html
+++ b/index.html
@@ -70,7 +70,7 @@
70 <a href="#file=sample/demo.pdf" onclick="load('sample/demo.pdf')">demo slides</a>. 70 <a href="#file=sample/demo.pdf" onclick="load('sample/demo.pdf')">demo slides</a>.
71 </p> 71 </p>
72 72
73 <input id="fileInput" type="file" multiple="false" accept="application/pdf" /> 73 <input id="fileInput" type="file" multiple="false" accept="application/pdf" disabled />
74 <br /> 74 <br />
75 <br /> 75 <br />
76 <input id="startButton" type="button" value="Start presentation" disabled /> 76 <input id="startButton" type="button" value="Start presentation" disabled />