diff options
author | Luke | 2012-04-23 13:15:47 +1000 |
---|---|---|
committer | Luke | 2012-04-23 13:15:47 +1000 |
commit | c3fd06cea981963f583f8945813e44286b4e5b27 (patch) | |
tree | af9eba77b1c88c4f92ecf9d5569285604dc990e1 | |
parent | d4718b06d6f17402f7414b22a015988e75a808b5 (diff) | |
download | io-slides-remote-c3fd06cea981963f583f8945813e44286b4e5b27.tar.gz |
Adding W to toggle widescreen
-rw-r--r-- | js/slide-deck.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/js/slide-deck.js b/js/slide-deck.js index 9ad0290..24ed92e 100644 --- a/js/slide-deck.js +++ b/js/slide-deck.js | |||
@@ -48,7 +48,7 @@ SlideDeck.prototype.getCurrentSlideFromHash_ = function() { | |||
48 | * @private | 48 | * @private |
49 | */ | 49 | */ |
50 | SlideDeck.prototype.onDomLoaded_ = function(e) { | 50 | SlideDeck.prototype.onDomLoaded_ = function(e) { |
51 | document.body.classList.add('loaded'); // Fade in deck. | 51 | document.body.classList.add('loaded'); // Add loaded class for templates to use. |
52 | 52 | ||
53 | this.slides = this.container.querySelectorAll('slide:not([hidden]):not(.backdrop)'); | 53 | this.slides = this.container.querySelectorAll('slide:not([hidden]):not(.backdrop)'); |
54 | 54 | ||
@@ -180,7 +180,7 @@ SlideDeck.prototype.onBodyKeyDown_ = function(e) { | |||
180 | e.preventDefault(); | 180 | e.preventDefault(); |
181 | break; | 181 | break; |
182 | 182 | ||
183 | case 72: // H | 183 | case 72: // H: Toggle code highlighting |
184 | document.body.classList.toggle('highlight-code'); | 184 | document.body.classList.toggle('highlight-code'); |
185 | break; | 185 | break; |
186 | 186 | ||
@@ -196,12 +196,12 @@ SlideDeck.prototype.onBodyKeyDown_ = function(e) { | |||
196 | // TODO: implement refresh on main slides when popup is refreshed. | 196 | // TODO: implement refresh on main slides when popup is refreshed. |
197 | break; | 197 | break; |
198 | 198 | ||
199 | case 27: // ESC | 199 | case 27: // ESC: Hide notes and highlighting |
200 | document.body.classList.remove('with-notes'); | 200 | document.body.classList.remove('with-notes'); |
201 | document.body.classList.remove('highlight-code'); | 201 | document.body.classList.remove('highlight-code'); |
202 | break; | 202 | break; |
203 | 203 | ||
204 | case 70: // F | 204 | case 70: // F: Toggle fullscreen |
205 | // Only respect 'f' on body. Don't want to capture keys from an <input>. | 205 | // Only respect 'f' on body. Don't want to capture keys from an <input>. |
206 | // Also, ignore browser's fullscreen shortcut (cmd+shift+f) so we don't | 206 | // Also, ignore browser's fullscreen shortcut (cmd+shift+f) so we don't |
207 | // get trapped in fullscreen! | 207 | // get trapped in fullscreen! |
@@ -215,6 +215,13 @@ SlideDeck.prototype.onBodyKeyDown_ = function(e) { | |||
215 | } | 215 | } |
216 | } | 216 | } |
217 | break; | 217 | break; |
218 | |||
219 | case 87: // W: Toggle widescreen | ||
220 | // Only respect 'w' on body. Don't want to capture keys from an <input>. | ||
221 | if (e.target == document.body && !(e.shiftKey && e.metaKey)) { | ||
222 | document.querySelector('slides').classList.toggle('layout-widescreen'); | ||
223 | } | ||
224 | break; | ||
218 | } | 225 | } |
219 | }; | 226 | }; |
220 | 227 | ||