From 6356da52f2f62bc877140d25a0a4d39627c5de81 Mon Sep 17 00:00:00 2001 From: Florrie Date: Sat, 8 Jun 2019 15:17:35 -0300 Subject: Queue after selected song --- ui.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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) -- cgit 1.3.0-6-gf8a5