mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 02:48:19 -07:00
Fix editMetadata/download didnt work with selected version
This commit is contained in:
parent
99686db96d
commit
fd3f1a7a22
@ -30,7 +30,7 @@ import 'emby-select';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function getPromise(apiClient, params) {
|
||||
function getPromise(apiClient, params) {
|
||||
const id = params.id;
|
||||
|
||||
if (id) {
|
||||
@ -54,9 +54,9 @@ import 'emby-select';
|
||||
}
|
||||
|
||||
throw new Error('Invalid request');
|
||||
}
|
||||
}
|
||||
|
||||
function hideAll(page, className, show) {
|
||||
function hideAll(page, className, show) {
|
||||
for (const elem of page.querySelectorAll('.' + className)) {
|
||||
if (show) {
|
||||
elem.classList.remove('hide');
|
||||
@ -64,9 +64,9 @@ import 'emby-select';
|
||||
elem.classList.add('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getContextMenuOptions(item, user, button) {
|
||||
function getContextMenuOptions(item, user, button) {
|
||||
return {
|
||||
item: item,
|
||||
open: false,
|
||||
@ -82,9 +82,9 @@ import 'emby-select';
|
||||
user: user,
|
||||
share: true
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function getProgramScheduleHtml(items) {
|
||||
function getProgramScheduleHtml(items) {
|
||||
let html = '';
|
||||
|
||||
html += '<div is="emby-itemscontainer" class="itemsContainer vertical-list" data-contextmenu="false">';
|
||||
@ -104,9 +104,9 @@ import 'emby-select';
|
||||
html += '</div>';
|
||||
|
||||
return html;
|
||||
}
|
||||
}
|
||||
|
||||
function renderSeriesTimerSchedule(page, apiClient, seriesTimerId) {
|
||||
function renderSeriesTimerSchedule(page, apiClient, seriesTimerId) {
|
||||
apiClient.getLiveTvTimers({
|
||||
UserId: apiClient.getCurrentUserId(),
|
||||
ImageTypeLimit: 1,
|
||||
@ -126,23 +126,23 @@ import 'emby-select';
|
||||
scheduleTab.innerHTML = html;
|
||||
imageLoader.lazyChildren(scheduleTab);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function renderTimerEditor(page, item, apiClient, user) {
|
||||
function renderTimerEditor(page, item, apiClient, user) {
|
||||
if (item.Type !== 'Recording' || !user.Policy.EnableLiveTvManagement || !item.TimerId || item.Status !== 'InProgress') {
|
||||
return void hideAll(page, 'btnCancelTimer');
|
||||
}
|
||||
|
||||
hideAll(page, 'btnCancelTimer', true);
|
||||
}
|
||||
}
|
||||
|
||||
function renderSeriesTimerEditor(page, item, apiClient, user) {
|
||||
function renderSeriesTimerEditor(page, item, apiClient, user) {
|
||||
if (item.Type !== 'SeriesTimer') {
|
||||
return void hideAll(page, 'btnCancelSeriesTimer');
|
||||
}
|
||||
|
||||
if (user.Policy.EnableLiveTvManagement) {
|
||||
import('seriesRecordingEditor').then(({default: seriesRecordingEditor}) => {
|
||||
import('seriesRecordingEditor').then(({ default: seriesRecordingEditor }) => {
|
||||
seriesRecordingEditor.embed(item, apiClient.serverId(), {
|
||||
context: page.querySelector('.seriesRecordingEditor')
|
||||
});
|
||||
@ -155,9 +155,9 @@ import 'emby-select';
|
||||
|
||||
page.querySelector('.seriesTimerScheduleSection').classList.add('hide');
|
||||
return void hideAll(page, 'btnCancelSeriesTimer');
|
||||
}
|
||||
}
|
||||
|
||||
function renderTrackSelections(page, instance, item, forceReload) {
|
||||
function renderTrackSelections(page, instance, item, forceReload) {
|
||||
const select = page.querySelector('.selectSource');
|
||||
|
||||
if (!item.MediaSources || !itemHelper.supportsMediaSourceSelection(item) || playbackManager.getSupportedCommands().indexOf('PlayMediaSource') === -1 || !playbackManager.canPlay(item)) {
|
||||
@ -194,9 +194,9 @@ import 'emby-select';
|
||||
renderAudioSelections(page, mediaSources);
|
||||
renderSubtitleSelections(page, mediaSources);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderVideoSelections(page, mediaSources) {
|
||||
function renderVideoSelections(page, mediaSources) {
|
||||
const mediaSourceId = page.querySelector('.selectSource').value;
|
||||
const mediaSource = mediaSources.filter(function (m) {
|
||||
return m.Id === mediaSourceId;
|
||||
@ -231,9 +231,9 @@ import 'emby-select';
|
||||
} else {
|
||||
page.querySelector('.selectVideoContainer').classList.add('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderAudioSelections(page, mediaSources) {
|
||||
function renderAudioSelections(page, mediaSources) {
|
||||
const mediaSourceId = page.querySelector('.selectSource').value;
|
||||
const mediaSource = mediaSources.filter(function (m) {
|
||||
return m.Id === mediaSourceId;
|
||||
@ -260,9 +260,9 @@ import 'emby-select';
|
||||
} else {
|
||||
page.querySelector('.selectAudioContainer').classList.add('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderSubtitleSelections(page, mediaSources) {
|
||||
function renderSubtitleSelections(page, mediaSources) {
|
||||
const mediaSourceId = page.querySelector('.selectSource').value;
|
||||
const mediaSource = mediaSources.filter(function (m) {
|
||||
return m.Id === mediaSourceId;
|
||||
@ -297,9 +297,9 @@ import 'emby-select';
|
||||
select.innerHTML = '';
|
||||
page.querySelector('.selectSubtitlesContainer').classList.add('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function reloadPlayButtons(page, item) {
|
||||
function reloadPlayButtons(page, item) {
|
||||
let canPlay = false;
|
||||
|
||||
if (item.Type == 'Program') {
|
||||
@ -339,9 +339,9 @@ import 'emby-select';
|
||||
}
|
||||
|
||||
return canPlay;
|
||||
}
|
||||
}
|
||||
|
||||
function reloadUserDataButtons(page, item) {
|
||||
function reloadUserDataButtons(page, item) {
|
||||
let i;
|
||||
let length;
|
||||
const btnPlaystates = page.querySelectorAll('.btnPlaystate');
|
||||
@ -371,9 +371,9 @@ import 'emby-select';
|
||||
btnUserRating.setItem(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getArtistLinksHtml(artists, serverId, context) {
|
||||
function getArtistLinksHtml(artists, serverId, context) {
|
||||
const html = [];
|
||||
|
||||
for (const artist of artists) {
|
||||
@ -386,15 +386,15 @@ import 'emby-select';
|
||||
}
|
||||
|
||||
return html.join(' / ');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Renders the item's name block
|
||||
* @param {Object} item - Item used to render the name.
|
||||
* @param {HTMLDivElement} container - Container to render the information into.
|
||||
* @param {Object} context - Application context.
|
||||
*/
|
||||
function renderName(item, container, context) {
|
||||
function renderName(item, container, context) {
|
||||
let parentRoute;
|
||||
const parentNameHtml = [];
|
||||
let parentNameLast = false;
|
||||
@ -504,25 +504,25 @@ import 'emby-select';
|
||||
} else {
|
||||
container.classList.add('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setTrailerButtonVisibility(page, item) {
|
||||
function setTrailerButtonVisibility(page, item) {
|
||||
if ((item.LocalTrailerCount || item.RemoteTrailers && item.RemoteTrailers.length) && playbackManager.getSupportedCommands().indexOf('PlayTrailers') !== -1) {
|
||||
hideAll(page, 'btnPlayTrailer', true);
|
||||
} else {
|
||||
hideAll(page, 'btnPlayTrailer');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderBackdrop(item) {
|
||||
function renderBackdrop(item) {
|
||||
if (dom.getWindowSize().innerWidth >= 1000) {
|
||||
backdrop.setBackdrops([item]);
|
||||
} else {
|
||||
backdrop.clearBackdrop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderDetailPageBackdrop(page, item, apiClient) {
|
||||
function renderDetailPageBackdrop(page, item, apiClient) {
|
||||
let imgUrl;
|
||||
let hasbackdrop = false;
|
||||
const itemBackdropElement = page.querySelector('#itemBackdrop');
|
||||
@ -562,9 +562,9 @@ import 'emby-select';
|
||||
}
|
||||
|
||||
return hasbackdrop;
|
||||
}
|
||||
}
|
||||
|
||||
function reloadFromItem(instance, page, params, item, user) {
|
||||
function reloadFromItem(instance, page, params, item, user) {
|
||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
||||
|
||||
Emby.Page.setTitle('');
|
||||
@ -662,12 +662,12 @@ import 'emby-select';
|
||||
hideAll(page, 'btnDownload', true);
|
||||
}
|
||||
|
||||
import('autoFocuser').then(({default: autoFocuser}) => {
|
||||
import('autoFocuser').then(({ default: autoFocuser }) => {
|
||||
autoFocuser.autoFocus(page);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function logoImageUrl(item, apiClient, options) {
|
||||
function logoImageUrl(item, apiClient, options) {
|
||||
options = options || {};
|
||||
options.type = 'Logo';
|
||||
|
||||
@ -682,9 +682,9 @@ import 'emby-select';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function renderLogo(page, item, apiClient) {
|
||||
function renderLogo(page, item, apiClient) {
|
||||
const detailLogo = page.querySelector('.detailLogo');
|
||||
|
||||
const url = logoImageUrl(item, apiClient, {});
|
||||
@ -697,14 +697,14 @@ import 'emby-select';
|
||||
} else {
|
||||
detailLogo.classList.add('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showRecordingFields(instance, page, item, user) {
|
||||
function showRecordingFields(instance, page, item, user) {
|
||||
if (!instance.currentRecordingFields) {
|
||||
const recordingFieldsElement = page.querySelector('.recordingFields');
|
||||
|
||||
if (item.Type == 'Program' && user.Policy.EnableLiveTvManagement) {
|
||||
import('recordingFields').then(({default: recordingFields}) => {
|
||||
import('recordingFields').then(({ default: recordingFields }) => {
|
||||
instance.currentRecordingFields = new recordingFields({
|
||||
parent: recordingFieldsElement,
|
||||
programId: item.Id,
|
||||
@ -717,9 +717,9 @@ import 'emby-select';
|
||||
recordingFieldsElement.innerHTML = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderLinks(page, item) {
|
||||
function renderLinks(page, item) {
|
||||
const externalLinksElem = page.querySelector('.itemExternalLinks');
|
||||
|
||||
const links = [];
|
||||
@ -746,9 +746,9 @@ import 'emby-select';
|
||||
} else {
|
||||
externalLinksElem.classList.add('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderDetailImage(elem, item, imageLoader) {
|
||||
function renderDetailImage(elem, item, imageLoader) {
|
||||
const itemArray = [];
|
||||
itemArray.push(item);
|
||||
const cardHtml = cardBuilder.getCardsHtml(itemArray, {
|
||||
@ -765,33 +765,33 @@ import 'emby-select';
|
||||
|
||||
elem.innerHTML = cardHtml;
|
||||
imageLoader.lazyChildren(elem);
|
||||
}
|
||||
}
|
||||
|
||||
function renderImage(page, item) {
|
||||
function renderImage(page, item) {
|
||||
renderDetailImage(
|
||||
page.querySelector('.detailImageContainer'),
|
||||
item,
|
||||
imageLoader
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function refreshDetailImageUserData(elem, item) {
|
||||
function refreshDetailImageUserData(elem, item) {
|
||||
elem.querySelector('.detailImageProgressContainer').innerHTML = indicators.getProgressBarHtml(item);
|
||||
}
|
||||
}
|
||||
|
||||
function refreshImage(page, item) {
|
||||
function refreshImage(page, item) {
|
||||
refreshDetailImageUserData(page.querySelector('.detailImageContainer'), item);
|
||||
}
|
||||
}
|
||||
|
||||
function setPeopleHeader(page, item) {
|
||||
function setPeopleHeader(page, item) {
|
||||
if (item.MediaType == 'Audio' || item.Type == 'MusicAlbum' || item.MediaType == 'Book' || item.MediaType == 'Photo') {
|
||||
page.querySelector('#peopleHeader').innerHTML = globalize.translate('People');
|
||||
} else {
|
||||
page.querySelector('#peopleHeader').innerHTML = globalize.translate('HeaderCastAndCrew');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderNextUp(page, item, user) {
|
||||
function renderNextUp(page, item, user) {
|
||||
const section = page.querySelector('.nextUpSection');
|
||||
|
||||
if (item.Type != 'Series') {
|
||||
@ -821,9 +821,9 @@ import 'emby-select';
|
||||
itemsContainer.innerHTML = html;
|
||||
imageLoader.lazyChildren(itemsContainer);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function setInitialCollapsibleState(page, item, apiClient, context, user) {
|
||||
function setInitialCollapsibleState(page, item, apiClient, context, user) {
|
||||
page.querySelector('.collectionItems').innerHTML = '';
|
||||
|
||||
if (item.Type == 'Playlist') {
|
||||
@ -872,9 +872,9 @@ import 'emby-select';
|
||||
} else {
|
||||
page.querySelector('#musicVideosCollapsible').classList.add('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function toggleLineClamp(clampTarget, e) {
|
||||
function toggleLineClamp(clampTarget, e) {
|
||||
const expandButton = e.target;
|
||||
const clampClassName = 'detail-clamp-text';
|
||||
|
||||
@ -885,9 +885,9 @@ import 'emby-select';
|
||||
clampTarget.classList.add(clampClassName);
|
||||
expandButton.innerHTML = globalize.translate('ShowMore');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderOverview(page, item) {
|
||||
function renderOverview(page, item) {
|
||||
for (const overviewElemnt of page.querySelectorAll('.overview')) {
|
||||
const overview = item.Overview || '';
|
||||
|
||||
@ -917,9 +917,9 @@ import 'emby-select';
|
||||
overviewElemnt.classList.add('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderGenres(page, item, context = inferContext(item)) {
|
||||
function renderGenres(page, item, context = inferContext(item)) {
|
||||
const genres = item.GenreItems || [];
|
||||
const type = context === 'music' ? 'MusicGenre' : 'Genre';
|
||||
|
||||
@ -945,9 +945,9 @@ import 'emby-select';
|
||||
} else {
|
||||
genresGroup.classList.add('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderWriter(page, item, context) {
|
||||
function renderWriter(page, item, context) {
|
||||
const writers = (item.People || []).filter(function (person) {
|
||||
return person.Type === 'Writer';
|
||||
});
|
||||
@ -974,9 +974,9 @@ import 'emby-select';
|
||||
} else {
|
||||
writersGroup.classList.add('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderDirector(page, item, context) {
|
||||
function renderDirector(page, item, context) {
|
||||
const directors = (item.People || []).filter(function (person) {
|
||||
return person.Type === 'Director';
|
||||
});
|
||||
@ -1003,9 +1003,9 @@ import 'emby-select';
|
||||
} else {
|
||||
directorsGroup.classList.add('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderMiscInfo(page, item) {
|
||||
function renderMiscInfo(page, item) {
|
||||
const primaryItemMiscInfo = page.querySelectorAll('.itemMiscInfo-primary');
|
||||
|
||||
for (const miscInfo of primaryItemMiscInfo) {
|
||||
@ -1035,9 +1035,9 @@ import 'emby-select';
|
||||
miscInfo.classList.add('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderTagline(page, item) {
|
||||
function renderTagline(page, item) {
|
||||
const taglineElement = page.querySelector('.tagline');
|
||||
|
||||
if (item.Taglines && item.Taglines.length) {
|
||||
@ -1046,9 +1046,9 @@ import 'emby-select';
|
||||
} else {
|
||||
taglineElement.classList.add('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderDetails(page, item, apiClient, context, isStatic) {
|
||||
function renderDetails(page, item, apiClient, context, isStatic) {
|
||||
renderSimilarItems(page, item, context);
|
||||
renderMoreFromSeason(page, item, apiClient);
|
||||
renderMoreFromArtist(page, item, apiClient);
|
||||
@ -1063,29 +1063,29 @@ import 'emby-select';
|
||||
renderLinks(page, item);
|
||||
renderTags(page, item);
|
||||
renderSeriesAirTime(page, item, isStatic);
|
||||
}
|
||||
}
|
||||
|
||||
function enableScrollX() {
|
||||
function enableScrollX() {
|
||||
return browser.mobile && screen.availWidth <= 1000;
|
||||
}
|
||||
}
|
||||
|
||||
function getPortraitShape(scrollX) {
|
||||
function getPortraitShape(scrollX) {
|
||||
if (scrollX == null) {
|
||||
scrollX = enableScrollX();
|
||||
}
|
||||
|
||||
return scrollX ? 'overflowPortrait' : 'portrait';
|
||||
}
|
||||
}
|
||||
|
||||
function getSquareShape(scrollX) {
|
||||
function getSquareShape(scrollX) {
|
||||
if (scrollX == null) {
|
||||
scrollX = enableScrollX();
|
||||
}
|
||||
|
||||
return scrollX ? 'overflowSquare' : 'square';
|
||||
}
|
||||
}
|
||||
|
||||
function renderMoreFromSeason(view, item, apiClient) {
|
||||
function renderMoreFromSeason(view, item, apiClient) {
|
||||
const section = view.querySelector('.moreFromSeasonSection');
|
||||
|
||||
if (section) {
|
||||
@ -1127,9 +1127,9 @@ import 'emby-select';
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderMoreFromArtist(view, item, apiClient) {
|
||||
function renderMoreFromArtist(view, item, apiClient) {
|
||||
const section = view.querySelector('.moreFromArtistSection');
|
||||
|
||||
if (section) {
|
||||
@ -1186,9 +1186,9 @@ import 'emby-select';
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderSimilarItems(page, item, context) {
|
||||
function renderSimilarItems(page, item, context) {
|
||||
const similarCollapsible = page.querySelector('#similarCollapsible');
|
||||
|
||||
if (similarCollapsible) {
|
||||
@ -1234,9 +1234,9 @@ import 'emby-select';
|
||||
imageLoader.lazyChildren(similarContent);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderSeriesAirTime(page, item, isStatic) {
|
||||
function renderSeriesAirTime(page, item, isStatic) {
|
||||
const seriesAirTime = page.querySelector('#seriesAirTime');
|
||||
if (item.Type != 'Series') {
|
||||
seriesAirTime.classList.add('hide');
|
||||
@ -1275,9 +1275,9 @@ import 'emby-select';
|
||||
} else {
|
||||
seriesAirTime.classList.add('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderTags(page, item) {
|
||||
function renderTags(page, item) {
|
||||
const itemTags = page.querySelector('.itemTags');
|
||||
const tagElements = [];
|
||||
let tags = item.Tags || [];
|
||||
@ -1297,9 +1297,9 @@ import 'emby-select';
|
||||
itemTags.innerHTML = '';
|
||||
itemTags.classList.add('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderChildren(page, item) {
|
||||
function renderChildren(page, item) {
|
||||
let fields = 'ItemCounts,PrimaryImageAspectRatio,BasicSyncInfo,CanDelete,MediaSourceCount';
|
||||
const query = {
|
||||
ParentId: item.Id,
|
||||
@ -1461,21 +1461,21 @@ import 'emby-select';
|
||||
} else {
|
||||
page.querySelector('.childrenSectionHeader').classList.remove('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderItemsByName(page, item) {
|
||||
function renderItemsByName(page, item) {
|
||||
import('scripts/itembynamedetailpage').then(() => {
|
||||
window.ItemsByName.renderItems(page, item);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function renderPlaylistItems(page, item) {
|
||||
function renderPlaylistItems(page, item) {
|
||||
import('scripts/playlistedit').then(() => {
|
||||
PlaylistViewer.render(page, item);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function renderProgramsForChannel(page, result) {
|
||||
function renderProgramsForChannel(page, result) {
|
||||
let html = '';
|
||||
let currentItems = [];
|
||||
let currentStartDate = null;
|
||||
@ -1529,9 +1529,9 @@ import 'emby-select';
|
||||
}
|
||||
|
||||
page.querySelector('.programGuide').innerHTML = html;
|
||||
}
|
||||
}
|
||||
|
||||
function renderChannelGuide(page, apiClient, item) {
|
||||
function renderChannelGuide(page, apiClient, item) {
|
||||
if (item.Type === 'TvChannel') {
|
||||
page.querySelector('.programGuideSection').classList.remove('hide');
|
||||
apiClient.getLiveTvPrograms({
|
||||
@ -1547,9 +1547,9 @@ import 'emby-select';
|
||||
renderProgramsForChannel(page, result);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderSeriesSchedule(page, item) {
|
||||
function renderSeriesSchedule(page, item) {
|
||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
||||
apiClient.getLiveTvPrograms({
|
||||
UserId: apiClient.getCurrentUserId(),
|
||||
@ -1581,9 +1581,9 @@ import 'emby-select';
|
||||
});
|
||||
loading.hide();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function inferContext(item) {
|
||||
function inferContext(item) {
|
||||
if (item.Type === 'Movie' || item.Type === 'BoxSet') {
|
||||
return 'movies';
|
||||
}
|
||||
@ -1601,9 +1601,9 @@ import 'emby-select';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function filterItemsByCollectionItemType(items, typeInfo) {
|
||||
function filterItemsByCollectionItemType(items, typeInfo) {
|
||||
return items.filter(function (item) {
|
||||
if (typeInfo.mediaType) {
|
||||
return item.MediaType == typeInfo.mediaType;
|
||||
@ -1611,9 +1611,9 @@ import 'emby-select';
|
||||
|
||||
return item.Type == typeInfo.type;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function canPlaySomeItemInCollection(items) {
|
||||
function canPlaySomeItemInCollection(items) {
|
||||
let i = 0;
|
||||
|
||||
for (let length = items.length; i < length; i++) {
|
||||
@ -1623,9 +1623,9 @@ import 'emby-select';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function renderCollectionItems(page, parentItem, types, items) {
|
||||
function renderCollectionItems(page, parentItem, types, items) {
|
||||
page.querySelector('.collectionItems').classList.remove('hide');
|
||||
page.querySelector('.collectionItems').innerHTML = '';
|
||||
|
||||
@ -1674,12 +1674,12 @@ import 'emby-select';
|
||||
|
||||
// HACK: Call autoFocuser again because btnPlay may be hidden, but focused by reloadFromItem
|
||||
// FIXME: Sometimes focus does not move until all (?) sections are loaded
|
||||
import('autoFocuser').then(({default: autoFocuser}) => {
|
||||
import('autoFocuser').then(({ default: autoFocuser }) => {
|
||||
autoFocuser.autoFocus(page);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function renderCollectionItemType(page, parentItem, type, items) {
|
||||
function renderCollectionItemType(page, parentItem, type, items) {
|
||||
let html = '';
|
||||
html += '<div class="verticalSection">';
|
||||
html += '<div class="sectionTitleContainer sectionTitleContainer-cards padded-left">';
|
||||
@ -1707,9 +1707,9 @@ import 'emby-select';
|
||||
const collectionItems = page.querySelector('.collectionItems');
|
||||
collectionItems.insertAdjacentHTML('beforeend', html);
|
||||
imageLoader.lazyChildren(collectionItems);
|
||||
}
|
||||
}
|
||||
|
||||
function renderMusicVideos(page, item, user) {
|
||||
function renderMusicVideos(page, item, user) {
|
||||
connectionManager.getApiClient(item.ServerId).getItems(user.Id, {
|
||||
SortBy: 'SortName',
|
||||
SortOrder: 'Ascending',
|
||||
@ -1727,9 +1727,9 @@ import 'emby-select';
|
||||
page.querySelector('#musicVideosCollapsible').classList.add('hide');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function renderAdditionalParts(page, item, user) {
|
||||
function renderAdditionalParts(page, item, user) {
|
||||
connectionManager.getApiClient(item.ServerId).getAdditionalVideoParts(user.Id, item.Id).then(function (result) {
|
||||
if (result.Items.length) {
|
||||
page.querySelector('#additionalPartsCollapsible').classList.remove('hide');
|
||||
@ -1740,16 +1740,16 @@ import 'emby-select';
|
||||
page.querySelector('#additionalPartsCollapsible').classList.add('hide');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function renderScenes(page, item) {
|
||||
function renderScenes(page, item) {
|
||||
let chapters = item.Chapters || [];
|
||||
|
||||
if (chapters.length && !chapters[0].ImageTag && (chapters = []), chapters.length) {
|
||||
page.querySelector('#scenesCollapsible').classList.remove('hide');
|
||||
const scenesContent = page.querySelector('#scenesContent');
|
||||
|
||||
import('chaptercardbuilder').then(({default: chaptercardbuilder}) => {
|
||||
import('chaptercardbuilder').then(({ default: chaptercardbuilder }) => {
|
||||
chaptercardbuilder.buildChapterCards(item, chapters, {
|
||||
itemsContainer: scenesContent,
|
||||
backdropShape: 'overflowBackdrop',
|
||||
@ -1760,9 +1760,9 @@ import 'emby-select';
|
||||
} else {
|
||||
page.querySelector('#scenesCollapsible').classList.add('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getVideosHtml(items) {
|
||||
function getVideosHtml(items) {
|
||||
return cardBuilder.getCardsHtml({
|
||||
items: items,
|
||||
shape: 'autooverflow',
|
||||
@ -1772,17 +1772,17 @@ import 'emby-select';
|
||||
centerText: true,
|
||||
showRuntime: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function renderSpecials(page, item, user) {
|
||||
function renderSpecials(page, item, user) {
|
||||
connectionManager.getApiClient(item.ServerId).getSpecialFeatures(user.Id, item.Id).then(function (specials) {
|
||||
const specialsContent = page.querySelector('#specialsContent');
|
||||
specialsContent.innerHTML = getVideosHtml(specials);
|
||||
imageLoader.lazyChildren(specialsContent);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function renderCast(page, item) {
|
||||
function renderCast(page, item) {
|
||||
const people = (item.People || []).filter(function (p) {
|
||||
return p.Type === 'Actor';
|
||||
});
|
||||
@ -1794,7 +1794,7 @@ import 'emby-select';
|
||||
page.querySelector('#castCollapsible').classList.remove('hide');
|
||||
const castContent = page.querySelector('#castContent');
|
||||
|
||||
import('peoplecardbuilder').then(({default: peoplecardbuilder}) => {
|
||||
import('peoplecardbuilder').then(({ default: peoplecardbuilder }) => {
|
||||
peoplecardbuilder.buildPeopleCards(people, {
|
||||
itemsContainer: castContent,
|
||||
coverImage: true,
|
||||
@ -1803,31 +1803,31 @@ import 'emby-select';
|
||||
imageBlurhashes: item.ImageBlurHashes
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function itemDetailPage() {
|
||||
function itemDetailPage() {
|
||||
const self = this;
|
||||
self.setInitialCollapsibleState = setInitialCollapsibleState;
|
||||
self.renderDetails = renderDetails;
|
||||
self.renderCast = renderCast;
|
||||
}
|
||||
}
|
||||
|
||||
function bindAll(view, selector, eventName, fn) {
|
||||
function bindAll(view, selector, eventName, fn) {
|
||||
const elems = view.querySelectorAll(selector);
|
||||
|
||||
for (const elem of elems) {
|
||||
elem.addEventListener(eventName, fn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onTrackSelectionsSubmit(e) {
|
||||
function onTrackSelectionsSubmit(e) {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
window.ItemDetailPage = new itemDetailPage();
|
||||
window.ItemDetailPage = new itemDetailPage();
|
||||
|
||||
export default function (view, params) {
|
||||
export default function (view, params) {
|
||||
function reload(instance, page, params) {
|
||||
loading.show();
|
||||
|
||||
@ -1842,7 +1842,7 @@ import 'emby-select';
|
||||
}
|
||||
|
||||
function splitVersions(instance, page, apiClient, params) {
|
||||
import('confirm').then(({default: confirm}) => {
|
||||
import('confirm').then(({ default: confirm }) => {
|
||||
confirm('Are you sure you wish to split the media sources into separate items?', 'Split Media Apart').then(function () {
|
||||
loading.show();
|
||||
apiClient.ajax({
|
||||
@ -1904,7 +1904,7 @@ import 'emby-select';
|
||||
}
|
||||
|
||||
function onCancelSeriesTimerClick() {
|
||||
import('recordingHelper').then(({default: recordingHelper}) => {
|
||||
import('recordingHelper').then(({ default: recordingHelper }) => {
|
||||
recordingHelper.cancelSeriesTimerWithConfirmation(currentItem.Id, currentItem.ServerId).then(function () {
|
||||
Dashboard.navigate('livetv.html');
|
||||
});
|
||||
@ -1912,7 +1912,7 @@ import 'emby-select';
|
||||
}
|
||||
|
||||
function onCancelTimerClick() {
|
||||
import('recordingHelper').then(({default: recordingHelper}) => {
|
||||
import('recordingHelper').then(({ default: recordingHelper }) => {
|
||||
recordingHelper.cancelTimer(connectionManager.getApiClient(currentItem.ServerId), currentItem.TimerId).then(function () {
|
||||
reload(self, view, params);
|
||||
});
|
||||
@ -1924,7 +1924,7 @@ import 'emby-select';
|
||||
}
|
||||
|
||||
function onDownloadClick() {
|
||||
import('fileDownloader').then(({default: fileDownloader}) => {
|
||||
import('fileDownloader').then(({ default: fileDownloader }) => {
|
||||
const downloadHref = apiClient.getItemDownloadUrl(currentItem.Id);
|
||||
fileDownloader.download([{
|
||||
url: downloadHref,
|
||||
@ -1935,9 +1935,13 @@ import 'emby-select';
|
||||
}
|
||||
|
||||
function onMoreCommandsClick() {
|
||||
const button = this;
|
||||
var button = this;
|
||||
var selectedItem = currentItem;
|
||||
apiClient.getItem(apiClient.getCurrentUserId(), view.querySelector('.selectSource').value).then(function (item) {
|
||||
selectedItem = item;
|
||||
|
||||
apiClient.getCurrentUser().then(function (user) {
|
||||
itemContextMenu.show(getContextMenuOptions(currentItem, user, button)).then(function (result) {
|
||||
itemContextMenu.show(getContextMenuOptions(selectedItem, user, button)).then(function (result) {
|
||||
if (result.deleted) {
|
||||
appRouter.goHome();
|
||||
} else if (result.updated) {
|
||||
@ -1945,6 +1949,8 @@ import 'emby-select';
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
function onPlayerChange() {
|
||||
@ -2018,6 +2024,6 @@ import 'emby-select';
|
||||
self._currentPlaybackMediaSources = null;
|
||||
self.currentRecordingFields = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
Loading…
Reference in New Issue
Block a user