mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Remove Jquery from metadataeditor.js
This commit is contained in:
parent
812cbb19a4
commit
30f193f273
1 changed files with 300 additions and 259 deletions
|
@ -1,4 +1,4 @@
|
||||||
define(['itemHelper', 'dialogHelper', 'datetime', 'jQuery', 'emby-checkbox', 'emby-input', 'emby-select', 'listViewStyle', 'emby-textarea', 'emby-button', 'paper-icon-button-light'], function (itemHelper, dialogHelper, datetime, $) {
|
define(['itemHelper', 'dialogHelper', 'datetime', 'emby-checkbox', 'emby-input', 'emby-select', 'listViewStyle', 'emby-textarea', 'emby-button', 'paper-icon-button-light'], function (itemHelper, dialogHelper, datetime) {
|
||||||
|
|
||||||
var currentContext;
|
var currentContext;
|
||||||
var metadataEditorInfo;
|
var metadataEditorInfo;
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
ApiClient.updateItem(item).then(function () {
|
ApiClient.updateItem(item).then(function () {
|
||||||
|
|
||||||
var newContentType = $('#selectContentType', form).val() || '';
|
var newContentType = form.querySelector('#selectContentType').value || '';
|
||||||
|
|
||||||
if ((metadataEditorInfo.ContentType || '') != newContentType) {
|
if ((metadataEditorInfo.ContentType || '') != newContentType) {
|
||||||
|
|
||||||
|
@ -53,14 +53,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSelectedAirDays(form) {
|
function getSelectedAirDays(form) {
|
||||||
return $('.chkAirDay:checked', form).map(function () {
|
var checked = form.querySelectorAll('.chkAirDay:checked') || [];
|
||||||
|
return Array.prototype.map.call(checked, function () {
|
||||||
return this.getAttribute('data-day');
|
return this.getAttribute('data-day');
|
||||||
}).get();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAlbumArtists(form) {
|
function getAlbumArtists(form) {
|
||||||
|
|
||||||
return $('#txtAlbumArtist', form).val().trim().split(';').filter(function (s) {
|
return form.querySelector('#txtAlbumArtist').value.trim().split(';').filter(function (s) {
|
||||||
|
|
||||||
return s.length > 0;
|
return s.length > 0;
|
||||||
|
|
||||||
|
@ -74,7 +75,7 @@
|
||||||
|
|
||||||
function getArtists(form) {
|
function getArtists(form) {
|
||||||
|
|
||||||
return $('#txtArtist', form).val().trim().split(';').filter(function (s) {
|
return form.querySelector('#txtArtist').value.trim().split(';').filter(function (s) {
|
||||||
|
|
||||||
return s.length > 0;
|
return s.length > 0;
|
||||||
|
|
||||||
|
@ -88,7 +89,7 @@
|
||||||
|
|
||||||
function getDateFromForm(form, element, property) {
|
function getDateFromForm(form, element, property) {
|
||||||
|
|
||||||
var val = $(element, form).val();
|
var val = form.querySelector(element).value;
|
||||||
|
|
||||||
if (!val) {
|
if (!val) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -121,76 +122,79 @@
|
||||||
try {
|
try {
|
||||||
var item = {
|
var item = {
|
||||||
Id: currentItem.Id,
|
Id: currentItem.Id,
|
||||||
Name: $('#txtName', form).val(),
|
Name: form.querySelector('#txtName').value,
|
||||||
OriginalTitle: $('#txtOriginalName', form).val(),
|
OriginalTitle: form.querySelector('#txtOriginalName').value,
|
||||||
ForcedSortName: $('#txtSortName', form).val(),
|
ForcedSortName: form.querySelector('#txtSortName').value,
|
||||||
DisplayMediaType: $('#txtDisplayMediaType', form).val(),
|
DisplayMediaType: form.querySelector('#txtDisplayMediaType').value,
|
||||||
CommunityRating: $('#txtCommunityRating', form).val(),
|
CommunityRating: form.querySelector('#txtCommunityRating').value,
|
||||||
VoteCount: $('#txtCommunityVoteCount', form).val(),
|
VoteCount: form.querySelector('#txtCommunityVoteCount').value,
|
||||||
HomePageUrl: $('#txtHomePageUrl', form).val(),
|
HomePageUrl: form.querySelector('#txtHomePageUrl').value,
|
||||||
Budget: $('#txtBudget', form).val(),
|
Budget: form.querySelector('#txtBudget').value,
|
||||||
Revenue: $('#txtRevenue', form).val(),
|
Revenue: form.querySelector('#txtRevenue').value,
|
||||||
CriticRating: $('#txtCriticRating', form).val(),
|
CriticRating: form.querySelector('#txtCriticRating').value,
|
||||||
CriticRatingSummary: $('#txtCriticRatingSummary', form).val(),
|
CriticRatingSummary: form.querySelector('#txtCriticRatingSummary').value,
|
||||||
IndexNumber: $('#txtIndexNumber', form).val() || null,
|
IndexNumber: form.querySelector('#txtIndexNumber').value || null,
|
||||||
AbsoluteEpisodeNumber: $('#txtAbsoluteEpisodeNumber', form).val(),
|
AbsoluteEpisodeNumber: form.querySelector('#txtAbsoluteEpisodeNumber').value,
|
||||||
DvdEpisodeNumber: $('#txtDvdEpisodeNumber', form).val(),
|
DvdEpisodeNumber: form.querySelector('#txtDvdEpisodeNumber').value,
|
||||||
DvdSeasonNumber: $('#txtDvdSeasonNumber', form).val(),
|
DvdSeasonNumber: form.querySelector('#txtDvdSeasonNumber').value,
|
||||||
AirsBeforeSeasonNumber: $('#txtAirsBeforeSeason', form).val(),
|
AirsBeforeSeasonNumber: form.querySelector('#txtAirsBeforeSeason').value,
|
||||||
AirsAfterSeasonNumber: $('#txtAirsAfterSeason', form).val(),
|
AirsAfterSeasonNumber: form.querySelector('#txtAirsAfterSeason').value,
|
||||||
AirsBeforeEpisodeNumber: $('#txtAirsBeforeEpisode', form).val(),
|
AirsBeforeEpisodeNumber: form.querySelector('#txtAirsBeforeEpisode').value,
|
||||||
ParentIndexNumber: $('#txtParentIndexNumber', form).val() || null,
|
ParentIndexNumber: form.querySelector('#txtParentIndexNumber').value || null,
|
||||||
DisplayOrder: $('#selectDisplayOrder', form).val(),
|
DisplayOrder: form.querySelector('#selectDisplayOrder').value,
|
||||||
Players: $('#txtPlayers', form).val(),
|
Players: form.querySelector('#txtPlayers').value,
|
||||||
Album: $('#txtAlbum', form).val(),
|
Album: form.querySelector('#txtAlbum').value,
|
||||||
AlbumArtist: getAlbumArtists(form),
|
AlbumArtist: getAlbumArtists(form),
|
||||||
ArtistItems: getArtists(form),
|
ArtistItems: getArtists(form),
|
||||||
Metascore: $('#txtMetascore', form).val(),
|
Metascore: form.querySelector('#txtMetascore').value,
|
||||||
AwardSummary: $('#txtAwardSummary', form).val(),
|
AwardSummary: form.querySelector('#txtAwardSummary').value,
|
||||||
Overview: $('#txtOverview', form).val(),
|
Overview: form.querySelector('#txtOverview').value,
|
||||||
ShortOverview: $('#txtShortOverview', form).val(),
|
ShortOverview: form.querySelector('#txtShortOverview').value,
|
||||||
Status: $('#selectStatus', form).val(),
|
Status: form.querySelector('#selectStatus').value,
|
||||||
AirDays: getSelectedAirDays(form),
|
AirDays: getSelectedAirDays(form),
|
||||||
AirTime: $('#txtAirTime', form).val(),
|
AirTime: form.querySelector('#txtAirTime').value,
|
||||||
Genres: editableListViewValues($("#listGenres", form)),
|
Genres: editableListViewValues(form.querySelector("#listGenres")),
|
||||||
ProductionLocations: editableListViewValues($("#listCountries", form)),
|
ProductionLocations: editableListViewValues(form.querySelector("#listCountries")),
|
||||||
Tags: editableListViewValues($("#listTags", form)),
|
Tags: editableListViewValues(form.querySelector("#listTags")),
|
||||||
Keywords: editableListViewValues($("#listKeywords", form)),
|
Keywords: editableListViewValues(form.querySelector("#listKeywords")),
|
||||||
Studios: editableListViewValues($("#listStudios", form)).map(function (element) { return { Name: element }; }),
|
Studios: editableListViewValues(form.querySelector("#listStudios")).map(function (element) { return { Name: element }; }),
|
||||||
|
|
||||||
PremiereDate: getDateFromForm(form, '#txtPremiereDate', 'PremiereDate'),
|
PremiereDate: getDateFromForm(form, '#txtPremiereDate', 'PremiereDate'),
|
||||||
DateCreated: getDateFromForm(form, '#txtDateAdded', 'DateCreated'),
|
DateCreated: getDateFromForm(form, '#txtDateAdded', 'DateCreated'),
|
||||||
EndDate: getDateFromForm(form, '#txtEndDate', 'EndDate'),
|
EndDate: getDateFromForm(form, '#txtEndDate', 'EndDate'),
|
||||||
ProductionYear: $('#txtProductionYear', form).val(),
|
ProductionYear: form.querySelector('#txtProductionYear').value,
|
||||||
AspectRatio: $('#txtOriginalAspectRatio', form).val(),
|
AspectRatio: form.querySelector('#txtOriginalAspectRatio').value,
|
||||||
Video3DFormat: $('#select3dFormat', form).val(),
|
Video3DFormat: form.querySelector('#select3dFormat').value,
|
||||||
|
|
||||||
OfficialRating: $('#selectOfficialRating', form).val(),
|
OfficialRating: form.querySelector('#selectOfficialRating').value,
|
||||||
CustomRating: $('#selectCustomRating', form).val(),
|
CustomRating: form.querySelector('#selectCustomRating').value,
|
||||||
People: currentItem.People,
|
People: currentItem.People,
|
||||||
LockData: form.querySelector("#chkLockData").checked,
|
LockData: form.querySelector("#chkLockData").checked,
|
||||||
LockedFields: $('.selectLockedField', form).get().filter(function (c) {
|
LockedFields: Array.prototype.filter.call(form.querySelectorAll('.selectLockedField'), function (c) {
|
||||||
return !c.checked;
|
return !c.checked;
|
||||||
}).map(function (c) {
|
}).map(function (c) {
|
||||||
return c.getAttribute('data-value');
|
return c.getAttribute('data-value');
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
item.ProviderIds = $.extend({}, currentItem.ProviderIds || {});
|
item.ProviderIds = {};
|
||||||
|
for (var key in currentItem.ProviderIds) {
|
||||||
|
if (!currentItem.hasOwnProperty(key)) return;
|
||||||
|
item.ProviderIds[key] = currentItem.ProviderIds[key];
|
||||||
|
}
|
||||||
|
|
||||||
$('.txtExternalId', form).each(function () {
|
var idElements = form.querySelectorAll('.txtExternalId');
|
||||||
|
Array.prototype.map.call(idElements, function () {
|
||||||
var providerkey = this.getAttribute('data-providerkey');
|
var providerKey = this.getAttribute('data-providerkey');
|
||||||
|
item.ProviderIds[providerKey] = this.value;
|
||||||
item.ProviderIds[providerkey] = this.value;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
item.PreferredMetadataLanguage = $('#selectLanguage', form).val();
|
item.PreferredMetadataLanguage = form.querySelector('#selectLanguage').value;
|
||||||
item.PreferredMetadataCountryCode = $('#selectCountry', form).val();
|
item.PreferredMetadataCountryCode = form.querySelector('#selectCountry').value;
|
||||||
|
|
||||||
if (currentItem.Type == "Person") {
|
if (currentItem.Type == "Person") {
|
||||||
|
|
||||||
var placeOfBirth = $('#txtPlaceOfBirth', form).val();
|
var placeOfBirth = form.querySelector('#txtPlaceOfBirth').value;
|
||||||
|
|
||||||
item.ProductionLocations = placeOfBirth ? [placeOfBirth] : [];
|
item.ProductionLocations = placeOfBirth ? [placeOfBirth] : [];
|
||||||
}
|
}
|
||||||
|
@ -198,11 +202,11 @@
|
||||||
if (currentItem.Type == "Series") {
|
if (currentItem.Type == "Series") {
|
||||||
|
|
||||||
// 600000000
|
// 600000000
|
||||||
var seriesRuntime = $('#txtSeriesRuntime', form).val();
|
var seriesRuntime = form.querySelector('#txtSeriesRuntime').value;
|
||||||
item.RunTimeTicks = seriesRuntime ? (seriesRuntime * 600000000) : null;
|
item.RunTimeTicks = seriesRuntime ? (seriesRuntime * 600000000) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var tagline = $('#txtTagline', form).val();
|
var tagline = form.querySelector('#txtTagline').value;
|
||||||
item.Taglines = tagline ? [tagline] : [];
|
item.Taglines = tagline ? [tagline] : [];
|
||||||
|
|
||||||
submitUpdatedItem(form, item);
|
submitUpdatedItem(form, item);
|
||||||
|
@ -228,26 +232,26 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function editableListViewValues(list) {
|
function editableListViewValues(list) {
|
||||||
return list.find('.textValue').map(function () { return $(this).text(); }).get();
|
return Array.prototype.map.call(list.querySelectorAll('.textValue'), function (el) { return el.textContent; });
|
||||||
}
|
}
|
||||||
|
|
||||||
function addElementToEditableListview(source, sortCallback) {
|
function addElementToEditableListview(source, sortCallback) {
|
||||||
|
|
||||||
require(['prompt'], function (prompt) {
|
require(['prompt'], function (prompt) {
|
||||||
|
|
||||||
prompt({
|
prompt({
|
||||||
label: 'Value:'
|
label: 'Value:'
|
||||||
}).then(function (text) {
|
}).then(function (text) {
|
||||||
var list = $(source).parents('.editableListviewContainer').find('.paperList');
|
var list = parentWithClass(source, 'editableListviewContainer').querySelector('.paperList');
|
||||||
var items = editableListViewValues(list);
|
var items = editableListViewValues(list);
|
||||||
items.push(text);
|
items.push(text);
|
||||||
populateListView(list[0], items, sortCallback);
|
populateListView(list, items, sortCallback);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeElementFromListview(source) {
|
function removeElementFromListview(source) {
|
||||||
$(source).parents('.listItem').remove();
|
var el = parentWithClass(source, 'listItem');
|
||||||
|
el.parentNode.removeChild(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
function editPerson(context, person, index) {
|
function editPerson(context, person, index) {
|
||||||
|
@ -270,10 +274,10 @@
|
||||||
function showRefreshMenu(context, button) {
|
function showRefreshMenu(context, button) {
|
||||||
|
|
||||||
require(['refreshDialog'], function (refreshDialog) {
|
require(['refreshDialog'], function (refreshDialog) {
|
||||||
new refreshDialog({
|
showElement(new refreshDialog({
|
||||||
itemIds: [currentItem.Id],
|
itemIds: [currentItem.Id],
|
||||||
serverId: ApiClient.serverInfo().Id
|
serverId: ApiClient.serverInfo().Id
|
||||||
}).show();
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,7 +346,7 @@
|
||||||
|
|
||||||
function init(context) {
|
function init(context) {
|
||||||
|
|
||||||
$('.btnCancel', context).on('click', function () {
|
context.querySelector('.btnCancel').addEventListener('click', function () {
|
||||||
|
|
||||||
closeDialog(false);
|
closeDialog(false);
|
||||||
});
|
});
|
||||||
|
@ -363,18 +367,20 @@
|
||||||
context.querySelector('#chkLockData').addEventListener('click', function (e) {
|
context.querySelector('#chkLockData').addEventListener('click', function (e) {
|
||||||
|
|
||||||
if (!e.target.checked) {
|
if (!e.target.checked) {
|
||||||
$('.providerSettingsContainer').show();
|
showElement('.providerSettingsContainer');
|
||||||
} else {
|
} else {
|
||||||
$('.providerSettingsContainer').hide();
|
hideElement('.providerSettingsContainer');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
context.removeEventListener('click', onEditorClick);
|
context.removeEventListener('click', onEditorClick);
|
||||||
context.addEventListener('click', onEditorClick);
|
context.addEventListener('click', onEditorClick);
|
||||||
|
|
||||||
$('form', context).off('submit', onSubmit).on('submit', onSubmit);
|
var form = context.querySelector('form');
|
||||||
|
form.removeEventListener('submit', onSubmit)
|
||||||
|
form.addEventListener('submit', onSubmit);
|
||||||
|
|
||||||
$("#btnAddPerson", context).on('click', function (event, data) {
|
context.querySelector("#btnAddPerson").addEventListener('click', function (event, data) {
|
||||||
|
|
||||||
editPerson(context, {}, -1);
|
editPerson(context, {}, -1);
|
||||||
});
|
});
|
||||||
|
@ -436,9 +442,9 @@
|
||||||
function renderContentTypeOptions(context, metadataInfo) {
|
function renderContentTypeOptions(context, metadataInfo) {
|
||||||
|
|
||||||
if (metadataInfo.ContentTypeOptions.length) {
|
if (metadataInfo.ContentTypeOptions.length) {
|
||||||
$('#fldContentType', context).show();
|
hideElement('#fldContentType', context);
|
||||||
} else {
|
} else {
|
||||||
$('#fldContentType', context).hide();
|
showElement('#fldContentType', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
var html = metadataInfo.ContentTypeOptions.map(function (i) {
|
var html = metadataInfo.ContentTypeOptions.map(function (i) {
|
||||||
|
@ -448,7 +454,9 @@
|
||||||
|
|
||||||
}).join('');
|
}).join('');
|
||||||
|
|
||||||
$('#selectContentType', context).html(html).val(metadataInfo.ContentType || '');
|
var selectEl = context.querySelector('#selectContentType');
|
||||||
|
selectEl.innerHTML = html;
|
||||||
|
selectEl.value = metadataInfo.ContentType || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function onExternalIdChange() {
|
function onExternalIdChange() {
|
||||||
|
@ -457,9 +465,9 @@
|
||||||
var buttonClass = this.getAttribute('data-buttonclass');
|
var buttonClass = this.getAttribute('data-buttonclass');
|
||||||
|
|
||||||
if (this.value) {
|
if (this.value) {
|
||||||
$('.' + buttonClass).attr('href', formatString.replace('{0}', this.value));
|
document.querySelector('.' + buttonClass).setAttribute('href',formatString.replace('{0}', this.value));
|
||||||
} else {
|
} else {
|
||||||
$('.' + buttonClass).attr('href', '#');
|
document.querySelector('.' + buttonClass).setAttribute('href', '#');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -496,194 +504,227 @@
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
var elem = $('.externalIds', context).html(html);
|
var elem = context.querySelector('.externalIds', context);
|
||||||
|
elem.innerHTML = html;
|
||||||
|
|
||||||
$('.txtExternalId', elem).on('change', onExternalIdChange).trigger('change');
|
var extIdEls = elem.querySelector('.txtExternalId') || [];
|
||||||
|
extIdEls.forEach(function (el) {
|
||||||
|
el.addEventListener('change', onExternalIdChange.bind(el));
|
||||||
|
el.dispatchEvent(new Event('change'))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function to hide the element by selector or raw element
|
||||||
|
// Selector can be an element or a selector string
|
||||||
|
// Context is optional and restricts the querySelector to the context
|
||||||
|
function hideElement(selector, context) {
|
||||||
|
context = context || document;
|
||||||
|
if (typeof selector == 'string') {
|
||||||
|
Array.prototype.forEach.call(context.querySelectorAll(selector), function(el){
|
||||||
|
el.style.display = 'none';
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
selector.style.display = 'none';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function to show the element by selector or raw element
|
||||||
|
// Selector can be an element or a selector string
|
||||||
|
// Context is optional and restricts the querySelector to the context
|
||||||
|
function showElement(selector, context) {
|
||||||
|
context = context || document;
|
||||||
|
if (typeof selector == 'string') {
|
||||||
|
Array.prototype.forEach.call(context.querySelectorAll(selector), function(el){
|
||||||
|
el.style.display = '';
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
selector.style.display = '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setFieldVisibilities(context, item) {
|
function setFieldVisibilities(context, item) {
|
||||||
|
|
||||||
if (item.Path && item.LocationType != 'Remote') {
|
if (item.Path && item.LocationType != 'Remote') {
|
||||||
$('#fldPath', context).show();
|
showElement('#fldPath', context);
|
||||||
} else {
|
} else {
|
||||||
$('#fldPath', context).hide();
|
hideElement('#fldPath', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Type == "Series" || item.Type == "Movie" || item.Type == "Trailer") {
|
if (item.Type == "Series" || item.Type == "Movie" || item.Type == "Trailer") {
|
||||||
$('#fldOriginalName', context).show();
|
showElement('#fldOriginalName', context);
|
||||||
} else {
|
} else {
|
||||||
$('#fldOriginalName', context).hide();
|
hideElement('#fldOriginalName', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Type == "Series") {
|
if (item.Type == "Series") {
|
||||||
$('#fldSeriesRuntime', context).show();
|
showElement('#fldSeriesRuntime', context);
|
||||||
} else {
|
} else {
|
||||||
$('#fldSeriesRuntime', context).hide();
|
hideElement('#fldSeriesRuntime', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Type == "Series" || item.Type == "Person") {
|
if (item.Type == "Series" || item.Type == "Person") {
|
||||||
$('#fldEndDate', context).show();
|
showElement('#fldEndDate', context);
|
||||||
} else {
|
} else {
|
||||||
$('#fldEndDate', context).hide();
|
hideElement('#fldEndDate', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Type == "Movie" || item.MediaType == "Game" || item.MediaType == "Trailer" || item.Type == "MusicVideo") {
|
if (item.Type == "Movie" || item.MediaType == "Game" || item.MediaType == "Trailer" || item.Type == "MusicVideo") {
|
||||||
$('#fldBudget', context).show();
|
showElement('#fldBudget', context);
|
||||||
$('#fldRevenue', context).show();
|
showElement('#fldRevenue', context);
|
||||||
} else {
|
} else {
|
||||||
$('#fldBudget', context).hide();
|
hideElement('#fldBudget', context);
|
||||||
$('#fldRevenue', context).hide();
|
hideElement('#fldRevenue', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Type == "MusicAlbum") {
|
if (item.Type == "MusicAlbum") {
|
||||||
$('#albumAssociationMessage', context).show();
|
showElement('#albumAssociationMessage', context);
|
||||||
} else {
|
} else {
|
||||||
$('#albumAssociationMessage', context).hide();
|
hideElement('#albumAssociationMessage', context)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.MediaType == "Game") {
|
if (item.MediaType == "Game") {
|
||||||
$('#fldPlayers', context).show();
|
showElement('#fldPlayers', context);
|
||||||
} else {
|
} else {
|
||||||
$('#fldPlayers', context).hide();
|
hideElement('#fldPlayers', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Type == "Movie" || item.Type == "Trailer") {
|
if (item.Type == "Movie" || item.Type == "Trailer") {
|
||||||
$('#fldCriticRating', context).show();
|
showElement('#fldCriticRating', context);
|
||||||
$('#fldCriticRatingSummary', context).show();
|
showElement('#fldCriticRatingSummary', context);
|
||||||
} else {
|
} else {
|
||||||
$('#fldCriticRating', context).hide();
|
hideElement('#fldCriticRating', context);
|
||||||
$('#fldCriticRatingSummary', context).hide();
|
hideElement('#fldCriticRatingSummary', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Type == "Movie") {
|
if (item.Type == "Movie") {
|
||||||
$('#fldAwardSummary', context).show();
|
showElement('#fldAwardSummary', context);
|
||||||
} else {
|
} else {
|
||||||
$('#fldAwardSummary', context).hide();
|
hideElement('#fldAwardSummary', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Type == "Movie" || item.Type == "Trailer") {
|
if (item.Type == "Movie" || item.Type == "Trailer") {
|
||||||
$('#fldMetascore', context).show();
|
showElement('#fldMetascore', context);
|
||||||
} else {
|
} else {
|
||||||
$('#fldMetascore', context).hide();
|
hideElement('#fldMetascore', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Type == "Series") {
|
if (item.Type == "Series") {
|
||||||
$('#fldStatus', context).show();
|
showElement('#fldStatus', context);
|
||||||
$('#fldAirDays', context).show();
|
showElement('#fldAirDays', context);
|
||||||
$('#fldAirTime', context).show();
|
showElement('#fldAirTime', context);
|
||||||
} else {
|
} else {
|
||||||
$('#fldStatus', context).hide();
|
hideElement('#fldStatus', context);
|
||||||
$('#fldAirDays', context).hide();
|
hideElement('#fldAirDays', context);
|
||||||
$('#fldAirTime', context).hide();
|
hideElement('#fldAirTime', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.MediaType == "Video" && item.Type != "TvChannel") {
|
if (item.MediaType == "Video" && item.Type != "TvChannel") {
|
||||||
$('#fld3dFormat', context).show();
|
showElement('#fld3dFormat', context);
|
||||||
} else {
|
} else {
|
||||||
$('#fld3dFormat', context).hide();
|
hideElement('#fld3dFormat', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Type == "Audio") {
|
if (item.Type == "Audio") {
|
||||||
$('#fldAlbumArtist', context).show();
|
showElement('#fldAlbumArtist', context);
|
||||||
} else {
|
} else {
|
||||||
$('#fldAlbumArtist', context).hide();
|
hideElement('#fldAlbumArtist', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Type == "Audio" || item.Type == "MusicVideo") {
|
if (item.Type == "Audio" || item.Type == "MusicVideo") {
|
||||||
$('#fldArtist', context).show();
|
showElement('#fldArtist', context);
|
||||||
$('#fldAlbum', context).show();
|
showElement('#fldAlbum', context);
|
||||||
} else {
|
} else {
|
||||||
$('#fldArtist', context).hide();
|
hideElement('#fldArtist', context);
|
||||||
$('#fldAlbum', context).hide();
|
hideElement('#fldAlbum', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Type == "Episode") {
|
if (item.Type == "Episode") {
|
||||||
$('#collapsibleDvdEpisodeInfo', context).show();
|
showElement('#collapsibleDvdEpisodeInfo', context);
|
||||||
} else {
|
} else {
|
||||||
$('#collapsibleDvdEpisodeInfo', context).hide();
|
hideElement('#collapsibleDvdEpisodeInfo', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Type == "Episode" && item.ParentIndexNumber == 0) {
|
if (item.Type == "Episode" && item.ParentIndexNumber == 0) {
|
||||||
$('#collapsibleSpecialEpisodeInfo', context).show();
|
showElement('#collapsibleSpecialEpisodeInfo', context);
|
||||||
} else {
|
} else {
|
||||||
$('#collapsibleSpecialEpisodeInfo', context).hide();
|
hideElement('#collapsibleSpecialEpisodeInfo', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Type == "Person" || item.Type == "Genre" || item.Type == "Studio" || item.Type == "GameGenre" || item.Type == "MusicGenre" || item.Type == "TvChannel") {
|
if (item.Type == "Person" || item.Type == "Genre" || item.Type == "Studio" || item.Type == "GameGenre" || item.Type == "MusicGenre" || item.Type == "TvChannel") {
|
||||||
$('#fldCommunityRating', context).hide();
|
hideElement('#fldCommunityRating', context);
|
||||||
$('#fldCommunityVoteCount', context).hide();
|
hideElement('#fldCommunityVoteCount', context);
|
||||||
$('#genresCollapsible', context).hide();
|
hideElement('#genresCollapsible', context);
|
||||||
$('#peopleCollapsible', context).hide();
|
hideElement('#peopleCollapsible', context);
|
||||||
$('#studiosCollapsible', context).hide();
|
hideElement('#studiosCollapsible', context);
|
||||||
|
|
||||||
if (item.Type == "TvChannel") {
|
if (item.Type == "TvChannel") {
|
||||||
$('#fldOfficialRating', context).show();
|
showElement('#fldOfficialRating', context);
|
||||||
} else {
|
} else {
|
||||||
$('#fldOfficialRating', context).hide();
|
hideElement('#fldOfficialRating', context);
|
||||||
}
|
}
|
||||||
$('#fldCustomRating', context).hide();
|
hideElement('#fldCustomRating', context);
|
||||||
} else {
|
} else {
|
||||||
$('#fldCommunityRating', context).show();
|
showElement('#fldCommunityRating', context);
|
||||||
$('#fldCommunityVoteCount', context).show();
|
showElement('#fldCommunityVoteCount', context);
|
||||||
$('#genresCollapsible', context).show();
|
showElement('#genresCollapsible', context);
|
||||||
$('#peopleCollapsible', context).show();
|
showElement('#peopleCollapsible', context);
|
||||||
$('#studiosCollapsible', context).show();
|
showElement('#studiosCollapsible', context);
|
||||||
$('#fldOfficialRating', context).show();
|
showElement('#fldOfficialRating', context);
|
||||||
$('#fldCustomRating', context).show();
|
showElement('#fldCustomRating', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Type == "Movie" || item.Type == "Trailer" || item.Type == "MusicArtist") {
|
if (item.Type == "Movie" || item.Type == "Trailer" || item.Type == "MusicArtist") {
|
||||||
$('#countriesCollapsible', context).show();
|
showElement('#countriesCollapsible', context);
|
||||||
} else {
|
} else {
|
||||||
$('#countriesCollapsible', context).hide();
|
hideElement('#countriesCollapsible', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Type == "TvChannel") {
|
if (item.Type == "TvChannel") {
|
||||||
$('#tagsCollapsible', context).hide();
|
hideElement('#tagsCollapsible', context);
|
||||||
$('#metadataSettingsCollapsible', context).hide();
|
hideElement('#metadataSettingsCollapsible', context);
|
||||||
$('#fldPremiereDate', context).hide();
|
hideElement('#fldPremiereDate', context);
|
||||||
$('#fldDateAdded', context).hide();
|
hideElement('#fldDateAdded', context);
|
||||||
$('#fldYear', context).hide();
|
hideElement('#fldYear', context);
|
||||||
} else {
|
} else {
|
||||||
$('#tagsCollapsible', context).show();
|
showElement('#tagsCollapsible', context);
|
||||||
$('#metadataSettingsCollapsible', context).show();
|
showElement('#metadataSettingsCollapsible', context);
|
||||||
$('#fldPremiereDate', context).show();
|
showElement('#fldPremiereDate', context);
|
||||||
$('#fldDateAdded', context).show();
|
showElement('#fldDateAdded', context);
|
||||||
$('#fldYear', context).show();
|
showElement('#fldYear', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Type == "Movie" || item.Type == "Trailer" || item.Type == "BoxSet") {
|
if (item.Type == "Movie" || item.Type == "Trailer" || item.Type == "BoxSet") {
|
||||||
$('#keywordsCollapsible', context).show();
|
showElement('#keywordsCollapsible', context);
|
||||||
} else {
|
} else {
|
||||||
$('#keywordsCollapsible', context).hide();
|
hideElement('#keywordsCollapsible', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.MediaType == "Video" && item.Type != "TvChannel") {
|
if (item.MediaType == "Video" && item.Type != "TvChannel") {
|
||||||
$('#fldSourceType', context).show();
|
showElement('#fldSourceType', context);
|
||||||
} else {
|
} else {
|
||||||
$('#fldSourceType', context).hide();
|
hideElement('#fldSourceType', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Type == "Person") {
|
if (item.Type == "Person") {
|
||||||
|
//todo
|
||||||
context.querySelector('#txtProductionYear').label(Globalize.translate('LabelBirthYear'));
|
context.querySelector('#txtProductionYear').label(Globalize.translate('LabelBirthYear'));
|
||||||
context.querySelector("#txtPremiereDate").label(Globalize.translate('LabelBirthDate'));
|
context.querySelector("#txtPremiereDate").label(Globalize.translate('LabelBirthDate'));
|
||||||
context.querySelector("#txtEndDate").label(Globalize.translate('LabelDeathDate'));
|
context.querySelector("#txtEndDate").label(Globalize.translate('LabelDeathDate'));
|
||||||
$('#fldPlaceOfBirth', context).show();
|
showElement('#fldPlaceOfBirth');
|
||||||
} else {
|
} else {
|
||||||
context.querySelector('#txtProductionYear').label(Globalize.translate('LabelYear'));
|
context.querySelector('#txtProductionYear').label(Globalize.translate('LabelYear'));
|
||||||
context.querySelector("#txtPremiereDate").label(Globalize.translate('LabelReleaseDate'));
|
context.querySelector("#txtPremiereDate").label(Globalize.translate('LabelReleaseDate'));
|
||||||
context.querySelector("#txtEndDate").label(Globalize.translate('LabelEndDate'));
|
context.querySelector("#txtEndDate").label(Globalize.translate('LabelEndDate'));
|
||||||
$('#fldPlaceOfBirth', context).hide();
|
hideElement('#fldPlaceOfBirth');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.MediaType == "Video" && item.Type != "TvChannel") {
|
if (item.MediaType == "Video" && item.Type != "TvChannel") {
|
||||||
$('#fldOriginalAspectRatio', context).show();
|
showElement('#fldOriginalAspectRatio');
|
||||||
} else {
|
} else {
|
||||||
$('#fldOriginalAspectRatio', context).hide();
|
hideElement('#fldOriginalAspectRatio');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Type == "Audio" || item.Type == "Episode" || item.Type == "Season") {
|
if (item.Type == "Audio" || item.Type == "Episode" || item.Type == "Season") {
|
||||||
$('#fldIndexNumber', context).show();
|
showElement('#fldIndexNumber');
|
||||||
|
|
||||||
if (item.Type == "Episode") {
|
if (item.Type == "Episode") {
|
||||||
context.querySelector('#txtIndexNumber').label(Globalize.translate('LabelEpisodeNumber'));
|
context.querySelector('#txtIndexNumber').label(Globalize.translate('LabelEpisodeNumber'));
|
||||||
|
@ -695,11 +736,11 @@
|
||||||
context.querySelector('#txtIndexNumber').label(Globalize.translate('LabelNumber'));
|
context.querySelector('#txtIndexNumber').label(Globalize.translate('LabelNumber'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$('#fldIndexNumber', context).hide();
|
hideElement('#fldIndexNumber');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Type == "Audio" || item.Type == "Episode") {
|
if (item.Type == "Audio" || item.Type == "Episode") {
|
||||||
$('#fldParentIndexNumber', context).show();
|
showElement('#fldParentIndexNumber');
|
||||||
|
|
||||||
if (item.Type == "Episode") {
|
if (item.Type == "Episode") {
|
||||||
context.querySelector('#txtParentIndexNumber').label(Globalize.translate('LabelSeasonNumber'));
|
context.querySelector('#txtParentIndexNumber').label(Globalize.translate('LabelSeasonNumber'));
|
||||||
|
@ -709,122 +750,116 @@
|
||||||
context.querySelector('#txtParentIndexNumber').label(Globalize.translate('LabelParentNumber'));
|
context.querySelector('#txtParentIndexNumber').label(Globalize.translate('LabelParentNumber'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$('#fldParentIndexNumber', context).hide();
|
hideElement('#fldParentIndexNumber', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Type == "BoxSet") {
|
if (item.Type == "BoxSet") {
|
||||||
$('#fldDisplayOrder', context).show();
|
showElement('#fldDisplayOrder', context);
|
||||||
|
|
||||||
$('#selectDisplayOrder', context).html('<option value="SortName">' + Globalize.translate('OptionSortName') + '</option><option value="PremiereDate">' + Globalize.translate('OptionReleaseDate') + '</option>');
|
context.querySelector('#selectDisplayOrder').innerHTML = '<option value="SortName">' + Globalize.translate('OptionSortName') + '</option><option value="PremiereDate">' + Globalize.translate('OptionReleaseDate') + '</option>';
|
||||||
} else {
|
} else {
|
||||||
$('#selectDisplayOrder', context).html('');
|
context.querySelector('#selectDisplayOrder').innerHTML = '';
|
||||||
$('#fldDisplayOrder', context).hide();
|
hideElement('#fldDisplayOrder', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
var displaySettingFields = $('.fldDisplaySetting', context);
|
var displaySettingFields = context.querySelectorAll('.fldDisplaySetting');
|
||||||
if (displaySettingFields.filter(function (index) {
|
var hiddenDisplaySettingFields = Array.prototype.filter.call(displaySettingFields, function (field) {
|
||||||
|
return field.style.display != 'none';
|
||||||
|
|
||||||
return displaySettingFields[index].style.display != 'none';
|
});
|
||||||
|
if (hiddenDisplaySettingFields.length) {
|
||||||
}).length) {
|
showElement('#collapsibleDisplaySettings', context);
|
||||||
$('#collapsibleDisplaySettings', context).show();
|
|
||||||
} else {
|
} else {
|
||||||
$('#collapsibleDisplaySettings', context).hide();
|
hideElement('#collapsibleDisplaySettings', context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function fillItemInfo(context, item, parentalRatingOptions) {
|
function fillItemInfo(context, item, parentalRatingOptions) {
|
||||||
|
|
||||||
var select = $('#selectOfficialRating', context);
|
var select = context.querySelector('#selectOfficialRating');
|
||||||
|
|
||||||
populateRatings(parentalRatingOptions, select, item.OfficialRating);
|
populateRatings(parentalRatingOptions, select, item.OfficialRating);
|
||||||
|
|
||||||
select.val(item.OfficialRating || "");
|
select.value = item.OfficialRating || "";
|
||||||
|
|
||||||
select = $('#selectCustomRating', context);
|
select = context.querySelector('#selectCustomRating');
|
||||||
|
|
||||||
populateRatings(parentalRatingOptions, select, item.CustomRating);
|
populateRatings(parentalRatingOptions, select, item.CustomRating);
|
||||||
|
|
||||||
select.val(item.CustomRating || "");
|
select.value = item.CustomRating || "";
|
||||||
|
|
||||||
var selectStatus = $('#selectStatus', context);
|
var selectStatus = context.querySelector('#selectStatus');
|
||||||
populateStatus(selectStatus);
|
populateStatus(selectStatus);
|
||||||
selectStatus.val(item.Status || "");
|
selectStatus.value = item.Status || "";
|
||||||
|
|
||||||
$('#select3dFormat', context).val(item.Video3DFormat || "");
|
context.querySelector('#select3dFormat', context).value = item.Video3DFormat || "";
|
||||||
|
|
||||||
$('.chkAirDay', context).each(function () {
|
|
||||||
|
|
||||||
this.checked = (item.AirDays || []).indexOf(this.getAttribute('data-day')) != -1;
|
|
||||||
|
|
||||||
|
Array.prototype.forEach.call(context.querySelectorAll('.chkAirDay', context), function (el) {
|
||||||
|
el.checked = (item.AirDays || []).indexOf(el.getAttribute('data-day')) != -1;
|
||||||
});
|
});
|
||||||
|
|
||||||
populateListView($('#listCountries', context)[0], item.ProductionLocations || []);
|
populateListView(context.querySelector('#listCountries'), item.ProductionLocations || []);
|
||||||
populateListView($('#listGenres', context)[0], item.Genres);
|
populateListView(context.querySelector('#listGenres'), item.Genres);
|
||||||
populatePeople(context, item.People || []);
|
populatePeople(context, item.People || []);
|
||||||
|
|
||||||
populateListView($('#listStudios', context)[0], (item.Studios || []).map(function (element) { return element.Name || ''; }));
|
populateListView(context.querySelector('#listStudios'), (item.Studios || []).map(function (element) { return element.Name || ''; }));
|
||||||
|
|
||||||
populateListView($('#listTags', context)[0], item.Tags);
|
populateListView(context.querySelector('#listTags'), item.Tags);
|
||||||
populateListView($('#listKeywords', context)[0], item.Keywords);
|
populateListView(context.querySelector('#listKeywords'), item.Keywords);
|
||||||
|
|
||||||
var lockData = (item.LockData || false);
|
var lockData = (item.LockData || false);
|
||||||
var chkLockData = context.querySelector("#chkLockData");
|
var chkLockData = context.querySelector("#chkLockData");
|
||||||
chkLockData.checked = lockData;
|
chkLockData.checked = lockData;
|
||||||
if (chkLockData.checked) {
|
if (chkLockData.checked) {
|
||||||
$('.providerSettingsContainer', context).hide();
|
hideElement('.providerSettingsContainer', context)
|
||||||
} else {
|
} else {
|
||||||
$('.providerSettingsContainer', context).show();
|
showElement('.providerSettingsContainer', context)
|
||||||
}
|
}
|
||||||
populateInternetProviderSettings(context, item, item.LockedFields);
|
populateInternetProviderSettings(context, item, item.LockedFields);
|
||||||
|
|
||||||
$('#txtPath', context).val(item.Path || '');
|
context.querySelector('#txtPath').value = item.Path || '';
|
||||||
$('#txtName', context).val(item.Name || "");
|
context.querySelector('#txtName').value = item.Name || "";
|
||||||
$('#txtOriginalName', context).val(item.OriginalTitle || "");
|
context.querySelector('#txtOriginalName').value = item.OriginalTitle || "";
|
||||||
context.querySelector('#txtOverview').value = item.Overview || '';
|
context.querySelector('#txtOverview').value = item.Overview || '';
|
||||||
$('#txtShortOverview', context).val(item.ShortOverview || "");
|
context.querySelector('#txtShortOverview').value = item.ShortOverview || "";
|
||||||
$('#txtTagline', context).val((item.Taglines && item.Taglines.length ? item.Taglines[0] : ''));
|
context.querySelector('#txtTagline').value = (item.Taglines && item.Taglines.length ? item.Taglines[0] : '');
|
||||||
$('#txtSortName', context).val(item.ForcedSortName || "");
|
context.querySelector('#txtSortName').value = item.ForcedSortName || "";
|
||||||
$('#txtDisplayMediaType', context).val(item.DisplayMediaType || "");
|
context.querySelector('#txtDisplayMediaType').value = item.DisplayMediaType || "";
|
||||||
$('#txtCommunityRating', context).val(item.CommunityRating || "");
|
context.querySelector('#txtCommunityRating').value = item.CommunityRating || "";
|
||||||
$('#txtCommunityVoteCount', context).val(item.VoteCount || "");
|
context.querySelector('#txtCommunityVoteCount').value = item.VoteCount || "";
|
||||||
$('#txtHomePageUrl', context).val(item.HomePageUrl || "");
|
context.querySelector('#txtHomePageUrl').value = item.HomePageUrl || "";
|
||||||
|
|
||||||
$('#txtAwardSummary', context).val(item.AwardSummary || "");
|
context.querySelector('#txtAwardSummary').value = item.AwardSummary || "";
|
||||||
$('#txtMetascore', context).val(item.Metascore || "");
|
context.querySelector('#txtMetascore').value = item.Metascore || "";
|
||||||
|
|
||||||
$('#txtBudget', context).val(item.Budget || "");
|
context.querySelector('#txtBudget').value = item.Budget || "";
|
||||||
$('#txtRevenue', context).val(item.Revenue || "");
|
context.querySelector('#txtRevenue').value = item.Revenue || "";
|
||||||
|
|
||||||
$('#txtCriticRating', context).val(item.CriticRating || "");
|
context.querySelector('#txtCriticRating').value = item.CriticRating || "";
|
||||||
$('#txtCriticRatingSummary', context).val(item.CriticRatingSummary || "");
|
context.querySelector('#txtCriticRatingSummary').value = item.CriticRatingSummary || "";
|
||||||
|
|
||||||
$('#txtIndexNumber', context).val(('IndexNumber' in item) ? item.IndexNumber : "");
|
context.querySelector('#txtIndexNumber').value = ('IndexNumber' in item) ? item.IndexNumber : "";
|
||||||
$('#txtParentIndexNumber', context).val(('ParentIndexNumber' in item) ? item.ParentIndexNumber : "");
|
context.querySelector('#txtParentIndexNumber').value = ('ParentIndexNumber' in item) ? item.ParentIndexNumber : "";
|
||||||
$('#txtPlayers', context).val(item.Players || "");
|
context.querySelector('#txtPlayers').value = item.Players || "";
|
||||||
|
|
||||||
$('#txtAbsoluteEpisodeNumber', context).val(('AbsoluteEpisodeNumber' in item) ? item.AbsoluteEpisodeNumber : "");
|
context.querySelector('#txtAbsoluteEpisodeNumber').value = ('AbsoluteEpisodeNumber' in item) ? item.AbsoluteEpisodeNumber : "";
|
||||||
$('#txtDvdEpisodeNumber', context).val(('DvdEpisodeNumber' in item) ? item.DvdEpisodeNumber : "");
|
context.querySelector('#txtDvdEpisodeNumber').value = ('DvdEpisodeNumber' in item) ? item.DvdEpisodeNumber : "";
|
||||||
$('#txtDvdSeasonNumber', context).val(('DvdSeasonNumber' in item) ? item.DvdSeasonNumber : "");
|
context.querySelector('#txtDvdSeasonNumber').value = ('DvdSeasonNumber' in item) ? item.DvdSeasonNumber : "";
|
||||||
$('#txtAirsBeforeSeason', context).val(('AirsBeforeSeasonNumber' in item) ? item.AirsBeforeSeasonNumber : "");
|
context.querySelector('#txtAirsBeforeSeason').value = ('AirsBeforeSeasonNumber' in item) ? item.AirsBeforeSeasonNumber : "";
|
||||||
$('#txtAirsAfterSeason', context).val(('AirsAfterSeasonNumber' in item) ? item.AirsAfterSeasonNumber : "");
|
context.querySelector('#txtAirsAfterSeason').value = ('AirsAfterSeasonNumber' in item) ? item.AirsAfterSeasonNumber : "";
|
||||||
$('#txtAirsBeforeEpisode', context).val(('AirsBeforeEpisodeNumber' in item) ? item.AirsBeforeEpisodeNumber : "");
|
context.querySelector('#txtAirsBeforeEpisode').value = ('AirsBeforeEpisodeNumber' in item) ? item.AirsBeforeEpisodeNumber : "";
|
||||||
|
|
||||||
$('#txtAlbum', context).val(item.Album || "");
|
context.querySelector('#txtAlbum').value = item.Album || "";
|
||||||
|
|
||||||
$('#txtAlbumArtist', context).val((item.AlbumArtists || []).map(function (a) {
|
|
||||||
|
|
||||||
|
context.querySelector('#txtAlbumArtist').value = (item.AlbumArtists || []).map(function (a) {
|
||||||
return a.Name;
|
return a.Name;
|
||||||
|
}).join(';');
|
||||||
|
|
||||||
}).join(';'));
|
context.querySelector('#selectDisplayOrder').value = item.DisplayOrder;
|
||||||
|
|
||||||
$('#selectDisplayOrder', context).val(item.DisplayOrder);
|
|
||||||
|
|
||||||
$('#txtArtist', context).val((item.ArtistItems || []).map(function (a) {
|
|
||||||
|
|
||||||
|
context.querySelector('#txtArtist').value = (item.ArtistItems || []).map(function (a) {
|
||||||
return a.Name;
|
return a.Name;
|
||||||
|
}).join(';');
|
||||||
}).join(';'));
|
|
||||||
|
|
||||||
var date;
|
var date;
|
||||||
|
|
||||||
|
@ -832,57 +867,57 @@
|
||||||
try {
|
try {
|
||||||
date = datetime.parseISO8601Date(item.DateCreated, true);
|
date = datetime.parseISO8601Date(item.DateCreated, true);
|
||||||
|
|
||||||
$('#txtDateAdded', context).val(date.toISOString().slice(0, 10));
|
context.querySelector('#txtDateAdded').value = date.toISOString().slice(0, 10);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
$('#txtDateAdded', context).val('');
|
context.querySelector('#txtDateAdded').value = '';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$('#txtDateAdded', context).val('');
|
context.querySelector('#txtDateAdded').value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.PremiereDate) {
|
if (item.PremiereDate) {
|
||||||
try {
|
try {
|
||||||
date = datetime.parseISO8601Date(item.PremiereDate, true);
|
date = datetime.parseISO8601Date(item.PremiereDate, true);
|
||||||
|
|
||||||
$('#txtPremiereDate', context).val(date.toISOString().slice(0, 10));
|
context.querySelector('#txtPremiereDate').value = date.toISOString().slice(0, 10);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
$('#txtPremiereDate', context).val('');
|
context.querySelector('#txtPremiereDate').value = '';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$('#txtPremiereDate', context).val('');
|
context.querySelector('#txtPremiereDate').value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.EndDate) {
|
if (item.EndDate) {
|
||||||
try {
|
try {
|
||||||
date = datetime.parseISO8601Date(item.EndDate, true);
|
date = datetime.parseISO8601Date(item.EndDate, true);
|
||||||
|
|
||||||
$('#txtEndDate', context).val(date.toISOString().slice(0, 10));
|
context.querySelector('#txtEndDate').value = date.toISOString().slice(0, 10);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
$('#txtEndDate', context).val('');
|
context.querySelector('#txtEndDate').value = '';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$('#txtEndDate', context).val('');
|
context.querySelector('#txtEndDate').value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#txtProductionYear', context).val(item.ProductionYear || "");
|
context.querySelector('#txtProductionYear').value = item.ProductionYear || "";
|
||||||
|
|
||||||
$('#txtAirTime', context).val(item.AirTime || '');
|
context.querySelector('#txtAirTime').value = item.AirTime || '';
|
||||||
|
|
||||||
var placeofBirth = item.ProductionLocations && item.ProductionLocations.length ? item.ProductionLocations[0] : '';
|
var placeofBirth = item.ProductionLocations && item.ProductionLocations.length ? item.ProductionLocations[0] : '';
|
||||||
$('#txtPlaceOfBirth', context).val(placeofBirth);
|
context.querySelector('#txtPlaceOfBirth').value = placeofBirth;
|
||||||
|
|
||||||
$('#txtOriginalAspectRatio', context).val(item.AspectRatio || "");
|
context.querySelector('#txtOriginalAspectRatio').value = item.AspectRatio || "";
|
||||||
|
|
||||||
$('#selectLanguage', context).val(item.PreferredMetadataLanguage || "");
|
context.querySelector('#selectLanguage').value = item.PreferredMetadataLanguage || "";
|
||||||
$('#selectCountry', context).val(item.PreferredMetadataCountryCode || "");
|
context.querySelector('#selectCountry').value = item.PreferredMetadataCountryCode || "";
|
||||||
|
|
||||||
if (item.RunTimeTicks) {
|
if (item.RunTimeTicks) {
|
||||||
|
|
||||||
var minutes = item.RunTimeTicks / 600000000;
|
var minutes = item.RunTimeTicks / 600000000;
|
||||||
|
|
||||||
$('#txtSeriesRuntime', context).val(Math.round(minutes));
|
context.querySelector('#txtSeriesRuntime').value = Math.round(minutes);
|
||||||
} else {
|
} else {
|
||||||
$('#txtSeriesRuntime', context).val("");
|
context.querySelector('#txtSeriesRuntime', context).value = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -919,7 +954,7 @@
|
||||||
html += "<option value='" + rating.Value + "'>" + rating.Name + "</option>";
|
html += "<option value='" + rating.Value + "'>" + rating.Name + "</option>";
|
||||||
}
|
}
|
||||||
|
|
||||||
select.html(html);
|
select.innerHTML = html;
|
||||||
}
|
}
|
||||||
|
|
||||||
function populateStatus(select) {
|
function populateStatus(select) {
|
||||||
|
@ -928,7 +963,7 @@
|
||||||
html += "<option value=''></option>";
|
html += "<option value=''></option>";
|
||||||
html += "<option value='Continuing'>" + Globalize.translate('OptionContinuing') + "</option>";
|
html += "<option value='Continuing'>" + Globalize.translate('OptionContinuing') + "</option>";
|
||||||
html += "<option value='Ended'>" + Globalize.translate('OptionEnded') + "</option>";
|
html += "<option value='Ended'>" + Globalize.translate('OptionEnded') + "</option>";
|
||||||
select.html(html);
|
select.innerHTML = html;
|
||||||
}
|
}
|
||||||
|
|
||||||
function populateListView(list, items, sortCallback) {
|
function populateListView(list, items, sortCallback) {
|
||||||
|
@ -997,20 +1032,26 @@
|
||||||
|
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
|
|
||||||
$('.btnDeletePerson', elem).on('click', function () {
|
var deleteButton = elem.querySelector('.btnDeletePerson')
|
||||||
|
if (deleteButton) {
|
||||||
|
deleteButton.addEventListener('click', function () {
|
||||||
|
|
||||||
var index = parseInt(this.getAttribute('data-index'));
|
var index = parseInt(this.getAttribute('data-index'));
|
||||||
currentItem.People.splice(index, 1);
|
currentItem.People.splice(index, 1);
|
||||||
|
|
||||||
populatePeople(context, currentItem.People);
|
populatePeople(context, currentItem.People);
|
||||||
});
|
}.bind(deleteButton));
|
||||||
|
}
|
||||||
|
|
||||||
$('.btnEditPerson', elem).on('click', function () {
|
var editButton = elem.querySelector('.btnEditPerson')
|
||||||
|
if (editButton) {
|
||||||
|
editButton.addEventListener('click', function () {
|
||||||
|
|
||||||
var index = parseInt(this.getAttribute('data-index'));
|
var index = parseInt(this.getAttribute('data-index'));
|
||||||
|
|
||||||
editPerson(context, currentItem.People[index], index);
|
editPerson(context, currentItem.People[index], index);
|
||||||
});
|
}.bind(editButton));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateSliders(fields, currentFields) {
|
function generateSliders(fields, currentFields) {
|
||||||
|
@ -1031,7 +1072,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function populateInternetProviderSettings(context, item, lockedFields) {
|
function populateInternetProviderSettings(context, item, lockedFields) {
|
||||||
var container = $('.providerSettingsContainer', context);
|
var container = context.querySelector('.providerSettingsContainer');
|
||||||
lockedFields = lockedFields || new Array();
|
lockedFields = lockedFields || new Array();
|
||||||
|
|
||||||
var metadatafields = [
|
var metadatafields = [
|
||||||
|
@ -1067,7 +1108,7 @@
|
||||||
html += "<h1>" + Globalize.translate('HeaderEnabledFields') + "</h1>";
|
html += "<h1>" + Globalize.translate('HeaderEnabledFields') + "</h1>";
|
||||||
html += "<p>" + Globalize.translate('HeaderEnabledFieldsHelp') + "</p>";
|
html += "<p>" + Globalize.translate('HeaderEnabledFieldsHelp') + "</p>";
|
||||||
html += generateSliders(metadatafields, lockedFields);
|
html += generateSliders(metadatafields, lockedFields);
|
||||||
container.html(html);
|
container.innerHTML = html;
|
||||||
}
|
}
|
||||||
|
|
||||||
function reload(context, itemId) {
|
function reload(context, itemId) {
|
||||||
|
@ -1091,27 +1132,27 @@
|
||||||
populateLanguages(context.querySelector('#selectLanguage'), languages);
|
populateLanguages(context.querySelector('#selectLanguage'), languages);
|
||||||
populateCountries(context.querySelector('#selectCountry'), countries);
|
populateCountries(context.querySelector('#selectCountry'), countries);
|
||||||
|
|
||||||
LibraryBrowser.renderName(item, $('.itemName', context), true);
|
LibraryBrowser.renderName(item, document.querySelector('.itemName'), true);
|
||||||
|
|
||||||
setFieldVisibilities(context, item);
|
setFieldVisibilities(context, item);
|
||||||
fillItemInfo(context, item, metadataEditorInfo.ParentalRatingOptions);
|
fillItemInfo(context, item, metadataEditorInfo.ParentalRatingOptions);
|
||||||
|
|
||||||
if (item.MediaType == 'Photo') {
|
if (item.MediaType == 'Photo') {
|
||||||
$('#btnEditImages', context).hide();
|
hideElement('#btnEditImages', context);
|
||||||
} else {
|
} else {
|
||||||
$('#btnEditImages', context).show();
|
showElement('#btnEditImages', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.MediaType == "Video" && item.Type != "Episode") {
|
if (item.MediaType == "Video" && item.Type != "Episode") {
|
||||||
$('#fldShortOverview', context).show();
|
showElement('#fldShortOverview', context);
|
||||||
} else {
|
} else {
|
||||||
$('#fldShortOverview', context).hide();
|
hideElement('#fldShortOverview', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.MediaType == "Video" && item.Type != "Episode") {
|
if (item.MediaType == "Video" && item.Type != "Episode") {
|
||||||
$('#fldTagline', context).show();
|
showElement('#fldTagline', context);
|
||||||
} else {
|
} else {
|
||||||
$('#fldTagline', context).hide();
|
hideElement('#fldTagline', context);
|
||||||
}
|
}
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue