2020-06-09 22:46:51 +03:00
|
|
|
/* eslint-disable indent */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Module for display list view.
|
|
|
|
* @module components/listview/listview
|
|
|
|
*/
|
|
|
|
|
2022-01-30 00:27:26 +03:00
|
|
|
import escapeHtml from 'escape-html';
|
2020-08-14 08:46:34 +02:00
|
|
|
import itemHelper from '../itemHelper';
|
|
|
|
import mediaInfo from '../mediainfo/mediainfo';
|
|
|
|
import indicators from '../indicators/indicators';
|
|
|
|
import layoutManager from '../layoutManager';
|
|
|
|
import globalize from '../../scripts/globalize';
|
|
|
|
import datetime from '../../scripts/datetime';
|
|
|
|
import cardBuilder from '../cardbuilder/cardBuilder';
|
2021-01-26 16:25:38 -05:00
|
|
|
import './listview.scss';
|
2020-08-14 08:46:34 +02:00
|
|
|
import '../../elements/emby-ratingbutton/emby-ratingbutton';
|
|
|
|
import '../../elements/emby-playstatebutton/emby-playstatebutton';
|
2020-10-17 19:08:56 +01:00
|
|
|
import ServerConnections from '../ServerConnections';
|
2018-10-23 01:05:09 +03:00
|
|
|
|
|
|
|
function getIndex(item, options) {
|
2019-01-10 15:39:37 +03:00
|
|
|
if (options.index === 'disc') {
|
2019-02-03 02:41:16 +09:00
|
|
|
return item.ParentIndexNumber == null ? '' : globalize.translate('ValueDiscNumber', item.ParentIndexNumber);
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
const sortBy = (options.sortBy || '').toLowerCase();
|
|
|
|
let code;
|
|
|
|
let name;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
if (sortBy.indexOf('sortname') === 0) {
|
|
|
|
if (item.Type === 'Episode') {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
// SortName
|
|
|
|
name = (item.SortName || item.Name || '?')[0].toUpperCase();
|
|
|
|
|
|
|
|
code = name.charCodeAt(0);
|
|
|
|
if (code < 65 || code > 90) {
|
|
|
|
return '#';
|
|
|
|
}
|
|
|
|
|
|
|
|
return name.toUpperCase();
|
|
|
|
}
|
|
|
|
if (sortBy.indexOf('officialrating') === 0) {
|
2019-02-03 02:41:16 +09:00
|
|
|
return item.OfficialRating || globalize.translate('Unrated');
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
if (sortBy.indexOf('communityrating') === 0) {
|
|
|
|
if (item.CommunityRating == null) {
|
2019-02-03 02:41:16 +09:00
|
|
|
return globalize.translate('Unrated');
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return Math.floor(item.CommunityRating);
|
|
|
|
}
|
|
|
|
if (sortBy.indexOf('criticrating') === 0) {
|
|
|
|
if (item.CriticRating == null) {
|
2019-02-03 02:41:16 +09:00
|
|
|
return globalize.translate('Unrated');
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return Math.floor(item.CriticRating);
|
|
|
|
}
|
|
|
|
if (sortBy.indexOf('albumartist') === 0) {
|
|
|
|
// SortName
|
|
|
|
if (!item.AlbumArtist) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
name = item.AlbumArtist[0].toUpperCase();
|
|
|
|
|
|
|
|
code = name.charCodeAt(0);
|
|
|
|
if (code < 65 || code > 90) {
|
|
|
|
return '#';
|
|
|
|
}
|
|
|
|
|
|
|
|
return name.toUpperCase();
|
|
|
|
}
|
|
|
|
return '';
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2021-03-17 22:43:52 +01:00
|
|
|
function getImageUrl(item, size) {
|
2020-10-17 19:08:56 +01:00
|
|
|
const apiClient = ServerConnections.getApiClient(item.ServerId);
|
2020-05-26 13:00:26 +02:00
|
|
|
let itemId;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
const options = {
|
2021-03-17 22:43:52 +01:00
|
|
|
fillWidth: size,
|
|
|
|
fillHeight: size,
|
2020-05-04 12:44:12 +02:00
|
|
|
type: 'Primary'
|
2019-01-10 15:39:37 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
if (item.ImageTags && item.ImageTags.Primary) {
|
|
|
|
options.tag = item.ImageTags.Primary;
|
2020-05-26 13:00:26 +02:00
|
|
|
itemId = item.Id;
|
2020-06-10 10:52:33 +02:00
|
|
|
} else if (item.AlbumId && item.AlbumPrimaryImageTag) {
|
|
|
|
options.tag = item.AlbumPrimaryImageTag;
|
|
|
|
itemId = item.AlbumId;
|
|
|
|
} else if (item.SeriesId && item.SeriesPrimaryImageTag) {
|
|
|
|
options.tag = item.SeriesPrimaryImageTag;
|
|
|
|
itemId = item.SeriesId;
|
|
|
|
} else if (item.ParentPrimaryImageTag) {
|
|
|
|
options.tag = item.ParentPrimaryImageTag;
|
|
|
|
itemId = item.ParentPrimaryImageItemId;
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
2020-06-09 00:58:55 +02:00
|
|
|
|
2020-06-02 17:59:08 +02:00
|
|
|
if (itemId) {
|
2020-07-03 17:21:53 +02:00
|
|
|
return apiClient.getScaledImageUrl(itemId, options);
|
2020-06-02 17:59:08 +02:00
|
|
|
}
|
2020-06-09 00:48:56 +02:00
|
|
|
return null;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2021-03-17 22:43:52 +01:00
|
|
|
function getChannelImageUrl(item, size) {
|
2020-10-17 19:08:56 +01:00
|
|
|
const apiClient = ServerConnections.getApiClient(item.ServerId);
|
2020-06-09 22:46:51 +03:00
|
|
|
const options = {
|
2021-03-17 22:43:52 +01:00
|
|
|
fillWidth: size,
|
|
|
|
fillHeight: size,
|
2020-05-04 12:44:12 +02:00
|
|
|
type: 'Primary'
|
2019-01-10 15:39:37 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
if (item.ChannelId && item.ChannelPrimaryImageTag) {
|
|
|
|
options.tag = item.ChannelPrimaryImageTag;
|
|
|
|
}
|
|
|
|
|
2020-06-02 17:59:08 +02:00
|
|
|
if (item.ChannelId) {
|
2020-07-03 17:21:53 +02:00
|
|
|
return apiClient.getScaledImageUrl(item.ChannelId, options);
|
2020-06-02 17:59:08 +02:00
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function getTextLinesHtml(textlines, isLargeStyle) {
|
2020-06-09 22:46:51 +03:00
|
|
|
let html = '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
const largeTitleTagName = layoutManager.tv ? 'h2' : 'div';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2020-06-20 21:06:00 +02:00
|
|
|
for (const [i, text] of textlines.entries()) {
|
2019-01-10 15:39:37 +03:00
|
|
|
if (!text) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2021-11-10 14:06:53 -05:00
|
|
|
let elem;
|
|
|
|
|
2019-01-10 15:39:37 +03:00
|
|
|
if (i === 0) {
|
|
|
|
if (isLargeStyle) {
|
2021-11-10 14:06:53 -05:00
|
|
|
elem = document.createElement(largeTitleTagName);
|
2019-01-10 15:39:37 +03:00
|
|
|
} else {
|
2021-11-10 14:06:53 -05:00
|
|
|
elem = document.createElement('div');
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
} else {
|
2021-11-10 14:06:53 -05:00
|
|
|
elem = document.createElement('div');
|
|
|
|
elem.classList.add('secondary');
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
2021-11-10 14:06:53 -05:00
|
|
|
|
|
|
|
elem.classList.add('listItemBodyText');
|
|
|
|
|
2022-10-16 00:06:54 +03:00
|
|
|
elem.innerHTML = '<bdi>' + escapeHtml(text) + '</bdi>';
|
2021-11-10 14:06:53 -05:00
|
|
|
|
|
|
|
html += elem.outerHTML;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
return html;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function getRightButtonsHtml(options) {
|
2020-06-09 22:46:51 +03:00
|
|
|
let html = '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
for (let i = 0, length = options.rightButtons.length; i < length; i++) {
|
|
|
|
const button = options.rightButtons[i];
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2022-02-24 20:15:24 +03:00
|
|
|
html += `<button is="paper-icon-button-light" class="listItemButton itemAction" data-action="custom" data-customaction="${button.id}" title="${button.title}"><span class="material-icons ${button.icon}" aria-hidden="true"></span></button>`;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
return html;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
export function getListViewHtml(options) {
|
|
|
|
const items = options.items;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
let groupTitle = '';
|
|
|
|
const action = options.action || 'link';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
const isLargeStyle = options.imageSize === 'large';
|
|
|
|
const enableOverview = options.enableOverview;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
const clickEntireItem = layoutManager.tv ? true : false;
|
|
|
|
const outerTagName = clickEntireItem ? 'button' : 'div';
|
|
|
|
const enableSideMediaInfo = options.enableSideMediaInfo != null ? options.enableSideMediaInfo : true;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
let outerHtml = '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
const enableContentWrapper = options.enableOverview && !layoutManager.tv;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
for (let i = 0, length = items.length; i < length; i++) {
|
|
|
|
const item = items[i];
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
let html = '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
if (options.showIndex) {
|
2020-06-09 22:46:51 +03:00
|
|
|
const itemGroupTitle = getIndex(item, options);
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
if (itemGroupTitle !== groupTitle) {
|
|
|
|
if (html) {
|
|
|
|
html += '</div>';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i === 0) {
|
|
|
|
html += '<h2 class="listGroupHeader listGroupHeader-first">';
|
2019-11-23 00:29:38 +09:00
|
|
|
} else {
|
2019-01-10 15:39:37 +03:00
|
|
|
html += '<h2 class="listGroupHeader">';
|
|
|
|
}
|
2022-01-30 00:27:26 +03:00
|
|
|
html += escapeHtml(itemGroupTitle);
|
2019-01-10 15:39:37 +03:00
|
|
|
html += '</h2>';
|
|
|
|
|
|
|
|
html += '<div>';
|
|
|
|
|
|
|
|
groupTitle = itemGroupTitle;
|
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
let cssClass = 'listItem';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
if (options.border || (options.highlight !== false && !layoutManager.tv)) {
|
|
|
|
cssClass += ' listItem-border';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (clickEntireItem) {
|
|
|
|
cssClass += ' itemAction listItem-button';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (layoutManager.tv) {
|
|
|
|
cssClass += ' listItem-focusscale';
|
|
|
|
}
|
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
let downloadWidth = 80;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
if (isLargeStyle) {
|
2020-05-04 12:44:12 +02:00
|
|
|
cssClass += ' listItem-largeImage';
|
2019-01-10 15:39:37 +03:00
|
|
|
downloadWidth = 500;
|
|
|
|
}
|
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
const playlistItemId = item.PlaylistItemId ? (` data-playlistitemid="${item.PlaylistItemId}"`) : '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
const positionTicksData = item.UserData && item.UserData.PlaybackPositionTicks ? (` data-positionticks="${item.UserData.PlaybackPositionTicks}"`) : '';
|
|
|
|
const collectionIdData = options.collectionId ? (` data-collectionid="${options.collectionId}"`) : '';
|
|
|
|
const playlistIdData = options.playlistId ? (` data-playlistid="${options.playlistId}"`) : '';
|
|
|
|
const mediaTypeData = item.MediaType ? (` data-mediatype="${item.MediaType}"`) : '';
|
|
|
|
const collectionTypeData = item.CollectionType ? (` data-collectiontype="${item.CollectionType}"`) : '';
|
|
|
|
const channelIdData = item.ChannelId ? (` data-channelid="${item.ChannelId}"`) : '';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
if (enableContentWrapper) {
|
|
|
|
cssClass += ' listItem-withContentWrapper';
|
|
|
|
}
|
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
html += `<${outerTagName} class="${cssClass}"${playlistItemId} data-action="${action}" data-isfolder="${item.IsFolder}" data-id="${item.Id}" data-serverid="${item.ServerId}" data-type="${item.Type}"${mediaTypeData}${collectionTypeData}${channelIdData}${positionTicksData}${collectionIdData}${playlistIdData}>`;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
if (enableContentWrapper) {
|
|
|
|
html += '<div class="listItem-content">';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!clickEntireItem && options.dragHandle) {
|
2022-02-24 20:15:24 +03:00
|
|
|
html += '<span class="listViewDragHandle material-icons listItemIcon listItemIcon-transparent drag_handle" aria-hidden="true"></span>';
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (options.image !== false) {
|
2020-10-07 21:12:14 +09:00
|
|
|
const imgUrl = options.imageSource === 'channel' ? getChannelImageUrl(item, downloadWidth) : getImageUrl(item, downloadWidth);
|
|
|
|
let imageClass = isLargeStyle ? 'listItemImage listItemImage-large' : 'listItemImage';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2022-11-21 17:45:56 -06:00
|
|
|
if (options.imageSource === 'channel') {
|
|
|
|
imageClass += ' listItemImage-channel';
|
|
|
|
}
|
|
|
|
|
2019-01-10 15:39:37 +03:00
|
|
|
if (isLargeStyle && layoutManager.tv) {
|
|
|
|
imageClass += ' listItemImage-large-tv';
|
|
|
|
}
|
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
const playOnImageClick = options.imagePlayButton && !layoutManager.tv;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
if (!clickEntireItem) {
|
|
|
|
imageClass += ' itemAction';
|
|
|
|
}
|
|
|
|
|
2020-07-24 10:43:03 +02:00
|
|
|
const imageAction = playOnImageClick ? 'link' : action;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2020-06-22 17:37:06 +02:00
|
|
|
if (imgUrl) {
|
2020-07-03 17:21:53 +02:00
|
|
|
html += '<div data-action="' + imageAction + '" class="' + imageClass + ' lazy" data-src="' + imgUrl + '" item-icon>';
|
2020-06-22 17:37:06 +02:00
|
|
|
} else {
|
|
|
|
html += '<div class="' + imageClass + ' cardImageContainer ' + cardBuilder.getDefaultBackgroundClass(item.Name) + '">' + cardBuilder.getDefaultText(item, options);
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
|
2022-01-20 15:58:14 -06:00
|
|
|
const mediaSourceCount = item.MediaSourceCount || 1;
|
|
|
|
if (mediaSourceCount > 1 && options.disableIndicators !== true) {
|
|
|
|
html += '<div class="mediaSourceIndicator">' + mediaSourceCount + '</div>';
|
|
|
|
}
|
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
let indicatorsHtml = '';
|
2019-01-10 15:39:37 +03:00
|
|
|
indicatorsHtml += indicators.getPlayedIndicatorHtml(item);
|
|
|
|
|
|
|
|
if (indicatorsHtml) {
|
2020-06-09 22:46:51 +03:00
|
|
|
html += `<div class="indicators listItemIndicators">${indicatorsHtml}</div>`;
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (playOnImageClick) {
|
2022-02-24 20:15:24 +03:00
|
|
|
html += '<button is="paper-icon-button-light" class="listItemImageButton itemAction" data-action="resume"><span class="material-icons listItemImageButton-icon play_arrow" aria-hidden="true"></span></button>';
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
const progressHtml = indicators.getProgressBarHtml(item, {
|
2019-01-10 15:39:37 +03:00
|
|
|
containerClass: 'listItemProgressBar'
|
2018-10-23 01:05:09 +03:00
|
|
|
});
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
if (progressHtml) {
|
|
|
|
html += progressHtml;
|
|
|
|
}
|
|
|
|
html += '</div>';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (options.showIndexNumberLeft) {
|
|
|
|
html += '<div class="listItem-indexnumberleft">';
|
|
|
|
html += (item.IndexNumber || ' ');
|
|
|
|
html += '</div>';
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
const textlines = [];
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
if (options.showProgramDateTime) {
|
|
|
|
textlines.push(datetime.toLocaleString(datetime.parseISO8601Date(item.StartDate), {
|
|
|
|
|
|
|
|
weekday: 'long',
|
|
|
|
month: 'short',
|
|
|
|
day: 'numeric',
|
|
|
|
hour: 'numeric',
|
|
|
|
minute: '2-digit'
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (options.showProgramTime) {
|
|
|
|
textlines.push(datetime.getDisplayTime(datetime.parseISO8601Date(item.StartDate)));
|
|
|
|
}
|
|
|
|
|
2022-10-03 14:22:02 -04:00
|
|
|
if (options.showChannel && item.ChannelName) {
|
|
|
|
textlines.push(item.ChannelName);
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
let parentTitle = null;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
if (options.showParentTitle) {
|
|
|
|
if (item.Type === 'Episode') {
|
|
|
|
parentTitle = item.SeriesName;
|
2019-11-23 00:29:38 +09:00
|
|
|
} else if (item.IsSeries || (item.EpisodeTitle && item.Name)) {
|
2019-01-10 15:39:37 +03:00
|
|
|
parentTitle = item.Name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
let displayName = itemHelper.getDisplayName(item, {
|
2018-10-23 01:05:09 +03:00
|
|
|
includeParentInfo: options.includeParentInfoInTitle
|
|
|
|
});
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
if (options.showIndexNumber && item.IndexNumber != null) {
|
2020-06-09 22:46:51 +03:00
|
|
|
displayName = `${item.IndexNumber}. ${displayName}`;
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (options.showParentTitle && options.parentTitleWithTitle) {
|
|
|
|
if (displayName) {
|
|
|
|
if (parentTitle) {
|
|
|
|
parentTitle += ' - ';
|
|
|
|
}
|
|
|
|
parentTitle = (parentTitle || '') + displayName;
|
|
|
|
}
|
|
|
|
|
|
|
|
textlines.push(parentTitle || '');
|
2019-11-23 00:29:38 +09:00
|
|
|
} else if (options.showParentTitle) {
|
2019-01-10 15:39:37 +03:00
|
|
|
textlines.push(parentTitle || '');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (displayName && !options.parentTitleWithTitle) {
|
|
|
|
textlines.push(displayName);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (item.IsFolder) {
|
2022-10-03 14:22:02 -04:00
|
|
|
if (options.artist !== false && item.AlbumArtist && item.Type === 'MusicAlbum') {
|
2019-01-10 15:39:37 +03:00
|
|
|
textlines.push(item.AlbumArtist);
|
|
|
|
}
|
|
|
|
} else {
|
2020-05-26 22:58:27 +02:00
|
|
|
if (options.artist) {
|
|
|
|
const artistItems = item.ArtistItems;
|
2019-01-10 15:39:37 +03:00
|
|
|
if (artistItems && item.Type !== 'MusicAlbum') {
|
2020-06-09 22:46:51 +03:00
|
|
|
textlines.push(artistItems.map(a => {
|
2019-01-10 15:39:37 +03:00
|
|
|
return a.Name;
|
|
|
|
}).join(', '));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-03 14:22:02 -04:00
|
|
|
if (item.Type === 'TvChannel' && item.CurrentProgram) {
|
|
|
|
textlines.push(itemHelper.getDisplayName(item.CurrentProgram));
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
cssClass = 'listItemBody';
|
|
|
|
if (!clickEntireItem) {
|
|
|
|
cssClass += ' itemAction';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (options.image === false) {
|
|
|
|
cssClass += ' listItemBody-noleftpadding';
|
|
|
|
}
|
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
html += `<div class="${cssClass}">`;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
html += getTextLinesHtml(textlines, isLargeStyle);
|
|
|
|
|
2022-10-03 14:22:02 -04:00
|
|
|
if (options.mediaInfo !== false && !enableSideMediaInfo) {
|
|
|
|
const mediaInfoClass = 'secondary listItemMediaInfo listItemBodyText';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2022-10-03 14:22:02 -04:00
|
|
|
html += `<div class="${mediaInfoClass}">`;
|
|
|
|
html += mediaInfo.getPrimaryMediaInfoHtml(item, {
|
|
|
|
episodeTitle: false,
|
|
|
|
originalAirDate: false,
|
|
|
|
subtitles: false
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2022-10-03 14:22:02 -04:00
|
|
|
});
|
|
|
|
html += '</div>';
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (enableOverview && item.Overview) {
|
|
|
|
html += '<div class="secondary listItem-overview listItemBodyText">';
|
2022-07-04 11:56:38 -04:00
|
|
|
html += '<bdi>' + item.Overview + '</bdi>';
|
2019-01-10 15:39:37 +03:00
|
|
|
html += '</div>';
|
|
|
|
}
|
|
|
|
|
|
|
|
html += '</div>';
|
|
|
|
|
2022-10-03 14:22:02 -04:00
|
|
|
if (options.mediaInfo !== false && enableSideMediaInfo) {
|
|
|
|
html += '<div class="secondary listItemMediaInfo">';
|
|
|
|
html += mediaInfo.getPrimaryMediaInfoHtml(item, {
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2022-10-03 14:22:02 -04:00
|
|
|
year: false,
|
|
|
|
container: false,
|
|
|
|
episodeTitle: false,
|
|
|
|
criticRating: false,
|
2022-11-21 17:45:56 -06:00
|
|
|
officialRating: false,
|
2022-10-03 14:22:02 -04:00
|
|
|
endsAt: false
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2022-10-03 14:22:02 -04:00
|
|
|
});
|
|
|
|
html += '</div>';
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!options.recordButton && (item.Type === 'Timer' || item.Type === 'Program')) {
|
|
|
|
html += indicators.getTimerIndicator(item).replace('indicatorIcon', 'indicatorIcon listItemAside');
|
|
|
|
}
|
2020-01-17 18:37:12 +03:00
|
|
|
|
2020-01-17 19:26:19 +03:00
|
|
|
html += '<div class="listViewUserDataButtons">';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
if (!clickEntireItem) {
|
|
|
|
if (options.addToListButton) {
|
2022-02-24 20:15:24 +03:00
|
|
|
html += '<button is="paper-icon-button-light" class="listItemButton itemAction" data-action="addtoplaylist"><span class="material-icons playlist_add" aria-hidden="true"></span></button>';
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (options.infoButton) {
|
2022-02-24 20:15:24 +03:00
|
|
|
html += '<button is="paper-icon-button-light" class="listItemButton itemAction" data-action="link"><span class="material-icons info_outline" aria-hidden="true"></span></button>';
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (options.rightButtons) {
|
|
|
|
html += getRightButtonsHtml(options);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (options.enableUserDataButtons !== false) {
|
2020-06-09 22:46:51 +03:00
|
|
|
const userData = item.UserData || {};
|
|
|
|
const likes = userData.Likes == null ? '' : userData.Likes;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2020-06-20 21:06:00 +02:00
|
|
|
if (itemHelper.canMarkPlayed(item) && options.enablePlayedButton !== false) {
|
2022-02-24 20:15:24 +03:00
|
|
|
html += '<button is="emby-playstatebutton" type="button" class="listItemButton paper-icon-button-light" data-id="' + item.Id + '" data-serverid="' + item.ServerId + '" data-itemtype="' + item.Type + '" data-played="' + (userData.Played) + '"><span class="material-icons check" aria-hidden="true"></span></button>';
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
|
2020-06-20 21:06:00 +02:00
|
|
|
if (itemHelper.canRate(item) && options.enableRatingButton !== false) {
|
2022-02-24 20:15:24 +03:00
|
|
|
html += '<button is="emby-ratingbutton" type="button" class="listItemButton paper-icon-button-light" data-id="' + item.Id + '" data-serverid="' + item.ServerId + '" data-itemtype="' + item.Type + '" data-likes="' + likes + '" data-isfavorite="' + (userData.IsFavorite) + '"><span class="material-icons favorite" aria-hidden="true"></span></button>';
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
}
|
2020-06-20 21:10:32 +02:00
|
|
|
|
|
|
|
if (options.moreButton !== false) {
|
2022-02-24 20:15:24 +03:00
|
|
|
html += '<button is="paper-icon-button-light" class="listItemButton itemAction" data-action="menu"><span class="material-icons more_vert" aria-hidden="true"></span></button>';
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
}
|
2020-01-17 18:37:12 +03:00
|
|
|
html += '</div>';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
if (enableContentWrapper) {
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
if (enableOverview && item.Overview) {
|
|
|
|
html += '<div class="listItem-bottomoverview secondary">';
|
2022-07-04 13:29:46 -04:00
|
|
|
html += '<bdi>' + item.Overview + '</bdi>';
|
2019-01-10 15:39:37 +03:00
|
|
|
html += '</div>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
html += `</${outerTagName}>`;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
outerHtml += html;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
return outerHtml;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2020-06-09 22:46:51 +03:00
|
|
|
/* eslint-enable indent */
|
|
|
|
export default {
|
|
|
|
getListViewHtml: getListViewHtml
|
|
|
|
};
|