mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-06-24 22:33:16 +00:00
Extent tm-full-screen message to support forcing the status
Now one can force "enter" or "exit", instead of just toggling the current status
This commit is contained in:
parent
b89e8d1635
commit
3140ff9e49
|
@ -42,10 +42,16 @@ exports.startup = function() {
|
||||||
var fullscreen = $tw.utils.getFullScreenApis();
|
var fullscreen = $tw.utils.getFullScreenApis();
|
||||||
if(fullscreen) {
|
if(fullscreen) {
|
||||||
$tw.rootWidget.addEventListener("tm-full-screen",function(event) {
|
$tw.rootWidget.addEventListener("tm-full-screen",function(event) {
|
||||||
if(event.event.target.ownerDocument[fullscreen._fullscreenElement]) {
|
if(event.param === "enter") {
|
||||||
|
event.event.target.ownerDocument.documentElement[fullscreen._requestFullscreen](Element.ALLOW_KEYBOARD_INPUT);
|
||||||
|
} else if(event.param === "exit") {
|
||||||
event.event.target.ownerDocument[fullscreen._exitFullscreen]();
|
event.event.target.ownerDocument[fullscreen._exitFullscreen]();
|
||||||
} else {
|
} else {
|
||||||
event.event.target.ownerDocument.documentElement[fullscreen._requestFullscreen](Element.ALLOW_KEYBOARD_INPUT);
|
if(event.event.target.ownerDocument[fullscreen._fullscreenElement]) {
|
||||||
|
event.event.target.ownerDocument[fullscreen._exitFullscreen]();
|
||||||
|
} else {
|
||||||
|
event.event.target.ownerDocument.documentElement[fullscreen._requestFullscreen](Element.ALLOW_KEYBOARD_INPUT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,28 @@
|
||||||
|
caption: tm-full-screen
|
||||||
created: 20140811112400855
|
created: 20140811112400855
|
||||||
modified: 20140811113627373
|
modified: 20180814215126941
|
||||||
tags: Messages
|
tags: Messages
|
||||||
title: WidgetMessage: tm-full-screen
|
title: WidgetMessage: tm-full-screen
|
||||||
type: text/vnd.tiddlywiki
|
type: text/vnd.tiddlywiki
|
||||||
caption: tm-full-screen
|
|
||||||
|
|
||||||
The fullscreen message toggles the "fullscreen" mode of the browser, if it supports it.
|
The fullscreen message is used to enter, exit or toggle the "fullscreen" mode of the browser, if it supports it. It uses the following properties on the `event` object:
|
||||||
|
|
||||||
|
|!Name |!Description |
|
||||||
|
|param |`enter` to enter full screen mode, `exit` to exit it, otherwise toggle the full screen status |
|
||||||
|
|
||||||
|
The fullscreen message is handled by the TiddlyWiki core.
|
||||||
|
|
||||||
|
|
||||||
|
<$macrocall $name='wikitext-example-without-html'
|
||||||
|
src='<$button message="tm-full-screen">
|
||||||
|
Full screen toggle
|
||||||
|
</$button>
|
||||||
|
|
||||||
|
<$button message="tm-full-screen" param="enter">
|
||||||
|
Full screen enter
|
||||||
|
</$button>
|
||||||
|
|
||||||
|
<$button message="tm-full-screen" param="exit">
|
||||||
|
Full screen exit
|
||||||
|
</$button>'/>
|
||||||
|
|
||||||
The fullscreen message is handled by the TiddlyWiki core.
|
|
Loading…
Reference in New Issue
Block a user