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);

</script>


--
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/5532ED71.7030404%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to