mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-04 17:16:18 +00:00
Fixes to fullscreen support
Prompted by this article: http://generatedcontent.org/post/70347573294/is-your-fullscreen-api-code -up-to-date-find-out-how-to
This commit is contained in:
parent
cc39686693
commit
638c8b2070
@ -130,15 +130,6 @@ exports.convertEventName = function(eventName) {
|
||||
|
||||
// Setup constants for the current browser
|
||||
exports.getBrowserInfo = function(info) {
|
||||
info.requestFullScreen = document.body.webkitRequestFullScreen !== undefined ? "webkitRequestFullScreen" :
|
||||
document.body.mozRequestFullScreen !== undefined ? "mozRequestFullScreen" :
|
||||
document.body.requestFullScreen !== undefined ? "requestFullScreen" : "";
|
||||
info.cancelFullScreen = document.webkitCancelFullScreen !== undefined ? "webkitCancelFullScreen" :
|
||||
document.mozCancelFullScreen !== undefined ? "mozCancelFullScreen" :
|
||||
document.cancelFullScreen !== undefined ? "cancelFullScreen" : "";
|
||||
info.isFullScreen = document.webkitIsFullScreen !== undefined ? "webkitIsFullScreen" :
|
||||
document.mozFullScreen !== undefined ? "mozFullScreen" :
|
||||
document.fullScreen !== undefined ? "fullScreen" : "";
|
||||
};
|
||||
|
||||
})();
|
||||
|
@ -12,18 +12,33 @@ Message handler for full screen mode
|
||||
/*global $tw: false, Element: false */
|
||||
"use strict";
|
||||
|
||||
var toggleFullScreen = function() {
|
||||
if(document[$tw.browser.isFullScreen]) {
|
||||
document[$tw.browser.cancelFullScreen]();
|
||||
var d = document,
|
||||
db = d.body,
|
||||
_requestFullscreen = db.webkitRequestFullscreen !== undefined ? "webkitRequestFullscreen" :
|
||||
db.mozRequestFullScreen !== undefined ? "mozRequestFullScreen" :
|
||||
db.msRequestFullscreen !== undefined ? "msRequestFullscreen" :
|
||||
db.requestFullscreen !== undefined ? "requestFullscreen" : "",
|
||||
_exitFullscreen = d.webkitExitFullscreen !== undefined ? "webkitExitFullscreen" :
|
||||
d.mozCancelFullScreen !== undefined ? "mozCancelFullScreen" :
|
||||
d.msExitFullscreen !== undefined ? "msExitFullscreen" :
|
||||
d.exitFullscreen !== undefined ? "exitFullscreen" : "",
|
||||
_fullscreenElement = d.webkitFullscreenElement !== undefined ? "webkitFullscreenElement" :
|
||||
d.mozFullScreenElement !== undefined ? "mozFullScreenElement" :
|
||||
d.msFullscreenElement !== undefined ? "msFullscreenElement" :
|
||||
d.fullscreenElement !== undefined ? "fullscreenElement" : "";
|
||||
|
||||
var toggleFullscreen = function() {
|
||||
if(document[_fullscreenElement]) {
|
||||
document[_exitFullscreen]();
|
||||
} else {
|
||||
document.documentElement[$tw.browser.requestFullScreen](Element.ALLOW_KEYBOARD_INPUT);
|
||||
document.documentElement[_requestFullscreen](Element.ALLOW_KEYBOARD_INPUT);
|
||||
}
|
||||
};
|
||||
|
||||
exports.startup = function() {
|
||||
// Install the full screen handler
|
||||
$tw.rootWidget.addEventListener("tw-full-screen",function(event) {
|
||||
toggleFullScreen();
|
||||
toggleFullscreen();
|
||||
});
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user