mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Beautified all js in web dashboard
This commit is contained in:
parent
5895f209e7
commit
6bfd795635
346 changed files with 72978 additions and 375 deletions
|
@ -1 +1,51 @@
|
|||
define(["dialogHelper","datetime","emby-select","paper-icon-button-light","formDialogStyle"],function(dialogHelper,datetime){"use strict";function getDisplayTime(hours){var minutes=0,pct=hours%1;return pct&&(minutes=parseInt(60*pct)),datetime.getDisplayTime(new Date(2e3,1,1,hours,minutes,0,0))}function populateHours(context){for(var html="",i=0;i<24;i++)html+='<option value="'+i+'">'+getDisplayTime(i)+"</option>";html+='<option value="24">'+getDisplayTime(0)+"</option>",context.querySelector("#selectStart").innerHTML=html,context.querySelector("#selectEnd").innerHTML=html}function loadSchedule(context,schedule){context.querySelector("#selectDay").value=schedule.DayOfWeek||"Sunday",context.querySelector("#selectStart").value=schedule.StartHour||0,context.querySelector("#selectEnd").value=schedule.EndHour||0}function submitSchedule(context,options){var updatedSchedule={DayOfWeek:context.querySelector("#selectDay").value,StartHour:context.querySelector("#selectStart").value,EndHour:context.querySelector("#selectEnd").value};if(parseFloat(updatedSchedule.StartHour)>=parseFloat(updatedSchedule.EndHour))return void alert(Globalize.translate("ErrorMessageStartHourGreaterThanEnd"));context.submitted=!0,options.schedule=Object.assign(options.schedule,updatedSchedule),dialogHelper.close(context)}return{show:function(options){return new Promise(function(resolve,reject){var xhr=new XMLHttpRequest;xhr.open("GET","components/accessschedule/accessschedule.template.html",!0),xhr.onload=function(e){var template=this.response,dlg=dialogHelper.createDialog({removeOnClose:!0,size:"small"});dlg.classList.add("formDialog");var html="";html+=Globalize.translateDocument(template),dlg.innerHTML=html,populateHours(dlg),loadSchedule(dlg,options.schedule),dialogHelper.open(dlg),dlg.addEventListener("close",function(){dlg.submitted?resolve(options.schedule):reject()}),dlg.querySelector(".btnCancel").addEventListener("click",function(e){dialogHelper.close(dlg)}),dlg.querySelector("form").addEventListener("submit",function(e){return submitSchedule(dlg,options),e.preventDefault(),!1})},xhr.send()})}}});
|
||||
define(["dialogHelper", "datetime", "emby-select", "paper-icon-button-light", "formDialogStyle"], function(dialogHelper, datetime) {
|
||||
"use strict";
|
||||
|
||||
function getDisplayTime(hours) {
|
||||
var minutes = 0,
|
||||
pct = hours % 1;
|
||||
return pct && (minutes = parseInt(60 * pct)), datetime.getDisplayTime(new Date(2e3, 1, 1, hours, minutes, 0, 0))
|
||||
}
|
||||
|
||||
function populateHours(context) {
|
||||
for (var html = "", i = 0; i < 24; i++) html += '<option value="' + i + '">' + getDisplayTime(i) + "</option>";
|
||||
html += '<option value="24">' + getDisplayTime(0) + "</option>", context.querySelector("#selectStart").innerHTML = html, context.querySelector("#selectEnd").innerHTML = html
|
||||
}
|
||||
|
||||
function loadSchedule(context, schedule) {
|
||||
context.querySelector("#selectDay").value = schedule.DayOfWeek || "Sunday", context.querySelector("#selectStart").value = schedule.StartHour || 0, context.querySelector("#selectEnd").value = schedule.EndHour || 0
|
||||
}
|
||||
|
||||
function submitSchedule(context, options) {
|
||||
var updatedSchedule = {
|
||||
DayOfWeek: context.querySelector("#selectDay").value,
|
||||
StartHour: context.querySelector("#selectStart").value,
|
||||
EndHour: context.querySelector("#selectEnd").value
|
||||
};
|
||||
if (parseFloat(updatedSchedule.StartHour) >= parseFloat(updatedSchedule.EndHour)) return void alert(Globalize.translate("ErrorMessageStartHourGreaterThanEnd"));
|
||||
context.submitted = !0, options.schedule = Object.assign(options.schedule, updatedSchedule), dialogHelper.close(context)
|
||||
}
|
||||
return {
|
||||
show: function(options) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var xhr = new XMLHttpRequest;
|
||||
xhr.open("GET", "components/accessschedule/accessschedule.template.html", !0), xhr.onload = function(e) {
|
||||
var template = this.response,
|
||||
dlg = dialogHelper.createDialog({
|
||||
removeOnClose: !0,
|
||||
size: "small"
|
||||
});
|
||||
dlg.classList.add("formDialog");
|
||||
var html = "";
|
||||
html += Globalize.translateDocument(template), dlg.innerHTML = html, populateHours(dlg), loadSchedule(dlg, options.schedule), dialogHelper.open(dlg), dlg.addEventListener("close", function() {
|
||||
dlg.submitted ? resolve(options.schedule) : reject()
|
||||
}), dlg.querySelector(".btnCancel").addEventListener("click", function(e) {
|
||||
dialogHelper.close(dlg)
|
||||
}), dlg.querySelector("form").addEventListener("submit", function(e) {
|
||||
return submitSchedule(dlg, options), e.preventDefault(), !1
|
||||
})
|
||||
}, xhr.send()
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1 +1,89 @@
|
|||
define(["events","globalize","dom","datetime","userSettings","serverNotifications","connectionManager","emby-button","listViewStyle"],function(events,globalize,dom,datetime,userSettings,serverNotifications,connectionManager){"use strict";function getEntryHtml(entry,apiClient){var html="";html+='<div class="listItem listItem-border">';var color="Error"==entry.Severity||"Fatal"==entry.Severity||"Warn"==entry.Severity?"#cc0000":"#52B54B";if(entry.UserId&&entry.UserPrimaryImageTag){html+='<i class="listItemIcon md-icon" style="width:2em!important;height:2em!important;padding:0;color:transparent;background-color:'+color+";background-image:url('"+apiClient.getUserImageUrl(entry.UserId,{type:"Primary",tag:entry.UserPrimaryImageTag,height:40})+"');background-repeat:no-repeat;background-position:center center;background-size: cover;\">dvr</i>"}else html+='<i class="listItemIcon md-icon" style="background-color:'+color+'">dvr</i>';html+='<div class="listItemBody three-line">',html+='<div class="listItemBodyText">',html+=entry.Name,html+="</div>",html+='<div class="listItemBodyText secondary">';var date=datetime.parseISO8601Date(entry.Date,!0);return html+=datetime.toLocaleString(date).toLowerCase(),html+="</div>",html+='<div class="listItemBodyText secondary listItemBodyText-nowrap">',html+=entry.ShortOverview||"",html+="</div>",html+="</div>",entry.Overview&&(html+='<button type="button" is="paper-icon-button-light" class="btnEntryInfo" data-id="'+entry.Id+'" title="'+globalize.translate("Info")+'"><i class="md-icon">info</i></button>'),html+="</div>"}function renderList(elem,apiClient,result,startIndex,limit){elem.innerHTML=result.Items.map(function(i){return getEntryHtml(i,apiClient)}).join("")}function reloadData(instance,elem,apiClient,startIndex,limit){null==startIndex&&(startIndex=parseInt(elem.getAttribute("data-activitystartindex")||"0")),limit=limit||parseInt(elem.getAttribute("data-activitylimit")||"7");var minDate=new Date,hasUserId="false"!==elem.getAttribute("data-useractivity");hasUserId?minDate.setTime(minDate.getTime()-864e5):minDate.setTime(minDate.getTime()-6048e5),ApiClient.getJSON(ApiClient.getUrl("System/ActivityLog/Entries",{startIndex:startIndex,limit:limit,minDate:minDate.toISOString(),hasUserId:hasUserId})).then(function(result){if(elem.setAttribute("data-activitystartindex",startIndex),elem.setAttribute("data-activitylimit",limit),!startIndex){var activityContainer=dom.parentWithClass(elem,"activityContainer");activityContainer&&(result.Items.length?activityContainer.classList.remove("hide"):activityContainer.classList.add("hide"))}instance.items=result.Items,renderList(elem,apiClient,result,startIndex,limit)})}function onActivityLogUpdate(e,apiClient,data){var options=this.options;options&&options.serverId===apiClient.serverId()&&reloadData(this,options.element,apiClient)}function onListClick(e){var btnEntryInfo=dom.parentWithClass(e.target,"btnEntryInfo");if(btnEntryInfo){var id=btnEntryInfo.getAttribute("data-id"),items=this.items;if(items){var item=items.filter(function(i){return i.Id.toString()===id})[0];item&&showItemOverview(item)}}}function showItemOverview(item){require(["alert"],function(alert){alert({text:item.Overview})})}function ActivityLog(options){this.options=options;var element=options.element;element.classList.add("activityLogListWidget"),element.addEventListener("click",onListClick.bind(this));var apiClient=connectionManager.getApiClient(options.serverId);reloadData(this,element,apiClient);var onUpdate=onActivityLogUpdate.bind(this);this.updateFn=onUpdate,events.on(serverNotifications,"ActivityLogEntry",onUpdate),apiClient.sendMessage("ActivityLogEntryStart","0,1500")}return ActivityLog.prototype.destroy=function(){var options=this.options;if(options){options.element.classList.remove("activityLogListWidget");connectionManager.getApiClient(options.serverId).sendMessage("ActivityLogEntryStop","0,1500")}var onUpdate=this.updateFn;onUpdate&&events.off(serverNotifications,"ActivityLogEntry",onUpdate),this.items=null,this.options=null},ActivityLog});
|
||||
define(["events", "globalize", "dom", "datetime", "userSettings", "serverNotifications", "connectionManager", "emby-button", "listViewStyle"], function(events, globalize, dom, datetime, userSettings, serverNotifications, connectionManager) {
|
||||
"use strict";
|
||||
|
||||
function getEntryHtml(entry, apiClient) {
|
||||
var html = "";
|
||||
html += '<div class="listItem listItem-border">';
|
||||
var color = "Error" == entry.Severity || "Fatal" == entry.Severity || "Warn" == entry.Severity ? "#cc0000" : "#52B54B";
|
||||
if (entry.UserId && entry.UserPrimaryImageTag) {
|
||||
html += '<i class="listItemIcon md-icon" style="width:2em!important;height:2em!important;padding:0;color:transparent;background-color:' + color + ";background-image:url('" + apiClient.getUserImageUrl(entry.UserId, {
|
||||
type: "Primary",
|
||||
tag: entry.UserPrimaryImageTag,
|
||||
height: 40
|
||||
}) + "');background-repeat:no-repeat;background-position:center center;background-size: cover;\">dvr</i>"
|
||||
} else html += '<i class="listItemIcon md-icon" style="background-color:' + color + '">dvr</i>';
|
||||
html += '<div class="listItemBody three-line">', html += '<div class="listItemBodyText">', html += entry.Name, html += "</div>", html += '<div class="listItemBodyText secondary">';
|
||||
var date = datetime.parseISO8601Date(entry.Date, !0);
|
||||
return html += datetime.toLocaleString(date).toLowerCase(), html += "</div>", html += '<div class="listItemBodyText secondary listItemBodyText-nowrap">', html += entry.ShortOverview || "", html += "</div>", html += "</div>", entry.Overview && (html += '<button type="button" is="paper-icon-button-light" class="btnEntryInfo" data-id="' + entry.Id + '" title="' + globalize.translate("Info") + '"><i class="md-icon">info</i></button>'), html += "</div>"
|
||||
}
|
||||
|
||||
function renderList(elem, apiClient, result, startIndex, limit) {
|
||||
elem.innerHTML = result.Items.map(function(i) {
|
||||
return getEntryHtml(i, apiClient)
|
||||
}).join("")
|
||||
}
|
||||
|
||||
function reloadData(instance, elem, apiClient, startIndex, limit) {
|
||||
null == startIndex && (startIndex = parseInt(elem.getAttribute("data-activitystartindex") || "0")), limit = limit || parseInt(elem.getAttribute("data-activitylimit") || "7");
|
||||
var minDate = new Date,
|
||||
hasUserId = "false" !== elem.getAttribute("data-useractivity");
|
||||
hasUserId ? minDate.setTime(minDate.getTime() - 864e5) : minDate.setTime(minDate.getTime() - 6048e5), ApiClient.getJSON(ApiClient.getUrl("System/ActivityLog/Entries", {
|
||||
startIndex: startIndex,
|
||||
limit: limit,
|
||||
minDate: minDate.toISOString(),
|
||||
hasUserId: hasUserId
|
||||
})).then(function(result) {
|
||||
if (elem.setAttribute("data-activitystartindex", startIndex), elem.setAttribute("data-activitylimit", limit), !startIndex) {
|
||||
var activityContainer = dom.parentWithClass(elem, "activityContainer");
|
||||
activityContainer && (result.Items.length ? activityContainer.classList.remove("hide") : activityContainer.classList.add("hide"))
|
||||
}
|
||||
instance.items = result.Items, renderList(elem, apiClient, result, startIndex, limit)
|
||||
})
|
||||
}
|
||||
|
||||
function onActivityLogUpdate(e, apiClient, data) {
|
||||
var options = this.options;
|
||||
options && options.serverId === apiClient.serverId() && reloadData(this, options.element, apiClient)
|
||||
}
|
||||
|
||||
function onListClick(e) {
|
||||
var btnEntryInfo = dom.parentWithClass(e.target, "btnEntryInfo");
|
||||
if (btnEntryInfo) {
|
||||
var id = btnEntryInfo.getAttribute("data-id"),
|
||||
items = this.items;
|
||||
if (items) {
|
||||
var item = items.filter(function(i) {
|
||||
return i.Id.toString() === id
|
||||
})[0];
|
||||
item && showItemOverview(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showItemOverview(item) {
|
||||
require(["alert"], function(alert) {
|
||||
alert({
|
||||
text: item.Overview
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function ActivityLog(options) {
|
||||
this.options = options;
|
||||
var element = options.element;
|
||||
element.classList.add("activityLogListWidget"), element.addEventListener("click", onListClick.bind(this));
|
||||
var apiClient = connectionManager.getApiClient(options.serverId);
|
||||
reloadData(this, element, apiClient);
|
||||
var onUpdate = onActivityLogUpdate.bind(this);
|
||||
this.updateFn = onUpdate, events.on(serverNotifications, "ActivityLogEntry", onUpdate), apiClient.sendMessage("ActivityLogEntryStart", "0,1500")
|
||||
}
|
||||
return ActivityLog.prototype.destroy = function() {
|
||||
var options = this.options;
|
||||
if (options) {
|
||||
options.element.classList.remove("activityLogListWidget");
|
||||
connectionManager.getApiClient(options.serverId).sendMessage("ActivityLogEntryStop", "0,1500")
|
||||
}
|
||||
var onUpdate = this.updateFn;
|
||||
onUpdate && events.off(serverNotifications, "ActivityLogEntry", onUpdate), this.items = null, this.options = null
|
||||
}, ActivityLog
|
||||
});
|
|
@ -1 +1,31 @@
|
|||
define(["itemHelper","libraryMenu","apphost"],function(itemHelper,libraryMenu,appHost){"use strict";function initSyncButtons(view){var apiClient=window.ApiClient;apiClient&&apiClient.getCurrentUserId()&&apiClient.getCurrentUser().then(function(user){for(var item={SupportsSync:!0},categorySyncButtons=view.querySelectorAll(".categorySyncButton"),i=0,length=categorySyncButtons.length;i<length;i++)categorySyncButtons[i].addEventListener("click",onCategorySyncButtonClick),itemHelper.canSync(user,item)?categorySyncButtons[i].classList.remove("hide"):categorySyncButtons[i].classList.add("hide")})}function onCategorySyncButtonClick(e){var button=this,category=button.getAttribute("data-category"),parentId=libraryMenu.getTopParentId();require(["syncDialog"],function(syncDialog){syncDialog.showMenu({ParentId:parentId,Category:category,serverId:ApiClient.serverId(),mode:appHost.supports("sync")?"download":"sync"})})}return{init:function(view){initSyncButtons(view)}}});
|
||||
define(["itemHelper", "libraryMenu", "apphost"], function(itemHelper, libraryMenu, appHost) {
|
||||
"use strict";
|
||||
|
||||
function initSyncButtons(view) {
|
||||
var apiClient = window.ApiClient;
|
||||
apiClient && apiClient.getCurrentUserId() && apiClient.getCurrentUser().then(function(user) {
|
||||
for (var item = {
|
||||
SupportsSync: !0
|
||||
}, categorySyncButtons = view.querySelectorAll(".categorySyncButton"), i = 0, length = categorySyncButtons.length; i < length; i++) categorySyncButtons[i].addEventListener("click", onCategorySyncButtonClick), itemHelper.canSync(user, item) ? categorySyncButtons[i].classList.remove("hide") : categorySyncButtons[i].classList.add("hide")
|
||||
})
|
||||
}
|
||||
|
||||
function onCategorySyncButtonClick(e) {
|
||||
var button = this,
|
||||
category = button.getAttribute("data-category"),
|
||||
parentId = libraryMenu.getTopParentId();
|
||||
require(["syncDialog"], function(syncDialog) {
|
||||
syncDialog.showMenu({
|
||||
ParentId: parentId,
|
||||
Category: category,
|
||||
serverId: ApiClient.serverId(),
|
||||
mode: appHost.supports("sync") ? "download" : "sync"
|
||||
})
|
||||
})
|
||||
}
|
||||
return {
|
||||
init: function(view) {
|
||||
initSyncButtons(view)
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1 +1,96 @@
|
|||
define(["dialogHelper","loading","connectionManager","globalize","actionsheet","emby-input","paper-icon-button-light","emby-button","listViewStyle","material-icons","formDialogStyle"],function(dialogHelper,loading,connectionManager,globalize,actionsheet){"use strict";return function(options){function parentWithClass(elem,className){for(;!elem.classList||!elem.classList.contains(className);)if(!(elem=elem.parentNode))return null;return elem}function mapChannel(button,channelId,providerChannelId){loading.show();var providerId=options.providerId;connectionManager.getApiClient(options.serverId).ajax({type:"POST",url:ApiClient.getUrl("LiveTv/ChannelMappings"),data:{providerId:providerId,tunerChannelId:channelId,providerChannelId:providerChannelId},dataType:"json"}).then(function(mapping){var listItem=parentWithClass(button,"listItem");button.setAttribute("data-providerid",mapping.ProviderChannelId),listItem.querySelector(".secondary").innerHTML=getMappingSecondaryName(mapping,currentMappingOptions.ProviderName),loading.hide()})}function onChannelsElementClick(e){var btnMap=parentWithClass(e.target,"btnMap");if(btnMap){var channelId=btnMap.getAttribute("data-id"),providerChannelId=btnMap.getAttribute("data-providerid"),menuItems=currentMappingOptions.ProviderChannels.map(function(m){return{name:m.Name,id:m.Id,selected:m.Id.toLowerCase()===providerChannelId.toLowerCase()}});actionsheet.show({positionTo:btnMap,items:menuItems}).then(function(newChannelId){mapChannel(btnMap,channelId,newChannelId)})}}function getChannelMappingOptions(serverId,providerId){var apiClient=connectionManager.getApiClient(serverId);return apiClient.getJSON(apiClient.getUrl("LiveTv/ChannelMappingOptions",{providerId:providerId}))}function getMappingSecondaryName(mapping,providerName){return(mapping.ProviderChannelName||"")+" - "+providerName}function getTunerChannelHtml(channel,providerName){var html="";return html+='<div class="listItem">',html+='<i class="md-icon listItemIcon">dvr</i>',html+='<div class="listItemBody two-line">',html+='<h3 class="listItemBodyText">',html+=channel.Name,html+="</h3>",html+='<div class="secondary listItemBodyText">',channel.ProviderChannelName&&(html+=getMappingSecondaryName(channel,providerName)),html+="</div>",html+="</div>",html+='<button class="btnMap autoSize" is="paper-icon-button-light" type="button" data-id="'+channel.Id+'" data-providerid="'+channel.ProviderChannelId+'"><i class="md-icon">mode_edit</i></button>',html+="</div>"}function getEditorHtml(){var html="";return html+='<div class="formDialogContent">',html+='<div class="dialogContentInner dialog-content-centered">',html+='<form style="margin:auto;">',html+="<h1>"+globalize.translate("HeaderChannels")+"</h1>",html+='<div class="channels paperList">',html+="</div>",html+="</form>",html+="</div>",html+="</div>"}function initEditor(dlg,options){getChannelMappingOptions(options.serverId,options.providerId).then(function(result){currentMappingOptions=result;var channelsElement=dlg.querySelector(".channels");channelsElement.innerHTML=result.TunerChannels.map(function(channel){return getTunerChannelHtml(channel,result.ProviderName)}).join(""),channelsElement.addEventListener("click",onChannelsElementClick)})}var currentMappingOptions,self=this;self.show=function(){var dialogOptions={removeOnClose:!0};dialogOptions.size="small";var dlg=dialogHelper.createDialog(dialogOptions);dlg.classList.add("formDialog"),dlg.classList.add("ui-body-a"),dlg.classList.add("background-theme-a");var html="",title=globalize.translate("MapChannels");return html+='<div class="formDialogHeader">',html+='<button is="paper-icon-button-light" class="btnCancel autoSize" tabindex="-1"><i class="md-icon"></i></button>',html+='<h3 class="formDialogHeaderTitle">',html+=title,html+="</h3>",html+="</div>",html+=getEditorHtml(),dlg.innerHTML=html,initEditor(dlg,options),dlg.querySelector(".btnCancel").addEventListener("click",function(){dialogHelper.close(dlg)}),new Promise(function(resolve,reject){dlg.addEventListener("close",resolve),dialogHelper.open(dlg)})}}});
|
||||
define(["dialogHelper", "loading", "connectionManager", "globalize", "actionsheet", "emby-input", "paper-icon-button-light", "emby-button", "listViewStyle", "material-icons", "formDialogStyle"], function(dialogHelper, loading, connectionManager, globalize, actionsheet) {
|
||||
"use strict";
|
||||
return function(options) {
|
||||
function parentWithClass(elem, className) {
|
||||
for (; !elem.classList || !elem.classList.contains(className);)
|
||||
if (!(elem = elem.parentNode)) return null;
|
||||
return elem
|
||||
}
|
||||
|
||||
function mapChannel(button, channelId, providerChannelId) {
|
||||
loading.show();
|
||||
var providerId = options.providerId;
|
||||
connectionManager.getApiClient(options.serverId).ajax({
|
||||
type: "POST",
|
||||
url: ApiClient.getUrl("LiveTv/ChannelMappings"),
|
||||
data: {
|
||||
providerId: providerId,
|
||||
tunerChannelId: channelId,
|
||||
providerChannelId: providerChannelId
|
||||
},
|
||||
dataType: "json"
|
||||
}).then(function(mapping) {
|
||||
var listItem = parentWithClass(button, "listItem");
|
||||
button.setAttribute("data-providerid", mapping.ProviderChannelId), listItem.querySelector(".secondary").innerHTML = getMappingSecondaryName(mapping, currentMappingOptions.ProviderName), loading.hide()
|
||||
})
|
||||
}
|
||||
|
||||
function onChannelsElementClick(e) {
|
||||
var btnMap = parentWithClass(e.target, "btnMap");
|
||||
if (btnMap) {
|
||||
var channelId = btnMap.getAttribute("data-id"),
|
||||
providerChannelId = btnMap.getAttribute("data-providerid"),
|
||||
menuItems = currentMappingOptions.ProviderChannels.map(function(m) {
|
||||
return {
|
||||
name: m.Name,
|
||||
id: m.Id,
|
||||
selected: m.Id.toLowerCase() === providerChannelId.toLowerCase()
|
||||
}
|
||||
});
|
||||
actionsheet.show({
|
||||
positionTo: btnMap,
|
||||
items: menuItems
|
||||
}).then(function(newChannelId) {
|
||||
mapChannel(btnMap, channelId, newChannelId)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function getChannelMappingOptions(serverId, providerId) {
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
return apiClient.getJSON(apiClient.getUrl("LiveTv/ChannelMappingOptions", {
|
||||
providerId: providerId
|
||||
}))
|
||||
}
|
||||
|
||||
function getMappingSecondaryName(mapping, providerName) {
|
||||
return (mapping.ProviderChannelName || "") + " - " + providerName
|
||||
}
|
||||
|
||||
function getTunerChannelHtml(channel, providerName) {
|
||||
var html = "";
|
||||
return html += '<div class="listItem">', html += '<i class="md-icon listItemIcon">dvr</i>', html += '<div class="listItemBody two-line">', html += '<h3 class="listItemBodyText">', html += channel.Name, html += "</h3>", html += '<div class="secondary listItemBodyText">', channel.ProviderChannelName && (html += getMappingSecondaryName(channel, providerName)), html += "</div>", html += "</div>", html += '<button class="btnMap autoSize" is="paper-icon-button-light" type="button" data-id="' + channel.Id + '" data-providerid="' + channel.ProviderChannelId + '"><i class="md-icon">mode_edit</i></button>', html += "</div>"
|
||||
}
|
||||
|
||||
function getEditorHtml() {
|
||||
var html = "";
|
||||
return html += '<div class="formDialogContent">', html += '<div class="dialogContentInner dialog-content-centered">', html += '<form style="margin:auto;">', html += "<h1>" + globalize.translate("HeaderChannels") + "</h1>", html += '<div class="channels paperList">', html += "</div>", html += "</form>", html += "</div>", html += "</div>"
|
||||
}
|
||||
|
||||
function initEditor(dlg, options) {
|
||||
getChannelMappingOptions(options.serverId, options.providerId).then(function(result) {
|
||||
currentMappingOptions = result;
|
||||
var channelsElement = dlg.querySelector(".channels");
|
||||
channelsElement.innerHTML = result.TunerChannels.map(function(channel) {
|
||||
return getTunerChannelHtml(channel, result.ProviderName)
|
||||
}).join(""), channelsElement.addEventListener("click", onChannelsElementClick)
|
||||
})
|
||||
}
|
||||
var currentMappingOptions, self = this;
|
||||
self.show = function() {
|
||||
var dialogOptions = {
|
||||
removeOnClose: !0
|
||||
};
|
||||
dialogOptions.size = "small";
|
||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
||||
dlg.classList.add("formDialog"), dlg.classList.add("ui-body-a"), dlg.classList.add("background-theme-a");
|
||||
var html = "",
|
||||
title = globalize.translate("MapChannels");
|
||||
return html += '<div class="formDialogHeader">', html += '<button is="paper-icon-button-light" class="btnCancel autoSize" tabindex="-1"><i class="md-icon"></i></button>', html += '<h3 class="formDialogHeaderTitle">', html += title, html += "</h3>", html += "</div>", html += getEditorHtml(), dlg.innerHTML = html, initEditor(dlg, options), dlg.querySelector(".btnCancel").addEventListener("click", function() {
|
||||
dialogHelper.close(dlg)
|
||||
}), new Promise(function(resolve, reject) {
|
||||
dlg.addEventListener("close", resolve), dialogHelper.open(dlg)
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +1,32 @@
|
|||
define(["dom","appRouter","connectionManager"],function(dom,appRouter,connectionManager){"use strict";function onGroupedCardClick(e,card){var itemId=card.getAttribute("data-id"),serverId=card.getAttribute("data-serverid"),apiClient=connectionManager.getApiClient(serverId),userId=apiClient.getCurrentUserId(),playedIndicator=card.querySelector(".playedIndicator"),playedIndicatorHtml=playedIndicator?playedIndicator.innerHTML:null,options={Limit:parseInt(playedIndicatorHtml||"10"),Fields:"PrimaryImageAspectRatio,DateCreated",ParentId:itemId,GroupItems:!1},actionableParent=dom.parentWithTag(e.target,["A","BUTTON","INPUT"]);if(!actionableParent||actionableParent.classList.contains("cardContent"))return apiClient.getJSON(apiClient.getUrl("Users/"+userId+"/Items/Latest",options)).then(function(items){if(1===items.length)return void appRouter.showItem(items[0]);var url="itemdetails.html?id="+itemId+"&serverId="+serverId;Dashboard.navigate(url)}),e.stopPropagation(),e.preventDefault(),!1}function onItemsContainerClick(e){var groupedCard=dom.parentWithClass(e.target,"groupedCard");groupedCard&&onGroupedCardClick(e,groupedCard)}return{onItemsContainerClick:onItemsContainerClick}});
|
||||
define(["dom", "appRouter", "connectionManager"], function(dom, appRouter, connectionManager) {
|
||||
"use strict";
|
||||
|
||||
function onGroupedCardClick(e, card) {
|
||||
var itemId = card.getAttribute("data-id"),
|
||||
serverId = card.getAttribute("data-serverid"),
|
||||
apiClient = connectionManager.getApiClient(serverId),
|
||||
userId = apiClient.getCurrentUserId(),
|
||||
playedIndicator = card.querySelector(".playedIndicator"),
|
||||
playedIndicatorHtml = playedIndicator ? playedIndicator.innerHTML : null,
|
||||
options = {
|
||||
Limit: parseInt(playedIndicatorHtml || "10"),
|
||||
Fields: "PrimaryImageAspectRatio,DateCreated",
|
||||
ParentId: itemId,
|
||||
GroupItems: !1
|
||||
},
|
||||
actionableParent = dom.parentWithTag(e.target, ["A", "BUTTON", "INPUT"]);
|
||||
if (!actionableParent || actionableParent.classList.contains("cardContent")) return apiClient.getJSON(apiClient.getUrl("Users/" + userId + "/Items/Latest", options)).then(function(items) {
|
||||
if (1 === items.length) return void appRouter.showItem(items[0]);
|
||||
var url = "itemdetails.html?id=" + itemId + "&serverId=" + serverId;
|
||||
Dashboard.navigate(url)
|
||||
}), e.stopPropagation(), e.preventDefault(), !1
|
||||
}
|
||||
|
||||
function onItemsContainerClick(e) {
|
||||
var groupedCard = dom.parentWithClass(e.target, "groupedCard");
|
||||
groupedCard && onGroupedCardClick(e, groupedCard)
|
||||
}
|
||||
return {
|
||||
onItemsContainerClick: onItemsContainerClick
|
||||
}
|
||||
});
|
|
@ -1 +1,32 @@
|
|||
define(["dialogHelper","connectHelper","emby-input","emby-button","emby-collapse","paper-icon-button-light","formDialogStyle","emby-linkbutton"],function(dialogHelper,connectHelper){"use strict";return{show:function(){return new Promise(function(resolve,reject){var xhr=new XMLHttpRequest;xhr.open("GET","components/guestinviter/connectlink.template.html",!0),xhr.onload=function(e){var template=this.response,dlg=dialogHelper.createDialog({removeOnClose:!0,size:"small"});dlg.classList.add("ui-body-a"),dlg.classList.add("background-theme-a"),dlg.classList.add("formDialog");var html="";html+=Globalize.translateDocument(template),dlg.innerHTML=html,dialogHelper.open(dlg),dlg.addEventListener("close",function(){dlg.submitted?resolve():reject()}),dlg.querySelector(".btnCancel").addEventListener("click",function(e){dialogHelper.close(dlg)}),dlg.querySelector("form").addEventListener("submit",function(e){return ApiClient.getCurrentUser().then(function(user){connectHelper.updateUserLink(ApiClient,user,dlg.querySelector("#txtConnectUsername").value).then(function(){dialogHelper.close(dlg)},function(){dialogHelper.close(dlg)})}),e.preventDefault(),!1})},xhr.send()})}}});
|
||||
define(["dialogHelper", "connectHelper", "emby-input", "emby-button", "emby-collapse", "paper-icon-button-light", "formDialogStyle", "emby-linkbutton"], function(dialogHelper, connectHelper) {
|
||||
"use strict";
|
||||
return {
|
||||
show: function() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var xhr = new XMLHttpRequest;
|
||||
xhr.open("GET", "components/guestinviter/connectlink.template.html", !0), xhr.onload = function(e) {
|
||||
var template = this.response,
|
||||
dlg = dialogHelper.createDialog({
|
||||
removeOnClose: !0,
|
||||
size: "small"
|
||||
});
|
||||
dlg.classList.add("ui-body-a"), dlg.classList.add("background-theme-a"), dlg.classList.add("formDialog");
|
||||
var html = "";
|
||||
html += Globalize.translateDocument(template), dlg.innerHTML = html, dialogHelper.open(dlg), dlg.addEventListener("close", function() {
|
||||
dlg.submitted ? resolve() : reject()
|
||||
}), dlg.querySelector(".btnCancel").addEventListener("click", function(e) {
|
||||
dialogHelper.close(dlg)
|
||||
}), dlg.querySelector("form").addEventListener("submit", function(e) {
|
||||
return ApiClient.getCurrentUser().then(function(user) {
|
||||
connectHelper.updateUserLink(ApiClient, user, dlg.querySelector("#txtConnectUsername").value).then(function() {
|
||||
dialogHelper.close(dlg)
|
||||
}, function() {
|
||||
dialogHelper.close(dlg)
|
||||
})
|
||||
}), e.preventDefault(), !1
|
||||
})
|
||||
}, xhr.send()
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1 +1,58 @@
|
|||
define(["dialogHelper","loading","require","emby-input","emby-button","emby-checkbox","paper-icon-button-light","formDialogStyle","emby-linkbutton"],function(dialogHelper,loading,require){"use strict";function renderLibrarySharingList(context,result){var folderHtml="";folderHtml+=result.Items.map(function(i){var currentHtml="";return currentHtml+='<label><input is="emby-checkbox" class="chkShareFolder" type="checkbox" data-folderid="'+i.Id+'" checked="checked"/><span>'+i.Name+"</span></label>"}).join(""),context.querySelector(".librarySharingList").innerHTML=folderHtml}function inviteUser(dlg){loading.show();var shareExcludes=Array.prototype.filter.call(dlg.querySelectorAll(".chkShareFolder"),function(i){return i.checked}).map(function(i){return i.getAttribute("data-folderid")});require(["connectHelper"],function(connectHelper){connectHelper.inviteGuest({apiClient:ApiClient,guestOptions:{ConnectUsername:dlg.querySelector("#txtConnectUsername").value,EnabledLibraries:shareExcludes.join(","),SendingUserId:Dashboard.getCurrentUserId(),EnableLiveTv:!1}}).then(function(){loading.hide(),dlg.submitted=!0,dialogHelper.close(dlg)})})}return{show:function(){return new Promise(function(resolve,reject){require(["text!./guestinviter.template.html"],function(template){var dlg=dialogHelper.createDialog({removeOnClose:!0,size:"small"});dlg.classList.add("ui-body-a"),dlg.classList.add("background-theme-a"),dlg.classList.add("formDialog");var html="";html+=Globalize.translateDocument(template),dlg.innerHTML=html,dialogHelper.open(dlg),dlg.addEventListener("close",function(){dlg.submitted?resolve():reject()}),dlg.querySelector(".btnCancel").addEventListener("click",function(e){dialogHelper.close(dlg)}),dlg.querySelector("form").addEventListener("submit",function(e){return inviteUser(dlg),e.preventDefault(),!1}),ApiClient.getJSON(ApiClient.getUrl("Library/MediaFolders",{IsHidden:!1})).then(function(result){renderLibrarySharingList(dlg,result)})})})}}});
|
||||
define(["dialogHelper", "loading", "require", "emby-input", "emby-button", "emby-checkbox", "paper-icon-button-light", "formDialogStyle", "emby-linkbutton"], function(dialogHelper, loading, require) {
|
||||
"use strict";
|
||||
|
||||
function renderLibrarySharingList(context, result) {
|
||||
var folderHtml = "";
|
||||
folderHtml += result.Items.map(function(i) {
|
||||
var currentHtml = "";
|
||||
return currentHtml += '<label><input is="emby-checkbox" class="chkShareFolder" type="checkbox" data-folderid="' + i.Id + '" checked="checked"/><span>' + i.Name + "</span></label>"
|
||||
}).join(""), context.querySelector(".librarySharingList").innerHTML = folderHtml
|
||||
}
|
||||
|
||||
function inviteUser(dlg) {
|
||||
loading.show();
|
||||
var shareExcludes = Array.prototype.filter.call(dlg.querySelectorAll(".chkShareFolder"), function(i) {
|
||||
return i.checked
|
||||
}).map(function(i) {
|
||||
return i.getAttribute("data-folderid")
|
||||
});
|
||||
require(["connectHelper"], function(connectHelper) {
|
||||
connectHelper.inviteGuest({
|
||||
apiClient: ApiClient,
|
||||
guestOptions: {
|
||||
ConnectUsername: dlg.querySelector("#txtConnectUsername").value,
|
||||
EnabledLibraries: shareExcludes.join(","),
|
||||
SendingUserId: Dashboard.getCurrentUserId(),
|
||||
EnableLiveTv: !1
|
||||
}
|
||||
}).then(function() {
|
||||
loading.hide(), dlg.submitted = !0, dialogHelper.close(dlg)
|
||||
})
|
||||
})
|
||||
}
|
||||
return {
|
||||
show: function() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
require(["text!./guestinviter.template.html"], function(template) {
|
||||
var dlg = dialogHelper.createDialog({
|
||||
removeOnClose: !0,
|
||||
size: "small"
|
||||
});
|
||||
dlg.classList.add("ui-body-a"), dlg.classList.add("background-theme-a"), dlg.classList.add("formDialog");
|
||||
var html = "";
|
||||
html += Globalize.translateDocument(template), dlg.innerHTML = html, dialogHelper.open(dlg), dlg.addEventListener("close", function() {
|
||||
dlg.submitted ? resolve() : reject()
|
||||
}), dlg.querySelector(".btnCancel").addEventListener("click", function(e) {
|
||||
dialogHelper.close(dlg)
|
||||
}), dlg.querySelector("form").addEventListener("submit", function(e) {
|
||||
return inviteUser(dlg), e.preventDefault(), !1
|
||||
}), ApiClient.getJSON(ApiClient.getUrl("Library/MediaFolders", {
|
||||
IsHidden: !1
|
||||
})).then(function(result) {
|
||||
renderLibrarySharingList(dlg, result)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1 +1,28 @@
|
|||
define(["datetime"],function(datetime){"use strict";function humane_date(date_str){var format,time_formats=[[90,"a minute"],[3600,"minutes",60],[5400,"an hour"],[86400,"hours",3600],[129600,"a day"],[604800,"days",86400],[907200,"a week"],[2628e3,"weeks",604800],[3942e3,"a month"],[31536e3,"months",2628e3],[47304e3,"a year"],[31536e5,"years",31536e3]],dt=new Date,date=datetime.parseISO8601Date(date_str,!0),seconds=(dt-date)/1e3,i=0;for(seconds<0&&(seconds=Math.abs(seconds));format=time_formats[i++];)if(seconds<format[0])return 2==format.length?format[1]+" ago":Math.round(seconds/format[2])+" "+format[1]+" ago";return seconds>47304e5?Math.round(seconds/47304e5)+" centuries ago":date_str}return window.humane_date=humane_date,humane_date});
|
||||
define(["datetime"], function(datetime) {
|
||||
"use strict";
|
||||
|
||||
function humane_date(date_str) {
|
||||
var format, time_formats = [
|
||||
[90, "a minute"],
|
||||
[3600, "minutes", 60],
|
||||
[5400, "an hour"],
|
||||
[86400, "hours", 3600],
|
||||
[129600, "a day"],
|
||||
[604800, "days", 86400],
|
||||
[907200, "a week"],
|
||||
[2628e3, "weeks", 604800],
|
||||
[3942e3, "a month"],
|
||||
[31536e3, "months", 2628e3],
|
||||
[47304e3, "a year"],
|
||||
[31536e5, "years", 31536e3]
|
||||
],
|
||||
dt = new Date,
|
||||
date = datetime.parseISO8601Date(date_str, !0),
|
||||
seconds = (dt - date) / 1e3,
|
||||
i = 0;
|
||||
for (seconds < 0 && (seconds = Math.abs(seconds)); format = time_formats[i++];)
|
||||
if (seconds < format[0]) return 2 == format.length ? format[1] + " ago" : Math.round(seconds / format[2]) + " " + format[1] + " ago";
|
||||
return seconds > 47304e5 ? Math.round(seconds / 47304e5) + " centuries ago" : date_str
|
||||
}
|
||||
return window.humane_date = humane_date, humane_date
|
||||
});
|
|
@ -1 +1,57 @@
|
|||
define(["globalize","shell","browser","apphost"],function(globalize,shell,browser,appHost){"use strict";function getProductInfo(feature){return null}function getPremiumInfoUrl(){return"https://emby.media/premiere"}function beginPurchase(feature,email){appHost.supports("externalpremium")?shell.openUrl(getPremiumInfoUrl()):require(["alert"],function(alert){alert("Please visit "+getPremiumInfoUrl())})}function restorePurchase(id){return Promise.reject()}function getSubscriptionOptions(){var options=[];return options.push({id:"embypremiere",title:globalize.translate("sharedcomponents#HeaderBecomeProjectSupporter"),requiresEmail:!1}),Promise.resolve(options)}function isUnlockedByDefault(feature,options){return"playback"===feature||"livetv"===feature?Promise.resolve():Promise.reject()}function getAdminFeatureName(feature){return feature}function getRestoreButtonText(){return globalize.translate("sharedcomponents#HeaderAlreadyPaid")}function getPeriodicMessageIntervalMs(feature){return 0}return{getProductInfo:getProductInfo,beginPurchase:beginPurchase,restorePurchase:restorePurchase,getSubscriptionOptions:getSubscriptionOptions,isUnlockedByDefault:isUnlockedByDefault,getAdminFeatureName:getAdminFeatureName,getRestoreButtonText:getRestoreButtonText,getPeriodicMessageIntervalMs:getPeriodicMessageIntervalMs,getPremiumInfoUrl:getPremiumInfoUrl}});
|
||||
define(["globalize", "shell", "browser", "apphost"], function(globalize, shell, browser, appHost) {
|
||||
"use strict";
|
||||
|
||||
function getProductInfo(feature) {
|
||||
return null
|
||||
}
|
||||
|
||||
function getPremiumInfoUrl() {
|
||||
return "https://emby.media/premiere"
|
||||
}
|
||||
|
||||
function beginPurchase(feature, email) {
|
||||
appHost.supports("externalpremium") ? shell.openUrl(getPremiumInfoUrl()) : require(["alert"], function(alert) {
|
||||
alert("Please visit " + getPremiumInfoUrl())
|
||||
})
|
||||
}
|
||||
|
||||
function restorePurchase(id) {
|
||||
return Promise.reject()
|
||||
}
|
||||
|
||||
function getSubscriptionOptions() {
|
||||
var options = [];
|
||||
return options.push({
|
||||
id: "embypremiere",
|
||||
title: globalize.translate("sharedcomponents#HeaderBecomeProjectSupporter"),
|
||||
requiresEmail: !1
|
||||
}), Promise.resolve(options)
|
||||
}
|
||||
|
||||
function isUnlockedByDefault(feature, options) {
|
||||
return "playback" === feature || "livetv" === feature ? Promise.resolve() : Promise.reject()
|
||||
}
|
||||
|
||||
function getAdminFeatureName(feature) {
|
||||
return feature
|
||||
}
|
||||
|
||||
function getRestoreButtonText() {
|
||||
return globalize.translate("sharedcomponents#HeaderAlreadyPaid")
|
||||
}
|
||||
|
||||
function getPeriodicMessageIntervalMs(feature) {
|
||||
return 0
|
||||
}
|
||||
return {
|
||||
getProductInfo: getProductInfo,
|
||||
beginPurchase: beginPurchase,
|
||||
restorePurchase: restorePurchase,
|
||||
getSubscriptionOptions: getSubscriptionOptions,
|
||||
isUnlockedByDefault: isUnlockedByDefault,
|
||||
getAdminFeatureName: getAdminFeatureName,
|
||||
getRestoreButtonText: getRestoreButtonText,
|
||||
getPeriodicMessageIntervalMs: getPeriodicMessageIntervalMs,
|
||||
getPremiumInfoUrl: getPremiumInfoUrl
|
||||
}
|
||||
});
|
|
@ -1 +1,77 @@
|
|||
define(["globalize","dom","dialogHelper","emby-checkbox","emby-select","emby-input"],function(globalize,dom,dialogHelper){"use strict";function getDefaultImageConfig(itemType,type){return{Type:type,MinWidth:0,Limit:"Primary"===type?1:0}}function findImageOptions(imageOptions,type){return imageOptions.filter(function(i){return i.Type==type})[0]}function getImageConfig(options,availableOptions,imageType,itemType){return findImageOptions(options.ImageOptions||[],imageType)||findImageOptions(availableOptions.DefaultImageOptions||[],imageType)||getDefaultImageConfig(itemType,imageType)}function setVisibilityOfBackdrops(elem,visible){visible?(elem.classList.remove("hide"),elem.querySelector("input").setAttribute("required","required")):(elem.classList.add("hide"),elem.querySelector("input").setAttribute("required",""),elem.querySelector("input").removeAttribute("required"))}function loadValues(context,itemType,options,availableOptions){var supportedImageTypes=availableOptions.SupportedImageTypes||[];setVisibilityOfBackdrops(context.querySelector(".backdropFields"),-1!=supportedImageTypes.indexOf("Backdrop")),setVisibilityOfBackdrops(context.querySelector(".screenshotFields"),-1!=supportedImageTypes.indexOf("Screenshot")),Array.prototype.forEach.call(context.querySelectorAll(".imageType"),function(i){var imageType=i.getAttribute("data-imagetype"),container=dom.parentWithTag(i,"LABEL");-1==supportedImageTypes.indexOf(imageType)?container.classList.add("hide"):container.classList.remove("hide"),getImageConfig(options,availableOptions,imageType,itemType).Limit?i.checked=!0:i.checked=!1});var backdropConfig=getImageConfig(options,availableOptions,"Backdrop",itemType);context.querySelector("#txtMaxBackdrops").value=backdropConfig.Limit,context.querySelector("#txtMinBackdropDownloadWidth").value=backdropConfig.MinWidth;var screenshotConfig=getImageConfig(options,availableOptions,"Screenshot",itemType);context.querySelector("#txtMaxScreenshots").value=screenshotConfig.Limit,context.querySelector("#txtMinScreenshotDownloadWidth").value=screenshotConfig.MinWidth}function saveValues(context,options){options.ImageOptions=Array.prototype.map.call(context.querySelectorAll(".imageType:not(.hide)"),function(c){return{Type:c.getAttribute("data-imagetype"),Limit:c.checked?1:0,MinWidth:0}}),options.ImageOptions.push({Type:"Backdrop",Limit:context.querySelector("#txtMaxBackdrops").value,MinWidth:context.querySelector("#txtMinBackdropDownloadWidth").value}),options.ImageOptions.push({Type:"Screenshot",Limit:context.querySelector("#txtMaxScreenshots").value,MinWidth:context.querySelector("#txtMinScreenshotDownloadWidth").value})}function editor(){this.show=function(itemType,options,availableOptions){return new Promise(function(resolve,reject){var xhr=new XMLHttpRequest;xhr.open("GET","components/imageoptionseditor/imageoptionseditor.template.html",!0),xhr.onload=function(e){var template=this.response,dlg=dialogHelper.createDialog({size:"medium-tall",removeOnClose:!0,scrollY:!1});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(resolve,resolve),dlg.querySelector(".btnCancel").addEventListener("click",function(){dialogHelper.close(dlg)})},xhr.send()})}}return editor});
|
||||
define(["globalize", "dom", "dialogHelper", "emby-checkbox", "emby-select", "emby-input"], function(globalize, dom, dialogHelper) {
|
||||
"use strict";
|
||||
|
||||
function getDefaultImageConfig(itemType, type) {
|
||||
return {
|
||||
Type: type,
|
||||
MinWidth: 0,
|
||||
Limit: "Primary" === type ? 1 : 0
|
||||
}
|
||||
}
|
||||
|
||||
function findImageOptions(imageOptions, type) {
|
||||
return imageOptions.filter(function(i) {
|
||||
return i.Type == type
|
||||
})[0]
|
||||
}
|
||||
|
||||
function getImageConfig(options, availableOptions, imageType, itemType) {
|
||||
return findImageOptions(options.ImageOptions || [], imageType) || findImageOptions(availableOptions.DefaultImageOptions || [], imageType) || getDefaultImageConfig(itemType, imageType)
|
||||
}
|
||||
|
||||
function setVisibilityOfBackdrops(elem, visible) {
|
||||
visible ? (elem.classList.remove("hide"), elem.querySelector("input").setAttribute("required", "required")) : (elem.classList.add("hide"), elem.querySelector("input").setAttribute("required", ""), elem.querySelector("input").removeAttribute("required"))
|
||||
}
|
||||
|
||||
function loadValues(context, itemType, options, availableOptions) {
|
||||
var supportedImageTypes = availableOptions.SupportedImageTypes || [];
|
||||
setVisibilityOfBackdrops(context.querySelector(".backdropFields"), -1 != supportedImageTypes.indexOf("Backdrop")), setVisibilityOfBackdrops(context.querySelector(".screenshotFields"), -1 != supportedImageTypes.indexOf("Screenshot")), Array.prototype.forEach.call(context.querySelectorAll(".imageType"), function(i) {
|
||||
var imageType = i.getAttribute("data-imagetype"),
|
||||
container = dom.parentWithTag(i, "LABEL"); - 1 == supportedImageTypes.indexOf(imageType) ? container.classList.add("hide") : container.classList.remove("hide"), getImageConfig(options, availableOptions, imageType, itemType).Limit ? i.checked = !0 : i.checked = !1
|
||||
});
|
||||
var backdropConfig = getImageConfig(options, availableOptions, "Backdrop", itemType);
|
||||
context.querySelector("#txtMaxBackdrops").value = backdropConfig.Limit, context.querySelector("#txtMinBackdropDownloadWidth").value = backdropConfig.MinWidth;
|
||||
var screenshotConfig = getImageConfig(options, availableOptions, "Screenshot", itemType);
|
||||
context.querySelector("#txtMaxScreenshots").value = screenshotConfig.Limit, context.querySelector("#txtMinScreenshotDownloadWidth").value = screenshotConfig.MinWidth
|
||||
}
|
||||
|
||||
function saveValues(context, options) {
|
||||
options.ImageOptions = Array.prototype.map.call(context.querySelectorAll(".imageType:not(.hide)"), function(c) {
|
||||
return {
|
||||
Type: c.getAttribute("data-imagetype"),
|
||||
Limit: c.checked ? 1 : 0,
|
||||
MinWidth: 0
|
||||
}
|
||||
}), options.ImageOptions.push({
|
||||
Type: "Backdrop",
|
||||
Limit: context.querySelector("#txtMaxBackdrops").value,
|
||||
MinWidth: context.querySelector("#txtMinBackdropDownloadWidth").value
|
||||
}), options.ImageOptions.push({
|
||||
Type: "Screenshot",
|
||||
Limit: context.querySelector("#txtMaxScreenshots").value,
|
||||
MinWidth: context.querySelector("#txtMinScreenshotDownloadWidth").value
|
||||
})
|
||||
}
|
||||
|
||||
function editor() {
|
||||
this.show = function(itemType, options, availableOptions) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var xhr = new XMLHttpRequest;
|
||||
xhr.open("GET", "components/imageoptionseditor/imageoptionseditor.template.html", !0), xhr.onload = function(e) {
|
||||
var template = this.response,
|
||||
dlg = dialogHelper.createDialog({
|
||||
size: "medium-tall",
|
||||
removeOnClose: !0,
|
||||
scrollY: !1
|
||||
});
|
||||
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(resolve, resolve), dlg.querySelector(".btnCancel").addEventListener("click", function() {
|
||||
dialogHelper.close(dlg)
|
||||
})
|
||||
}, xhr.send()
|
||||
})
|
||||
}
|
||||
}
|
||||
return editor
|
||||
});
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +1,78 @@
|
|||
define(["dialogHelper","dom","layoutManager","connectionManager","globalize","loading","material-icons","formDialogStyle","emby-button","emby-itemscontainer","cardStyle"],function(dialogHelper,dom,layoutManager,connectionManager,globalize,loading){"use strict";function getEditorHtml(){var html="";return html+='<div class="formDialogContent scrollY">',html+='<div class="dialogContentInner dialog-content-centered">',html+='<div class="loadingContent hide">',html+="<h1>"+globalize.translate("DetectingDevices")+"...</h1>",html+="<p>"+globalize.translate("MessagePleaseWait")+"</p>",html+="</div>",html+='<h1 style="margin-bottom:.25em;" class="devicesHeader hide">'+globalize.translate("HeaderNewDevices")+"</h1>",html+='<div is="emby-itemscontainer" class="results vertical-wrap">',html+="</div>",html+="</div>",html+="</div>"}function getDeviceHtml(device){var padderClass,html="",cssClass="card scalableCard",cardBoxCssClass="cardBox visualCardBox";return cssClass+=" backdropCard backdropCard-scalable",padderClass="cardPadder-backdrop",layoutManager.tv&&(cssClass+=" card-focusscale",cardBoxCssClass+=" cardBox-focustransform"),cardBoxCssClass+=" card-focuscontent",html+='<button type="button" class="'+cssClass+'" data-id="'+device.DeviceId+'" style="min-width:33.3333%;">',html+='<div class="'+cardBoxCssClass+'">',html+='<div class="cardScalable visualCardBox-cardScalable">',html+='<div class="'+padderClass+'"></div>',html+='<div class="cardContent searchImage">',html+='<div class="cardImageContainer coveredImage"><i class="cardImageIcon md-icon">dvr</i></div>',html+="</div>",html+="</div>",html+='<div class="cardFooter visualCardBox-cardFooter">',html+='<div class="cardText cardTextCentered">'+getTunerName(device.Type)+"</div>",html+='<div class="cardText cardTextCentered cardText-secondary">'+device.FriendlyName+"</div>",html+='<div class="cardText cardText-secondary cardTextCentered">',html+=device.Url||" ",html+="</div>",html+="</div>",html+="</div>",html+="</button>"}function getTunerName(providerId){switch(providerId=providerId.toLowerCase()){case"m3u":return"M3U";case"hdhomerun":return"HDHomerun";case"hauppauge":return"Hauppauge";case"satip":return"DVB";default:return"Unknown"}}function renderDevices(view,devices){var i,length,html="";for(i=0,length=devices.length;i<length;i++)html+=getDeviceHtml(devices[i]);devices.length?view.querySelector(".devicesHeader").classList.remove("hide"):(html="<p><br/>"+globalize.translate("NoNewDevicesFound")+"</p>",view.querySelector(".devicesHeader").classList.add("hide"));var elem=view.querySelector(".results");elem.innerHTML=html,layoutManager.tv&&focusManager.autoFocus(elem)}function discoverDevices(view,apiClient){return loading.show(),view.querySelector(".loadingContent").classList.remove("hide"),ApiClient.getJSON(ApiClient.getUrl("LiveTv/Tuners/Discvover",{NewDevicesOnly:!0})).then(function(devices){currentDevices=devices,renderDevices(view,devices),view.querySelector(".loadingContent").classList.add("hide"),loading.hide()})}function tunerPicker(){this.show=function(options){var dialogOptions={removeOnClose:!0,scrollY:!1};layoutManager.tv?dialogOptions.size="fullscreen":dialogOptions.size="small";var dlg=dialogHelper.createDialog(dialogOptions);dlg.classList.add("formDialog");var html="";html+='<div class="formDialogHeader">',html+='<button is="paper-icon-button-light" class="btnCancel autoSize" tabindex="-1"><i class="md-icon"></i></button>',html+='<h3 class="formDialogHeaderTitle">',html+=globalize.translate("HeaderLiveTvTunerSetup"),html+="</h3>",html+="</div>",html+=getEditorHtml(),dlg.innerHTML=html,dlg.querySelector(".btnCancel").addEventListener("click",function(){dialogHelper.close(dlg)});var deviceResult;dlg.querySelector(".results").addEventListener("click",function(e){var tunerCard=dom.parentWithClass(e.target,"card");if(tunerCard){var deviceId=tunerCard.getAttribute("data-id");deviceResult=currentDevices.filter(function(d){return d.DeviceId===deviceId})[0],dialogHelper.close(dlg)}}),layoutManager.tv&¢erFocus(dlg.querySelector(".formDialogContent"),!1,!0);var apiClient=connectionManager.getApiClient(options.serverId);return discoverDevices(dlg,apiClient),layoutManager.tv&¢erFocus(dlg.querySelector(".formDialogContent"),!1,!1),dialogHelper.open(dlg).then(function(){return deviceResult?Promise.resolve(deviceResult):Promise.reject()})}}var currentDevices=[];return tunerPicker});
|
||||
define(["dialogHelper", "dom", "layoutManager", "connectionManager", "globalize", "loading", "material-icons", "formDialogStyle", "emby-button", "emby-itemscontainer", "cardStyle"], function(dialogHelper, dom, layoutManager, connectionManager, globalize, loading) {
|
||||
"use strict";
|
||||
|
||||
function getEditorHtml() {
|
||||
var html = "";
|
||||
return html += '<div class="formDialogContent scrollY">', html += '<div class="dialogContentInner dialog-content-centered">', html += '<div class="loadingContent hide">', html += "<h1>" + globalize.translate("DetectingDevices") + "...</h1>", html += "<p>" + globalize.translate("MessagePleaseWait") + "</p>", html += "</div>", html += '<h1 style="margin-bottom:.25em;" class="devicesHeader hide">' + globalize.translate("HeaderNewDevices") + "</h1>", html += '<div is="emby-itemscontainer" class="results vertical-wrap">', html += "</div>", html += "</div>", html += "</div>"
|
||||
}
|
||||
|
||||
function getDeviceHtml(device) {
|
||||
var padderClass, html = "",
|
||||
cssClass = "card scalableCard",
|
||||
cardBoxCssClass = "cardBox visualCardBox";
|
||||
return cssClass += " backdropCard backdropCard-scalable", padderClass = "cardPadder-backdrop", layoutManager.tv && (cssClass += " card-focusscale", cardBoxCssClass += " cardBox-focustransform"), cardBoxCssClass += " card-focuscontent", html += '<button type="button" class="' + cssClass + '" data-id="' + device.DeviceId + '" style="min-width:33.3333%;">', html += '<div class="' + cardBoxCssClass + '">', html += '<div class="cardScalable visualCardBox-cardScalable">', html += '<div class="' + padderClass + '"></div>', html += '<div class="cardContent searchImage">', html += '<div class="cardImageContainer coveredImage"><i class="cardImageIcon md-icon">dvr</i></div>', html += "</div>", html += "</div>", html += '<div class="cardFooter visualCardBox-cardFooter">', html += '<div class="cardText cardTextCentered">' + getTunerName(device.Type) + "</div>", html += '<div class="cardText cardTextCentered cardText-secondary">' + device.FriendlyName + "</div>", html += '<div class="cardText cardText-secondary cardTextCentered">', html += device.Url || " ", html += "</div>", html += "</div>", html += "</div>", html += "</button>"
|
||||
}
|
||||
|
||||
function getTunerName(providerId) {
|
||||
switch (providerId = providerId.toLowerCase()) {
|
||||
case "m3u":
|
||||
return "M3U";
|
||||
case "hdhomerun":
|
||||
return "HDHomerun";
|
||||
case "hauppauge":
|
||||
return "Hauppauge";
|
||||
case "satip":
|
||||
return "DVB";
|
||||
default:
|
||||
return "Unknown"
|
||||
}
|
||||
}
|
||||
|
||||
function renderDevices(view, devices) {
|
||||
var i, length, html = "";
|
||||
for (i = 0, length = devices.length; i < length; i++) html += getDeviceHtml(devices[i]);
|
||||
devices.length ? view.querySelector(".devicesHeader").classList.remove("hide") : (html = "<p><br/>" + globalize.translate("NoNewDevicesFound") + "</p>", view.querySelector(".devicesHeader").classList.add("hide"));
|
||||
var elem = view.querySelector(".results");
|
||||
elem.innerHTML = html, layoutManager.tv && focusManager.autoFocus(elem)
|
||||
}
|
||||
|
||||
function discoverDevices(view, apiClient) {
|
||||
return loading.show(), view.querySelector(".loadingContent").classList.remove("hide"), ApiClient.getJSON(ApiClient.getUrl("LiveTv/Tuners/Discvover", {
|
||||
NewDevicesOnly: !0
|
||||
})).then(function(devices) {
|
||||
currentDevices = devices, renderDevices(view, devices), view.querySelector(".loadingContent").classList.add("hide"), loading.hide()
|
||||
})
|
||||
}
|
||||
|
||||
function tunerPicker() {
|
||||
this.show = function(options) {
|
||||
var dialogOptions = {
|
||||
removeOnClose: !0,
|
||||
scrollY: !1
|
||||
};
|
||||
layoutManager.tv ? dialogOptions.size = "fullscreen" : dialogOptions.size = "small";
|
||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
||||
dlg.classList.add("formDialog");
|
||||
var html = "";
|
||||
html += '<div class="formDialogHeader">', html += '<button is="paper-icon-button-light" class="btnCancel autoSize" tabindex="-1"><i class="md-icon"></i></button>', html += '<h3 class="formDialogHeaderTitle">', html += globalize.translate("HeaderLiveTvTunerSetup"), html += "</h3>", html += "</div>", html += getEditorHtml(), dlg.innerHTML = html, dlg.querySelector(".btnCancel").addEventListener("click", function() {
|
||||
dialogHelper.close(dlg)
|
||||
});
|
||||
var deviceResult;
|
||||
dlg.querySelector(".results").addEventListener("click", function(e) {
|
||||
var tunerCard = dom.parentWithClass(e.target, "card");
|
||||
if (tunerCard) {
|
||||
var deviceId = tunerCard.getAttribute("data-id");
|
||||
deviceResult = currentDevices.filter(function(d) {
|
||||
return d.DeviceId === deviceId
|
||||
})[0], dialogHelper.close(dlg)
|
||||
}
|
||||
}), layoutManager.tv && centerFocus(dlg.querySelector(".formDialogContent"), !1, !0);
|
||||
var apiClient = connectionManager.getApiClient(options.serverId);
|
||||
return discoverDevices(dlg, apiClient), layoutManager.tv && centerFocus(dlg.querySelector(".formDialogContent"), !1, !1), dialogHelper.open(dlg).then(function() {
|
||||
return deviceResult ? Promise.resolve(deviceResult) : Promise.reject()
|
||||
})
|
||||
}
|
||||
}
|
||||
var currentDevices = [];
|
||||
return tunerPicker
|
||||
});
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue