diff --git a/mopidy_musicbox_webclient/static/js/gui.js b/mopidy_musicbox_webclient/static/js/gui.js index 920f01c..2a8d4f1 100644 --- a/mopidy_musicbox_webclient/static/js/gui.js +++ b/mopidy_musicbox_webclient/static/js/gui.js @@ -302,10 +302,10 @@ $(document).bind("pageinit", function() { /************** * gui stuff * **************/ + function toggleFullscreen() { if (isMobileSafari) { alert ("To get this app in Full Screen, you have to add it to your home-screen using the Share button."); exit(); } - if (!document.fullscreenElement && // alternative standard method - !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement ) { // current working methods + if (!isFullscreen() ) { // current working methods var docElm = document.documentElement; if (docElm.requestFullscreen) { docElm.requestFullscreen(); @@ -316,7 +316,6 @@ function toggleFullscreen() { } else if (docElm.webkitRequestFullScreen) { docElm.webkitRequestFullScreen(); } - document.getElementById("toggletxt").innerHTML = "Exit Fullscreen"; } else { if (document.exitFullscreen) { document.exitFullscreen(); @@ -327,10 +326,14 @@ function toggleFullscreen() { } else if (document.webkitCancelFullScreen) { document.webkitCancelFullScreen(); } - document.getElementById("toggletxt").innerHTML = "Fullscreen"; } } +function isFullscreen() { + return (document.fullscreenElement || // alternative standard method + document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement ) // current working methods +} + function switchContent(divid, uri) { var hash = divid; if (uri) { @@ -506,7 +509,16 @@ $(document).ready(function(event) { toggleFullscreen(); }); -// remove buttons only for MusicBox + // event handlers for full screen mode + $(document).on('webkitfullscreenchange mozfullscreenchange fullscreenchange, MSFullscreenChange', function(e) { + if (isFullscreen()) { + document.getElementById("toggletxt").innerHTML = "Exit Fullscreen"; + } else { + document.getElementById("toggletxt").innerHTML = "Fullscreen"; + } + }); + + // remove buttons only for MusicBox if (!isMusicBox) { $('#navSettings').hide(); $('#navshutdown').hide(); diff --git a/mopidy_musicbox_webclient/static/mb.manifest b/mopidy_musicbox_webclient/static/mb.manifest index 8ff8679..5a76cd4 100644 --- a/mopidy_musicbox_webclient/static/mb.manifest +++ b/mopidy_musicbox_webclient/static/mb.manifest @@ -1,6 +1,6 @@ CACHE MANIFEST -# 2016-02-15:v1 +# 2016-02-18:v1 NETWORK: *