1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

switch to shared components

This commit is contained in:
Luke Pulverenti 2016-07-18 02:45:29 -04:00
parent c216a7ecdc
commit e305bf40c8
28 changed files with 789 additions and 723 deletions

View file

@ -577,34 +577,6 @@
});
},
deleteItems: function (itemIds) {
return new Promise(function (resolve, reject) {
var msg = Globalize.translate('ConfirmDeleteItem');
var title = Globalize.translate('HeaderDeleteItem');
if (itemIds.length > 1) {
msg = Globalize.translate('ConfirmDeleteItems');
title = Globalize.translate('HeaderDeleteItems');
}
require(['confirm'], function (confirm) {
confirm(msg, title).then(function () {
var promises = itemIds.map(function (itemId) {
ApiClient.deleteItem(itemId);
Events.trigger(LibraryBrowser, 'itemdeleting', [itemId]);
});
resolve();
}, reject);
});
});
},
editImages: function (itemId) {
return new Promise(function (resolve, reject) {
@ -2265,80 +2237,6 @@
return null;
},
getUserDataButtonHtml: function (method, itemId, btnCssClass, icon, tooltip, style) {
if (style == 'fab') {
var tagName = 'paper-fab';
return '<' + tagName + ' title="' + tooltip + '" data-id="' + itemId + '" icon="' + icon + '" class="' + btnCssClass + '" onclick="LibraryBrowser.' + method + '(this);return false;"></' + tagName + '>';
}
return '<button is="paper-icon-button-light" title="' + tooltip + '" data-id="' + itemId + '" class="autoSize ' + btnCssClass + '" onclick="LibraryBrowser.' + method + '(this);return false;"><i class="md-icon">' + icon + '</i></button>';
},
getUserDataIconsHtml: function (item, includePlayed, style) {
var html = '';
var userData = item.UserData || {};
var itemId = item.Id;
if (includePlayed !== false) {
var tooltipPlayed = Globalize.translate('TooltipPlayed');
if (item.MediaType == 'Video' || item.Type == 'Series' || item.Type == 'Season' || item.Type == 'BoxSet' || item.Type == 'Playlist') {
if (item.Type != 'TvChannel') {
if (userData.Played) {
html += LibraryBrowser.getUserDataButtonHtml('markPlayed', itemId, 'btnUserItemRating btnUserItemRatingOn', 'check', tooltipPlayed, style);
} else {
html += LibraryBrowser.getUserDataButtonHtml('markPlayed', itemId, 'btnUserItemRating', 'check', tooltipPlayed, style);
}
}
}
}
var tooltipFavorite = Globalize.translate('TooltipFavorite');
if (userData.IsFavorite) {
html += LibraryBrowser.getUserDataButtonHtml('markFavorite', itemId, 'btnUserItemRating btnUserItemRatingOn', 'favorite', tooltipFavorite, style);
} else {
html += LibraryBrowser.getUserDataButtonHtml('markFavorite', itemId, 'btnUserItemRating', 'favorite', tooltipFavorite, style);
}
return html;
},
markPlayed: function (link) {
var id = link.getAttribute('data-id');
var markAsPlayed = !link.classList.contains('btnUserItemRatingOn');
if (markAsPlayed) {
ApiClient.markPlayed(Dashboard.getCurrentUserId(), id);
link.classList.add('btnUserItemRatingOn');
} else {
ApiClient.markUnplayed(Dashboard.getCurrentUserId(), id);
link.classList.remove('btnUserItemRatingOn');
}
},
markFavorite: function (link) {
var id = link.getAttribute('data-id');
var markAsFavorite = !link.classList.contains('btnUserItemRatingOn');
ApiClient.updateFavoriteStatus(Dashboard.getCurrentUserId(), id, markAsFavorite);
if (markAsFavorite) {
link.classList.add('btnUserItemRatingOn');
} else {
link.classList.remove('btnUserItemRatingOn');
}
},
renderDetailImage: function (elem, item, editable, preferThumb) {
var imageTags = item.ImageTags || {};