Jan
unread,Apr 20, 2015, 10:15:32 AM4/20/15Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
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,
the button I did in .js is now partly working,
it can change the browser into Fullscreen
three Problems are not solved yet.
-In Fullscreenmode the button switches to Exit Fullscreen after it is
clicked a second time.
-Either the ToggleBrowserFullscreen or the exitFullscreen function does
not work.
-How can I get the browser to remember my decision to allow Fullscreen?
I hope someone can help me on this.
!Button
<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 function that will exit Fullscreen if the dokument is in
Fullscreen and otherwise go into fullscreen with the browserspecific
term, calling F11 as last option.
//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(element)
{
if(element.requestFullscreen)
{
element.requestFullscreen();
}
else if(element.mozRequestFullScreen)
{
element.mozRequestFullScreen();
}
else if(element.webkitRequestFullscreen)
{
element.webkitRequestFullscreen();
}
else if(element.msRequestFullscreen)
{
element.msRequestFullscreen();
}
}
goFullscreen(document.documentElement)
// This Function decides which Function should be used
function toggleBrowserFullscreen(fullscreenEnabled,fullscreenElement)
{
if(fullscreenElement)
{
exitFullscreen()
}
else if(fullscreenEnabled)
{
goFullscreen(document.documentElement)
}
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":"Fullscreen";
toggleBrowserFullscreen(document.documentElement);
</script>