aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpacien2023-10-23 21:24:11 +0200
committerpacien2023-10-23 21:24:11 +0200
commit7249325100ce5d373d7da8b3e14ea8283a56eef9 (patch)
treecb216efd8f9947881006fad2e241f39901b48a0d
parent9ba8a8702e87efce37f1d6f5d526bccde9a7a1d7 (diff)
downloadbeamer-viewer-7249325100ce5d373d7da8b3e14ea8283a56eef9.tar.gz
add button to start presentation
Instead of automatically starting after selecting a file. This pleases Chrome's popup blocker, which no longer blocks it. Firefox isn't smart enough to establish the click causality link though.
-rw-r--r--beamer/viewer/viewer.js10
-rw-r--r--index.html3
2 files changed, 11 insertions, 2 deletions
diff --git a/beamer/viewer/viewer.js b/beamer/viewer/viewer.js
index 414ff1c..065298a 100644
--- a/beamer/viewer/viewer.js
+++ b/beamer/viewer/viewer.js
@@ -21,6 +21,8 @@
21class Viewer { 21class Viewer {
22 constructor() { 22 constructor() {
23 this.fileInput = document.getElementById("fileInput"); 23 this.fileInput = document.getElementById("fileInput");
24 this.startButton = document.getElementById("startButton");
25
24 this._listenForInput(); 26 this._listenForInput();
25 } 27 }
26 28
@@ -47,8 +49,12 @@ class Viewer {
47 49
48 _listenForInput() { 50 _listenForInput() {
49 const self = this; 51 const self = this;
50 fileInput.addEventListener("change", function(event) { 52 fileInput.addEventListener("change", function(_event) {
51 self._readFile(event.target.files[0]); 53 self.startButton.disabled = false;
54 });
55
56 startButton.addEventListener("click", function(_event) {
57 self._readFile(self.fileInput.files[0]);
52 }); 58 });
53 59
54 document.body.addEventListener("drop", function(event) { 60 document.body.addEventListener("drop", function(event) {
diff --git a/index.html b/index.html
index 68239ff..61c53fc 100644
--- a/index.html
+++ b/index.html
@@ -70,6 +70,9 @@
70 </p> 70 </p>
71 71
72 <input id="fileInput" type="file" multiple="false" accept="application/pdf" /> 72 <input id="fileInput" type="file" multiple="false" accept="application/pdf" />
73 <br />
74 <br />
75 <input id="startButton" type="button" value="Start presentation" disabled />
73 </div> 76 </div>
74 </div> 77 </div>
75 78