From 7249325100ce5d373d7da8b3e14ea8283a56eef9 Mon Sep 17 00:00:00 2001 From: pacien Date: Mon, 23 Oct 2023 21:24:11 +0200 Subject: 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. --- beamer/viewer/viewer.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'beamer') 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 @@ class Viewer { constructor() { this.fileInput = document.getElementById("fileInput"); + this.startButton = document.getElementById("startButton"); + this._listenForInput(); } @@ -47,8 +49,12 @@ class Viewer { _listenForInput() { const self = this; - fileInput.addEventListener("change", function(event) { - self._readFile(event.target.files[0]); + fileInput.addEventListener("change", function(_event) { + self.startButton.disabled = false; + }); + + startButton.addEventListener("click", function(_event) { + self._readFile(self.fileInput.files[0]); }); document.body.addEventListener("drop", function(event) { -- cgit v1.2.3