From 4fe6bb5b42827b41460815f266c1857d062d1f20 Mon Sep 17 00:00:00 2001 From: robert-hamilton36 Date: Mon, 27 Mar 2023 09:36:09 +1300 Subject: [PATCH 1/3] Add external startMultiSelect function --- src/components/multiSelect/multiSelect.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/multiSelect/multiSelect.js b/src/components/multiSelect/multiSelect.js index 142a31a5d7..989a421cdb 100644 --- a/src/components/multiSelect/multiSelect.js +++ b/src/components/multiSelect/multiSelect.js @@ -564,3 +564,6 @@ export default function (options) { }; } +export const startMultiSelect = (card) => { + showSelections(card); +}; From 447b6f5582521cbc2d2696f3407bbbc640f45b17 Mon Sep 17 00:00:00 2001 From: robert-hamilton36 Date: Mon, 27 Mar 2023 09:38:32 +1300 Subject: [PATCH 2/3] Add select option --- src/components/itemContextMenu.js | 17 +++++++++++++++++ src/strings/en-us.json | 1 + 2 files changed, 18 insertions(+) diff --git a/src/components/itemContextMenu.js b/src/components/itemContextMenu.js index a90effb336..28dc31226c 100644 --- a/src/components/itemContextMenu.js +++ b/src/components/itemContextMenu.js @@ -1,5 +1,6 @@ import browser from '../scripts/browser'; import { copy } from '../scripts/clipboard'; +import dom from '../scripts/dom'; import globalize from '../scripts/globalize'; import actionsheet from './actionSheet/actionSheet'; import { appHost } from './apphost'; @@ -115,6 +116,16 @@ export function getCommands(options) { } } + // Multiselect is currrently only ran on long clicks of card components + // This disables Select on any context menu not originating from a card i.e songs + if (options.positionTo && (dom.parentWithClass(options.positionTo, 'card') !== null)) { + commands.push({ + name: globalize.translate('Select'), + id: 'multiSelect', + icon: 'library_add_check' + }); + } + if ((item.Type === 'Timer') && user.Policy.EnableLiveTvManagement && options.cancelTimer !== false) { commands.push({ name: globalize.translate('CancelRecording'), @@ -432,6 +443,12 @@ function executeCommand(item, id, options) { itemMediaInfo.show(itemId, serverId).then(getResolveFunction(resolve, id), getResolveFunction(resolve, id)); }); break; + case 'multiSelect': + import('./multiSelect/multiSelect').then(({ startMultiSelect: startMultiSelect }) => { + const card = dom.parentWithClass(options.positionTo, 'card'); + startMultiSelect(card); + }); + break; case 'refresh': refresh(apiClient, item); getResolveFunction(resolve, id)(); diff --git a/src/strings/en-us.json b/src/strings/en-us.json index 44e82f2e5c..e2b39af691 100644 --- a/src/strings/en-us.json +++ b/src/strings/en-us.json @@ -1685,6 +1685,7 @@ "Interview": "Interview", "Scene": "Scene", "Sample": "Sample", + "Select": "Select", "ThemeSong": "Theme Song", "ThemeVideo": "Theme Video", "EnableEnhancedNvdecDecoderHelp": "Experimental NVDEC implementation, do not enable this option unless you encounter decoding errors.", From a83e3b121b0dec3db3c770193a584005c10c9000 Mon Sep 17 00:00:00 2001 From: robert-hamilton36 Date: Mon, 24 Apr 2023 11:44:56 +1200 Subject: [PATCH 3/3] Remove Select option from tvs --- src/components/itemContextMenu.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/itemContextMenu.js b/src/components/itemContextMenu.js index 28dc31226c..1e33d66af7 100644 --- a/src/components/itemContextMenu.js +++ b/src/components/itemContextMenu.js @@ -99,6 +99,16 @@ export function getCommands(options) { } if (!browser.tv) { + // Multiselect is currrently only ran on long clicks of card components + // This disables Select on any context menu not originating from a card i.e songs + if (options.positionTo && (dom.parentWithClass(options.positionTo, 'card') !== null)) { + commands.push({ + name: globalize.translate('Select'), + id: 'multiSelect', + icon: 'library_add_check' + }); + } + if (itemHelper.supportsAddingToCollection(item) && options.EnableCollectionManagement) { commands.push({ name: globalize.translate('AddToCollection'), @@ -116,16 +126,6 @@ export function getCommands(options) { } } - // Multiselect is currrently only ran on long clicks of card components - // This disables Select on any context menu not originating from a card i.e songs - if (options.positionTo && (dom.parentWithClass(options.positionTo, 'card') !== null)) { - commands.push({ - name: globalize.translate('Select'), - id: 'multiSelect', - icon: 'library_add_check' - }); - } - if ((item.Type === 'Timer') && user.Policy.EnableLiveTvManagement && options.cancelTimer !== false) { commands.push({ name: globalize.translate('CancelRecording'),