mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
Move fullscreen button into core from plugin
This commit is contained in:
parent
6d06a54530
commit
799a5b059a
19
core/images/full-screen-button.tid
Normal file
19
core/images/full-screen-button.tid
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
title: $:/core/images/full-screen-button
|
||||||
|
tags: $:/tags/Image
|
||||||
|
|
||||||
|
<svg class="tw-image-full-screen-button tw-image-button" class="tw-image-button" width="22pt" height="22pt" viewBox="0 0 128 128">
|
||||||
|
<g>
|
||||||
|
<g>
|
||||||
|
<path d="M5.29777586e-31,8 C1.59060409e-15,3.581722 3.581722,0 8,0 L40,0 C44.418278,0 48,3.581722 48,8 C48,12.418278 44.418278,16 40,16 L16,16 L16,40 C16,44.418278 12.418278,48 8,48 C3.581722,48 -3.55271368e-15,44.418278 0,40 L3.55271368e-15,8 Z"></path>
|
||||||
|
</g>
|
||||||
|
<g transform="translate(104.000000, 104.000000) rotate(-180.000000) translate(-104.000000, -104.000000) translate(80.000000, 80.000000)">
|
||||||
|
<path d="M5.29777586e-31,8 C1.59060409e-15,3.581722 3.581722,0 8,0 L40,0 C44.418278,0 48,3.581722 48,8 C48,12.418278 44.418278,16 40,16 L16,16 L16,40 C16,44.418278 12.418278,48 8,48 C3.581722,48 -3.55271368e-15,44.418278 0,40 L3.55271368e-15,8 Z"></path>
|
||||||
|
</g>
|
||||||
|
<g transform="translate(24.000000, 104.000000) rotate(-90.000000) translate(-24.000000, -104.000000) translate(0.000000, 80.000000)">
|
||||||
|
<path d="M5.29777586e-31,8 C1.59060409e-15,3.581722 3.581722,0 8,0 L40,0 C44.418278,0 48,3.581722 48,8 C48,12.418278 44.418278,16 40,16 L16,16 L16,40 C16,44.418278 12.418278,48 8,48 C3.581722,48 -3.55271368e-15,44.418278 0,40 L3.55271368e-15,8 Z"></path>
|
||||||
|
</g>
|
||||||
|
<g transform="translate(104.000000, 24.000000) rotate(90.000000) translate(-104.000000, -24.000000) translate(80.000000, 0.000000)">
|
||||||
|
<path d="M5.29777586e-31,8 C1.59060409e-15,3.581722 3.581722,0 8,0 L40,0 C44.418278,0 48,3.581722 48,8 C48,12.418278 44.418278,16 40,16 L16,16 L16,40 C16,44.418278 12.418278,48 8,48 C3.581722,48 -3.55271368e-15,44.418278 0,40 L3.55271368e-15,8 Z"></path>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
@ -24,6 +24,8 @@ Encryption/ClearPassword/Caption: clear password
|
|||||||
Encryption/ClearPassword/Hint: Clear the password and save this wiki without encryption
|
Encryption/ClearPassword/Hint: Clear the password and save this wiki without encryption
|
||||||
Encryption/SetPassword/Caption: set password
|
Encryption/SetPassword/Caption: set password
|
||||||
Encryption/SetPassword/Hint: Set a password for saving this wiki with encryption
|
Encryption/SetPassword/Hint: Set a password for saving this wiki with encryption
|
||||||
|
FullScreen/Caption: full-screen
|
||||||
|
FullScreen/Hint: Enter or leave full-screen mode
|
||||||
Info/Caption: info
|
Info/Caption: info
|
||||||
Info/Hint: Show information for this tiddler
|
Info/Hint: Show information for this tiddler
|
||||||
Home/Caption: home
|
Home/Caption: home
|
||||||
|
@ -66,6 +66,15 @@ exports.startup = function() {
|
|||||||
downloadType: "text/plain"
|
downloadType: "text/plain"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
var fullscreen = $tw.utils.getFullScreenApis();
|
||||||
|
$tw.rootWidget.addEventListener("tw-full-screen",function(event) {
|
||||||
|
if(document[fullscreen._fullscreenElement]) {
|
||||||
|
document[fullscreen._exitFullscreen]();
|
||||||
|
} else {
|
||||||
|
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({
|
||||||
|
@ -130,4 +130,26 @@ exports.convertEventName = function(eventName) {
|
|||||||
return newEventName;
|
return newEventName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Return the names of the fullscreen APIs
|
||||||
|
*/
|
||||||
|
exports.getFullScreenApis = function() {
|
||||||
|
var d = document,
|
||||||
|
db = d.body;
|
||||||
|
return {
|
||||||
|
"_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" : ""
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
13
core/ui/PageControls/full-screen.tid
Normal file
13
core/ui/PageControls/full-screen.tid
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
title: $:/core/ui/Buttons/full-screen
|
||||||
|
tags: $:/tags/PageControls
|
||||||
|
caption: {{$:/core/images/full-screen-button}} {{$:/language/Buttons/FullScreen/Caption}}
|
||||||
|
description: {{$:/language/Buttons/FullScreen/Hint}}
|
||||||
|
|
||||||
|
<$button message="tw-full-screen" title={{$:/language/Buttons/FullScreen/Hint}} aria-label={{$:/language/Buttons/FullScreen/Caption}} class=<<tw-config-toolbar-class>>>
|
||||||
|
<$list filter="[<tw-config-toolbar-icons>prefix[yes]]">
|
||||||
|
{{$:/core/images/full-screen-button}}
|
||||||
|
</$list>
|
||||||
|
<$list filter="[<tw-config-toolbar-text>prefix[yes]]">
|
||||||
|
<$text text={{$:/language/Buttons/FullScreen/Caption}}/>
|
||||||
|
</$list>
|
||||||
|
</$button>
|
@ -1,6 +1,9 @@
|
|||||||
title: $:/config/PageControlButtons/Visibility/$:/
|
title: $:/config/PageControlButtons/Visibility/$:/
|
||||||
|
|
||||||
core/ui/Buttons/encryption: hide
|
|
||||||
core/ui/Buttons/home: hide
|
|
||||||
core/ui/Buttons/permaview: hide
|
|
||||||
core/ui/Buttons/close-all: hide
|
core/ui/Buttons/close-all: hide
|
||||||
|
core/ui/Buttons/encryption: hide
|
||||||
|
core/ui/Buttons/full-screen: hide
|
||||||
|
core/ui/Buttons/home: hide
|
||||||
|
core/ui/Buttons/language: hide
|
||||||
|
core/ui/Buttons/more-page-actions: hide
|
||||||
|
core/ui/Buttons/permaview: hide
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"tiddlywiki/fullscreen",
|
|
||||||
"tiddlywiki/github-fork-ribbon"
|
"tiddlywiki/github-fork-ribbon"
|
||||||
],
|
],
|
||||||
"themes": [
|
"themes": [
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"tiddlywiki/fullscreen"
|
|
||||||
],
|
],
|
||||||
"themes": [
|
"themes": [
|
||||||
"tiddlywiki/vanilla",
|
"tiddlywiki/vanilla",
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"tiddlywiki/fullscreen"
|
|
||||||
],
|
],
|
||||||
"themes": [
|
"themes": [
|
||||||
"tiddlywiki/vanilla",
|
"tiddlywiki/vanilla",
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"tiddlywiki/fullscreen"
|
|
||||||
],
|
],
|
||||||
"themes": [
|
"themes": [
|
||||||
"tiddlywiki/vanilla",
|
"tiddlywiki/vanilla",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
title: $:/editions/tw5.com/download-empty
|
title: $:/editions/tw5.com/download-empty
|
||||||
|
|
||||||
\define saveTiddlerFilter()
|
\define saveTiddlerFilter()
|
||||||
[[$:/core]] [[$:/isEncrypted]] [[$:/plugins/tiddlywiki/fullscreen]] [[$:/themes/tiddlywiki/snowwhite]] [[$:/themes/tiddlywiki/vanilla]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]
|
[[$:/core]] [[$:/isEncrypted]] [[$:/themes/tiddlywiki/snowwhite]] [[$:/themes/tiddlywiki/vanilla]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]
|
||||||
\end
|
\end
|
||||||
\define savingEmpty()
|
\define savingEmpty()
|
||||||
yes
|
yes
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"tiddlywiki/cecily",
|
"tiddlywiki/cecily",
|
||||||
"tiddlywiki/fullscreen",
|
|
||||||
"tiddlywiki/googleanalytics",
|
"tiddlywiki/googleanalytics",
|
||||||
"tiddlywiki/nodewebkitsaver",
|
"tiddlywiki/nodewebkitsaver",
|
||||||
"tiddlywiki/github-fork-ribbon",
|
"tiddlywiki/github-fork-ribbon",
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"tiddlywiki/fullscreen",
|
|
||||||
"tiddlywiki/tiddlyweb"
|
"tiddlywiki/tiddlyweb"
|
||||||
],
|
],
|
||||||
"themes": [
|
"themes": [
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"tiddlywiki/fullscreen",
|
|
||||||
"tiddlywiki/tiddlyweb"
|
"tiddlywiki/tiddlyweb"
|
||||||
],
|
],
|
||||||
"themes": [
|
"themes": [
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"tiddlywiki/fullscreen"
|
|
||||||
],
|
],
|
||||||
"themes": [
|
"themes": [
|
||||||
"tiddlywiki/vanilla",
|
"tiddlywiki/vanilla",
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"tiddlywiki/fullscreen"
|
|
||||||
],
|
],
|
||||||
"themes": [
|
"themes": [
|
||||||
"tiddlywiki/vanilla",
|
"tiddlywiki/vanilla",
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/plugins/tiddlywiki/fullscreen/init.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: startup
|
|
||||||
|
|
||||||
Message handler for full screen mode
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false, Element: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
// Export name and synchronous status
|
|
||||||
exports.name = "full-screen";
|
|
||||||
exports.platforms = ["browser"];
|
|
||||||
exports.after = ["startup"];
|
|
||||||
exports.synchronous = true;
|
|
||||||
|
|
||||||
exports.startup = function() {
|
|
||||||
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" : "";
|
|
||||||
// Install the full screen handler
|
|
||||||
if(_requestFullscreen) {
|
|
||||||
$tw.rootWidget.addEventListener("tw-full-screen",function(event) {
|
|
||||||
if(document[_fullscreenElement]) {
|
|
||||||
document[_exitFullscreen]();
|
|
||||||
} else {
|
|
||||||
document.documentElement[_requestFullscreen](Element.ALLOW_KEYBOARD_INPUT);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"title": "$:/plugins/tiddlywiki/fullscreen",
|
|
||||||
"description": "Adds support for HTML5 full screen mode",
|
|
||||||
"author": "JeremyRuston",
|
|
||||||
"core-version": ">=5.0.0"
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user