Infocatcher / Sidebars_List

Adds drop-down list to switch sidebars, restartless extension for Firefox
https://addons.mozilla.org/firefox/addon/sidebars-list/
Other
1 stars 1 forks source link

Hide sidebar splitter, if active fullscreen web application #4

Closed Infocatcher closed 10 years ago

Infocatcher commented 10 years ago

We can use document.mozFullScreen to detect this. https://developer.mozilla.org/en-US/docs/Web/API/document.mozFullScreen

Infocatcher commented 10 years ago

Testcase: http://jsfiddle.net/9JgGa/1/ => http://fiddle.jshell.net/9JgGa/1/show/ or http://fiddle.jshell.net/9JgGa/1/show/light/

<!DOCTYPE HTML>
<meta charset="utf-8"/>
<title>FullScreen test</title>
<script type="text/javascript">
function toggleFullScreen() {
    if(
        document.fullscreenElement
        || document.mozFullScreenElement
        || document.msFullScreenElement
        || document.webkitFullScreenElement
    ) {
        document.exitFullscreen && document.exitFullscreen()
            || document.mozCancelFullScreen  && document.mozCancelFullScreen()
            || document.msExitFullscreen     && document.msExitFullscreen()
            || document.webkitExitFullscreen && document.webkitExitFullscreen();
    }
    else {
        var root = document.documentElement;
        root.requestFullscreen && root.requestFullscreen()
            || root.mozRequestFullScreen    && root.mozRequestFullScreen()
            || root.msRequestFullScreen     && root.msRequestFullScreen()
            || root.webkitRequestFullScreen && root.webkitRequestFullScreen();
    }
}
</script>
<body>
    <button onclick="toggleFullScreen()">Toggle FullScreen</button>
</body>