From 042c0248a013e51d1f3eb1bd65a78320d73bede6 Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Thu, 3 Dec 2020 01:12:52 -0500 Subject: [PATCH 1/2] Add item path to card data to support canPlay check --- src/components/cardbuilder/cardBuilder.js | 3 ++- src/components/shortcuts.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/cardbuilder/cardBuilder.js b/src/components/cardbuilder/cardBuilder.js index 4095bea48f..f05bf7a29e 100644 --- a/src/components/cardbuilder/cardBuilder.js +++ b/src/components/cardbuilder/cardBuilder.js @@ -1418,6 +1418,7 @@ import ServerConnections from '../ServerConnections'; const mediaTypeData = item.MediaType ? (' data-mediatype="' + item.MediaType + '"') : ''; const collectionTypeData = item.CollectionType ? (' data-collectiontype="' + item.CollectionType + '"') : ''; const channelIdData = item.ChannelId ? (' data-channelid="' + item.ChannelId + '"') : ''; + const pathData = item.Path ? (' data-path="' + item.Path + '"') : ''; const contextData = options.context ? (' data-context="' + options.context + '"') : ''; const parentIdData = options.parentId ? (' data-parentid="' + options.parentId + '"') : ''; @@ -1427,7 +1428,7 @@ import ServerConnections from '../ServerConnections'; additionalCardContent += getHoverMenuHtml(item, action, options); } - return '<' + tagName + ' data-index="' + index + '"' + timerAttributes + actionAttribute + ' data-isfolder="' + (item.IsFolder || false) + '" data-serverid="' + (item.ServerId || options.serverId) + '" data-id="' + (item.Id || item.ItemId) + '" data-type="' + item.Type + '"' + mediaTypeData + collectionTypeData + channelIdData + positionTicksData + collectionIdData + playlistIdData + contextData + parentIdData + ' data-prefix="' + prefix + '" class="' + className + '">' + cardImageContainerOpen + innerCardFooter + cardImageContainerClose + overlayButtons + additionalCardContent + cardScalableClose + outerCardFooter + cardBoxClose + ''; + return '<' + tagName + ' data-index="' + index + '"' + timerAttributes + actionAttribute + ' data-isfolder="' + (item.IsFolder || false) + '" data-serverid="' + (item.ServerId || options.serverId) + '" data-id="' + (item.Id || item.ItemId) + '" data-type="' + item.Type + '"' + mediaTypeData + collectionTypeData + channelIdData + pathData + positionTicksData + collectionIdData + playlistIdData + contextData + parentIdData + ' data-prefix="' + prefix + '" class="' + className + '">' + cardImageContainerOpen + innerCardFooter + cardImageContainerClose + overlayButtons + additionalCardContent + cardScalableClose + outerCardFooter + cardBoxClose + ''; } /** diff --git a/src/components/shortcuts.js b/src/components/shortcuts.js index 978fa15814..90515fc16f 100644 --- a/src/components/shortcuts.js +++ b/src/components/shortcuts.js @@ -145,6 +145,7 @@ import toast from './toast/toast'; SeriesId: card.getAttribute('data-seriesid'), ServerId: card.getAttribute('data-serverid'), MediaType: card.getAttribute('data-mediatype'), + Path: card.getAttribute('data-path'), IsFolder: card.getAttribute('data-isfolder') === 'true', UserData: { PlaybackPositionTicks: parseInt(card.getAttribute('data-positionticks') || '0') From 3e56bf61495fd84b947e93f09c80cd29d82b574b Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Thu, 3 Dec 2020 01:28:01 -0500 Subject: [PATCH 2/2] Remove unused parameter --- src/components/cardbuilder/cardBuilder.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/cardbuilder/cardBuilder.js b/src/components/cardbuilder/cardBuilder.js index f05bf7a29e..7f43db47ff 100644 --- a/src/components/cardbuilder/cardBuilder.js +++ b/src/components/cardbuilder/cardBuilder.js @@ -1425,7 +1425,7 @@ import ServerConnections from '../ServerConnections'; let additionalCardContent = ''; if (layoutManager.desktop && !options.disableHoverMenu) { - additionalCardContent += getHoverMenuHtml(item, action, options); + additionalCardContent += getHoverMenuHtml(item, action); } return '<' + tagName + ' data-index="' + index + '"' + timerAttributes + actionAttribute + ' data-isfolder="' + (item.IsFolder || false) + '" data-serverid="' + (item.ServerId || options.serverId) + '" data-id="' + (item.Id || item.ItemId) + '" data-type="' + item.Type + '"' + mediaTypeData + collectionTypeData + channelIdData + pathData + positionTicksData + collectionIdData + playlistIdData + contextData + parentIdData + ' data-prefix="' + prefix + '" class="' + className + '">' + cardImageContainerOpen + innerCardFooter + cardImageContainerClose + overlayButtons + additionalCardContent + cardScalableClose + outerCardFooter + cardBoxClose + ''; @@ -1435,10 +1435,9 @@ import ServerConnections from '../ServerConnections'; * Generates HTML markup for the card overlay. * @param {object} item - Item used to generate the card overlay. * @param {string} action - Action assigned to the overlay. - * @param {Array} options - Card builder options. * @returns {string} HTML markup of the card overlay. */ - function getHoverMenuHtml(item, action, options) { + function getHoverMenuHtml(item, action) { let html = ''; html += '
';