From 4e496e1073de4492a9493810ff254b4dbe41292b Mon Sep 17 00:00:00 2001 From: Wouter van Wijk Date: Tue, 19 Feb 2013 20:27:45 +0100 Subject: [PATCH] added track shuffle, coverart cleanup --- webclient/css/ws.css | 3 +-- webclient/images/icons/fork_21x24.png | Bin 0 -> 387 bytes webclient/images/icons/layers_24x21.png | Bin 0 -> 212 bytes webclient/index.html | 29 +++++++++++------------- webclient/js/controls.js | 18 +++++++++------ webclient/js/functionsvars.js | 29 ++++++------------------ webclient/js/gui.js | 4 ---- webclient/js/library.js | 3 +-- webclient/js/process_ws.js | 5 +--- 9 files changed, 34 insertions(+), 57 deletions(-) create mode 100755 webclient/images/icons/fork_21x24.png create mode 100755 webclient/images/icons/layers_24x21.png diff --git a/webclient/css/ws.css b/webclient/css/ws.css index 582894a..ae6e39a 100755 --- a/webclient/css/ws.css +++ b/webclient/css/ws.css @@ -289,8 +289,7 @@ a { height: 50px !important; } - -#controlspopupimage, #coverpopupimage, #artistpopupimage { +#buttons, #controlspopupimage, #coverpopupimage, #artistpopupimage { display: block; margin-left: auto; margin-right: auto diff --git a/webclient/images/icons/fork_21x24.png b/webclient/images/icons/fork_21x24.png new file mode 100755 index 0000000000000000000000000000000000000000..15af7aca3a5d9e520517b166ff23ae391ce1b8aa GIT binary patch literal 387 zcmV-}0et?6P)jZq@ zsP{UpJvD5}SZ@R#3UAGQ!N%)~{#bAx>y+;2&auiW@EtSn2TEO*Trx19CHET?V0}+& zSQr6+LYDwJk`ihC9C~gsA!l&7TUI;53CdAw+~@R#)(b~2CGPDuFvnlLV1z6%L@z8t hmAlLZ^y%LM3;^$DSr z1<%~X^wgl##FWaylc_d9MP;5Yjv*Ddl2Q~H!q!HWNV)p2;^aoJ))rPiWKyM|>-i%ciHQiwS@ zC4-xjRdeG{hCIb7{v|Skv%3=3t&#V2UA!{GM0Dc3E(RtZhTt^~&Szq;r2$>Q;OXk; Jvd$@?2>^6TM#umF literal 0 HcmV?d00001 diff --git a/webclient/index.html b/webclient/index.html index b55f8f0..57dd6de 100755 --- a/webclient/index.html +++ b/webclient/index.html @@ -44,29 +44,30 @@

bbb

- +
Close

bbb

- +
Close -

+

  -

- - - -
+  

+
+ + + +

