mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 11:28:23 -07:00
Add option to season image downloader to pick from series images
This commit is contained in:
parent
9d3a12237a
commit
d9ebdc05bb
@ -31,11 +31,16 @@ import template from './imageDownloader.template.html';
|
|||||||
let browsableImageStartIndex = 0;
|
let browsableImageStartIndex = 0;
|
||||||
let browsableImageType = 'Primary';
|
let browsableImageType = 'Primary';
|
||||||
let selectedProvider;
|
let selectedProvider;
|
||||||
|
let browsableParentId;
|
||||||
|
|
||||||
function getBaseRemoteOptions() {
|
function getBaseRemoteOptions(page) {
|
||||||
const options = {};
|
const options = {};
|
||||||
|
|
||||||
options.itemId = currentItemId;
|
if (page.querySelector('#chkShowParentImages').checked && browsableParentId) {
|
||||||
|
options.itemId = browsableParentId;
|
||||||
|
} else {
|
||||||
|
options.itemId = currentItemId;
|
||||||
|
}
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
@ -43,7 +48,7 @@ import template from './imageDownloader.template.html';
|
|||||||
function reloadBrowsableImages(page, apiClient) {
|
function reloadBrowsableImages(page, apiClient) {
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
const options = getBaseRemoteOptions();
|
const options = getBaseRemoteOptions(page);
|
||||||
|
|
||||||
options.type = browsableImageType;
|
options.type = browsableImageType;
|
||||||
options.startIndex = browsableImageStartIndex;
|
options.startIndex = browsableImageStartIndex;
|
||||||
@ -135,7 +140,7 @@ import template from './imageDownloader.template.html';
|
|||||||
}
|
}
|
||||||
|
|
||||||
function downloadRemoteImage(page, apiClient, url, type, provider) {
|
function downloadRemoteImage(page, apiClient, url, type, provider) {
|
||||||
const options = getBaseRemoteOptions();
|
const options = getBaseRemoteOptions(page);
|
||||||
|
|
||||||
options.Type = type;
|
options.Type = type;
|
||||||
options.ImageUrl = url;
|
options.ImageUrl = url;
|
||||||
@ -273,26 +278,31 @@ import template from './imageDownloader.template.html';
|
|||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function reloadBrowsableImagesFirstPage(page, apiClient) {
|
||||||
|
browsableImageStartIndex = 0;
|
||||||
|
reloadBrowsableImages(page, apiClient);
|
||||||
|
}
|
||||||
|
|
||||||
function initEditor(page, apiClient) {
|
function initEditor(page, apiClient) {
|
||||||
page.querySelector('#selectBrowsableImageType').addEventListener('change', function () {
|
page.querySelector('#selectBrowsableImageType').addEventListener('change', function () {
|
||||||
browsableImageType = this.value;
|
browsableImageType = this.value;
|
||||||
browsableImageStartIndex = 0;
|
|
||||||
selectedProvider = null;
|
selectedProvider = null;
|
||||||
|
|
||||||
reloadBrowsableImages(page, apiClient);
|
reloadBrowsableImagesFirstPage(page, apiClient);
|
||||||
});
|
});
|
||||||
|
|
||||||
page.querySelector('#selectImageProvider').addEventListener('change', function () {
|
page.querySelector('#selectImageProvider').addEventListener('change', function () {
|
||||||
browsableImageStartIndex = 0;
|
|
||||||
selectedProvider = this.value;
|
selectedProvider = this.value;
|
||||||
|
|
||||||
reloadBrowsableImages(page, apiClient);
|
reloadBrowsableImagesFirstPage(page, apiClient);
|
||||||
});
|
});
|
||||||
|
|
||||||
page.querySelector('#chkAllLanguages').addEventListener('change', function () {
|
page.querySelector('#chkAllLanguages').addEventListener('change', function () {
|
||||||
browsableImageStartIndex = 0;
|
reloadBrowsableImagesFirstPage(page, apiClient);
|
||||||
|
});
|
||||||
|
|
||||||
reloadBrowsableImages(page, apiClient);
|
page.querySelector('#chkShowParentImages').addEventListener('change', function () {
|
||||||
|
reloadBrowsableImagesFirstPage(page, apiClient);
|
||||||
});
|
});
|
||||||
|
|
||||||
page.addEventListener('click', function (e) {
|
page.addEventListener('click', function (e) {
|
||||||
@ -336,6 +346,10 @@ import template from './imageDownloader.template.html';
|
|||||||
scrollHelper.centerFocus.on(dlg, false);
|
scrollHelper.centerFocus.on(dlg, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (browsableParentId) {
|
||||||
|
dlg.querySelector('#lblShowParentImages').classList.remove('hide');
|
||||||
|
}
|
||||||
|
|
||||||
// Has to be assigned a z-index after the call to .open()
|
// Has to be assigned a z-index after the call to .open()
|
||||||
dlg.addEventListener('close', onDialogClosed);
|
dlg.addEventListener('close', onDialogClosed);
|
||||||
|
|
||||||
@ -366,7 +380,7 @@ import template from './imageDownloader.template.html';
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function show(itemId, serverId, itemType, imageType) {
|
export function show(itemId, serverId, itemType, imageType, parentId) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
currentResolve = resolve;
|
currentResolve = resolve;
|
||||||
currentReject = reject;
|
currentReject = reject;
|
||||||
@ -374,6 +388,7 @@ export function show(itemId, serverId, itemType, imageType) {
|
|||||||
browsableImageStartIndex = 0;
|
browsableImageStartIndex = 0;
|
||||||
browsableImageType = imageType || 'Primary';
|
browsableImageType = imageType || 'Primary';
|
||||||
selectedProvider = null;
|
selectedProvider = null;
|
||||||
|
browsableParentId = parentId;
|
||||||
showEditor(itemId, serverId, itemType);
|
showEditor(itemId, serverId, itemType);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,10 @@
|
|||||||
<input id="chkAllLanguages" type="checkbox" is="emby-checkbox" />
|
<input id="chkAllLanguages" type="checkbox" is="emby-checkbox" />
|
||||||
<span>${AllLanguages}</span>
|
<span>${AllLanguages}</span>
|
||||||
</label>
|
</label>
|
||||||
|
<label id="lblShowParentImages" class="hide" style="margin: 0 0 0 1em;width:auto;">
|
||||||
|
<input id="chkShowParentImages" type="checkbox" is="emby-checkbox" />
|
||||||
|
<span>${ShowParentImages}</span>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="availableImagesList vertical-wrap centered"></div>
|
<div class="availableImagesList vertical-wrap centered"></div>
|
||||||
|
@ -280,7 +280,13 @@ import template from './imageeditor.template.html';
|
|||||||
|
|
||||||
function showImageDownloader(page, imageType) {
|
function showImageDownloader(page, imageType) {
|
||||||
import('../imageDownloader/imageDownloader').then((ImageDownloader) => {
|
import('../imageDownloader/imageDownloader').then((ImageDownloader) => {
|
||||||
ImageDownloader.show(currentItem.Id, currentItem.ServerId, currentItem.Type, imageType).then(function () {
|
ImageDownloader.show(
|
||||||
|
currentItem.Id,
|
||||||
|
currentItem.ServerId,
|
||||||
|
currentItem.Type,
|
||||||
|
imageType,
|
||||||
|
currentItem.Type == 'Season' ? currentItem.ParentId : null
|
||||||
|
).then(function () {
|
||||||
hasChanges = true;
|
hasChanges = true;
|
||||||
reload(page);
|
reload(page);
|
||||||
});
|
});
|
||||||
|
@ -1384,6 +1384,7 @@
|
|||||||
"ShowIndicatorsFor": "Show indicators for:",
|
"ShowIndicatorsFor": "Show indicators for:",
|
||||||
"ShowLess": "Show less",
|
"ShowLess": "Show less",
|
||||||
"ShowMore": "Show more",
|
"ShowMore": "Show more",
|
||||||
|
"ShowParentImages": "Show series images",
|
||||||
"Shows": "Shows",
|
"Shows": "Shows",
|
||||||
"ShowTitle": "Show the title",
|
"ShowTitle": "Show the title",
|
||||||
"ShowYear": "Show the year",
|
"ShowYear": "Show the year",
|
||||||
|
Loading…
Reference in New Issue
Block a user