2019-01-10 15:39:37 +03:00
|
|
|
define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutManager', 'globalize', 'datetime', 'apphost', 'css!./listview', 'emby-ratingbutton', 'emby-playstatebutton'], function (itemHelper, mediaInfo, indicators, connectionManager, layoutManager, globalize, datetime, appHost) {
|
|
|
|
'use strict';
|
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
|
|
|
}
|
|
|
|
|
|
|
|
var sortBy = (options.sortBy || '').toLowerCase();
|
2019-11-23 00:29:38 +09:00
|
|
|
var code;
|
|
|
|
var 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
|
|
|
}
|
|
|
|
|
|
|
|
function getImageUrl(item, width) {
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
var apiClient = connectionManager.getApiClient(item.ServerId);
|
|
|
|
|
|
|
|
var options = {
|
|
|
|
width: width,
|
|
|
|
type: "Primary"
|
|
|
|
};
|
|
|
|
|
|
|
|
if (item.ImageTags && item.ImageTags.Primary) {
|
|
|
|
|
|
|
|
options.tag = item.ImageTags.Primary;
|
|
|
|
return apiClient.getScaledImageUrl(item.Id, options);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (item.AlbumId && item.AlbumPrimaryImageTag) {
|
|
|
|
|
|
|
|
options.tag = item.AlbumPrimaryImageTag;
|
|
|
|
return apiClient.getScaledImageUrl(item.AlbumId, options);
|
2019-11-23 00:29:38 +09:00
|
|
|
} else if (item.SeriesId && item.SeriesPrimaryImageTag) {
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
options.tag = item.SeriesPrimaryImageTag;
|
|
|
|
return apiClient.getScaledImageUrl(item.SeriesId, options);
|
|
|
|
|
2019-11-23 00:29:38 +09:00
|
|
|
} else if (item.ParentPrimaryImageTag) {
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
options.tag = item.ParentPrimaryImageTag;
|
|
|
|
return apiClient.getScaledImageUrl(item.ParentPrimaryImageItemId, options);
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function getChannelImageUrl(item, width) {
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
var apiClient = connectionManager.getApiClient(item.ServerId);
|
|
|
|
|
|
|
|
var options = {
|
|
|
|
width: width,
|
|
|
|
type: "Primary"
|
|
|
|
};
|
|
|
|
|
|
|
|
if (item.ChannelId && item.ChannelPrimaryImageTag) {
|
|
|
|
|
|
|
|
options.tag = item.ChannelPrimaryImageTag;
|
|
|
|
return apiClient.getScaledImageUrl(item.ChannelId, options);
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function getTextLinesHtml(textlines, isLargeStyle) {
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
|
|
var largeTitleTagName = layoutManager.tv ? 'h2' : 'div';
|
|
|
|
|
|
|
|
for (var i = 0, length = textlines.length; i < length; i++) {
|
|
|
|
|
|
|
|
var text = textlines[i];
|
|
|
|
|
|
|
|
if (!text) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i === 0) {
|
|
|
|
if (isLargeStyle) {
|
|
|
|
html += '<' + largeTitleTagName + ' class="listItemBodyText">';
|
|
|
|
} else {
|
|
|
|
html += '<div class="listItemBodyText">';
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
html += '<div class="secondary listItemBodyText">';
|
|
|
|
}
|
|
|
|
html += (textlines[i] || ' ');
|
|
|
|
if (i === 0 && isLargeStyle) {
|
|
|
|
html += '</' + largeTitleTagName + '>';
|
|
|
|
} else {
|
|
|
|
html += '</div>';
|
|
|
|
}
|
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) {
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
|
|
for (var i = 0, length = options.rightButtons.length; i < length; i++) {
|
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var button = options.rightButtons[i];
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
html += '<button is="paper-icon-button-light" class="listItemButton itemAction" data-action="custom" data-customaction="' + button.id + '" title="' + button.title + '"><i class="md-icon">' + button.icon + '</i></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
|
|
|
}
|
|
|
|
|
|
|
|
function getId(item) {
|
2019-01-10 15:39:37 +03:00
|
|
|
return item.Id;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function getListViewHtml(options) {
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
var items = options.items;
|
|
|
|
|
|
|
|
var groupTitle = '';
|
|
|
|
var action = options.action || 'link';
|
|
|
|
|
|
|
|
var isLargeStyle = options.imageSize === 'large';
|
|
|
|
var enableOverview = options.enableOverview;
|
|
|
|
|
|
|
|
var clickEntireItem = layoutManager.tv ? true : false;
|
|
|
|
var outerTagName = clickEntireItem ? 'button' : 'div';
|
|
|
|
var enableSideMediaInfo = options.enableSideMediaInfo != null ? options.enableSideMediaInfo : true;
|
|
|
|
|
|
|
|
var outerHtml = '';
|
|
|
|
|
|
|
|
var enableContentWrapper = options.enableOverview && !layoutManager.tv;
|
|
|
|
var containerAlbumArtistIds = (options.containerAlbumArtists || []).map(getId);
|
|
|
|
|
|
|
|
for (var i = 0, length = items.length; i < length; i++) {
|
|
|
|
|
|
|
|
var item = items[i];
|
|
|
|
|
|
|
|
var html = '';
|
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
if (options.showIndex) {
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var 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">';
|
|
|
|
}
|
|
|
|
html += itemGroupTitle;
|
|
|
|
html += '</h2>';
|
|
|
|
|
|
|
|
html += '<div>';
|
|
|
|
|
|
|
|
groupTitle = itemGroupTitle;
|
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var 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';
|
|
|
|
}
|
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var downloadWidth = 80;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
if (isLargeStyle) {
|
|
|
|
cssClass += " listItem-largeImage";
|
|
|
|
downloadWidth = 500;
|
|
|
|
}
|
|
|
|
|
|
|
|
var playlistItemId = item.PlaylistItemId ? (' data-playlistitemid="' + item.PlaylistItemId + '"') : '';
|
|
|
|
|
|
|
|
var positionTicksData = item.UserData && item.UserData.PlaybackPositionTicks ? (' data-positionticks="' + item.UserData.PlaybackPositionTicks + '"') : '';
|
|
|
|
var collectionIdData = options.collectionId ? (' data-collectionid="' + options.collectionId + '"') : '';
|
|
|
|
var playlistIdData = options.playlistId ? (' data-playlistid="' + options.playlistId + '"') : '';
|
|
|
|
var mediaTypeData = item.MediaType ? (' data-mediatype="' + item.MediaType + '"') : '';
|
|
|
|
var collectionTypeData = item.CollectionType ? (' data-collectiontype="' + item.CollectionType + '"') : '';
|
|
|
|
var channelIdData = item.ChannelId ? (' data-channelid="' + item.ChannelId + '"') : '';
|
|
|
|
|
|
|
|
if (enableContentWrapper) {
|
|
|
|
|
|
|
|
cssClass += ' listItem-withContentWrapper';
|
|
|
|
}
|
|
|
|
|
|
|
|
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 + '>';
|
|
|
|
|
|
|
|
if (enableContentWrapper) {
|
|
|
|
|
|
|
|
html += '<div class="listItem-content">';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!clickEntireItem && options.dragHandle) {
|
2019-11-20 00:24:54 +03:00
|
|
|
//html += '<button is="paper-icon-button-light" class="listViewDragHandle listItemButton"><i class="md-icon">drag_handle</i></button>';
|
2019-01-10 15:39:37 +03:00
|
|
|
// Firefox and Edge are not allowing the button to be draggable
|
2019-11-20 00:24:54 +03:00
|
|
|
html += '<i class="listViewDragHandle md-icon listItemIcon listItemIcon-transparent">drag_handle</i>';
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (options.image !== false) {
|
|
|
|
var imgUrl = options.imageSource === 'channel' ? getChannelImageUrl(item, downloadWidth) : getImageUrl(item, downloadWidth);
|
2018-10-23 01:05:09 +03:00
|
|
|
console.log(imgUrl);
|
2019-01-10 15:39:37 +03:00
|
|
|
var imageClass = isLargeStyle ? 'listItemImage listItemImage-large' : 'listItemImage';
|
|
|
|
|
|
|
|
if (isLargeStyle && layoutManager.tv) {
|
|
|
|
imageClass += ' listItemImage-large-tv';
|
|
|
|
}
|
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var playOnImageClick = options.imagePlayButton && !layoutManager.tv;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
if (!clickEntireItem) {
|
|
|
|
imageClass += ' itemAction';
|
|
|
|
}
|
|
|
|
|
|
|
|
var imageAction = playOnImageClick ? 'resume' : action;
|
|
|
|
|
|
|
|
if (imgUrl) {
|
|
|
|
html += '<div data-action="' + imageAction + '" class="' + imageClass + ' lazy" data-src="' + imgUrl + '" item-icon>';
|
|
|
|
} else {
|
|
|
|
html += '<div class="' + imageClass + '">';
|
|
|
|
}
|
|
|
|
|
|
|
|
var indicatorsHtml = '';
|
|
|
|
indicatorsHtml += indicators.getPlayedIndicatorHtml(item);
|
|
|
|
|
|
|
|
if (indicatorsHtml) {
|
|
|
|
html += '<div class="indicators listItemIndicators">' + indicatorsHtml + '</div>';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (playOnImageClick) {
|
2019-11-20 00:24:54 +03:00
|
|
|
html += '<button is="paper-icon-button-light" class="listItemImageButton itemAction" data-action="resume"><i class="md-icon listItemImageButton-icon">play_arrow</i></button>';
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var 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
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var 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)));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (options.showChannel) {
|
|
|
|
if (item.ChannelName) {
|
|
|
|
textlines.push(item.ChannelName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var 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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var displayName = itemHelper.getDisplayName(item, {
|
|
|
|
includeParentInfo: options.includeParentInfoInTitle
|
|
|
|
});
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
if (options.showIndexNumber && item.IndexNumber != null) {
|
|
|
|
displayName = item.IndexNumber + ". " + displayName;
|
|
|
|
}
|
|
|
|
|
|
|
|
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) {
|
|
|
|
if (options.artist !== false) {
|
|
|
|
|
|
|
|
if (item.AlbumArtist && item.Type === 'MusicAlbum') {
|
|
|
|
textlines.push(item.AlbumArtist);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
|
|
|
|
var showArtist = options.artist === true;
|
|
|
|
var artistItems = item.ArtistItems;
|
|
|
|
|
|
|
|
if (!showArtist && options.artist !== false) {
|
|
|
|
|
|
|
|
if (!artistItems || !artistItems.length) {
|
|
|
|
showArtist = true;
|
2019-11-23 00:29:38 +09:00
|
|
|
} else if (artistItems.length > 1 || containerAlbumArtistIds.indexOf(artistItems[0].Id) === -1) {
|
2019-01-10 15:39:37 +03:00
|
|
|
showArtist = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (showArtist) {
|
|
|
|
|
|
|
|
if (artistItems && item.Type !== 'MusicAlbum') {
|
|
|
|
textlines.push(artistItems.map(function (a) {
|
|
|
|
return a.Name;
|
|
|
|
}).join(', '));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (item.Type === 'TvChannel') {
|
|
|
|
|
|
|
|
if (item.CurrentProgram) {
|
|
|
|
textlines.push(itemHelper.getDisplayName(item.CurrentProgram));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
cssClass = 'listItemBody';
|
|
|
|
if (!clickEntireItem) {
|
|
|
|
cssClass += ' itemAction';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (options.image === false) {
|
|
|
|
cssClass += ' listItemBody-noleftpadding';
|
|
|
|
}
|
|
|
|
|
|
|
|
html += '<div class="' + cssClass + '">';
|
|
|
|
|
2019-11-20 00:24:54 +03:00
|
|
|
var moreIcon = 'more_horiz';
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
html += getTextLinesHtml(textlines, isLargeStyle);
|
|
|
|
|
|
|
|
if (options.mediaInfo !== false) {
|
|
|
|
if (!enableSideMediaInfo) {
|
|
|
|
|
|
|
|
var mediaInfoClass = 'secondary listItemMediaInfo listItemBodyText';
|
|
|
|
|
|
|
|
html += '<div class="' + mediaInfoClass + '">' + mediaInfo.getPrimaryMediaInfoHtml(item, {
|
|
|
|
episodeTitle: false,
|
|
|
|
originalAirDate: false,
|
|
|
|
subtitles: false
|
|
|
|
|
|
|
|
}) + '</div>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (enableOverview && item.Overview) {
|
|
|
|
html += '<div class="secondary listItem-overview listItemBodyText">';
|
|
|
|
html += item.Overview;
|
|
|
|
html += '</div>';
|
|
|
|
}
|
|
|
|
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
if (options.mediaInfo !== false) {
|
|
|
|
if (enableSideMediaInfo) {
|
|
|
|
html += '<div class="secondary listItemMediaInfo">' + mediaInfo.getPrimaryMediaInfoHtml(item, {
|
|
|
|
|
|
|
|
year: false,
|
|
|
|
container: false,
|
|
|
|
episodeTitle: false,
|
|
|
|
criticRating: false,
|
|
|
|
endsAt: false
|
|
|
|
|
|
|
|
}) + '</div>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!options.recordButton && (item.Type === 'Timer' || item.Type === 'Program')) {
|
|
|
|
html += indicators.getTimerIndicator(item).replace('indicatorIcon', 'indicatorIcon listItemAside');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!clickEntireItem) {
|
|
|
|
|
|
|
|
if (options.addToListButton) {
|
2019-11-20 00:24:54 +03:00
|
|
|
html += '<button is="paper-icon-button-light" class="listItemButton itemAction" data-action="addtoplaylist"><i class="md-icon">playlist_add</i></button>';
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (options.moreButton !== false) {
|
|
|
|
html += '<button is="paper-icon-button-light" class="listItemButton itemAction" data-action="menu"><i class="md-icon">' + moreIcon + '</i></button>';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (options.infoButton) {
|
2019-11-20 00:24:54 +03:00
|
|
|
html += '<button is="paper-icon-button-light" class="listItemButton itemAction" data-action="link"><i class="md-icon">info_outline</i></button>';
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (options.rightButtons) {
|
|
|
|
html += getRightButtonsHtml(options);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (options.enableUserDataButtons !== false) {
|
|
|
|
|
|
|
|
html += '<span class="listViewUserDataButtons flex align-items-center">';
|
|
|
|
|
|
|
|
var userData = item.UserData || {};
|
|
|
|
var likes = userData.Likes == null ? '' : userData.Likes;
|
|
|
|
|
|
|
|
if (itemHelper.canMarkPlayed(item)) {
|
2019-11-20 00:24:54 +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) + '"><i class="md-icon">check</i></button>';
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (itemHelper.canRate(item)) {
|
2019-11-20 00:24:54 +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) + '"><i class="md-icon">favorite</i></button>';
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
html += '</span>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (enableContentWrapper) {
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
if (enableOverview && item.Overview) {
|
|
|
|
html += '<div class="listItem-bottomoverview secondary">';
|
|
|
|
html += item.Overview;
|
|
|
|
html += '</div>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
html += '</' + outerTagName + '>';
|
|
|
|
|
|
|
|
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
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
return {
|
|
|
|
getListViewHtml: getListViewHtml
|
2019-01-10 15:39:37 +03:00
|
|
|
};
|
2019-01-27 22:10:07 +01:00
|
|
|
});
|