aboutsummaryrefslogtreecommitdiff
path: root/pointless
diff options
context:
space:
mode:
authorpacien2018-07-20 22:22:30 +0200
committerpacien2018-07-20 22:22:30 +0200
commit2f766bbfa6321de5eb9a0a4ce0e7f5df23962348 (patch)
treef70d9a9dfb521e10e8f936dea31456783165a530 /pointless
parentca443d6e6c46aefeef600a84bece426908dbd951 (diff)
downloadbeamer-viewer-2f766bbfa6321de5eb9a0a4ce0e7f5df23962348.tar.gz
Enforce constancy
Diffstat (limited to 'pointless')
-rw-r--r--pointless/viewer/init.js10
-rw-r--r--pointless/viewer/presentation.js10
-rw-r--r--pointless/viewer/stage.js8
-rw-r--r--pointless/viewer/timer.js6
-rw-r--r--pointless/viewer/viewer.js10
5 files changed, 22 insertions, 22 deletions
diff --git a/pointless/viewer/init.js b/pointless/viewer/init.js
index dddbf17..a9294ea 100644
--- a/pointless/viewer/init.js
+++ b/pointless/viewer/init.js
@@ -7,10 +7,10 @@
7 7
8"use strict"; 8"use strict";
9 9
10var params = function() { 10const params = function() {
11 var queryDict = {}; 11 const queryDict = {};
12 location.search.substr(1).split("&").forEach(function(item) { 12 location.search.substr(1).split("&").forEach(function(item) {
13 var pair = item.split("="); 13 const pair = item.split("=");
14 queryDict[pair[0]] = pair[1]; 14 queryDict[pair[0]] = pair[1];
15 }); 15 });
16 return queryDict; 16 return queryDict;
@@ -24,14 +24,14 @@ function initCache() {
24 if (!navigator.serviceWorker) return; 24 if (!navigator.serviceWorker) return;
25 navigator.serviceWorker.register("appcache.js"); 25 navigator.serviceWorker.register("appcache.js");
26 26
27 var offlineCapableIndicator = document.getElementById("offlineCapable"); 27 const offlineCapableIndicator = document.getElementById("offlineCapable");
28 offlineCapableIndicator.style.visibility = "visible"; 28 offlineCapableIndicator.style.visibility = "visible";
29} 29}
30 30
31function init() { 31function init() {
32 initCache(); 32 initCache();
33 33
34 var viewer = new Viewer(); 34 const viewer = new Viewer();
35 35
36 if ("file" in params) 36 if ("file" in params)
37 viewer.load(params["file"]); 37 viewer.load(params["file"]);
diff --git a/pointless/viewer/presentation.js b/pointless/viewer/presentation.js
index 853d764..97a9244 100644
--- a/pointless/viewer/presentation.js
+++ b/pointless/viewer/presentation.js
@@ -15,10 +15,10 @@ class Presentation {
15 } 15 }
16 16
17 _setupStage() { 17 _setupStage() {
18 var self = this; 18 const self = this;
19 var onStageReadyCallback = function() { self._onStageReady(); }; 19 const onStageReadyCallback = function() { self._onStageReady(); };
20 var onNextCallback = function() { self._onNext(); }; 20 const onNextCallback = function() { self._onNext(); };
21 var onPreviousCallback = function() { self._onPrevious(); }; 21 const onPreviousCallback = function() { self._onPrevious(); };
22 return new Stage(onStageReadyCallback, onNextCallback, onPreviousCallback); 22 return new Stage(onStageReadyCallback, onNextCallback, onPreviousCallback);
23 } 23 }
24 24
@@ -37,7 +37,7 @@ class Presentation {
37 } 37 }
38 38
39 _setPage(pageIndex) { 39 _setPage(pageIndex) {
40 var self = this; 40 const self = this;
41 this.currentPageIndex = pageIndex; 41 this.currentPageIndex = pageIndex;
42 this.pdf.getPage(this.currentPageIndex).then(function(page) { 42 this.pdf.getPage(this.currentPageIndex).then(function(page) {
43 self.stage.setPage(page); 43 self.stage.setPage(page);
diff --git a/pointless/viewer/stage.js b/pointless/viewer/stage.js
index 117b0af..b641a9e 100644
--- a/pointless/viewer/stage.js
+++ b/pointless/viewer/stage.js
@@ -18,7 +18,7 @@ class Stage {
18 if (this.projector == null) 18 if (this.projector == null)
19 alert("Please allow pop-ups, then refresh this page."); 19 alert("Please allow pop-ups, then refresh this page.");
20 20
21 var self = this; 21 const self = this;
22 this.projector.addEventListener("load", function() { 22 this.projector.addEventListener("load", function() {
23 self.audienceScreen = new Screen(self.projector, false, false); 23 self.audienceScreen = new Screen(self.projector, false, false);
24 self.presenterScreen = new Screen(window, true, true); 24 self.presenterScreen = new Screen(window, true, true);
@@ -36,7 +36,7 @@ class Stage {
36 } 36 }
37 37
38 _registerEventHandler(window) { 38 _registerEventHandler(window) {
39 var self = this; 39 const self = this;
40 window.addEventListener("keydown", function(event) { 40 window.addEventListener("keydown", function(event) {
41 self._onCommand(event); 41 self._onCommand(event);
42 }) 42 })
@@ -57,7 +57,7 @@ class Stage {
57 } 57 }
58 58
59 _watchDetach() { 59 _watchDetach() {
60 var self = this; 60 const self = this;
61 window.addEventListener("beforeunload", function() { 61 window.addEventListener("beforeunload", function() {
62 self._setMessage(self.projector, "Controller detached"); 62 self._setMessage(self.projector, "Controller detached");
63 }); 63 });
@@ -68,7 +68,7 @@ class Stage {
68 } 68 }
69 69
70 _setMessage(window, message) { 70 _setMessage(window, message) {
71 var messageBar = window.document.getElementById("message"); 71 const messageBar = window.document.getElementById("message");
72 messageBar.textContent = message; 72 messageBar.textContent = message;
73 } 73 }
74} 74}
diff --git a/pointless/viewer/timer.js b/pointless/viewer/timer.js
index 4f19986..28c3f97 100644
--- a/pointless/viewer/timer.js
+++ b/pointless/viewer/timer.js
@@ -18,19 +18,19 @@ class Timer {
18 if (this.startTime != null) return; 18 if (this.startTime != null) return;
19 this.startTime = Date.now(); 19 this.startTime = Date.now();
20 20
21 var self = this; 21 const self = this;
22 setInterval(function() { 22 setInterval(function() {
23 self._runTimer(); 23 self._runTimer();
24 }, 1000); 24 }, 1000);
25 } 25 }
26 26
27 _runTimer() { 27 _runTimer() {
28 var timeDelta = Math.floor((Date.now() - this.startTime) / 1000); 28 const timeDelta = Math.floor((Date.now() - this.startTime) / 1000);
29 this._setDisplay(timeDelta); 29 this._setDisplay(timeDelta);
30 } 30 }
31 31
32 _setDisplay(seconds) { 32 _setDisplay(seconds) {
33 var dateObj = new Date(null); 33 const dateObj = new Date(null);
34 dateObj.setSeconds(seconds); 34 dateObj.setSeconds(seconds);
35 this.display.textContent = dateObj.toISOString().substr(11, 8); 35 this.display.textContent = dateObj.toISOString().substr(11, 8);
36 } 36 }
diff --git a/pointless/viewer/viewer.js b/pointless/viewer/viewer.js
index 9e92c2c..75486a4 100644
--- a/pointless/viewer/viewer.js
+++ b/pointless/viewer/viewer.js
@@ -19,15 +19,15 @@ class Viewer {
19 load(source) { 19 load(source) {
20 this.welcomeScreen.style.display = "none"; 20 this.welcomeScreen.style.display = "none";
21 pdfjsLib.getDocument(source).then(function(pdf) { 21 pdfjsLib.getDocument(source).then(function(pdf) {
22 var presentation = new Presentation(pdf); 22 const presentation = new Presentation(pdf);
23 }); 23 });
24 } 24 }
25 25
26 _readFile(file) { 26 _readFile(file) {
27 var fileReader = new FileReader(); 27 const fileReader = new FileReader();
28 var self = this; 28 const self = this;
29 fileReader.onload = function() { 29 fileReader.onload = function() {
30 var byteArray = new Uint8Array(this.result); 30 const byteArray = new Uint8Array(this.result);
31 self.load(byteArray); 31 self.load(byteArray);
32 } 32 }
33 33
@@ -35,7 +35,7 @@ class Viewer {
35 } 35 }
36 36
37 _listenForInput() { 37 _listenForInput() {
38 var self = this; 38 const self = this;
39 fileInput.addEventListener("change", function(event) { 39 fileInput.addEventListener("change", function(event) {
40 self._readFile(event.target.files[0]); 40 self._readFile(event.target.files[0]);
41 }); 41 });