From 45dd2d663708bc1def07a1af7408c05229323754 Mon Sep 17 00:00:00 2001 From: jcass Date: Fri, 6 Jan 2017 21:19:09 +0200 Subject: [PATCH] Add more options to popup dialog box for inserting tracks in tracklist. --- .../static/css/webclient.css | 11 +++-- mopidy_musicbox_webclient/static/index.html | 47 +++++++----------- .../static/js/controls.js | 48 ++++++++++++------- mopidy_musicbox_webclient/static/mb.appcache | 2 +- 4 files changed, 55 insertions(+), 53 deletions(-) diff --git a/mopidy_musicbox_webclient/static/css/webclient.css b/mopidy_musicbox_webclient/static/css/webclient.css index aa891646..0220b3b6 100644 --- a/mopidy_musicbox_webclient/static/css/webclient.css +++ b/mopidy_musicbox_webclient/static/css/webclient.css @@ -222,13 +222,14 @@ span.hostInfo { font-size: 28px; } -.splitGroupLeft { - float: right; +.ui-block-a-min { + float: left !important; + width: initial !important; } -.splitGroupRight { - float:right; - margin-left: -6px; +.ui-block-b-min { + float:right !important; + width: initial !important; } /*************** diff --git a/mopidy_musicbox_webclient/static/index.html b/mopidy_musicbox_webclient/static/index.html index ec60c880..5aa6eb18 100644 --- a/mopidy_musicbox_webclient/static/index.html +++ b/mopidy_musicbox_webclient/static/index.html @@ -161,7 +161,7 @@

Artists

Play
  • - Insert Track After This One + Insert Track After This One
  • Remove from Queue @@ -181,27 +181,17 @@

    Artists

    -
    -
    -

    Insert a Track to Play Next - -

    - - -
    -
    -
    -
    -

    Add a Track to End of Queue +

    Add a Track to the Queue + +

    + +
    -
    +
    @@ -377,11 +367,14 @@

    Browse

    -
    +

    Play Queue

    -
    -
    +
    +
    + @@ -389,14 +382,6 @@

    Play Queue

    -
    - - -
    @@ -474,7 +459,7 @@

    Streams

    Play a specific stream/track and optionally save it to your favourites. - Insert track after \'' + trackName + '\'') + } + if (typeof songdata.track.uri !== 'undefined' && songdata.track.uri !== '') { + $('#getPlayingBtn').button('enable') + } else { + $('#getPlayingBtn').button('disable') } + + $('#select-add').append('') // PLAY_NEXT + $('#select-add').append('') // ADD_THIS_BOTTOM + $('#select-add').trigger('change') + $('#popupQueue').popup('close') - $('#popupInsertTrack').popup('open') + $('#popupAddTrack').popup('open') + }, + + addTrack: function (trackUri) { + if (parseInt($('#select-add').val()) === ADD_THIS_BOTTOM) { + controls.addTrackToBottom(trackUri) + } else { + controls.insertTrack(trackUri) + } }, insertTrack: function (trackUri) { if (typeof trackUri !== 'undefined' && trackUri !== '') { - var tlid = $('#popupInsertTrack').data('tlid') + var tlid = $('#popupAddTrack').data('tlid') if (typeof tlid !== 'undefined' && tlid !== '') { mopidy.tracklist.index({tlid: parseInt(tlid)}).then(function (index) { controls.playTracks(PLAY_NEXT, mopidy, trackUri, 'undefined', index) @@ -250,17 +271,12 @@ // No tlid provided, insert after current track. controls.playTracks(PLAY_NEXT, mopidy, trackUri, 'undefined') } - $('#popupInsertTrack').popup('close') + $('#popupAddTrack').popup('close') } return false }, - showAddTrackPopup: function () { - $('#addTrackInput').val('') - $('#popupAddTrack').popup('open') - }, - - addTrack: function (trackUri) { + addTrackToBottom: function (trackUri) { if (typeof trackUri !== 'undefined' && trackUri !== '') { controls.playTracks(ADD_THIS_BOTTOM, mopidy, trackUri, 'undefined') $('#popupAddTrack').popup('close') @@ -518,8 +534,8 @@ return false }, - getCurrentlyPlaying: function () { - $('#streamuriinput').val(songdata.track.uri) + getCurrentlyPlaying: function (uriInput, nameInput) { + $('#' + uriInput).val(songdata.track.uri) var name = songdata.track.name if (songdata.track.artists) { var artistStr = artistsToString(songdata.track.artists) @@ -527,7 +543,7 @@ name = artistStr + ' - ' + name } } - $('#streamnameinput').val(name) + $('#' + nameInput).val(name) return true }, diff --git a/mopidy_musicbox_webclient/static/mb.appcache b/mopidy_musicbox_webclient/static/mb.appcache index 08834284..b952b450 100644 --- a/mopidy_musicbox_webclient/static/mb.appcache +++ b/mopidy_musicbox_webclient/static/mb.appcache @@ -1,6 +1,6 @@ CACHE MANIFEST -# 2016-12-11:v2 +# 2017-01-06:v2 NETWORK: *