1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

minify resources

This commit is contained in:
Luke Pulverenti 2017-01-27 22:16:59 -05:00
parent 8a6884abef
commit 661eeac16e
201 changed files with 203 additions and 52376 deletions

View file

@ -1,122 +1 @@
define(['jQuery', 'listViewStyle'], function ($) {
'use strict';
function loadProfiles(page) {
Dashboard.showLoadingMsg();
ApiClient.getJSON(ApiClient.getUrl("Dlna/ProfileInfos")).then(function (result) {
renderUserProfiles(page, result);
renderSystemProfiles(page, result);
Dashboard.hideLoadingMsg();
});
}
function renderUserProfiles(page, profiles) {
renderProfiles(page, page.querySelector('.customProfiles'), profiles.filter(function (p) {
return p.Type == 'User';
}));
}
function renderSystemProfiles(page, profiles) {
renderProfiles(page, page.querySelector('.systemProfiles'), profiles.filter(function (p) {
return p.Type == 'System';
}));
}
function renderProfiles(page, element, profiles) {
var html = '';
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">';
html += "<a item-icon class='clearLink listItemIconContainer' href='dlnaprofile.html?id=" + profile.Id + "'>";
html += '<i class="md-icon listItemIcon">dvr</i>';
html += "</a>";
html += '<div class="listItemBody">';
html += "<a class='clearLink' href='dlnaprofile.html?id=" + profile.Id + "'>";
html += "<div>" + profile.Name + "</div>";
//html += "<div secondary>" + task.Description + "</div>";
html += "</a>";
html += '</div>';
if (profile.Type == 'User') {
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>';
}
if (profiles.length) {
html += '</div>';
}
element.innerHTML = html;
$('.btnDeleteProfile', element).on('click', function () {
var id = this.getAttribute('data-profileid');
deleteProfile(page, id);
});
}
function deleteProfile(page, id) {
require(['confirm'], function (confirm) {
confirm(Globalize.translate('MessageConfirmProfileDeletion'), Globalize.translate('HeaderConfirmProfileDeletion')).then(function () {
Dashboard.showLoadingMsg();
ApiClient.ajax({
type: "DELETE",
url: ApiClient.getUrl("Dlna/Profiles/" + id)
}).then(function () {
Dashboard.hideLoadingMsg();
loadProfiles(page);
});
});
});
}
function getTabs() {
return [
{
href: 'dlnasettings.html',
name: Globalize.translate('TabSettings')
},
{
href: 'dlnaprofiles.html',
name: Globalize.translate('TabProfiles')
}];
}
$(document).on('pageshow', "#dlnaProfilesPage", function () {
LibraryMenu.setTabs('dlna', 1, getTabs);
var page = this;
loadProfiles(page);
});
});
define(["jQuery","listViewStyle"],function($){"use strict";function loadProfiles(page){Dashboard.showLoadingMsg(),ApiClient.getJSON(ApiClient.getUrl("Dlna/ProfileInfos")).then(function(result){renderUserProfiles(page,result),renderSystemProfiles(page,result),Dashboard.hideLoadingMsg()})}function renderUserProfiles(page,profiles){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}))}function renderProfiles(page,element,profiles){var html="";profiles.length&&(html+='<div class="paperList">');for(var i=0,length=profiles.length;i<length;i++){var profile=profiles[i];html+='<div class="listItem">',html+="<a item-icon class='clearLink listItemIconContainer' href='dlnaprofile.html?id="+profile.Id+"'>",html+='<i class="md-icon listItemIcon">dvr</i>',html+="</a>",html+='<div class="listItemBody">',html+="<a 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>"}profiles.length&&(html+="</div>"),element.innerHTML=html,$(".btnDeleteProfile",element).on("click",function(){var id=this.getAttribute("data-profileid");deleteProfile(page,id)})}function deleteProfile(page,id){require(["confirm"],function(confirm){confirm(Globalize.translate("MessageConfirmProfileDeletion"),Globalize.translate("HeaderConfirmProfileDeletion")).then(function(){Dashboard.showLoadingMsg(),ApiClient.ajax({type:"DELETE",url:ApiClient.getUrl("Dlna/Profiles/"+id)}).then(function(){Dashboard.hideLoadingMsg(),loadProfiles(page)})})})}function getTabs(){return[{href:"dlnasettings.html",name:Globalize.translate("TabSettings")},{href:"dlnaprofiles.html",name:Globalize.translate("TabProfiles")}]}$(document).on("pageshow","#dlnaProfilesPage",function(){LibraryMenu.setTabs("dlna",1,getTabs);var page=this;loadProfiles(page)})});