diff options
Diffstat (limited to 'ui.js')
-rw-r--r-- | ui.js | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/ui.js b/ui.js index 85cefcd..0f20bc5 100644 --- a/ui.js +++ b/ui.js @@ -306,11 +306,12 @@ class AppElement extends FocusElement { this.addChild(this.menuLayer) this.whereControl = new InlineListPickerElement('Where?', [ - {value: 'next-selected', label: 'After selected song'}, + {value: 'after-selected', label: 'After selected song'}, {value: 'next', label: 'After current song'}, {value: 'end', label: 'At end of queue'}, {value: 'distribute-evenly', label: 'Distributed across queue evenly'}, - {value: 'distribute-randomly', label: 'Distributed across queue randomly'} + {value: 'distribute-randomly', label: 'Distributed across queue randomly'}, + {value: 'before-selected', label: 'Before selected song'} ], this.showContextMenu) this.orderControl = new InlineListPickerElement('Order?', [ @@ -1500,12 +1501,20 @@ class AppElement extends FocusElement { item = {name: oldName, items: [item]} } - if (where === 'next' || where === 'next-selected' || where === 'end') { + if (where === 'next' || where === 'after-selected' || where === 'before-selected' || where === 'end') { let afterItem = null if (where === 'next') { afterItem = playingTrack - } else if (where === 'next-selected') { + } else if (where === 'after-selected') { afterItem = this.queueListingElement.currentItem + } else if (where === 'before-selected') { + const { items } = this.SQP.queueGrouplike + const index = items.indexOf(this.queueListingElement.currentItem) + if (index === 0) { + afterItem = 'FRONT' + } else if (index > 0) { + afterItem = items[index - 1] + } } this.SQP.queue(item, afterItem, { |