diff options
author | Florrie <towerofnix@gmail.com> | 2019-06-08 15:17:35 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2019-06-08 15:17:35 -0300 |
commit | 6356da52f2f62bc877140d25a0a4d39627c5de81 (patch) | |
tree | d1363dc3c38ca3f31a75e8f8e77029b1ecfacd12 | |
parent | fb8f3703b183037140c57b7e1d1f6f265778c5d4 (diff) |
Queue after selected song
-rw-r--r-- | ui.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ui.js b/ui.js index e837256..7056506 100644 --- a/ui.js +++ b/ui.js @@ -206,6 +206,7 @@ class AppElement extends FocusElement { this.whereControl = new InlineListPickerElement('Where?', [ {value: 'next', label: 'After current song'}, + {value: 'next-selected', label: 'After selected song'}, {value: 'end', label: 'At end of queue'}, {value: 'distribute-evenly', label: 'Distributed across queue evenly'}, {value: 'distribute-randomly', label: 'Distributed across queue randomly'} @@ -769,6 +770,8 @@ class AppElement extends FocusElement { // just directly moved from the old event listener on grouplikeListings for // 'queue'. handleQueueOptions(item, {where = 'end', order = 'normal', play = false, skip = false} = {}) { + const passedItem = item + if (skip && this.playingTrack === item) { this.playNextTrack(this.playingTrack) } @@ -784,15 +787,21 @@ class AppElement extends FocusElement { item = {items: [item]} } - if (where === 'next' || where === 'end') { + if (where === 'next' || where === 'next-selected' || where === 'end') { let afterItem = null if (where === 'next') { afterItem = this.playingTrack + } else if (where === 'next-selected') { + afterItem = this.queueListingElement.currentItem } this.queueGrouplikeItem(item, afterItem, { movePlayingTrack: order === 'normal' }) + + if (isTrack(passedItem)) { + this.queueListingElement.selectAndShow(passedItem) + } } else if (where.startsWith('distribute-')) { this.distributeQueueGrouplikeItem(item, { how: where.slice('distribute-'.length) |