You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to TiddlyWiki
Hello,
I tried to write a .js code which should create a button which makes a
TWC go into browserFullscreen respectively return to normal if the
Browser is in FullscreenMode.
As it is my first real code I do not even know how far I missed that goal.
Help on this would be very appreciated.
Yours Jan
PS:
If I understand correctly Eric's TiddlyTools ToggleFullscreen toggles
all Menus but leaves the Browser as it is. If there is another working
Plugin for TWC fullfilling this purpose please let me know.
<script label="Fullscreen">
//looks if the Browser is Fullscreenenabled
var fullscreenEnabled = document.fullscreenEnabled ||
document.mozFullScreenEnabled || document.webkitFullscreenEnabled;
//looks if the document is already in Fullscreen.
var fullscreenElement = document.fullscreenElement ||
document.mozFullScreenElement || document.webkitFullscreenElement;
//defines a browserspecific EXITFullscreen function
function exitFullscreen()
{
if(document.exitFullscreen)
{
document.exitFullscreen();
}
else if(document.mozCancelFullScreen)
{
document.mozCancelFullScreen();
}
else if(document.webkitExitFullscreen)
{
document.webkitExitFullscreen();
}
}
//defines a browserspecific ENTERFullscreen function
function goFullscreen()
{
if(element.requestFullscreen)
{
element.requestFullscreen();
}
else if(element.mozRequestFullScreen)
{
element.mozRequestFullScreen();
}
else if(element.webkitRequestFullscreen)
{
element.webkitRequestFullscreen();
}
else if(element.msRequestFullscreen)
{
element.msRequestFullscreen();
}
}
// This Function decides which Function should be used
//if the dokument is in Fullscreen it will exit otherwise it will
launch into fullscreen or call F11 as last option.
function toggleBrowserFullscreen(fullscreenEnabled,fullscreenElement)
{
if(fullscreenElement)
{
exitFullscreen
}
else if(fullscreenEnabled)
{
goFullscreen
}
else
{
SendKeys("{F11}") // ancient brute force method to toggle Fullscreen.
}
}
//create a button which is telling what will be done.
place.innerHTML=fullscreenElement?"Exit
Fullscreen":fullscreenEnabled?"Fullscreen":"toggleFullscreen";
toggleBrowserFullscreen(element);