Merge pull request #165 from jcass77/fix/53_fullscreen_scrolling

Fix scrolling in full screen for Chrome and Safari.
This commit is contained in:
Nick Steel 2016-02-14 13:17:54 +00:00
commit 5629d15d02
4 changed files with 30 additions and 49 deletions

View File

@ -73,6 +73,7 @@ v2.2.0 (UNRELEASED)
**Fixes**
- Prevent mobile devices from scaling when used in landscape mode. (Fixes: `#157 <https://github.com/pimusicbox/mopidy-musicbox-webclient/issues/157>`_).
- Scrolling now works in full screen mode for Chrome and Safari as well. (Fixes: `#53 <https://github.com/pimusicbox/mopidy-musicbox-webclient/issues/53>`_).
v2.1.1 (2016-02-04)
-------------------

View File

@ -97,13 +97,9 @@
<a href="/alarmclock/">
<span class="navtxt"> Alarm Clock </span><i class="fa fa-clock-o"></i></a>
</li>
<li id="navEnterFullscreen" data-icon="false">
<li id="navToggleFullscreen" data-icon="false">
<a href="#">
<span class="navtxt"> Fullscreen </span><i class="fa fa-desktop"></i></a>
</li>
<li id="navExitFullscreen" class="hidden" data-icon="false">
<a href="#">
<span class="navtxt"> Exit Fullscreen </span><i class="fa fa-desktop"></i></a>
<span class="navtxt" id="toggletxt"> Fullscreen </span><i class="fa fa-desktop"></i></a>
</li>
<li id="navSettings" data-icon="false">
<a href="/settings/">

View File

@ -308,42 +308,34 @@ $(document).bind("pageinit", function() {
/**************
* gui stuff *
**************/
function enterFullscreen() {
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(); }
var elem = document.querySelector("#page");
elem.onwebkitfullscreenchange = onFullScreenEnter;
elem.onmozfullscreenchange = onFullScreenEnter;
elem.onfullscreenchange = onFullScreenEnter;
if (elem.webkitRequestFullscreen) {
elem.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
if (!document.fullscreenElement && // alternative standard method
!document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement ) { // current working methods
var docElm = document.documentElement;
if (docElm.requestFullscreen) {
docElm.requestFullscreen();
} else if (docElm.msRequestFullscreen) {
docElm.msRequestFullscreen();
} else if (docElm.mozRequestFullScreen) {
docElm.mozRequestFullScreen();
} else if (docElm.webkitRequestFullScreen) {
docElm.webkitRequestFullScreen();
}
document.getElementById("toggletxt").innerHTML = "Exit Fullscreen";
} else {
if (elem.mozRequestFullScreen) {
elem.mozRequestFullScreen();
} else {
elem.requestFullscreen();
}
}
}
function exitFullscreen() {
document.webkitExitFullscreen();
document.mozCancelFullscreen();
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
}
document.getElementById("toggletxt").innerHTML = "Fullscreen";
}
}
function onFullScreenEnter() {
var elem = document.querySelector("#page");
$('#navExitFullscreen').show();
$('#navEnterFullscreen').hide();
elem.onwebkitfullscreenchange = onFullScreenExit;
elem.onmozfullscreenchange = onFullScreenExit;
};
// Called whenever the browser exits fullscreen.
function onFullScreenExit() {
$('#navExitFullscreen').hide();
$('#navEnterFullscreen').show();
};
function switchContent(divid, uri) {
var hash = divid;
@ -521,11 +513,8 @@ $(document).ready(function(event) {
$('#controlspopupimage').click(
function() {
return switchContent('current')} );
$('#navEnterFullscreen').click(function(){
enterFullscreen();
});
$('#navExitFullscreen').click(function(){
exitFullscreen();
$('#navToggleFullscreen').click(function(){
toggleFullscreen();
});
// remove buttons only for MusicBox
@ -575,11 +564,6 @@ $(document).ready(function(event) {
$("#panel").panel("open");
}
//hide fullscreen button if in UIWebview
if (window.navigator.standalone) {
$('#navExitFullscreen').hide();
}
$.event.special.swipe.horizontalDistanceThreshold = 125; // (default: 30px) Swipe horizontal displacement must be more than this.
$.event.special.swipe.verticalDistanceThreshold = 50; // (default: 75px) Swipe vertical displacement must be less than this.
$.event.special.swipe.durationThreshold = 500;

View File

@ -1,6 +1,6 @@
CACHE MANIFEST
# 2016-02-06:v1
# 2016-02-14:v1
NETWORK:
*