From af3894b99868e8fabe9e2f0c640184f952e216a2 Mon Sep 17 00:00:00 2001 From: Florrie Date: Mon, 30 Jul 2018 19:21:53 -0300 Subject: Clean up remove event code --- README.md | 2 +- ui.js | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 77886b8..7f6a10c 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ playlist.json file (usually generated by http-music or downloaded from online). * **In the queue listing:** * s - shuffle the queue * c - clear the queue - * Backspace - remove the selected track from the queue + * x - remove the selected track from the queue * **In path displays:** (Path displays are the things that show below the main and queue listings. They show the path of groups to the selected item in the listing.) * Enter or Space - view the selected item in the main listing * Left and Right - navigate the path display diff --git a/ui.js b/ui.js index 5302c7c..1c673a5 100644 --- a/ui.js +++ b/ui.js @@ -62,8 +62,7 @@ class AppElement extends FocusElement { this.form.addInput(this.queueListingElement, false) this.queueListingElement.on('queue', item => this.playGrouplikeItem(item)) - this.queueListingElement.on('remove (backspace)', item => this.unqueueGrouplikeItem(item)) - this.queueListingElement.on('remove (x)', item => this.unqueueGrouplikeItem(item)) + this.queueListingElement.on('remove', item => this.unqueueGrouplikeItem(item)) this.queueListingElement.on('shuffle', () => this.shuffleQueue()) this.queueListingElement.on('clear', () => this.clearQueue()) this.queueListingElement.on('select main listing', @@ -135,7 +134,7 @@ class AppElement extends FocusElement { } } - grouplikeListing.on('remove (x)', item => { + grouplikeListing.on('remove', item => { if (this.editMode) { const parent = item[parentSymbol] const index = parent.items.indexOf(item) @@ -756,7 +755,7 @@ class GrouplikeListingElement extends FocusElement { if (this.grouplike.items.length) { for (const item of this.grouplike.items) { const itemElement = new GrouplikeItemElement(item, this.recordStore) - for (const evtName of ['download', 'remove (backspace)', 'remove (x)', 'mark', 'browse', 'queue', 'menu']) { + for (const evtName of ['download', 'remove', 'mark', 'browse', 'queue', 'menu']) { itemElement.on(evtName, (...data) => this.emit(evtName, item, ...data)) } form.addInput(itemElement) @@ -932,10 +931,8 @@ class GrouplikeItemElement extends Button { } else { this.emit('queue', {where: 'next', play: true}) } - } else if (telc.isBackspace(keyBuf)) { - this.emit('remove (backspace)') } else if (telc.isCaselessLetter(keyBuf, 'x')) { - this.emit('remove (x)') + this.emit('remove') /* } else if (telc.isCaselessLetter(keyBuf, 'm')) { this.emit('mark') -- cgit 1.3.0-6-gf8a5