mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
prettify a bit and add comment in medialibrarycreator.js
This commit is contained in:
parent
dfcad4992b
commit
e9fdcd2807
1 changed files with 32 additions and 11 deletions
|
@ -43,7 +43,7 @@ define(["loading", "dialogHelper", "dom", "jQuery", "components/libraryoptionsed
|
||||||
|
|
||||||
function getCollectionTypeOptionsHtml(collectionTypeOptions) {
|
function getCollectionTypeOptionsHtml(collectionTypeOptions) {
|
||||||
return collectionTypeOptions.filter(function(i) {
|
return collectionTypeOptions.filter(function(i) {
|
||||||
return !1 !== i.isSelectable
|
return i.isSelectable
|
||||||
}).map(function(i) {
|
}).map(function(i) {
|
||||||
return '<option value="' + i.value + '">' + i.name + "</option>"
|
return '<option value="' + i.value + '">' + i.name + "</option>"
|
||||||
}).join("")
|
}).join("")
|
||||||
|
@ -53,9 +53,15 @@ define(["loading", "dialogHelper", "dom", "jQuery", "components/libraryoptionsed
|
||||||
$("#selectCollectionType", page).html(getCollectionTypeOptionsHtml(collectionTypeOptions)).val("").on("change", function() {
|
$("#selectCollectionType", page).html(getCollectionTypeOptionsHtml(collectionTypeOptions)).val("").on("change", function() {
|
||||||
var value = this.value,
|
var value = this.value,
|
||||||
dlg = $(this).parents(".dialog")[0];
|
dlg = $(this).parents(".dialog")[0];
|
||||||
if (libraryoptionseditor.setContentType(dlg.querySelector(".libraryOptions"), "mixed" == value ? "" : value), value ? dlg.querySelector(".libraryOptions").classList.remove("hide") : dlg.querySelector(".libraryOptions").classList.add("hide"), "mixed" != value) {
|
libraryoptionseditor.setContentType(dlg.querySelector(".libraryOptions"), value == "mixed" ? "" : value);
|
||||||
|
if (value)
|
||||||
|
dlg.querySelector(".libraryOptions").classList.remove("hide");
|
||||||
|
else
|
||||||
|
dlg.querySelector(".libraryOptions").classList.add("hide");
|
||||||
|
|
||||||
|
if (value != "mixed") {
|
||||||
var index = this.selectedIndex;
|
var index = this.selectedIndex;
|
||||||
if (-1 != index) {
|
if (index != -1) {
|
||||||
var name = this.options[index].innerHTML.replace("*", "").replace("&", "&");
|
var name = this.options[index].innerHTML.replace("*", "").replace("&", "&");
|
||||||
$("#txtValue", dlg).val(name);
|
$("#txtValue", dlg).val(name);
|
||||||
var folderOption = collectionTypeOptions.filter(function(i) {
|
var folderOption = collectionTypeOptions.filter(function(i) {
|
||||||
|
@ -77,7 +83,7 @@ define(["loading", "dialogHelper", "dom", "jQuery", "components/libraryoptionsed
|
||||||
require(["directorybrowser"], function(directoryBrowser) {
|
require(["directorybrowser"], function(directoryBrowser) {
|
||||||
var picker = new directoryBrowser;
|
var picker = new directoryBrowser;
|
||||||
picker.show({
|
picker.show({
|
||||||
enableNetworkSharePath: !0,
|
enableNetworkSharePath: true,
|
||||||
callback: function(path, networkSharePath) {
|
callback: function(path, networkSharePath) {
|
||||||
path && addMediaLocation(page, path, networkSharePath), picker.close()
|
path && addMediaLocation(page, path, networkSharePath), picker.close()
|
||||||
}
|
}
|
||||||
|
@ -119,6 +125,8 @@ define(["loading", "dialogHelper", "dom", "jQuery", "components/libraryoptionsed
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDialogClosed() {
|
function onDialogClosed() {
|
||||||
|
// I can't see any corresponding call to loading.show,
|
||||||
|
// so I think this is not supposed to be here.
|
||||||
loading.hide();
|
loading.hide();
|
||||||
currentResolve(hasChanges);
|
currentResolve(hasChanges);
|
||||||
}
|
}
|
||||||
|
@ -132,20 +140,33 @@ define(["loading", "dialogHelper", "dom", "jQuery", "components/libraryoptionsed
|
||||||
function editor() {
|
function editor() {
|
||||||
this.show = function(options) {
|
this.show = function(options) {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
currentOptions = options, currentResolve = resolve, hasChanges = !1;
|
currentOptions = options, currentResolve = resolve, hasChanges = false;
|
||||||
var xhr = new XMLHttpRequest;
|
var xhr = new XMLHttpRequest;
|
||||||
xhr.open("GET", "components/medialibrarycreator/medialibrarycreator.template.html", !0), xhr.onload = function(e) {
|
xhr.open("GET", "components/medialibrarycreator/medialibrarycreator.template.html", true);
|
||||||
|
xhr.onload = function(e) {
|
||||||
var template = this.response,
|
var template = this.response,
|
||||||
dlg = dialogHelper.createDialog({
|
dlg = dialogHelper.createDialog({
|
||||||
size: "medium-tall",
|
size: "medium-tall",
|
||||||
modal: false,
|
modal: false,
|
||||||
removeOnClose: !0,
|
removeOnClose: true,
|
||||||
scrollY: !1
|
scrollY: false
|
||||||
});
|
});
|
||||||
dlg.classList.add("ui-body-a"), dlg.classList.add("background-theme-a"), dlg.classList.add("dlg-librarycreator"), dlg.classList.add("formDialog"), dlg.innerHTML = Globalize.translateDocument(template), initEditor(dlg, options.collectionTypeOptions), dlg.addEventListener("close", onDialogClosed), dialogHelper.open(dlg), dlg.querySelector(".btnCancel").addEventListener("click", function() {
|
dlg.classList.add("ui-body-a");
|
||||||
|
dlg.classList.add("background-theme-a");
|
||||||
|
dlg.classList.add("dlg-librarycreator");
|
||||||
|
dlg.classList.add("formDialog");
|
||||||
|
dlg.innerHTML = Globalize.translateDocument(template);
|
||||||
|
initEditor(dlg, options.collectionTypeOptions);
|
||||||
|
dlg.addEventListener("close", onDialogClosed);
|
||||||
|
dialogHelper.open(dlg);
|
||||||
|
dlg.querySelector(".btnCancel").addEventListener("click", function() {
|
||||||
dialogHelper.close(dlg)
|
dialogHelper.close(dlg)
|
||||||
}), pathInfos = [], renderPaths(dlg), initLibraryOptions(dlg)
|
});
|
||||||
}, xhr.send()
|
pathInfos = [];
|
||||||
|
renderPaths(dlg);
|
||||||
|
initLibraryOptions(dlg);
|
||||||
|
};
|
||||||
|
xhr.send();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue