From 4ece01c6e7a2dd6c09c7b3f7f631f828a8d6c0f0 Mon Sep 17 00:00:00 2001 From: pacien Date: Thu, 19 Jul 2018 01:20:39 +0200 Subject: Add pop-up blocker warning --- pointless/viewer/stage.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'pointless/viewer') diff --git a/pointless/viewer/stage.js b/pointless/viewer/stage.js index 7995de6..f8d6e09 100644 --- a/pointless/viewer/stage.js +++ b/pointless/viewer/stage.js @@ -15,10 +15,13 @@ class Stage { this.audienceScreen = null; this.presenterScreen = null; + this._setMessage(window, "Please allow pop-ups on this page"); + var self = this; this.projector.addEventListener("load", function() { self.audienceScreen = new Screen(self.projector, false, false); self.presenterScreen = new Screen(window, true, true); + self._setMessage(window, null); self._watchDetach(); onReady(); }); @@ -56,13 +59,16 @@ class Stage { _watchDetach() { var self = this; window.addEventListener("beforeunload", function() { - var messageBar = self.projector.document.getElementById("message"); - messageBar.textContent = "Controller detached"; + self._setMessage(self.projector, "Controller detached"); }); this.projector.addEventListener("beforeunload", function() { - var messageBar = document.getElementById("message"); - messageBar.textContent = "Viewer detached"; + self._setMessage(window, "Viewer detached"); }); } + + _setMessage(window, message) { + var messageBar = window.document.getElementById("message"); + messageBar.textContent = message; + } } -- cgit v1.2.3