- +
@@ -213,7 +210,7 @@ - + diff --git a/webclient/js/controls.js b/webclient/js/controls.js index 666de89..1ae495d 100644 --- a/webclient/js/controls.js +++ b/webclient/js/controls.js @@ -8,8 +8,6 @@ function playTrack(addtobottom) { //function playtrack(uri, playlisturi) { playlisturi = $('#popupTracks').data("list"); uri = $('#popupTracks').data("track"); - //console.log(uri); - //console.log(playlisturi); var trackslist = new Array(); var track; switchContent('current', uri); @@ -24,9 +22,11 @@ function playTrack(addtobottom) { } else { tracks = currentplaylist; } - - if (addtobottom) { return false;} - + + if (addtobottom) { + return false; + } + mopidy.playback.stop(true); for (var i = 0; i < tracks.length; i++) { @@ -47,6 +47,12 @@ function playTrack(addtobottom) { * Buttons */ +function doShuffle() { + mopidy.playback.stop(true); + mopidy.tracklist.shuffle(); + mopidy.playback.play(); +} + /* Toggle state of play button */ function setPlayState(nwplay) { if (nwplay) { @@ -180,7 +186,6 @@ function setPosition(pos) { function setVolume(value) { var oldval = initgui; - console.log('volume: ' + value); initgui = true; $("#volumeslider").val(value).slider('refresh'); initgui = oldval; @@ -238,4 +243,3 @@ function initTimer() { function pauseTimer() { clearInterval(posTimer); } - diff --git a/webclient/js/functionsvars.js b/webclient/js/functionsvars.js index 93b0475..c1c6bd1 100755 --- a/webclient/js/functionsvars.js +++ b/webclient/js/functionsvars.js @@ -63,7 +63,13 @@ STATUS_TIMER = 10000; */ function scrollToTop() { var divtop = 0; - // console.log(divtop); + $('body,html').animate({ + scrollTop : divtop + }, 250); +} + +function scrollToTracklist() { + var divtop = $("#playlisttablediv").offset().top - 25; $('body,html').animate({ scrollTop : divtop }, 250); @@ -133,8 +139,6 @@ function resultsToTables(results, target, uri) { nexturi = results[i + 1].album.uri; } if (results[i].album.uri != nexturi) { - // console.log(i); - tableid = 'art' + i; html += '
  • '; html += ''; @@ -161,7 +165,6 @@ function resultsToTables(results, target, uri) { newalbum = []; } } - //console.log(html); tableid = "#" + tableid; $(target).html(html); $(target).attr('data', uri); @@ -175,24 +178,6 @@ function playlisttotable(pl, table, uri) { var child = ''; for (var i = 0; i < pl.length; i++) { - /* var child = '
  • ' + pl[i].name + "

    "; - child += '

    ' + timeFromSeconds(pl[i].length / 1000) + '

    '; - // console.log(i); - child += '

    '; - for (var j = 0; j < pl[i].artists.length; j++) { - child += '' + pl[i].artists[j].name + ""; - //stop after 3 - if (j > 2) { - child += '...'; - break; - } - } - // child += ''; - child += ' / ' + pl[i].album.name + '

    '; - child += '
  • '; - //console.log(child); - tmp += child; - */ popupData[pl[i].uri] = pl[i]; child = '
  • '; diff --git a/webclient/js/gui.js b/webclient/js/gui.js index c5bee0d..edd7632 100755 --- a/webclient/js/gui.js +++ b/webclient/js/gui.js @@ -99,7 +99,6 @@ function setSongInfo(data) { function popupTracks(e, listuri, trackuri) { if (!e) var e = window.event; - //console.log('list: ' + listuri + ', track: ' + trackuri); $('#popupTrackName').html(popupData[trackuri].name); $('#popupAlbumName').html(popupData[trackuri].album.name); var child = ""; @@ -120,13 +119,11 @@ function popupTracks(e, listuri, trackuri) { })))); $('#popupArtistsDiv').hide(); - // console.log(child); // $('#popupArtistsLi').html(child).show(); } else { for (var j = 0; j < popupData[trackuri].artists.length; j++) { child += '
  • ' + popupData[trackuri].artists[j].name + '
  • '; } - //console.log(child); $('#popupArtistsLi').hide(); $('#popupArtistsLv').html(child).show(); $('#popupArtistsDiv').show(); @@ -273,7 +270,6 @@ $(document).ready(function() { window.onhashchange = locationHashChanged; // Log all events mopidy.on(function() { - // console.log(arguments); }); //update gui status every x seconds from mopdidy diff --git a/webclient/js/library.js b/webclient/js/library.js index f57e2dd..2bca96e 100644 --- a/webclient/js/library.js +++ b/webclient/js/library.js @@ -114,12 +114,11 @@ function showTracklist(uri) { showLoading(true); var pl = getPlaylistFromUri(uri); - // console.log (pl); //load from cache if (pl) { playlisttotable(pl.tracks, PLAYLIST_TABLE, uri); } - scrollToTop(); + scrollToTracklist(); //lookup recent tracklist mopidy.playlists.lookup(uri).then(processGetTracklist, console.error); return false; diff --git a/webclient/js/process_ws.js b/webclient/js/process_ws.js index 833653d..22796c2 100755 --- a/webclient/js/process_ws.js +++ b/webclient/js/process_ws.js @@ -41,14 +41,12 @@ function processRandom(data) { function processCurrentposition(data) { var pos = parseInt(data); setPosition(pos); - // console.log('pos:' + pos); } /******************************************************** * process results playstate *********************************************************/ function processPlaystate(data) { - // console.log(data); if (data == 'playing') { setPlayState(true); resumeTimer(); @@ -86,13 +84,12 @@ function processGetPlaylists(resultArr) { function processGetTracklist(resultArr) { //cache result var newplaylisturi = resultArr.uri; - //console.log(newplaylisturi); playlists[newplaylisturi] = resultArr; resultsToTables(playlists[newplaylisturi].tracks, PLAYLIST_TABLE, newplaylisturi); // playlisttotable(playlists[newplaylisturi].tracks, PLAYLIST_TABLE, newplaylisturi); // $('#playlistloader').hide(); showLoading(false); - scrollToTop(); + scrollToTracklist(); } /********************************************************