From 0f1197138e3aae2d9cc25f3f1d3c6c3d7a235422 Mon Sep 17 00:00:00 2001 From: Florrie Date: Tue, 15 Oct 2019 18:13:40 -0300 Subject: Open JSON playlist files in new tab --- ui.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'ui.js') diff --git a/ui.js b/ui.js index f334a70..368c8ea 100644 --- a/ui.js +++ b/ui.js @@ -223,7 +223,7 @@ class AppElement extends FocusElement { this.queueTimeLabel = new Label('') this.paneRight.addChild(this.queueTimeLabel) - this.queueListingElement.on('open', item => this.openThroughSystem(item)) + this.queueListingElement.on('open', item => this.openSpecialOrThroughSystem(item)) this.queueListingElement.on('queue', item => this.play(item)) this.queueListingElement.on('remove', item => this.unqueue(item)) this.queueListingElement.on('shuffle', () => this.shuffleQueue()) @@ -581,7 +581,7 @@ class AppElement extends FocusElement { grouplikeListing.on('browse', item => grouplikeListing.loadGrouplike(item)) grouplikeListing.on('download', item => this.SQP.download(item)) - grouplikeListing.on('open', item => this.openThroughSystem(item)) + grouplikeListing.on('open', item => this.openSpecialOrThroughSystem(item)) grouplikeListing.on('queue', (item, opts) => this.handleQueueOptions(item, opts)) const updateListingsFor = item => { @@ -797,6 +797,14 @@ class AppElement extends FocusElement { } } + openSpecialOrThroughSystem(item) { + if (item.url.endsWith('.json')) { + return this.handlePlaylistSource(item.url, true) + } else { + return this.openThroughSystem(item) + } + } + openThroughSystem(item) { if (!isOpenable(item)) { return @@ -916,6 +924,7 @@ class AppElement extends FocusElement { canControlQueue && isPlayable(item) && {label: 'Remove from queue', action: () => this.unqueue(item)}, {divider: true}, + isOpenable(item) && item.url.endsWith('.json') && {label: 'Open (JSON Playlist)', action: () => this.openSpecialOrThroughSystem(item)}, isOpenable(item) && {label: 'Open (System)', action: () => this.openThroughSystem(item)}, {divider: true}, -- cgit 1.3.0-6-gf8a5