1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-07-08 21:12:50 +00:00

Fix full screen button not supported

This commit is contained in:
Jermolene 2014-08-03 12:35:53 +01:00
parent bf9a87dc0e
commit 3529625a6c
2 changed files with 16 additions and 10 deletions

View File

@ -67,6 +67,7 @@ exports.startup = function() {
}); });
}); });
var fullscreen = $tw.utils.getFullScreenApis(); var fullscreen = $tw.utils.getFullScreenApis();
if(fullscreen) {
$tw.rootWidget.addEventListener("tw-full-screen",function(event) { $tw.rootWidget.addEventListener("tw-full-screen",function(event) {
if(document[fullscreen._fullscreenElement]) { if(document[fullscreen._fullscreenElement]) {
document[fullscreen._exitFullscreen](); document[fullscreen._exitFullscreen]();
@ -74,7 +75,7 @@ exports.startup = function() {
document.documentElement[fullscreen._requestFullscreen](Element.ALLOW_KEYBOARD_INPUT); document.documentElement[fullscreen._requestFullscreen](Element.ALLOW_KEYBOARD_INPUT);
} }
}); });
}
// If we're being viewed on a data: URI then give instructions for how to save // If we're being viewed on a data: URI then give instructions for how to save
if(document.location.protocol === "data:") { if(document.location.protocol === "data:") {
$tw.rootWidget.dispatchEvent({ $tw.rootWidget.dispatchEvent({

View File

@ -135,8 +135,8 @@ Return the names of the fullscreen APIs
*/ */
exports.getFullScreenApis = function() { exports.getFullScreenApis = function() {
var d = document, var d = document,
db = d.body; db = d.body,
return { result = {
"_requestFullscreen": db.webkitRequestFullscreen !== undefined ? "webkitRequestFullscreen" : "_requestFullscreen": db.webkitRequestFullscreen !== undefined ? "webkitRequestFullscreen" :
db.mozRequestFullScreen !== undefined ? "mozRequestFullScreen" : db.mozRequestFullScreen !== undefined ? "mozRequestFullScreen" :
db.msRequestFullscreen !== undefined ? "msRequestFullscreen" : db.msRequestFullscreen !== undefined ? "msRequestFullscreen" :
@ -150,6 +150,11 @@ exports.getFullScreenApis = function() {
d.msFullscreenElement !== undefined ? "msFullscreenElement" : d.msFullscreenElement !== undefined ? "msFullscreenElement" :
d.fullscreenElement !== undefined ? "fullscreenElement" : "" d.fullscreenElement !== undefined ? "fullscreenElement" : ""
}; };
if(!result._requestFullscreen || !result._exitFullscreen || !result._fullscreenElement) {
return null;
} else {
return result;
}
}; };
})(); })();