mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Deminify part 2 (#509)
This de-minifies and de-uglifies `controllers` subdirectory
This commit is contained in:
parent
f98a43f06f
commit
23677db990
66 changed files with 8296 additions and 4227 deletions
|
@ -1,14 +1,16 @@
|
|||
define(["jQuery", "loading", "fnchecked", "emby-checkbox"], function($, loading) {
|
||||
define(["jQuery", "loading", "fnchecked", "emby-checkbox"], function ($, loading) {
|
||||
"use strict";
|
||||
|
||||
function loadMediaFolders(page, mediaFolders) {
|
||||
var html = "";
|
||||
html += '<h3 class="checkboxListLabel">' + Globalize.translate("HeaderLibraries") + "</h3>";
|
||||
html += '<div class="checkboxList paperList" style="padding:.5em 1em;">';
|
||||
|
||||
for (var i = 0; i < mediaFolders.length; i++) {
|
||||
var folder = mediaFolders[i];
|
||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkFolder" data-id="' + folder.Id + '" checked="checked"/><span>' + folder.Name + "</span></label>";
|
||||
}
|
||||
|
||||
html += "</div>";
|
||||
$(".folderAccess", page).html(html).trigger("create");
|
||||
$("#chkEnableAllFolders", page).checked(true).trigger("change");
|
||||
|
@ -18,17 +20,21 @@ define(["jQuery", "loading", "fnchecked", "emby-checkbox"], function($, loading)
|
|||
var html = "";
|
||||
html += '<h3 class="checkboxListLabel">' + Globalize.translate("HeaderChannels") + "</h3>";
|
||||
html += '<div class="checkboxList paperList" style="padding:.5em 1em;">';
|
||||
|
||||
for (var i = 0; i < channels.length; i++) {
|
||||
var folder = channels[i];
|
||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkChannel" data-id="' + folder.Id + '" checked="checked"/><span>' + folder.Name + "</span></label>";
|
||||
}
|
||||
|
||||
html += "</div>";
|
||||
$(".channelAccess", page).show().html(html).trigger("create");
|
||||
|
||||
if (channels.length) {
|
||||
$(".channelAccessContainer", page).show();
|
||||
} else {
|
||||
$(".channelAccessContainer", page).hide();
|
||||
}
|
||||
|
||||
$("#chkEnableAllChannels", page).checked(true).trigger("change");
|
||||
}
|
||||
|
||||
|
@ -37,46 +43,51 @@ define(["jQuery", "loading", "fnchecked", "emby-checkbox"], function($, loading)
|
|||
$("#txtPassword", page).val("");
|
||||
loading.show();
|
||||
var promiseFolders = ApiClient.getJSON(ApiClient.getUrl("Library/MediaFolders", {
|
||||
IsHidden: false
|
||||
IsHidden: false
|
||||
}));
|
||||
var promiseChannels = ApiClient.getJSON(ApiClient.getUrl("Channels"));
|
||||
Promise.all([promiseFolders, promiseChannels]).then(function(responses) {
|
||||
Promise.all([promiseFolders, promiseChannels]).then(function (responses) {
|
||||
loadMediaFolders(page, responses[0].Items);
|
||||
loadChannels(page, responses[1].Items);
|
||||
loading.hide();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function saveUser(page) {
|
||||
var user = {};
|
||||
user.Name = $("#txtUsername", page).val();
|
||||
user.Password = $("#txtPassword", page).val();
|
||||
ApiClient.createUser(user).then(function(user) {
|
||||
ApiClient.createUser(user).then(function (user) {
|
||||
user.Policy.EnableAllFolders = $("#chkEnableAllFolders", page).checked();
|
||||
user.Policy.EnabledFolders = [];
|
||||
|
||||
if (!user.Policy.EnableAllFolders) {
|
||||
user.Policy.EnabledFolders = $(".chkFolder", page).get().filter(function(i) {
|
||||
return i.checked
|
||||
}).map(function(i) {
|
||||
user.Policy.EnabledFolders = $(".chkFolder", page).get().filter(function (i) {
|
||||
return i.checked;
|
||||
}).map(function (i) {
|
||||
return i.getAttribute("data-id");
|
||||
});
|
||||
}
|
||||
|
||||
user.Policy.EnableAllChannels = $("#chkEnableAllChannels", page).checked();
|
||||
user.Policy.EnabledChannels = [];
|
||||
|
||||
if (!user.Policy.EnableAllChannels) {
|
||||
user.Policy.EnabledChannels = $(".chkChannel", page).get().filter(function(i) {
|
||||
return i.checked
|
||||
}).map(function(i) {
|
||||
user.Policy.EnabledChannels = $(".chkChannel", page).get().filter(function (i) {
|
||||
return i.checked;
|
||||
}).map(function (i) {
|
||||
return i.getAttribute("data-id");
|
||||
});
|
||||
}
|
||||
ApiClient.updateUserPolicy(user.Id, user.Policy).then(function() {
|
||||
|
||||
ApiClient.updateUserPolicy(user.Id, user.Policy).then(function () {
|
||||
Dashboard.navigate("useredit.html?userId=" + user.Id);
|
||||
});
|
||||
}, function(response) {
|
||||
require(["toast"], function(toast) {
|
||||
}, function (response) {
|
||||
require(["toast"], function (toast) {
|
||||
toast(Globalize.translate("DefaultErrorMessage"));
|
||||
});
|
||||
|
||||
loading.hide();
|
||||
});
|
||||
}
|
||||
|
@ -92,16 +103,16 @@ define(["jQuery", "loading", "fnchecked", "emby-checkbox"], function($, loading)
|
|||
loadUser(page);
|
||||
}
|
||||
|
||||
$(document).on("pageinit", "#newUserPage", function() {
|
||||
$(document).on("pageinit", "#newUserPage", function () {
|
||||
var page = this;
|
||||
$("#chkEnableAllChannels", page).on("change", function() {
|
||||
$("#chkEnableAllChannels", page).on("change", function () {
|
||||
if (this.checked) {
|
||||
$(".channelAccessListContainer", page).hide();
|
||||
} else {
|
||||
$(".channelAccessListContainer", page).show();
|
||||
}
|
||||
});
|
||||
$("#chkEnableAllFolders", page).on("change", function() {
|
||||
$("#chkEnableAllFolders", page).on("change", function () {
|
||||
if (this.checked) {
|
||||
$(".folderAccessListContainer", page).hide();
|
||||
} else {
|
||||
|
@ -109,7 +120,7 @@ define(["jQuery", "loading", "fnchecked", "emby-checkbox"], function($, loading)
|
|||
}
|
||||
});
|
||||
$(".newUserProfileForm").off("submit", onSubmit).on("submit", onSubmit);
|
||||
}).on("pageshow", "#newUserPage", function() {
|
||||
}).on("pageshow", "#newUserPage", function () {
|
||||
loadData(this);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue