diff --git a/webclient/js/controls.js b/webclient/js/controls.js index b8587f1..d3382f6 100755 --- a/webclient/js/controls.js +++ b/webclient/js/controls.js @@ -11,6 +11,7 @@ function playBrowsedTracks(addtoqueue, trackid) { var selected = 0, counter = 0; //only add one station for dirble, otherwise add all tracks if (isRadioUri(trackid)) { + alert(trackid); mopidy.tracklist.add(null, null, trackid); } else { //add all items in the playlist @@ -391,7 +392,7 @@ function doSeekPos(value) { var val = $("#trackslider").val(); newposition = Math.round(val); if (!initgui) { - pauseTimer(); + pausePosTimer(); //set timer to not trigger it too much clearTimeout(seekTimer); $("#songelapsed").html(timeFromSeconds(val / 1000)); @@ -406,7 +407,7 @@ function triggerPos() { // console.log(newposition); mopidy.playback.seek(newposition); // mopidy.playback.resume(); - resumeTimer(); + resumePosTimer(); posChanging = false; } } @@ -418,7 +419,7 @@ function setPosition(pos) { var oldval = initgui; if (pos > songlength) { pos = songlength; - pauseTimer(); + pausePosTimer(); } currentposition = pos; initgui = true; @@ -467,30 +468,30 @@ function doMute() { } /******* - * Track timer + * Track position timer */ //timer function to update interface -function updateTimer() { +function updatePosTimer() { currentposition += TRACK_TIMER; setPosition(currentposition); // $("#songelapsed").html(timeFromSeconds(currentposition / 1000)); } -function resumeTimer() { - pauseTimer(); +function resumePosTimer() { + pausePosTimer(); if (songlength > 0) { - posTimer = setInterval(updateTimer, TRACK_TIMER); + posTimer = setInterval(updatePosTimer, TRACK_TIMER); } } -function initTimer() { - pauseTimer(); +function initPosTimer() { + pausePosTimer(); // setPosition(0); - resumeTimer(); + resumePosTimer(); } -function pauseTimer() { +function pausePosTimer() { clearInterval(posTimer); } diff --git a/webclient/js/functionsvars.js b/webclient/js/functionsvars.js index 15895b0..8f0b249 100755 --- a/webclient/js/functionsvars.js +++ b/webclient/js/functionsvars.js @@ -429,5 +429,5 @@ $.event.special.swipe = $.extend($.event.special.swipe, { function isRadioUri (uri) { var uriSplit = uri.split(":"); - return validUri || radioExtensionsUris.indexOf(uriSplit[0].toLowerCase()) >= 0; + return validUri(uri) || radioExtensionsUris.indexOf(uriSplit[0].toLowerCase()) >= 0; } diff --git a/webclient/js/gui.js b/webclient/js/gui.js index d23ad57..5906fc5 100755 --- a/webclient/js/gui.js +++ b/webclient/js/gui.js @@ -8,7 +8,7 @@ ********************/ function resetSong() { if (!posChanging) { - pauseTimer(); + pausePosTimer(); setPlayState(false); setPosition(0); @@ -79,6 +79,7 @@ function resizeMb() { function setSongInfo(data) { if (!data || (songdata == data) ) { return; } if (data.name == '') { +// data.name = data.uri; return; }; @@ -138,7 +139,7 @@ function setSongInfo(data) { if (!data.length || data.length == 0) { songlength = 0; $("#songlength").html(''); - pauseTimer(); + pausePosTimer(); $('#trackslider').slider('disable'); $('#radionameinput').val(data.name); $('#radiouriinput').val(data.uri); @@ -260,12 +261,12 @@ function initSocketevents() { mopidy.playback.getTimePosition().then(processCurrentposition, console.error); setPlayState(true); setSongInfo(data.tl_track.track); - initTimer(); + initPosTimer(); }); mopidy.on("event:trackPlaybackPaused", function(data) { //setSongInfo(data.tl_track.track); - pauseTimer(); + pausePosTimer(); setPlayState(false); }); @@ -287,7 +288,7 @@ function initSocketevents() { break; case "playing": mopidy.playback.getTimePosition().then(processCurrentposition, console.error); - resumeTimer(); + resumePosTimer(); setPlayState(true); break; } @@ -368,7 +369,7 @@ function setHeadline(site){ } //update timer -function updateTimer() { +function updateStatusTimer() { mopidy.playback.getCurrentTrack().then(processCurrenttrack, console.error); mopidy.playback.getTimePosition().then(processCurrentposition, console.error); //TODO check offline? @@ -498,7 +499,8 @@ $(document).ready(function(event) { window.onhashchange = locationHashChanged; //update gui status every x seconds from mopdidy - setInterval(updateTimer, STATUS_TIMER); + setInterval(updateStatusTimer, STATUS_TIMER); + //only show backbutton if in UIWebview if (window.navigator.standalone) { $("#btback").show(); diff --git a/webclient/js/jquery.mobile-1.3.2.min.js b/webclient/js/jquery.mobile-1.3.2.min.js old mode 100644 new mode 100755 diff --git a/webclient/js/process_ws.js b/webclient/js/process_ws.js index a133931..36777a1 100755 --- a/webclient/js/process_ws.js +++ b/webclient/js/process_ws.js @@ -9,6 +9,7 @@ * process results of a (new) currently playing track *********************************************************/ function processCurrenttrack(data) { +// console.log(data); setSongInfo(data); } @@ -49,7 +50,7 @@ function processCurrentposition(data) { function processPlaystate(data) { if (data == 'playing') { setPlayState(true); - resumeTimer(); + resumePosTimer(); } else { setPlayState(false); }