mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
apply suggestion
This commit is contained in:
parent
7fe80dcbf1
commit
f54b13224d
2 changed files with 43 additions and 36 deletions
|
@ -89,29 +89,37 @@ import 'emby-input';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export class showEditor {
|
async function showEditor(itemType, options, availableOptions) {
|
||||||
constructor(itemType, options, availableOptions) {
|
const response = await fetch('components/imageOptionsEditor/imageOptionsEditor.template.html');
|
||||||
return import('text!./components/imageOptionsEditor/imageOptionsEditor.template.html').then(({default: template}) => {
|
const template = await response.text();
|
||||||
return new Promise((resolve) => {
|
|
||||||
const dlg = dialogHelper.createDialog({
|
var dlg = dialogHelper.createDialog({
|
||||||
size: 'small',
|
size: 'small',
|
||||||
removeOnClose: true,
|
removeOnClose: true,
|
||||||
scrollY: false
|
scrollY: false
|
||||||
});
|
|
||||||
dlg.classList.add('formDialog');
|
|
||||||
dlg.innerHTML = globalize.translateDocument(template);
|
|
||||||
dlg.addEventListener('close', () => {
|
|
||||||
saveValues(dlg, options);
|
|
||||||
});
|
|
||||||
loadValues(dlg, itemType, options, availableOptions);
|
|
||||||
dialogHelper.open(dlg).then(resolve, resolve);
|
|
||||||
dlg.querySelector('.btnCancel').addEventListener('click', () => {
|
|
||||||
dialogHelper.close(dlg);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
dlg.classList.add('formDialog');
|
||||||
|
dlg.innerHTML = globalize.translateDocument(template);
|
||||||
|
dlg.addEventListener('close', function () {
|
||||||
|
saveValues(dlg, options);
|
||||||
|
});
|
||||||
|
loadValues(dlg, itemType, options, availableOptions);
|
||||||
|
dialogHelper.open(dlg).then(() => {
|
||||||
|
return;
|
||||||
|
}).catch(() => {
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
||||||
|
dialogHelper.close(dlg);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export class editor {
|
||||||
|
constructor() {
|
||||||
|
this.show = showEditor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eslint-enable indent */
|
/* eslint-enable indent */
|
||||||
export default showEditor;
|
export default editor;
|
||||||
|
|
|
@ -306,7 +306,7 @@ import 'emby-input';
|
||||||
}
|
}
|
||||||
|
|
||||||
function showImageOptionsForType(type) {
|
function showImageOptionsForType(type) {
|
||||||
import('imageoptionseditor').then(ImageOptionsEditor => {
|
import('imageoptionseditor').then(({default: ImageOptionsEditor}) => {
|
||||||
let typeOptions = getTypeOptions(currentLibraryOptions, type);
|
let typeOptions = getTypeOptions(currentLibraryOptions, type);
|
||||||
if (!typeOptions) {
|
if (!typeOptions) {
|
||||||
typeOptions = {
|
typeOptions = {
|
||||||
|
@ -315,7 +315,8 @@ import 'emby-input';
|
||||||
currentLibraryOptions.TypeOptions.push(typeOptions);
|
currentLibraryOptions.TypeOptions.push(typeOptions);
|
||||||
}
|
}
|
||||||
const availableOptions = getTypeOptions(currentAvailableOptions || {}, type);
|
const availableOptions = getTypeOptions(currentAvailableOptions || {}, type);
|
||||||
new ImageOptionsEditor.showEditor(type, typeOptions, availableOptions);
|
const imageOptionsEditor = new ImageOptionsEditor();
|
||||||
|
imageOptionsEditor.show(type, typeOptions, availableOptions);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,25 +357,23 @@ import 'emby-input';
|
||||||
parent.querySelector('.imageFetchers').addEventListener('click', onImageFetchersContainerClick);
|
parent.querySelector('.imageFetchers').addEventListener('click', onImageFetchersContainerClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function embed(parent, contentType, libraryOptions) {
|
export async function embed(parent, contentType, libraryOptions) {
|
||||||
currentLibraryOptions = {
|
currentLibraryOptions = {
|
||||||
TypeOptions: []
|
TypeOptions: []
|
||||||
};
|
};
|
||||||
currentAvailableOptions = null;
|
currentAvailableOptions = null;
|
||||||
const isNewLibrary = null === libraryOptions;
|
const isNewLibrary = null === libraryOptions;
|
||||||
isNewLibrary && parent.classList.add('newlibrary');
|
isNewLibrary && parent.classList.add('newlibrary');
|
||||||
return import('text!./libraryoptionseditor.template.html').then(({default: template}) => {
|
const response = await fetch('components/libraryoptionseditor/libraryoptionseditor.template.html');
|
||||||
return new Promise((resolve) => {
|
const template = await response.text();
|
||||||
parent.innerHTML = globalize.translateDocument(template);
|
parent.innerHTML = globalize.translateDocument(template);
|
||||||
populateRefreshInterval(parent.querySelector('#selectAutoRefreshInterval'));
|
populateRefreshInterval(parent.querySelector('#selectAutoRefreshInterval'));
|
||||||
const promises = [populateLanguages(parent), populateCountries(parent.querySelector('#selectCountry'))];
|
const promises = [populateLanguages(parent), populateCountries(parent.querySelector('#selectCountry'))];
|
||||||
Promise.all(promises).then(() => {
|
Promise.all(promises).then(function() {
|
||||||
return setContentType(parent, contentType).then(() => {
|
return setContentType(parent, contentType).then(function() {
|
||||||
libraryOptions && setLibraryOptions(parent, libraryOptions);
|
libraryOptions && setLibraryOptions(parent, libraryOptions);
|
||||||
bindEvents(parent);
|
bindEvents(parent);
|
||||||
resolve();
|
return;
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue