From c4fdc7792286090c631f29ebac66a813ecba7ddc Mon Sep 17 00:00:00 2001 From: Florrie Date: Sat, 15 Dec 2018 11:50:46 -0400 Subject: Label showing # of items / total items in menu --- ui.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'ui.js') diff --git a/ui.js b/ui.js index c3962d5..c4c0bae 100644 --- a/ui.js +++ b/ui.js @@ -1,7 +1,7 @@ const { getAllCrawlersForArg } = require('./crawlers') const { getDownloaderFor } = require('./downloaders') const { getPlayer } = require('./players') -const { parentSymbol, isGroup, isTrack, getItemPath, getItemPathString, flattenGrouplike, cloneGrouplike } = require('./playlist-utils') +const { parentSymbol, isGroup, isTrack, getItemPath, getItemPathString, flattenGrouplike, countTotalItems, cloneGrouplike } = require('./playlist-utils') const { shuffleArray } = require('./general-util') const processSmartPlaylist = require('./smart-playlist') const UndoManager = require('./undo-manager') @@ -1051,6 +1051,11 @@ class BasicGrouplikeItemElement extends Button { this.emit('pressed') } } + + clicked(button) { + super.clicked(button) + return false + } } class InteractiveGrouplikeItemElement extends BasicGrouplikeItemElement { @@ -1111,6 +1116,14 @@ class InteractiveGrouplikeItemElement extends BasicGrouplikeItemElement { x: this.absLeft, y: this.absTop + 1, items: [ + // A label that just shows some brief information about the item. + this.isGroup && {label: + `("${this.item.name}" -` + + ` ${this.item.items.length} item${this.item.items.length === 1 ? '' : 's'}` + + `, ${countTotalItems(this.item)} total` + + ')'}, + + // The actual controls! editMode && {label: this.isMarked ? 'Unmark' : 'Mark', action: () => this.emit('mark')}, anyMarked && {label: 'Paste (above)', action: () => this.emit('paste', {where: 'above'})}, anyMarked && {label: 'Paste (below)', action: () => this.emit('paste', {where: 'below'})}, -- cgit 1.3.0-6-gf8a5