aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorEric Bidelman2012-04-16 17:31:32 -0700
committerEric Bidelman2012-04-16 17:31:32 -0700
commitda0e41ba395d72839184e66fd27a0c50c8160c4d (patch)
tree984566defc48f74206e76b198ae64c68cb04334d /js
parent32f207b326a2138c14e0502fcd58c5c3457cde35 (diff)
downloadio-slides-remote-da0e41ba395d72839184e66fd27a0c50c8160c4d.tar.gz
Better fullscreen toggle. Ignore cmd+shift+f
Diffstat (limited to 'js')
-rw-r--r--js/slides.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/js/slides.js b/js/slides.js
index c970ddb..f089d30 100644
--- a/js/slides.js
+++ b/js/slides.js
@@ -2,6 +2,8 @@
2// From https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind 2// From https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind
3Function.prototype.bind||(Function.prototype.bind=function(c){if("function"!==typeof this)throw new TypeError("Function.prototype.bind - binding an object that is not callable");var d=Array.prototype.slice.call(arguments,1),e=this,a=function(){},b=function(){return e.apply(this instanceof a?this:c||window,d.concat(Array.prototype.slice.call(arguments)))};a.prototype=this.prototype;b.prototype=new a;return b}); 3Function.prototype.bind||(Function.prototype.bind=function(c){if("function"!==typeof this)throw new TypeError("Function.prototype.bind - binding an object that is not callable");var d=Array.prototype.slice.call(arguments,1),e=this,a=function(){},b=function(){return e.apply(this instanceof a?this:c||window,d.concat(Array.prototype.slice.call(arguments)))};a.prototype=this.prototype;b.prototype=new a;return b});
4 4
5document.cancelFullScreen = document.webkitCancelFullScreen ||
6 document.mozCancelFullScreen;
5 7
6/** 8/**
7 * @constructor 9 * @constructor
@@ -157,14 +159,17 @@ SlideDeck.prototype.onBodyKeyDown_ = function(e) {
157 document.body.classList.remove('with-notes'); 159 document.body.classList.remove('with-notes');
158 break; 160 break;
159 161
160 //case 13: // Enter
161 case 70: // F 162 case 70: // F
162 // Only respect 'f'/enter on body. Don't want to capture keys from <input> 163 // Only respect 'f' on body. Don't want to capture keys from an <input>.
163 if (e.target == document.body) { 164 // Also, ignore browser's fullscreen shortcut (cmd+shift+f) so we don't
164 if (e.keyCode != 13 && !document.webkitIsFullScreen) { 165 // get trapped in fullscreen!
166 if (e.target == document.body && !(e.shiftKey && e.metaKey)) {
167 if (!!!document.mozFullScreen) {
168 document.body.mozRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
169 } else if (!!!document.webkitIsFullScreen) {
165 document.body.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT); 170 document.body.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
166 } else { 171 } else {
167 document.webkitCancelFullScreen(); 172 document.cancelFullScreen();
168 } 173 }
169 } 174 }
170 break; 175 break;