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,48 +1,75 @@
|
|||
define(["jQuery", "globalize", "loading", "libraryMenu", "listViewStyle", "emby-button"], function($, globalize, loading, libraryMenu) {
|
||||
define(["jQuery", "globalize", "loading", "libraryMenu", "listViewStyle", "emby-button"], function ($, globalize, loading, libraryMenu) {
|
||||
"use strict";
|
||||
|
||||
function loadProfiles(page) {
|
||||
loading.show(), ApiClient.getJSON(ApiClient.getUrl("Dlna/ProfileInfos")).then(function(result) {
|
||||
renderUserProfiles(page, result), renderSystemProfiles(page, result), loading.hide()
|
||||
})
|
||||
loading.show();
|
||||
ApiClient.getJSON(ApiClient.getUrl("Dlna/ProfileInfos")).then(function (result) {
|
||||
renderUserProfiles(page, result);
|
||||
renderSystemProfiles(page, result);
|
||||
loading.hide();
|
||||
});
|
||||
}
|
||||
|
||||
function renderUserProfiles(page, profiles) {
|
||||
renderProfiles(page, page.querySelector(".customProfiles"), profiles.filter(function(p) {
|
||||
return "User" == p.Type
|
||||
}))
|
||||
renderProfiles(page, page.querySelector(".customProfiles"), profiles.filter(function (p) {
|
||||
return "User" == p.Type;
|
||||
}));
|
||||
}
|
||||
|
||||
function renderSystemProfiles(page, profiles) {
|
||||
renderProfiles(page, page.querySelector(".systemProfiles"), profiles.filter(function(p) {
|
||||
return "System" == p.Type
|
||||
}))
|
||||
renderProfiles(page, page.querySelector(".systemProfiles"), profiles.filter(function (p) {
|
||||
return "System" == p.Type;
|
||||
}));
|
||||
}
|
||||
|
||||
function renderProfiles(page, element, profiles) {
|
||||
var html = "";
|
||||
profiles.length && (html += '<div class="paperList">');
|
||||
|
||||
if (profiles.length) {
|
||||
html += '<div class="paperList">';
|
||||
}
|
||||
|
||||
for (var i = 0, length = profiles.length; i < length; i++) {
|
||||
var profile = profiles[i];
|
||||
html += '<div class="listItem listItem-border">', html += '<i class="listItemIcon md-icon">live_tv</i>', html += '<div class="listItemBody two-line">', html += "<a is='emby-linkbutton' style='padding:0;margin:0;' data-ripple='false' class='clearLink' href='dlnaprofile.html?id=" + profile.Id + "'>", html += "<div>" + profile.Name + "</div>", html += "</a>", html += "</div>", "User" == profile.Type && (html += '<button type="button" is="paper-icon-button-light" class="btnDeleteProfile" data-profileid="' + profile.Id + '" title="' + globalize.translate("ButtonDelete") + '"><i class="md-icon">delete</i></button>'), html += "</div>"
|
||||
html += '<div class="listItem listItem-border">';
|
||||
html += '<i class="listItemIcon md-icon">live_tv</i>';
|
||||
html += '<div class="listItemBody two-line">';
|
||||
html += "<a is='emby-linkbutton' style='padding:0;margin:0;' data-ripple='false' class='clearLink' href='dlnaprofile.html?id=" + profile.Id + "'>";
|
||||
html += "<div>" + profile.Name + "</div>";
|
||||
html += "</a>";
|
||||
html += "</div>";
|
||||
|
||||
if ("User" == profile.Type) {
|
||||
html += '<button type="button" is="paper-icon-button-light" class="btnDeleteProfile" data-profileid="' + profile.Id + '" title="' + globalize.translate("ButtonDelete") + '"><i class="md-icon">delete</i></button>';
|
||||
}
|
||||
|
||||
html += "</div>";
|
||||
}
|
||||
profiles.length && (html += "</div>"), element.innerHTML = html, $(".btnDeleteProfile", element).on("click", function() {
|
||||
|
||||
if (profiles.length) {
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
element.innerHTML = html;
|
||||
$(".btnDeleteProfile", element).on("click", function () {
|
||||
var id = this.getAttribute("data-profileid");
|
||||
deleteProfile(page, id)
|
||||
})
|
||||
deleteProfile(page, id);
|
||||
});
|
||||
}
|
||||
|
||||
function deleteProfile(page, id) {
|
||||
require(["confirm"], function(confirm) {
|
||||
confirm(globalize.translate("MessageConfirmProfileDeletion"), globalize.translate("HeaderConfirmProfileDeletion")).then(function() {
|
||||
loading.show(), ApiClient.ajax({
|
||||
require(["confirm"], function (confirm) {
|
||||
confirm(globalize.translate("MessageConfirmProfileDeletion"), globalize.translate("HeaderConfirmProfileDeletion")).then(function () {
|
||||
loading.show();
|
||||
ApiClient.ajax({
|
||||
type: "DELETE",
|
||||
url: ApiClient.getUrl("Dlna/Profiles/" + id)
|
||||
}).then(function() {
|
||||
loading.hide(), loadProfiles(page)
|
||||
})
|
||||
})
|
||||
})
|
||||
}).then(function () {
|
||||
loading.hide();
|
||||
loadProfiles(page);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getTabs() {
|
||||
|
@ -52,10 +79,11 @@ define(["jQuery", "globalize", "loading", "libraryMenu", "listViewStyle", "emby-
|
|||
}, {
|
||||
href: "dlnaprofiles.html",
|
||||
name: globalize.translate("TabProfiles")
|
||||
}]
|
||||
}];
|
||||
}
|
||||
|
||||
$(document).on("pageshow", "#dlnaProfilesPage", function() {
|
||||
libraryMenu.setTabs("dlna", 1, getTabs), loadProfiles(this)
|
||||
})
|
||||
});
|
||||
$(document).on("pageshow", "#dlnaProfilesPage", function () {
|
||||
libraryMenu.setTabs("dlna", 1, getTabs);
|
||||
loadProfiles(this);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue