diff --git a/mopidy_musicbox_webclient/static/css/webclient.css b/mopidy_musicbox_webclient/static/css/webclient.css index e3a1754..dc09c4e 100644 --- a/mopidy_musicbox_webclient/static/css/webclient.css +++ b/mopidy_musicbox_webclient/static/css/webclient.css @@ -14,18 +14,6 @@ ****************************/ @media all and (min-width: 961px) { - /*header*/ - .header-breakpoint.ui-grid-b .ui-block-a { - width: 30%; - } - - .header-breakpoint.ui-grid-b .ui-block-b { - width: 30%; - } - - .header-breakpoint.ui-grid-b .ui-block-c { - width: 30.1%; - } /*playlists*/ .pl-breakpoint.ui-grid-a .ui-block-a { @@ -49,15 +37,15 @@ } #playlisttracksback { - display:none; + display: none; } #playlisttracksdiv { - display:block; + display: block; } #playlistslistdiv { - display:block; + display: block; } /*search*/ @@ -65,81 +53,60 @@ margin-left: .5em; } - .srch-breakpoint.ui-grid-a .ui-block-a, .srch-breakpoint.ui-grid-a .ui-block-b { + .srch-breakpoint.ui-grid-a .ui-block-a, + .srch-breakpoint.ui-grid-a .ui-block-b { width: 49%; } } /* phone landscape */ @media all and (max-width: 960px) { - /*header*/ - .header-breakpoint.ui-grid-b .ui-block-a { - width: 35%; - clear: left; - } - - .header-breakpoint.ui-grid-b .ui-block-b { - display: none; - } - - .header-breakpoint.ui-grid-b .ui-block-c { - width: 33%; - } /*playlists*/ - .pl-breakpoint .ui-block-a, .pl-breakpoint .ui-block-b { + .pl-breakpoint .ui-block-a, + .pl-breakpoint .ui-block-b { width: 100%; - } + } /*search*/ - .srch-breakpoint.ui-grid-a .ui-block-a, .srch-breakpoint.ui-grid-a .ui-block-b { + .srch-breakpoint.ui-grid-a .ui-block-a, + .srch-breakpoint.ui-grid-a .ui-block-b { width: 100%; } #playlisttracksback { - display:block; + display: block; } #playlisttracksdiv { - display:none; + display: none; } #playlistslistdiv { - display:block; + display: block; } - } /***************************** * Side Panel and Navigation * *****************************/ -.mainNav .fa{ +.mainNav .fa { float: right; } -.mainNav .navtxt{ +.mainNav .navtxt { float: left; } -.mainNav .navtxt:after{ +.mainNav .navtxt:after { clear: left; } -.bottom{ - width: 100%; - margin: -15px; - margin-top: 30px; -} - -/**headers and controls**/ -#nextimg, #previmg, #backimg, #controlsimg { - margin-top: 6px; -} - #contentHeadline a { color:white; } +/**headers and controls**/ #headermenubtn { padding-top: 2px; } @@ -170,9 +137,9 @@ /* Increase slider handle by 30%. */ .ui-slider-track.ui-mini .ui-slider-handle { - height: 22px; - width: 22px; - margin: -12px 0 0 -12px; + height: 22px; + width: 22px; + margin: -12px 0 0 -12px; } .ui-slider-input { @@ -196,7 +163,7 @@ /******************** * Pages, content * ********************/ -#page{ +#page { background-color: #fff; } @@ -212,11 +179,16 @@ display: none; } -#currentpane, #searchpane, #albumspane, #artistspane, #streampane { - display: none; +#currentpane, +#searchpane, +#albumspane, +#artistspane, +#streampane { + display: none; } -#artistviewimage, #albumviewcover { +#artistviewimage, +#albumviewcover { float: right; height: 90px; max-width: 90%; @@ -224,7 +196,7 @@ /*** home ***/ #homerows div { - text-align:center; + text-align: center; background-color: #2C3E50; padding: 2px; padding-top: 20px; @@ -256,7 +228,7 @@ .table { padding: 0; - list-style-type:none; + list-style-type: none; } .table li:last-child { @@ -308,7 +280,7 @@ background-position: 4px 51%; } .currenttrack { - background-image: url('../images/icons/play_alt_16x16.png'); + background-image: url('../images/icons/play_alt_16x16.png'); background-repeat: no-repeat; background-color: #eee; background-position: 4px 50%; @@ -333,7 +305,7 @@ * Now Playing area * **********************/ -#nowPlayingFooter{ +#nowPlayingFooter { height: 50px; line-height: 48px; text-align: center; @@ -348,8 +320,8 @@ .footerControls div span { padding-left: 3px; padding-right: 3px; - height: 100%; - vertical-align: middle; + height: 100%; + vertical-align: middle; } .footerControls #btplayNowPlaying { @@ -366,11 +338,15 @@ text-decoration: none; } -.popupArtistName, .popupTrackName, .popupAlbumName, .popupArtistName { +.popupArtistName, +.popupTrackName, +.popupAlbumName, +.popupArtistName { font-style: oblique; } -#controlspopup, #artistpopup, #coverpopup { +#artistpopup, +#coverpopup { max-width: 90%; background: white; padding: 5px; @@ -381,50 +357,44 @@ margin-top: 10px; } -#buttons, #controlspopupimage, #coverpopupimage, #artistpopupimage { +#controlspopupimage, +#coverpopupimage, +#artistpopupimage { display: block; margin-left: auto; margin-right: auto; margin-bottom: 10px; - max-width:90%; - max-height:90%; + max-width: 90%; + max-height: 90%; } -#buttons { - font-size: 24px; - padding-right: 15px; - margin-bottom: 15px; -} - -#popupTracksLv li, #popupQueueLv li { +#popupTracksLv li, +#popupQueueLv li { border-bottom: 1px solid #aaa; } -#popupTracksLv, #popupQueueLv { +#popupTracksLv, +#popupQueueLv { border: 1px solid #aaa; } /*dont hide clear buttons in text input */ .ui-input-clear-hidden { - display:block !important; -} + display: block !important; +} /**************** * Common use * ****************/ #playlistspane { - margin: 0px !important; + margin: 0 !important; } a { text-decoration: none !important; } -.nobreak, .btsquare { - display: inline !important; -} - .pull-right { float: right; font-size: 10px; @@ -437,27 +407,14 @@ a { margin-top: 12px; } -.hidden, #allresultloader, .loader { - display: none; -} - -.breakafter { - margin-right: 15px; -} - -.pright { - display: inline; - margin-top: 4px; - float: right; -} /********************** * Song information * **********************/ -.ui-footer{ +.ui-footer { border: 0px; } -#normalFooter{ +#normalFooter { height: 50px; line-height: 48px; text-align: center; @@ -508,22 +465,14 @@ a { padding: 3px; } -#nowPlayingpane{ +#nowPlayingpane { text-align: center; } /*helper*/ -.hidden{ - display: none; -} -.ui-loader h1{ - color: #efefef; -} -.settingscoll label { - font-size: 120%; - font-weight: bold; - padding-top: 30px; +.ui-loader h1 { + color: #efefef; } /* panel workaround to make it responsive wrap push on wide viewports once open */ @@ -547,32 +496,26 @@ a { } } /*smartphones*/ -@media (max-width: 35em){ - #nowPlayingpane{ - padding: 15px 25px 0px 25px; - max-width:90%; - max-height:90%; +@media (max-width: 35em) { + #nowPlayingpane { + padding: 15px 25px 0 25px; + max-width: 90%; + max-height: 90%; } .nowPlaying-artistInfo { font-size: 12px; } - .nowPlaying-artistInfo h4{ - margin: 0px; - font-weight: normal; - font-size: 12px; - } - - .nowPlaying-artistInfo h3{ - margin: 0px 0px 3px 00px; + .nowPlaying-artistInfo h3 { + margin: 0 0 3px 0; white-space: nowrap; overflow: hidden; } - #controlspopupimage{ - max-width:90%; - max-height:90%; + #controlspopupimage { + max-width: 90%; + max-height: 90%; margin-bottom: 3px; } @@ -605,7 +548,3 @@ input[type=text] { -o-user-select: text; user-select: text; } - -.mediaicon { - float: right; -} \ No newline at end of file diff --git a/mopidy_musicbox_webclient/static/dialog-success.html b/mopidy_musicbox_webclient/static/dialog-success.html index 8e3cbc0..642c995 100644 --- a/mopidy_musicbox_webclient/static/dialog-success.html +++ b/mopidy_musicbox_webclient/static/dialog-success.html @@ -1,6 +1,7 @@ + Success dialog diff --git a/mopidy_musicbox_webclient/static/index.html b/mopidy_musicbox_webclient/static/index.html index 6f7ef8a..d492084 100644 --- a/mopidy_musicbox_webclient/static/index.html +++ b/mopidy_musicbox_webclient/static/index.html @@ -1,6 +1,7 @@ + Musicbox @@ -99,9 +100,9 @@ -
  • +
  • @@ -118,14 +119,14 @@

    - + Album cover
    Close

     

    - + Album artist
    @@ -170,8 +171,7 @@ Show Album
  • - Show Artist + Show Artist
  • @@ -195,8 +195,7 @@ Show Album
  • - Show Artist + Show Artist
  • @@ -280,7 +279,7 @@
    - + Album cover
    @@ -305,8 +304,10 @@
      - -
        +
        + Back +
        +
          @@ -328,7 +329,7 @@
          - + Album cover

          @@ -337,7 +338,7 @@
          - + Album artist

          @@ -350,11 +351,13 @@

          Search for artists, albums, or specific tracks. - + onkeypress="return searchPressed(event.keyCode);" type="text"/> @@ -403,13 +406,13 @@ Get currently playing + onkeypress="return streamPressed(event.keyCode);" type="text"/> + onkeypress="return streamPressed(event.keyCode);" type="text"/> @@ -426,7 +429,7 @@

          -
          +
          Album cover
          diff --git a/mopidy_musicbox_webclient/static/js/controls.js b/mopidy_musicbox_webclient/static/js/controls.js index 496b295..0b4cbe6 100644 --- a/mopidy_musicbox_webclient/static/js/controls.js +++ b/mopidy_musicbox_webclient/static/js/controls.js @@ -93,7 +93,7 @@ function playTrack(action) { mopidy.tracklist.clear().then( mopidy.tracklist.add({'uris': trackUris}).then( function(tlTracks) { - mopidy.playback.play({'tl_track': tlTracks[selected]}) + mopidy.playback.play({'tl_track': tlTracks[selected]}); } ) ); @@ -143,7 +143,7 @@ function playTrackByUri(track_uri, playlist_uri) { mopidy.tracklist.add({'uris': [playlist_uri]}).then(function(tlTracks) { // Can fail for all sorts of reasons. If so, just add individually. - if (tlTracks.length == 0) { + if (tlTracks.length === 0) { var trackUris = getTracksFromUri(playlist_uri, false); mopidy.tracklist.add({'uris': trackUris}).then(findAndPlayTrack); } else { @@ -311,7 +311,7 @@ function setTracklistOption(name, new_value) { } else { $("#"+name+"bt").attr('style', 'color:#66DD33'); } - return new_value + return new_value; } function setRepeat(nwrepeat) { @@ -364,7 +364,7 @@ function doSeekPos(value) { positionChanging = value; mopidy.playback.seek({'time_position': Math.round(value)}).then( function() { positionChanging = null; - });; + }); } } @@ -512,7 +512,7 @@ function addToFavourites(newTracks) { getFavourites().catch(console.error.bind(console)).then(function(favourites) { if (favourites) { if (favourites.tracks) { - Array.prototype.push.apply(favourites.tracks, newTracks) + Array.prototype.push.apply(favourites.tracks, newTracks); } else { favourites.tracks = newTracks; } @@ -535,7 +535,7 @@ function addFavourite(uri, name) { } addToFavourites(newTracks); } else { - if (newTracks.length == 0) { + if (newTracks.length === 0) { console.log('No tracks to add'); } else { console.log('Too many tracks (%d) to add', tracks.length); @@ -568,7 +568,7 @@ function showFavourites() { $.cookie.json = true; if ($.cookie('streamUris')) { - tmp = '' + tmp = ''; } if (favourites.tracks) { var child = ''; diff --git a/mopidy_musicbox_webclient/static/js/functionsvars.js b/mopidy_musicbox_webclient/static/js/functionsvars.js index 011aee5..d0b99fc 100644 --- a/mopidy_musicbox_webclient/static/js/functionsvars.js +++ b/mopidy_musicbox_webclient/static/js/functionsvars.js @@ -128,20 +128,20 @@ function scrollToTracklist() { function getArtist(pl) { for (var i = 0; i < pl.length; i++) { for (var j = 0; j < pl[i].artists.length; j++) { - if (pl[i].artists[j].name != '') { + if (pl[i].artists[j].name !== '') { return pl[i].artists[j].name; } } - }; + } } //A hack to find the first album of a playlist. this is not yet returned by mopidy function getAlbum(pl) { for (var i = 0; i < pl.length; i++) { - if (pl[i].album.name != '') { + if (pl[i].album.name !== '') { return pl[i].album.name; } - }; + } } function artistsToString(artists, max) { @@ -170,7 +170,7 @@ function albumTracksToTable(pl, target, uri) { popupData[pl[i].uri] = pl[i]; liID = targetmin + '-' + pl[i].uri; tmp += renderSongLi(pl[i], liID, uri); - }; + } tmp += ''; $(target).html(tmp); $(target).attr('data', uri); @@ -178,7 +178,7 @@ function albumTracksToTable(pl, target, uri) { function renderSongLi(song, liID, uri) { var name; - if (!song.name || song.name == '') { + if (!song.name || song.name === '') { name = uri.split('/'); name = decodeURI(name[name.length - 1]); } else { @@ -195,7 +195,7 @@ function renderSongLi(song, liID, uri) { function renderQueueSongLi(song, liID, uri, tlid) { var name; - if (!song.name || song.name == '') { + if (!song.name || song.name === '') { name = uri.split('/'); name = decodeURI(name[name.length - 1]); } else { @@ -212,7 +212,7 @@ function renderQueueSongLi(song, liID, uri, tlid) { function resultsToTables(results, target, uri) { if (!results) { - return + return; } var tlids = []; if (target == CURRENT_PLAYLIST_TABLE) { @@ -249,7 +249,7 @@ function resultsToTables(results, target, uri) { results[i].album.name = ''; } //create name if there is no one - if (!results[i].name || results[i].name == '') { + if (!results[i].name || results[i].name === '') { name = results[i].uri.split('/'); results[i].name = decodeURI(name[name.length - 1]) || 'Track ' + String(i); } @@ -269,11 +269,11 @@ function resultsToTables(results, target, uri) { newtlids = []; nextname = ''; } else { - if ((results[i].album.name != nextname) || (nextname == '')) { + if ((results[i].album.name != nextname) || (nextname === '')) { tableid = 'art' + i; //render differently if only one track in the album if (newalbum.length == 1) { - if (i != 0) { + if (i !== 0) { html += '
        •  
        • '; } iconClass = getMediaClass(newalbum[0].uri); @@ -303,7 +303,7 @@ function resultsToTables(results, target, uri) { } } } - if (newalbum[0].album.name != '') { + if (newalbum[0].album.name !== '') { html += ' / '; } html += '' + newalbum[0].album.name + '

          '; @@ -387,7 +387,7 @@ function playlisttotable(pl, target, uri) { child += ''; tmp += child; } - }; + } $(target).html(tmp); $(target).attr('data', uri); @@ -415,7 +415,7 @@ function getUris(tracks) { function getTracksFromUri(uri, full_track_data) { var returnTracksOrUris = function(tracks) { return (full_track_data || false) ? tracks : getUris(tracks); - } + }; if (customTracklists[uri]) { return returnTracksOrUris(customTracklists[uri]); } else if (playlists[uri] && playlists[uri].tracks) { @@ -483,7 +483,7 @@ function showOffline(on) { // from http://dzone.com/snippets/validate-url-regexp function validUri(str) { - var regexp = /^(mms|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/ + var regexp = /^(mms|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/; return regexp.test(str); } diff --git a/mopidy_musicbox_webclient/static/js/gui.js b/mopidy_musicbox_webclient/static/js/gui.js index 84cff3d..0a9ea84 100644 --- a/mopidy_musicbox_webclient/static/js/gui.js +++ b/mopidy_musicbox_webclient/static/js/gui.js @@ -9,9 +9,9 @@ function resetSong() { setPlayState(false); setPosition(0); - var data = new Object; + var data = new Object({}); data.tlid = -1; - data.track = new Object; + data.track = new Object({}); data.track.name = ''; data.track.artists = ''; data.track.length = 0; @@ -80,10 +80,10 @@ function setSongInfo(data) { // console.log(data, songdata); if (!data ) { return; } if (data.tlid == songdata.tlid) { return; } - if (!data.track.name || data.track.name == '') { + if (!data.track.name || data.track.name === '') { var name = data.track.uri.split('/'); data.track.name = decodeURI(name[name.length - 1]); - }; + } updatePlayIcons(data.track.uri, data.tlid); artistshtml = ''; @@ -95,7 +95,7 @@ function setSongInfo(data) { if (rs && rs[1] == data.track.name) { data.track.name = (rs[0] || rs[1]); } - }; + } } songdata = data; @@ -103,7 +103,7 @@ function setSongInfo(data) { setSongTitle(data.track.name, false); songlength = Infinity; - if (!data.track.length || data.track.length == 0) { + if (!data.track.length || data.track.length === 0) { $('#trackslider').next().find('.ui-slider-handle').hide(); $('#trackslider').slider('disable'); // $('#streamnameinput').val(data.track.name); @@ -162,7 +162,7 @@ function closePopups() { function popupTracks(e, listuri, trackuri, tlid) { if (!e) - var e = window.event; + e = window.event; $('.popupTrackName').html(popupData[trackuri].name); $('.popupAlbumName').html(popupData[trackuri].album.name); var child = ""; @@ -191,18 +191,19 @@ function popupTracks(e, listuri, trackuri, tlid) { var hash = document.location.hash.split('?'); var divid = hash[0].substr(1); + var popupName = ''; if (divid == 'current') { $(".addqueue").hide(); - var popupName = '#popupQueue'; + popupName = '#popupQueue'; } else if (divid == 'browse') { $(".addqueue").show(); - var popupName = '#popupBrowse'; + popupName = '#popupBrowse'; } else { $(".addqueue").show(); - var popupName = '#popupTracks'; + popupName = '#popupTracks'; } - if (typeof tlid != 'undefined' && tlid != '') { + if (typeof tlid != 'undefined' && tlid !== '') { $(popupName).data("list", listuri).data("track", trackuri).data("tlid", tlid).popup("open", { x : e.pageX, y : e.pageY @@ -259,15 +260,15 @@ function initSocketevents() { }); mopidy.on("event:volumeChanged", function(data) { - setVolume(data["volume"]); + setVolume(data.volume); }); mopidy.on("event:muteChanged", function(data) { - setMute(data["mute"]); + setMute(data.mute); }); mopidy.on("event:playbackStateChanged", function(data) { - switch (data["new_state"]) { + switch (data.new_state) { case "paused": case "stopped": setPlayState(false); @@ -283,14 +284,14 @@ function initSocketevents() { }); mopidy.on("event:seeked", function(data) { - setPosition(parseInt(data["time_position"])); + setPosition(parseInt(data.time_position)); if (play) { startProgressTimer(); } }); mopidy.on("event:streamTitleChanged", function(data) { - setSongTitle(data["title"], true); + setSongTitle(data.title, true); }); } @@ -331,7 +332,7 @@ function toggleFullscreen() { function isFullscreen() { return (document.fullscreenElement || // alternative standard method - document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement ) // current working methods + document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement ); // current working methods } function switchContent(divid, uri) { @@ -345,8 +346,8 @@ function switchContent(divid, uri) { function setHeadline(site){ site = site.trim(); str = $('.mainNav').find('a[href$='+site+']').text(); - if(str == ""){ - str = site.charAt(0).toUpperCase() + site.slice(1);; + if(str === ""){ + str = site.charAt(0).toUpperCase() + site.slice(1); } $('#contentHeadline').html('' + str + ''); } @@ -365,7 +366,7 @@ function updateStatusOfAll() { mopidy.playback.getTimePosition().then(processCurrentposition, console.error); mopidy.playback.getState().then(processPlaystate, console.error); - updateOptions() + updateOptions(); mopidy.playback.getVolume().then(processVolume, console.error); mopidy.mixer.getMute().then(processMute, console.error); @@ -409,7 +410,7 @@ function locationHashChanged() { case 'search': $('#navsearch a').addClass($.mobile.activeBtnClass); $("#searchinput").focus(); - if (customTracklists['mbw:allresultscache'] == '') { + if (customTracklists['mbw:allresultscache'] === '') { initSearch($('#searchinput').val()); } break; @@ -417,12 +418,12 @@ function locationHashChanged() { $('#navstream a').addClass('ui-state-active ui-state-persist ui-btn-active'); break; case 'artists': - if (uri != '') { + if (uri !== '') { showArtist(uri); } break; case 'albums': - if (uri != '') { + if (uri !== '') { showAlbum(uri); } break; @@ -508,11 +509,13 @@ $(document).ready(function(event) { //navigation temporary, rewrite this! $('#songinfo').click( - function() - {return switchContent('nowPlaying')} ); + function() { + return switchContent('nowPlaying'); + }); $('#controlspopupimage').click( function() { - return switchContent('current')} ); + return switchContent('current'); + }); $('#navToggleFullscreen').click(function(){ toggleFullscreen(); }); diff --git a/mopidy_musicbox_webclient/static/js/images.js b/mopidy_musicbox_webclient/static/js/images.js index c6202ed..652fae3 100644 --- a/mopidy_musicbox_webclient/static/js/images.js +++ b/mopidy_musicbox_webclient/static/js/images.js @@ -72,7 +72,7 @@ function getCoverFromLastFm(track, images, size) { lastfm.album.getInfo( {artist: artistname, album: albumname}, { success: function(data) { for (var i = 0; i < data.album.image.length; i++) { - if ( data.album.image[i]['size'] == size) { + if ( data.album.image[i].size == size) { $(images).attr('src', data.album.image[i]['#text'] || defUrl); } } @@ -84,7 +84,7 @@ function getArtistImage(nwartist, image, size) { var defUrl = 'images/user_24x32.png'; lastfm.artist.getInfo({artist: nwartist}, {success: function(data){ for (var i = 0; i < data.artist.image.length; i++) { - if ( data.artist.image[i]['size'] == size) { + if ( data.artist.image[i].size == size) { $(image).attr('src', data.artist.image[i]['#text'] || defUrl); } } diff --git a/mopidy_musicbox_webclient/static/js/process_ws.js b/mopidy_musicbox_webclient/static/js/process_ws.js index b0277af..d8cfeeb 100644 --- a/mopidy_musicbox_webclient/static/js/process_ws.js +++ b/mopidy_musicbox_webclient/static/js/process_ws.js @@ -76,8 +76,8 @@ function processPlaystate(data) { * process results of a browse list *********************************************************/ function processBrowseDir(resultArr) { - var backHtml = '
        • Back

        • ' - if ( (!resultArr) || (resultArr == '') || (resultArr.length == 0) ) { + var backHtml = '
        • Back

        • '; + if ( (!resultArr) || (resultArr === '') || (resultArr.length === 0) ) { $('#browsepath').html('No tracks found...'); $('#browselist').html(backHtml); showLoading(false); @@ -124,7 +124,7 @@ function processBrowseDir(resultArr) { '' + '

          ' + resultArr[i].name + '

          '; - index++ + index++; } else { if (browseStack.length > 0) { iconClass="fa fa-folder-o"; @@ -152,7 +152,7 @@ function processBrowseDir(resultArr) { * process results of list of playlists of the user *********************************************************/ function processGetPlaylists(resultArr) { - if ((!resultArr) || (resultArr == '')) { + if ((!resultArr) || (resultArr === '')) { $('#playlistslist').empty(); return; } @@ -167,7 +167,7 @@ function processGetPlaylists(resultArr) { } else { tmp = tmp + li_html + ' ' + resultArr[i].name + ''; } - }; + } // Prepend the user's Spotify "Starred" playlist and favourites to the results. (like Spotify official client). tmp = favourites + starred + tmp; $('#playlistslist').html(tmp); @@ -179,12 +179,12 @@ function processGetPlaylists(resultArr) { * process results of a returned list of playlist track refs *********************************************************/ function processPlaylistItems(resultDict) { - if (resultDict.items.length == 0) { + if (resultDict.items.length === 0) { console.log('Playlist', resultDict.uri, 'is empty'); showLoading(false); return; } - var trackUris = [] + var trackUris = []; for (i = 0; i < resultDict.items.length; i++) { trackUris.push(resultDict.items[i].uri); } @@ -198,7 +198,6 @@ function processPlaylistItems(resultDict) { showLoading(false); return playlists[newplaylisturi].tracks; }); - return false; } /******************************************************** @@ -215,7 +214,7 @@ function processCurrentPlaylist(resultArr) { * process results of an artist lookup *********************************************************/ function processArtistResults(resultArr) { - if (!resultArr || (resultArr.length == 0)) { + if (!resultArr || (resultArr.length === 0)) { $('#h_artistname').text('Artist not found...'); getCover('', '#artistviewimage, #artistpopupimage', 'extralarge'); showLoading(false); @@ -234,7 +233,7 @@ function processArtistResults(resultArr) { * process results of an album lookup *********************************************************/ function processAlbumResults(resultArr) { - if (!resultArr || (resultArr.length == 0)) { + if (!resultArr || (resultArr.length === 0)) { $('#h_albumname').text('Album not found...'); getCover('', '#albumviewcover, #coverpopupimage', 'extralarge'); showLoading(false); diff --git a/mopidy_musicbox_webclient/static/js/progress_timer.js b/mopidy_musicbox_webclient/static/js/progress_timer.js index c9239ef..3e97fad 100644 --- a/mopidy_musicbox_webclient/static/js/progress_timer.js +++ b/mopidy_musicbox_webclient/static/js/progress_timer.js @@ -3,8 +3,8 @@ var progressElement = document.getElementById('trackslider'); var positionNode = document.createTextNode(''); var durationNode = document.createTextNode(''); -var START_BEATS = 5 // 0.5 seconds, needs to be less than 1s to prevent unwanted updates. -var RUN_BEATS = 300 // 30 seconds assuming default timer update rate of 100ms +var START_BEATS = 5; // 0.5 seconds, needs to be less than 1s to prevent unwanted updates. +var RUN_BEATS = 300; // 30 seconds assuming default timer update rate of 100ms var callbackHeartbeats = 0; // Timer will check syncs on every n-number of calls. var targetPosition = null; @@ -19,7 +19,7 @@ document.getElementById('songlength').appendChild(durationNode); function timerCallback(position, duration, isRunning) { updateTimers(position, duration, isRunning); - if (callbackHeartbeats == 0) { + if (callbackHeartbeats === 0) { callbackHeartbeats = getHeartbeat(); } @@ -38,7 +38,7 @@ function timerCallback(position, duration, isRunning) { } function updateTimers(position, duration, isRunning) { - var ready = !(duration == Infinity && position == 0 && !isRunning); // Timer has been properly initialized. + var ready = !(duration == Infinity && position === 0 && !isRunning); // Timer has been properly initialized. var streaming = (duration == Infinity && position > 0); // Playing a stream. var ok = synced && isRunning; // Normal operation. var syncing = !synced && isRunning; // Busy syncing. @@ -59,7 +59,7 @@ function updateTimers(position, duration, isRunning) { positionNode.nodeValue = '(sync)'; } } else if (synced || streaming) { - positionNode.nodeValue = format(position);; + positionNode.nodeValue = format(position); } } @@ -71,10 +71,10 @@ function updateTimers(position, duration, isRunning) { } function getHeartbeat() { - if (syncsLeft > 0 && callbackHeartbeats == 0) { + if (syncsLeft > 0 && callbackHeartbeats === 0) { // Step back exponentially while increasing heartbeat. return Math.round(delay_exponential(5, 2, MAX_SYNCS - syncsLeft)); - } else if (syncsLeft == 0 && callbackHeartbeats == 0) { + } else if (syncsLeft === 0 && callbackHeartbeats === 0) { // Sync completed, keep checking using maximum number of heartbeats. return RUN_BEATS; } else { @@ -111,7 +111,7 @@ function toInt(value) { function format(milliseconds) { if (milliseconds === Infinity) { return '(n/a)'; - } else if (milliseconds == 0) { + } else if (milliseconds === 0) { return '0:00'; } diff --git a/mopidy_musicbox_webclient/static/mb.appcache b/mopidy_musicbox_webclient/static/mb.appcache index a5d061f..0b24062 100644 --- a/mopidy_musicbox_webclient/static/mb.appcache +++ b/mopidy_musicbox_webclient/static/mb.appcache @@ -1,6 +1,6 @@ CACHE MANIFEST -# 2016-02-28:v1 +# 2016-02-29:v1 NETWORK: * diff --git a/mopidy_musicbox_webclient/static/system.html b/mopidy_musicbox_webclient/static/system.html index fbb9f9c..a252a6e 100644 --- a/mopidy_musicbox_webclient/static/system.html +++ b/mopidy_musicbox_webclient/static/system.html @@ -1,6 +1,7 @@ + System