From 029e5d44fa6e5776ae65fe7a5cdabed4249c39e4 Mon Sep 17 00:00:00 2001 From: woutervanwijk Date: Tue, 12 Nov 2013 01:17:34 +0100 Subject: [PATCH] bugfixes, better swipes --- flatclient/css/webclient.css | 16 ++++++---- flatclient/index.html | 2 -- flatclient/js/controls.js | 1 + flatclient/js/functionsvars.js | 57 +++++++++++++++++++++++++++++----- flatclient/js/gui.js | 21 ++++++------- 5 files changed, 69 insertions(+), 28 deletions(-) diff --git a/flatclient/css/webclient.css b/flatclient/css/webclient.css index 968c88e..9219c0b 100755 --- a/flatclient/css/webclient.css +++ b/flatclient/css/webclient.css @@ -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; diff --git a/flatclient/index.html b/flatclient/index.html index 5124988..4fae49f 100755 --- a/flatclient/index.html +++ b/flatclient/index.html @@ -192,8 +192,6 @@ - -
    diff --git a/flatclient/js/controls.js b/flatclient/js/controls.js index 939c393..5a98519 100755 --- a/flatclient/js/controls.js +++ b/flatclient/js/controls.js @@ -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...'); diff --git a/flatclient/js/functionsvars.js b/flatclient/js/functionsvars.js index ed437ac..efb0ce5 100755 --- a/flatclient/js/functionsvars.js +++ b/flatclient/js/functionsvars.js @@ -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 = '
  • ' + @@ -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) { '' + '' + '

    ' + newalbum[0].name + "

    "; -/* '' + timeFromSeconds(newalbum[0].length / 1000) + ''; */ +/* '' + timeFromSeconds(newalbum[0].length / 1000) + ''; */ 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); -} \ No newline at end of file +} + + +$.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" ); + } + } +}); diff --git a/flatclient/js/gui.js b/flatclient/js/gui.js index ea7aa50..828aefc 100755 --- a/flatclient/js/gui.js +++ b/flatclient/js/gui.js @@ -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. -}); \ No newline at end of file + $.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; + +});