diff options
Diffstat (limited to 'js/slide-controller.js')
-rw-r--r-- | js/slide-controller.js | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/js/slide-controller.js b/js/slide-controller.js index efb0097..bef37c4 100644 --- a/js/slide-controller.js +++ b/js/slide-controller.js | |||
@@ -13,6 +13,7 @@ | |||
13 | this.mode = null; | 13 | this.mode = null; |
14 | this.remoteSocket = null; | 14 | this.remoteSocket = null; |
15 | this.isPresenter = window.opener; | 15 | this.isPresenter = window.opener; |
16 | this.isController = window.opener; | ||
16 | 17 | ||
17 | this.keyLock = null; | 18 | this.keyLock = null; |
18 | 19 | ||
@@ -20,7 +21,7 @@ | |||
20 | } | 21 | } |
21 | 22 | ||
22 | 23 | ||
23 | SlideController.MODES = ['local', 'remote', 'controller']; | 24 | SlideController.MODES = ['local', 'remote', 'controller', 'presenter']; |
24 | 25 | ||
25 | SlideController.prototype.setup = function() { | 26 | SlideController.prototype.setup = function() { |
26 | 27 | ||
@@ -80,9 +81,12 @@ | |||
80 | 81 | ||
81 | break; | 82 | break; |
82 | 83 | ||
83 | case 'controller': | 84 | case 'presenter': |
84 | this.isPresenter = true; | 85 | this.isPresenter = true; |
85 | document.body.classList.add('popup'); | 86 | document.body.classList.add('popup'); |
87 | |||
88 | case 'controller': | ||
89 | this.isController = true; | ||
86 | document.body.classList.add('with-notes'); | 90 | document.body.classList.add('with-notes'); |
87 | var password = prompt("Broadcaster password"); | 91 | var password = prompt("Broadcaster password"); |
88 | 92 | ||
@@ -192,6 +196,11 @@ | |||
192 | return; | 196 | return; |
193 | } | 197 | } |
194 | 198 | ||
199 | // don't toggle speaker's notes for viewers | ||
200 | if (msg.keyCode === 80) { | ||
201 | return; | ||
202 | } | ||
203 | |||
195 | console.log("Sending: " + JSON.stringify(msg)); | 204 | console.log("Sending: " + JSON.stringify(msg)); |
196 | 205 | ||
197 | // // Send message to popup window. | 206 | // // Send message to popup window. |
@@ -200,13 +209,15 @@ | |||
200 | // } | 209 | // } |
201 | 210 | ||
202 | // Send message to main window. | 211 | // Send message to main window. |
203 | if (this.isPresenter) { | 212 | if (this.isController) { |
204 | if (this.mode === 'local') { | 213 | switch (this.mode) { |
205 | // TODO: It would be dope if FF implemented location.origin. | 214 | case 'local': |
206 | window.opener.postMessage(msg, '*'); | 215 | // TODO: It would be dope if FF implemented location.origin. |
207 | } | 216 | window.opener.postMessage(msg, '*'); |
208 | if (this.mode === 'controller') { | 217 | break; |
209 | this.remoteSocket.emit('message', msg.keyCode); | 218 | case 'controller': |
219 | case 'presenter': | ||
220 | this.remoteSocket.emit('message', msg.keyCode); | ||
210 | } | 221 | } |
211 | } | 222 | } |
212 | }; | 223 | }; |