bugfixes, better swipes

This commit is contained in:
woutervanwijk 2013-11-12 01:17:34 +01:00
parent bc4cd06faa
commit 029e5d44fa
5 changed files with 69 additions and 28 deletions

View File

@ -165,10 +165,6 @@
font-size: 15px;
}
.pane {
min-height: 125px;
}
/***********************
* Track Slider
***********************/
@ -377,16 +373,16 @@
}
#controlspopup, #artistpopup, #coverpopup {
max-width: 460px;
max-width: 550px;
background: white;
padding: 5px;
max-width: 80%;
}
#h_artistname {
margin-bottom: 65px;
margin-top: 10px;
}
#buttons, #controlspopupimage, #coverpopupimage, #artistpopupimage {
display: block;
margin-left: auto;
@ -394,6 +390,14 @@
margin-bottom: 5px;
}
#popupTracksLv li, #popupQueueLv li {
border-bottom: 1px solid #aaa;
}
#popupTracksLv, #popupQueueLv {
border: 1px solid #aaa;
}
/*dont hide clear buttons in text input */
.ui-input-clear-hidden {
display:block !important;

View File

@ -192,8 +192,6 @@
</div>
<!-- /header -->
<div data-role="content" id="playlistspane" class="pane ui-grid-a pl-breakpoint">
<div class="ui-block-a scroll" id="playlistslistdiv">
<ul id="playlistslist" class="table"></ul>

View File

@ -127,6 +127,7 @@ function playTrackByUri(uri, playlisturi){
*/
function playTrackQueueByUri(uri, playlisturi){
//stop directly, for user feedback
//console.log('qu');
mopidy.playback.stop(true);
$('#popupQueue').popup('close');
toast('Loading...');

View File

@ -74,11 +74,13 @@ STATUS_TIMER = 10000;
var radioStations = [];
//fill with defaults
radioStations.push(['FluxFM', 'http://www.fluxfm.de/stream-berlin']);
radioStations.push(['FM4', 'http://mp3stream1.apasf.apa.at:8000/']);
radioStations.push(['Bayern 2', 'http://gffstream.ic.llnwd.net/stream/gffstream_w11a']);
radioStations.push(['Bayern 3', 'http://gffstream.ic.llnwd.net/stream/gffstream_w12a']);
radioStations.push(['Campus Crew', 'http://streamplus8.leonex.de:35132/']);
radioStations.push(['NPR 24', 'http://nprdmp.ic.llnwd.net/stream/nprdmp_live01_mp3']);
radioStations.push(['3FM Dutch', 'http://icecast.omroep.nl/3fm-bb-mp3']);
radioStations.push(['BBC WorldService', 'http://vprbbc.streamguys.net:8000/vprbbc24.mp3']);
radioStations.push(['Arrow Jazz', 'http://81.173.3.132:8082']);
radioStations.push(['PBS Australia', 'http://eno.emit.com:8000/pbsfm_live_64.mp3']);
radioStations.push(['Kiss FM Berlin', 'http://stream.kissfm.de/kissfm/mp3-128/internetradio/']);
/*******
*
@ -145,7 +147,6 @@ function albumTracksToTable(pl, target, uri) {
}
function renderSongLi(song, liID, uri){
var hash = document.location.hash.split('?');
//this is so dirty... ... ...
var playlistType = '';
@ -155,6 +156,7 @@ function renderSongLi(song, liID, uri){
} else {
playlistType = 'playTrackByUri';
}
console.log(playlistType);
// songLi = '';
songLi = '<li class="song albumli" id="' + liID + '">' +
@ -176,6 +178,7 @@ function resultsToTables(results, target, uri) {
} else {
playlistType = 'playTrackByUri';
}
console.log(playlistType);
var newalbum = [];
var nexturi = '';
@ -215,7 +218,7 @@ function resultsToTables(results, target, uri) {
'<i class="fa fa-ellipsis-vertical"></i></a>' +
'<a href="#" onclick="return ' + playlistType + '(\'' + newalbum[0].uri + '\',\'' + uri + '\');">' +
'<h1>' + newalbum[0].name + "</h1><p>";
/* '<span style="float: right;">' + timeFromSeconds(newalbum[0].length / 1000) + '</span>'; */
/* '<span style="float: right;">' + timeFromSeconds(newalbum[0].length / 1000) + '</span>'; */
for ( j = 0; j < newalbum[0].artists.length; j++) {
html += newalbum[0].artists[j].name;
html += (j == newalbum[0].artists.length - 1) ? '' : ' / ';
@ -325,6 +328,7 @@ function getTracksFromUri(uri) {
} else if (customTracklists[uri]) {
return customTracklists[uri];
}
return [];
}
//convert time to human readable format
@ -389,4 +393,41 @@ function showOffline(on) {
function validUri(str) {
var regexp = /(mms|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
return regexp.test(str);
}
}
$.event.special.swipe = $.extend($.event.special.swipe, {
start: function( event ) {
var data = event.originalEvent.touches ?
event.originalEvent.touches[ 0 ] : event;
return {
time: ( new Date() ).getTime(),
coords: [ data.pageX, data.pageY ],
origin: $( event.target ),
offset: $('body').scrollTop()
};
},
stop: function( event ) {
var data = event.originalEvent.touches ?
event.originalEvent.touches[ 0 ] : event;
return {
time: ( new Date() ).getTime(),
coords: [ data.pageX, data.pageY ],
offset: $('body').scrollTop()
};
},
handleSwipe: function( start, stop ) {
var swipe = $.event.special.swipe,
x = Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ),
y = Math.abs( start.coords[ 1 ] - stop.coords[ 1 ] ),
offset = Math.abs( start.offset - stop.offset ),
time = stop.time - start.time;
if ( time < swipe.durationThreshold && x > swipe.horizontalDistanceThreshold && ( y + offset )
< swipe.verticalDistanceThreshold ) {
start.origin.trigger( "swipe" ).trigger( ( start.coords[ 0 ] - stop.coords[ 0 ] ) ? "swipeleft" : "swiperight" );
}
}
});

View File

@ -392,19 +392,12 @@ $(document).ready(function() {
});
initRadio();
if ($(window).width() < 560) {
if ($(window).width() <= 1024) {
$("#panel").panel("close");
}else{
$("#panel").panel("open");
}
/* //hide fs button if mobile browser
if(isMobileSafari) {
alert(ua);
$('#navExitFullscreen').hide();
}
*/
//hide fullscreen button if in UIWebview
if (window.navigator.standalone) {
$('#navExitFullscreen').hide();
@ -413,9 +406,10 @@ $(document).ready(function() {
// swipe songinfo and panel
$( "#normalFooter" ).on( "swiperight", doPrevious );
$( "#normalFooter" ).on( "swipeleft", doNext );
$( "#panel, .pane" ).on( "swiperight", function() { $("#panel").panel("open") } );
$( "#panel, .pane" ).on( "swipeleft", function() { $("#panel").panel("close") });
$( "#header" ).on( "swiperight", function() { $("#panel").panel("open") } );
$( "#header" ).on( "swipeleft", function() { $("#panel").panel("close") });
$( ".pane" ).on( "swiperight", function() { $("#panel").panel("open") } );
});
$(document).bind("pageinit", function() {
@ -569,6 +563,9 @@ function locationHashChanged() {
}
$(document).bind("mobileinit", function(){
$.event.special.swipe.horizontalDistanceThreshold = 100; // (default: 30px) Swipe horizontal displacement must be more than this.
$.event.special.swipe.verticalDistanceThreshold = 100; // (default: 75px) Swipe vertical displacement must be less than this.
});
$.event.special.swipe.horizontalDistanceThreshold = 30; // (default: 30px) Swipe horizontal displacement must be more than this.
$.event.special.swipe.verticalDistanceThreshold = 75; // (default: 75px) Swipe vertical displacement must be less than this.
$.event.special.swipe.scrollSupressionThreshold = 30;
$.event.special.swipe.durationThreshold = 500;
});