fix Ox.Fullscreen

This commit is contained in:
rolux 2013-02-10 20:50:28 +05:30
parent 32a10a7d69
commit 4c45d71f5b
2 changed files with 15 additions and 22 deletions

View file

@ -1,13 +1,3 @@
html:fullscreen {
background-color: $bodyBackground;
}
html:-moz-full-screen {
background-color: $bodyBackground;
}
html:-webkit-full-screen {
background-color: $bodyBackground;
}
body.$themeClass { body.$themeClass {
background-color: $bodyBackground; background-color: $bodyBackground;
} }

View file

@ -21,10 +21,10 @@ Ox.Fullscreen <o> Fullscreen controller
Ox.Fullscreen = (function() { Ox.Fullscreen = (function() {
var documentElement = document.documentElement, var documentElement = document.body,
enter = document.documentElement.requestFullscreen enter = document.body.requestFullscreen
|| document.documentElement.mozRequestFullScreen || document.body.mozRequestFullScreen
|| document.documentElement.webkitRequestFullscreen, || document.body.webkitRequestFullscreen,
exit = document.exitFullscreen exit = document.exitFullscreen
|| document.mozCancelFullScreen || document.mozCancelFullScreen
|| document.webkitExitFullscreen, || document.webkitExitFullscreen,
@ -86,8 +86,9 @@ Ox.Fullscreen = (function() {
} }
that.available = document.fullscreenEnabled that.available = document.fullscreenEnabled
|| document.webkitFullscreenEnabled || document.webkitFullscreenEnabled
|| document.mozFullScreenEnabled || false; || document.mozFullScreenEnabled
|| false;
that.bind = function(event, handler) { that.bind = function(event, handler) {
bind(event, handler); bind(event, handler);
@ -98,15 +99,16 @@ Ox.Fullscreen = (function() {
}; };
that.enter = function() { that.enter = function() {
if (document.documentElement.requestFullscreen) { if (document.body.requestFullscreen) {
document.documentElement.requestFullscreen(); document.body.requestFullscreen();
} else if (document.documentElement.mozRequestFullScreen) { } else if (document.body.mozRequestFullScreen) {
document.documentElement.mozRequestFullScreen(); document.body.mozRequestFullScreen();
} else if (document.documentElement.webkitRequestFullscreen) { } else if (document.body.webkitRequestFullscreen) {
document.documentElement.webkitRequestFullscreen(); document.body.webkitRequestFullscreen();
} }
// FIXME: Why does storing the function in a variable not work? // FIXME: Why does storing the function in a variable not work?
// enter && enter(); // enter && enter();
// ^ Missing `this` binding
}; };
that.exit = function() { that.exit = function() {
@ -119,6 +121,7 @@ Ox.Fullscreen = (function() {
} }
// FIXME: Why does storing the function in a variable not work? // FIXME: Why does storing the function in a variable not work?
// exit && exit(); // exit && exit();
// ^ Missing `this` binding
}; };
that.getState = function() { that.getState = function() {