mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 19:08:18 -07:00
Merge pull request #511 from grafixeyehero/Deminify-part-3-components
Deminify part 3
This commit is contained in:
commit
e89a45e887
@ -1,19 +1,33 @@
|
|||||||
define(["dialogHelper", "datetime", "emby-select", "paper-icon-button-light", "formDialogStyle"], function(dialogHelper, datetime) {
|
define(["dialogHelper", "datetime", "emby-select", "paper-icon-button-light", "formDialogStyle"], function (dialogHelper, datetime) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function getDisplayTime(hours) {
|
function getDisplayTime(hours) {
|
||||||
var minutes = 0,
|
var minutes = 0;
|
||||||
pct = hours % 1;
|
var pct = hours % 1;
|
||||||
return pct && (minutes = parseInt(60 * pct)), datetime.getDisplayTime(new Date(2e3, 1, 1, hours, minutes, 0, 0))
|
|
||||||
|
if (pct) {
|
||||||
|
minutes = parseInt(60 * pct);
|
||||||
|
}
|
||||||
|
|
||||||
|
return datetime.getDisplayTime(new Date(2000, 1, 1, hours, minutes, 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
function populateHours(context) {
|
function populateHours(context) {
|
||||||
for (var html = "", i = 0; i < 24; i++) html += '<option value="' + i + '">' + getDisplayTime(i) + "</option>";
|
var html = "";
|
||||||
html += '<option value="24">' + getDisplayTime(0) + "</option>", context.querySelector("#selectStart").innerHTML = html, context.querySelector("#selectEnd").innerHTML = html
|
|
||||||
|
for (var 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) {
|
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
|
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) {
|
function submitSchedule(context, options) {
|
||||||
@ -22,30 +36,54 @@ define(["dialogHelper", "datetime", "emby-select", "paper-icon-button-light", "f
|
|||||||
StartHour: context.querySelector("#selectStart").value,
|
StartHour: context.querySelector("#selectStart").value,
|
||||||
EndHour: context.querySelector("#selectEnd").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)
|
if (parseFloat(updatedSchedule.StartHour) >= parseFloat(updatedSchedule.EndHour)) {
|
||||||
|
return void alert(Globalize.translate("ErrorMessageStartHourGreaterThanEnd"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context.submitted = true;
|
||||||
|
options.schedule = Object.assign(options.schedule, updatedSchedule);
|
||||||
|
dialogHelper.close(context);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
show: function(options) {
|
show: function (options) {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
var xhr = new XMLHttpRequest;
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.open("GET", "components/accessschedule/accessschedule.template.html", !0), xhr.onload = function(e) {
|
xhr.open("GET", "components/accessschedule/accessschedule.template.html", true);
|
||||||
var template = this.response,
|
|
||||||
dlg = dialogHelper.createDialog({
|
xhr.onload = function (e) {
|
||||||
removeOnClose: !0,
|
var template = this.response;
|
||||||
|
var dlg = dialogHelper.createDialog({
|
||||||
|
removeOnClose: true,
|
||||||
size: "small"
|
size: "small"
|
||||||
});
|
});
|
||||||
dlg.classList.add("formDialog");
|
dlg.classList.add("formDialog");
|
||||||
var html = "";
|
var html = "";
|
||||||
html += Globalize.translateDocument(template), dlg.innerHTML = html, populateHours(dlg), loadSchedule(dlg, options.schedule), dialogHelper.open(dlg), dlg.addEventListener("close", function() {
|
html += Globalize.translateDocument(template);
|
||||||
dlg.submitted ? resolve(options.schedule) : reject()
|
dlg.innerHTML = html;
|
||||||
}), dlg.querySelector(".btnCancel").addEventListener("click", function(e) {
|
populateHours(dlg);
|
||||||
dialogHelper.close(dlg)
|
loadSchedule(dlg, options.schedule);
|
||||||
}), dlg.querySelector("form").addEventListener("submit", function(e) {
|
dialogHelper.open(dlg);
|
||||||
return submitSchedule(dlg, options), e.preventDefault(), !1
|
dlg.addEventListener("close", function () {
|
||||||
})
|
if (dlg.submitted) {
|
||||||
}, xhr.send()
|
resolve(options.schedule);
|
||||||
})
|
} else {
|
||||||
|
reject();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
dlg.querySelector(".btnCancel").addEventListener("click", function (e) {
|
||||||
|
dialogHelper.close(dlg);
|
||||||
|
});
|
||||||
|
dlg.querySelector("form").addEventListener("submit", function (e) {
|
||||||
|
submitSchedule(dlg, options);
|
||||||
|
e.preventDefault();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
xhr.send();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
};
|
||||||
});
|
});
|
@ -1,4 +1,4 @@
|
|||||||
define(["events", "globalize", "dom", "datetime", "userSettings", "serverNotifications", "connectionManager", "emby-button", "listViewStyle"], function(events, globalize, dom, datetime, userSettings, serverNotifications, connectionManager) {
|
define(["events", "globalize", "dom", "datetime", "userSettings", "serverNotifications", "connectionManager", "emby-button", "listViewStyle"], function (events, globalize, dom, datetime, userSettings, serverNotifications, connectionManager) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function getEntryHtml(entry, apiClient) {
|
function getEntryHtml(entry, apiClient) {
|
||||||
@ -6,10 +6,12 @@ define(["events", "globalize", "dom", "datetime", "userSettings", "serverNotific
|
|||||||
html += '<div class="listItem listItem-border">';
|
html += '<div class="listItem listItem-border">';
|
||||||
var color = "#00a4dc";
|
var color = "#00a4dc";
|
||||||
var icon = "notifications";
|
var icon = "notifications";
|
||||||
|
|
||||||
if ("Error" == entry.Severity || "Fatal" == entry.Severity || "Warn" == entry.Severity) {
|
if ("Error" == entry.Severity || "Fatal" == entry.Severity || "Warn" == entry.Severity) {
|
||||||
color = "#cc0000";
|
color = "#cc0000";
|
||||||
icon = "notification_important";
|
icon = "notification_important";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry.UserId && entry.UserPrimaryImageTag) {
|
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, {
|
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",
|
type: "Primary",
|
||||||
@ -18,78 +20,138 @@ define(["events", "globalize", "dom", "datetime", "userSettings", "serverNotific
|
|||||||
} else {
|
} else {
|
||||||
html += '<i class="listItemIcon md-icon" style="background-color:' + color + '">' + icon + '</i>';
|
html += '<i class="listItemIcon md-icon" style="background-color:' + color + '">' + icon + '</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);
|
html += '<div class="listItemBody three-line">';
|
||||||
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>"
|
html += '<div class="listItemBodyText">';
|
||||||
|
html += entry.Name;
|
||||||
|
html += "</div>";
|
||||||
|
html += '<div class="listItemBodyText secondary">';
|
||||||
|
var date = datetime.parseISO8601Date(entry.Date, true);
|
||||||
|
html += datetime.toLocaleString(date).toLowerCase();
|
||||||
|
html += "</div>";
|
||||||
|
html += '<div class="listItemBodyText secondary listItemBodyText-nowrap">';
|
||||||
|
html += entry.ShortOverview || "";
|
||||||
|
html += "</div>";
|
||||||
|
html += "</div>";
|
||||||
|
|
||||||
|
if (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>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return html += "</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderList(elem, apiClient, result, startIndex, limit) {
|
function renderList(elem, apiClient, result, startIndex, limit) {
|
||||||
elem.innerHTML = result.Items.map(function(i) {
|
elem.innerHTML = result.Items.map(function (i) {
|
||||||
return getEntryHtml(i, apiClient)
|
return getEntryHtml(i, apiClient);
|
||||||
}).join("")
|
}).join("");
|
||||||
}
|
}
|
||||||
|
|
||||||
function reloadData(instance, elem, apiClient, startIndex, limit) {
|
function reloadData(instance, elem, apiClient, startIndex, limit) {
|
||||||
null == startIndex && (startIndex = parseInt(elem.getAttribute("data-activitystartindex") || "0")), limit = limit || parseInt(elem.getAttribute("data-activitylimit") || "7");
|
if (null == startIndex) {
|
||||||
var minDate = new Date,
|
startIndex = parseInt(elem.getAttribute("data-activitystartindex") || "0");
|
||||||
hasUserId = "false" !== elem.getAttribute("data-useractivity");
|
}
|
||||||
hasUserId ? minDate.setTime(minDate.getTime() - 864e5) : minDate.setTime(minDate.getTime() - 6048e5), ApiClient.getJSON(ApiClient.getUrl("System/ActivityLog/Entries", {
|
|
||||||
|
limit = limit || parseInt(elem.getAttribute("data-activitylimit") || "7");
|
||||||
|
var minDate = new Date();
|
||||||
|
var hasUserId = "false" !== elem.getAttribute("data-useractivity");
|
||||||
|
|
||||||
|
if (hasUserId) {
|
||||||
|
minDate.setTime(minDate.getTime() - 24 * 60 * 60 * 1000); // one day back
|
||||||
|
} else {
|
||||||
|
minDate.setTime(minDate.getTime() - 7 * 24 * 60 * 60 * 1000); // one week back
|
||||||
|
}
|
||||||
|
|
||||||
|
ApiClient.getJSON(ApiClient.getUrl("System/ActivityLog/Entries", {
|
||||||
startIndex: startIndex,
|
startIndex: startIndex,
|
||||||
limit: limit,
|
limit: limit,
|
||||||
minDate: minDate.toISOString(),
|
minDate: minDate.toISOString(),
|
||||||
hasUserId: hasUserId
|
hasUserId: hasUserId
|
||||||
})).then(function(result) {
|
})).then(function (result) {
|
||||||
if (elem.setAttribute("data-activitystartindex", startIndex), elem.setAttribute("data-activitylimit", limit), !startIndex) {
|
elem.setAttribute("data-activitystartindex", startIndex);
|
||||||
|
elem.setAttribute("data-activitylimit", limit);
|
||||||
|
if (!startIndex) {
|
||||||
var activityContainer = dom.parentWithClass(elem, "activityContainer");
|
var activityContainer = dom.parentWithClass(elem, "activityContainer");
|
||||||
activityContainer && (result.Items.length ? activityContainer.classList.remove("hide") : activityContainer.classList.add("hide"))
|
|
||||||
|
if (activityContainer) {
|
||||||
|
if (result.Items.length) {
|
||||||
|
activityContainer.classList.remove("hide");
|
||||||
|
} else {
|
||||||
|
activityContainer.classList.add("hide");
|
||||||
}
|
}
|
||||||
instance.items = result.Items, renderList(elem, apiClient, result, startIndex, limit)
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
|
instance.items = result.Items;
|
||||||
|
renderList(elem, apiClient, result, startIndex, limit);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onActivityLogUpdate(e, apiClient, data) {
|
function onActivityLogUpdate(e, apiClient, data) {
|
||||||
var options = this.options;
|
var options = this.options;
|
||||||
options && options.serverId === apiClient.serverId() && reloadData(this, options.element, apiClient)
|
|
||||||
|
if (options && options.serverId === apiClient.serverId()) {
|
||||||
|
reloadData(this, options.element, apiClient);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onListClick(e) {
|
function onListClick(e) {
|
||||||
var btnEntryInfo = dom.parentWithClass(e.target, "btnEntryInfo");
|
var btnEntryInfo = dom.parentWithClass(e.target, "btnEntryInfo");
|
||||||
|
|
||||||
if (btnEntryInfo) {
|
if (btnEntryInfo) {
|
||||||
var id = btnEntryInfo.getAttribute("data-id"),
|
var id = btnEntryInfo.getAttribute("data-id");
|
||||||
items = this.items;
|
var items = this.items;
|
||||||
|
|
||||||
if (items) {
|
if (items) {
|
||||||
var item = items.filter(function(i) {
|
var item = items.filter(function (i) {
|
||||||
return i.Id.toString() === id
|
return i.Id.toString() === id;
|
||||||
})[0];
|
})[0];
|
||||||
item && showItemOverview(item)
|
|
||||||
|
if (item) {
|
||||||
|
showItemOverview(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showItemOverview(item) {
|
function showItemOverview(item) {
|
||||||
require(["alert"], function(alert) {
|
require(["alert"], function (alert) {
|
||||||
alert({
|
alert({
|
||||||
text: item.Overview
|
text: item.Overview
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function ActivityLog(options) {
|
function ActivityLog(options) {
|
||||||
this.options = options;
|
this.options = options;
|
||||||
var element = options.element;
|
var element = options.element;
|
||||||
element.classList.add("activityLogListWidget"), element.addEventListener("click", onListClick.bind(this));
|
element.classList.add("activityLogListWidget");
|
||||||
|
element.addEventListener("click", onListClick.bind(this));
|
||||||
var apiClient = connectionManager.getApiClient(options.serverId);
|
var apiClient = connectionManager.getApiClient(options.serverId);
|
||||||
reloadData(this, element, apiClient);
|
reloadData(this, element, apiClient);
|
||||||
var onUpdate = onActivityLogUpdate.bind(this);
|
var onUpdate = onActivityLogUpdate.bind(this);
|
||||||
this.updateFn = onUpdate, events.on(serverNotifications, "ActivityLogEntry", onUpdate), apiClient.sendMessage("ActivityLogEntryStart", "0,1500")
|
this.updateFn = onUpdate;
|
||||||
|
events.on(serverNotifications, "ActivityLogEntry", onUpdate);
|
||||||
|
apiClient.sendMessage("ActivityLogEntryStart", "0,1500");
|
||||||
}
|
}
|
||||||
return ActivityLog.prototype.destroy = function() {
|
|
||||||
|
ActivityLog.prototype.destroy = function () {
|
||||||
var options = this.options;
|
var options = this.options;
|
||||||
|
|
||||||
if (options) {
|
if (options) {
|
||||||
options.element.classList.remove("activityLogListWidget");
|
options.element.classList.remove("activityLogListWidget");
|
||||||
connectionManager.getApiClient(options.serverId).sendMessage("ActivityLogEntryStop", "0,1500")
|
connectionManager.getApiClient(options.serverId).sendMessage("ActivityLogEntryStop", "0,1500");
|
||||||
}
|
}
|
||||||
|
|
||||||
var onUpdate = this.updateFn;
|
var onUpdate = this.updateFn;
|
||||||
onUpdate && events.off(serverNotifications, "ActivityLogEntry", onUpdate), this.items = null, this.options = null
|
|
||||||
}, ActivityLog
|
if (onUpdate) {
|
||||||
|
events.off(serverNotifications, "ActivityLogEntry", onUpdate);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.items = null;
|
||||||
|
this.options = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
return ActivityLog;
|
||||||
});
|
});
|
||||||
|
@ -1,10 +1,16 @@
|
|||||||
define(["dialogHelper", "loading", "connectionManager", "globalize", "actionsheet", "emby-input", "paper-icon-button-light", "emby-button", "listViewStyle", "material-icons", "formDialogStyle"], function(dialogHelper, loading, connectionManager, globalize, actionsheet) {
|
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";
|
"use strict";
|
||||||
return function(options) {
|
|
||||||
|
return function (options) {
|
||||||
function parentWithClass(elem, className) {
|
function parentWithClass(elem, className) {
|
||||||
for (; !elem.classList || !elem.classList.contains(className);)
|
while (!elem.classList || !elem.classList.contains(className)) {
|
||||||
if (!(elem = elem.parentNode)) return null;
|
elem = elem.parentNode;
|
||||||
return elem
|
if (!elem) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapChannel(button, channelId, providerChannelId) {
|
function mapChannel(button, channelId, providerChannelId) {
|
||||||
@ -19,33 +25,35 @@ define(["dialogHelper", "loading", "connectionManager", "globalize", "actionshee
|
|||||||
providerChannelId: providerChannelId
|
providerChannelId: providerChannelId
|
||||||
},
|
},
|
||||||
dataType: "json"
|
dataType: "json"
|
||||||
}).then(function(mapping) {
|
}).then(function (mapping) {
|
||||||
var listItem = parentWithClass(button, "listItem");
|
var listItem = parentWithClass(button, "listItem");
|
||||||
button.setAttribute("data-providerid", mapping.ProviderChannelId), listItem.querySelector(".secondary").innerHTML = getMappingSecondaryName(mapping, currentMappingOptions.ProviderName), loading.hide()
|
button.setAttribute("data-providerid", mapping.ProviderChannelId);
|
||||||
})
|
listItem.querySelector(".secondary").innerHTML = getMappingSecondaryName(mapping, currentMappingOptions.ProviderName);
|
||||||
|
loading.hide();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onChannelsElementClick(e) {
|
function onChannelsElementClick(e) {
|
||||||
var btnMap = parentWithClass(e.target, "btnMap");
|
var btnMap = parentWithClass(e.target, "btnMap");
|
||||||
|
|
||||||
if (btnMap) {
|
if (btnMap) {
|
||||||
var channelId = btnMap.getAttribute("data-id");
|
var channelId = btnMap.getAttribute("data-id");
|
||||||
var providerChannelId = btnMap.getAttribute("data-providerid");
|
var providerChannelId = btnMap.getAttribute("data-providerid");
|
||||||
var menuItems = currentMappingOptions.ProviderChannels.map(function(m) {
|
var menuItems = currentMappingOptions.ProviderChannels.map(function (m) {
|
||||||
return {
|
return {
|
||||||
name: m.Name,
|
name: m.Name,
|
||||||
id: m.Id,
|
id: m.Id,
|
||||||
selected: m.Id.toLowerCase() === providerChannelId.toLowerCase()
|
selected: m.Id.toLowerCase() === providerChannelId.toLowerCase()
|
||||||
}
|
};
|
||||||
}).sort(function (a, b) {
|
}).sort(function (a, b) {
|
||||||
return a.name.localeCompare(b.name);
|
return a.name.localeCompare(b.name);
|
||||||
});
|
});
|
||||||
|
|
||||||
actionsheet.show({
|
actionsheet.show({
|
||||||
positionTo: btnMap,
|
positionTo: btnMap,
|
||||||
items: menuItems
|
items: menuItems
|
||||||
}).then(function(newChannelId) {
|
}).then(function (newChannelId) {
|
||||||
mapChannel(btnMap, channelId, newChannelId)
|
mapChannel(btnMap, channelId, newChannelId);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,47 +61,87 @@ define(["dialogHelper", "loading", "connectionManager", "globalize", "actionshee
|
|||||||
var apiClient = connectionManager.getApiClient(serverId);
|
var apiClient = connectionManager.getApiClient(serverId);
|
||||||
return apiClient.getJSON(apiClient.getUrl("LiveTv/ChannelMappingOptions", {
|
return apiClient.getJSON(apiClient.getUrl("LiveTv/ChannelMappingOptions", {
|
||||||
providerId: providerId
|
providerId: providerId
|
||||||
}))
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMappingSecondaryName(mapping, providerName) {
|
function getMappingSecondaryName(mapping, providerName) {
|
||||||
return (mapping.ProviderChannelName || "") + " - " + providerName
|
return (mapping.ProviderChannelName || "") + " - " + providerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTunerChannelHtml(channel, providerName) {
|
function getTunerChannelHtml(channel, providerName) {
|
||||||
var html = "";
|
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>"
|
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">';
|
||||||
|
|
||||||
|
if (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>';
|
||||||
|
return html += "</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEditorHtml() {
|
function getEditorHtml() {
|
||||||
var html = "";
|
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>"
|
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>";
|
||||||
|
return html += "</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function initEditor(dlg, options) {
|
function initEditor(dlg, options) {
|
||||||
getChannelMappingOptions(options.serverId, options.providerId).then(function(result) {
|
getChannelMappingOptions(options.serverId, options.providerId).then(function (result) {
|
||||||
currentMappingOptions = result;
|
currentMappingOptions = result;
|
||||||
var channelsElement = dlg.querySelector(".channels");
|
var channelsElement = dlg.querySelector(".channels");
|
||||||
channelsElement.innerHTML = result.TunerChannels.map(function(channel) {
|
channelsElement.innerHTML = result.TunerChannels.map(function (channel) {
|
||||||
return getTunerChannelHtml(channel, result.ProviderName)
|
return getTunerChannelHtml(channel, result.ProviderName);
|
||||||
}).join(""), channelsElement.addEventListener("click", onChannelsElementClick)
|
}).join("");
|
||||||
})
|
channelsElement.addEventListener("click", onChannelsElementClick);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
var currentMappingOptions, self = this;
|
|
||||||
self.show = function() {
|
var currentMappingOptions;
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
self.show = function () {
|
||||||
var dialogOptions = {
|
var dialogOptions = {
|
||||||
removeOnClose: !0
|
removeOnClose: true
|
||||||
};
|
};
|
||||||
dialogOptions.size = "small";
|
dialogOptions.size = "small";
|
||||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
var dlg = dialogHelper.createDialog(dialogOptions);
|
||||||
dlg.classList.add("formDialog"), dlg.classList.add("ui-body-a"), dlg.classList.add("background-theme-a");
|
dlg.classList.add("formDialog");
|
||||||
var html = "",
|
dlg.classList.add("ui-body-a");
|
||||||
title = globalize.translate("MapChannels");
|
dlg.classList.add("background-theme-a");
|
||||||
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() {
|
var html = "";
|
||||||
dialogHelper.close(dlg)
|
var title = globalize.translate("MapChannels");
|
||||||
}), new Promise(function(resolve, reject) {
|
html += '<div class="formDialogHeader">';
|
||||||
dlg.addEventListener("close", resolve), dialogHelper.open(dlg)
|
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);
|
||||||
|
});
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
dlg.addEventListener("close", resolve);
|
||||||
|
dialogHelper.open(dlg);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
define(["loading", "libraryBrowser", "cardBuilder", "dom", "apphost", "imageLoader", "globalize", "layoutManager", "scrollStyles", "emby-itemscontainer"], function(loading, libraryBrowser, cardBuilder, dom, appHost, imageLoader, globalize, layoutManager) {
|
define(["loading", "libraryBrowser", "cardBuilder", "dom", "apphost", "imageLoader", "globalize", "layoutManager", "scrollStyles", "emby-itemscontainer"], function (loading, libraryBrowser, cardBuilder, dom, appHost, imageLoader, globalize, layoutManager) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function enableScrollX() {
|
function enableScrollX() {
|
||||||
return !layoutManager.desktop
|
return !layoutManager.desktop;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getThumbShape() {
|
function getThumbShape() {
|
||||||
return enableScrollX() ? "overflowBackdrop" : "backdrop"
|
return enableScrollX() ? "overflowBackdrop" : "backdrop";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPosterShape() {
|
function getPosterShape() {
|
||||||
return enableScrollX() ? "overflowPortrait" : "portrait"
|
return enableScrollX() ? "overflowPortrait" : "portrait";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSquareShape() {
|
function getSquareShape() {
|
||||||
return enableScrollX() ? "overflowSquare" : "square"
|
return enableScrollX() ? "overflowSquare" : "square";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSections() {
|
function getSections() {
|
||||||
@ -23,147 +23,208 @@ define(["loading", "libraryBrowser", "cardBuilder", "dom", "apphost", "imageLoad
|
|||||||
types: "Movie",
|
types: "Movie",
|
||||||
id: "favoriteMovies",
|
id: "favoriteMovies",
|
||||||
shape: getPosterShape(),
|
shape: getPosterShape(),
|
||||||
showTitle: !1,
|
showTitle: false,
|
||||||
overlayPlayButton: !0
|
overlayPlayButton: true
|
||||||
}, {
|
}, {
|
||||||
name: "HeaderFavoriteShows",
|
name: "HeaderFavoriteShows",
|
||||||
types: "Series",
|
types: "Series",
|
||||||
id: "favoriteShows",
|
id: "favoriteShows",
|
||||||
shape: getPosterShape(),
|
shape: getPosterShape(),
|
||||||
showTitle: !1,
|
showTitle: false,
|
||||||
overlayPlayButton: !0
|
overlayPlayButton: true
|
||||||
}, {
|
}, {
|
||||||
name: "HeaderFavoriteEpisodes",
|
name: "HeaderFavoriteEpisodes",
|
||||||
types: "Episode",
|
types: "Episode",
|
||||||
id: "favoriteEpisode",
|
id: "favoriteEpisode",
|
||||||
shape: getThumbShape(),
|
shape: getThumbShape(),
|
||||||
preferThumb: !1,
|
preferThumb: false,
|
||||||
showTitle: !0,
|
showTitle: true,
|
||||||
showParentTitle: !0,
|
showParentTitle: true,
|
||||||
overlayPlayButton: !0,
|
overlayPlayButton: true,
|
||||||
overlayText: !1,
|
overlayText: false,
|
||||||
centerText: !0
|
centerText: true
|
||||||
}, {
|
}, {
|
||||||
name: "HeaderFavoriteVideos",
|
name: "HeaderFavoriteVideos",
|
||||||
types: "Video,MusicVideo",
|
types: "Video,MusicVideo",
|
||||||
id: "favoriteVideos",
|
id: "favoriteVideos",
|
||||||
shape: getThumbShape(),
|
shape: getThumbShape(),
|
||||||
preferThumb: !0,
|
preferThumb: true,
|
||||||
showTitle: !0,
|
showTitle: true,
|
||||||
overlayPlayButton: !0,
|
overlayPlayButton: true,
|
||||||
overlayText: !1,
|
overlayText: false,
|
||||||
centerText: !0
|
centerText: true
|
||||||
}, {
|
}, {
|
||||||
name: "HeaderFavoriteArtists",
|
name: "HeaderFavoriteArtists",
|
||||||
types: "MusicArtist",
|
types: "MusicArtist",
|
||||||
id: "favoriteArtists",
|
id: "favoriteArtists",
|
||||||
shape: getSquareShape(),
|
shape: getSquareShape(),
|
||||||
preferThumb: !1,
|
preferThumb: false,
|
||||||
showTitle: !0,
|
showTitle: true,
|
||||||
overlayText: !1,
|
overlayText: false,
|
||||||
showParentTitle: !1,
|
showParentTitle: false,
|
||||||
centerText: !0,
|
centerText: true,
|
||||||
overlayPlayButton: !0,
|
overlayPlayButton: true,
|
||||||
coverImage: !0
|
coverImage: true
|
||||||
}, {
|
}, {
|
||||||
name: "HeaderFavoriteAlbums",
|
name: "HeaderFavoriteAlbums",
|
||||||
types: "MusicAlbum",
|
types: "MusicAlbum",
|
||||||
id: "favoriteAlbums",
|
id: "favoriteAlbums",
|
||||||
shape: getSquareShape(),
|
shape: getSquareShape(),
|
||||||
preferThumb: !1,
|
preferThumb: false,
|
||||||
showTitle: !0,
|
showTitle: true,
|
||||||
overlayText: !1,
|
overlayText: false,
|
||||||
showParentTitle: !0,
|
showParentTitle: true,
|
||||||
centerText: !0,
|
centerText: true,
|
||||||
overlayPlayButton: !0,
|
overlayPlayButton: true,
|
||||||
coverImage: !0
|
coverImage: true
|
||||||
}, {
|
}, {
|
||||||
name: "HeaderFavoriteSongs",
|
name: "HeaderFavoriteSongs",
|
||||||
types: "Audio",
|
types: "Audio",
|
||||||
id: "favoriteSongs",
|
id: "favoriteSongs",
|
||||||
shape: getSquareShape(),
|
shape: getSquareShape(),
|
||||||
preferThumb: !1,
|
preferThumb: false,
|
||||||
showTitle: !0,
|
showTitle: true,
|
||||||
overlayText: !1,
|
overlayText: false,
|
||||||
showParentTitle: !0,
|
showParentTitle: true,
|
||||||
centerText: !0,
|
centerText: true,
|
||||||
overlayMoreButton: !0,
|
overlayMoreButton: true,
|
||||||
action: "instantmix",
|
action: "instantmix",
|
||||||
coverImage: !0
|
coverImage: true
|
||||||
}]
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadSection(elem, userId, topParentId, section, isSingleSection) {
|
function loadSection(elem, userId, topParentId, section, isSingleSection) {
|
||||||
var screenWidth = dom.getWindowSize().innerWidth,
|
var screenWidth = dom.getWindowSize().innerWidth;
|
||||||
options = {
|
var options = {
|
||||||
SortBy: "SortName",
|
SortBy: "SortName",
|
||||||
SortOrder: "Ascending",
|
SortOrder: "Ascending",
|
||||||
Filters: "IsFavorite",
|
Filters: "IsFavorite",
|
||||||
Recursive: !0,
|
Recursive: true,
|
||||||
Fields: "PrimaryImageAspectRatio,BasicSyncInfo",
|
Fields: "PrimaryImageAspectRatio,BasicSyncInfo",
|
||||||
CollapseBoxSetItems: !1,
|
CollapseBoxSetItems: false,
|
||||||
ExcludeLocationTypes: "Virtual",
|
ExcludeLocationTypes: "Virtual",
|
||||||
EnableTotalRecordCount: !1
|
EnableTotalRecordCount: false
|
||||||
};
|
};
|
||||||
topParentId && (options.ParentId = topParentId), isSingleSection || (options.Limit = screenWidth >= 1920 ? 10 : screenWidth >= 1440 ? 8 : 6, enableScrollX() && (options.Limit = 20));
|
|
||||||
|
if (topParentId) {
|
||||||
|
options.ParentId = topParentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isSingleSection) {
|
||||||
|
options.Limit = screenWidth >= 1920 ? 10 : screenWidth >= 1440 ? 8 : 6;
|
||||||
|
|
||||||
|
if (enableScrollX()) {
|
||||||
|
options.Limit = 20;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var promise;
|
var promise;
|
||||||
return "MusicArtist" === section.types ? promise = ApiClient.getArtists(userId, options) : (options.IncludeItemTypes = section.types, promise = ApiClient.getItems(userId, options)), promise.then(function(result) {
|
|
||||||
|
if ("MusicArtist" === section.types) {
|
||||||
|
promise = ApiClient.getArtists(userId, options);
|
||||||
|
} else {
|
||||||
|
options.IncludeItemTypes = section.types;
|
||||||
|
promise = ApiClient.getItems(userId, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
return promise.then(function (result) {
|
||||||
var html = "";
|
var html = "";
|
||||||
|
|
||||||
if (result.Items.length) {
|
if (result.Items.length) {
|
||||||
if (html += '<div class="sectionTitleContainer sectionTitleContainer-cards padded-left">', !layoutManager.tv && options.Limit && result.Items.length >= options.Limit) {
|
if (html += '<div class="sectionTitleContainer sectionTitleContainer-cards padded-left">', !layoutManager.tv && options.Limit && result.Items.length >= options.Limit) {
|
||||||
html += '<a is="emby-linkbutton" href="' + ("list.html?serverId=" + ApiClient.serverId() + "&type=" + section.types + "&IsFavorite=true") + '" class="more button-flat button-flat-mini sectionTitleTextButton">', html += '<h2 class="sectionTitle sectionTitle-cards">', html += globalize.translate(section.name), html += "</h2>", html += '<i class="md-icon"></i>', html += "</a>"
|
html += '<a is="emby-linkbutton" href="' + ("list.html?serverId=" + ApiClient.serverId() + "&type=" + section.types + "&IsFavorite=true") + '" class="more button-flat button-flat-mini sectionTitleTextButton">';
|
||||||
} else html += '<h2 class="sectionTitle sectionTitle-cards">' + globalize.translate(section.name) + "</h2>";
|
html += '<h2 class="sectionTitle sectionTitle-cards">';
|
||||||
if (html += "</div>", enableScrollX()) {
|
html += globalize.translate(section.name);
|
||||||
|
html += "</h2>";
|
||||||
|
html += '<i class="md-icon"></i>';
|
||||||
|
html += "</a>";
|
||||||
|
} else {
|
||||||
|
html += '<h2 class="sectionTitle sectionTitle-cards">' + globalize.translate(section.name) + "</h2>";
|
||||||
|
}
|
||||||
|
|
||||||
|
html += "</div>";
|
||||||
|
if (enableScrollX()) {
|
||||||
var scrollXClass = "scrollX hiddenScrollX";
|
var scrollXClass = "scrollX hiddenScrollX";
|
||||||
layoutManager.tv && (scrollXClass += " smoothScrollX"), html += '<div is="emby-itemscontainer" class="itemsContainer ' + scrollXClass + ' padded-left padded-right">'
|
if (layoutManager.tv) {
|
||||||
} else html += '<div is="emby-itemscontainer" class="itemsContainer vertical-wrap padded-left padded-right">';
|
scrollXClass += " smoothScrollX";
|
||||||
var supportsImageAnalysis = appHost.supports("imageanalysis"),
|
}
|
||||||
cardLayout = (appHost.preferVisualCards || supportsImageAnalysis) && section.autoCardLayout && section.showTitle;
|
|
||||||
cardLayout = !1, html += cardBuilder.getCardsHtml(result.Items, {
|
html += '<div is="emby-itemscontainer" class="itemsContainer ' + scrollXClass + ' padded-left padded-right">';
|
||||||
|
} else {
|
||||||
|
html += '<div is="emby-itemscontainer" class="itemsContainer vertical-wrap padded-left padded-right">';
|
||||||
|
}
|
||||||
|
|
||||||
|
var supportsImageAnalysis = appHost.supports("imageanalysis");
|
||||||
|
var cardLayout = (appHost.preferVisualCards || supportsImageAnalysis) && section.autoCardLayout && section.showTitle;
|
||||||
|
cardLayout = false;
|
||||||
|
html += cardBuilder.getCardsHtml(result.Items, {
|
||||||
preferThumb: section.preferThumb,
|
preferThumb: section.preferThumb,
|
||||||
shape: section.shape,
|
shape: section.shape,
|
||||||
centerText: section.centerText && !cardLayout,
|
centerText: section.centerText && !cardLayout,
|
||||||
overlayText: !1 !== section.overlayText,
|
overlayText: false !== section.overlayText,
|
||||||
showTitle: section.showTitle,
|
showTitle: section.showTitle,
|
||||||
showParentTitle: section.showParentTitle,
|
showParentTitle: section.showParentTitle,
|
||||||
scalable: !0,
|
scalable: true,
|
||||||
coverImage: section.coverImage,
|
coverImage: section.coverImage,
|
||||||
overlayPlayButton: section.overlayPlayButton,
|
overlayPlayButton: section.overlayPlayButton,
|
||||||
overlayMoreButton: section.overlayMoreButton && !cardLayout,
|
overlayMoreButton: section.overlayMoreButton && !cardLayout,
|
||||||
action: section.action,
|
action: section.action,
|
||||||
allowBottomPadding: !enableScrollX(),
|
allowBottomPadding: !enableScrollX(),
|
||||||
cardLayout: cardLayout
|
cardLayout: cardLayout
|
||||||
}), html += "</div>"
|
});
|
||||||
|
html += "</div>";
|
||||||
}
|
}
|
||||||
elem.innerHTML = html, imageLoader.lazyChildren(elem)
|
|
||||||
})
|
elem.innerHTML = html;
|
||||||
|
imageLoader.lazyChildren(elem);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadSections(page, userId, topParentId, types) {
|
function loadSections(page, userId, topParentId, types) {
|
||||||
loading.show();
|
loading.show();
|
||||||
var sections = getSections(),
|
var sections = getSections();
|
||||||
sectionid = getParameterByName("sectionid");
|
var sectionid = getParameterByName("sectionid");
|
||||||
sectionid && (sections = sections.filter(function(s) {
|
|
||||||
return s.id === sectionid
|
if (sectionid) {
|
||||||
})), types && (sections = sections.filter(function(s) {
|
sections = sections.filter(function (s) {
|
||||||
return -1 !== types.indexOf(s.id)
|
return s.id === sectionid;
|
||||||
}));
|
});
|
||||||
var i, length, elem = page.querySelector(".favoriteSections");
|
}
|
||||||
|
|
||||||
|
if (types) {
|
||||||
|
sections = sections.filter(function (s) {
|
||||||
|
return -1 !== types.indexOf(s.id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var i;
|
||||||
|
var length;
|
||||||
|
var elem = page.querySelector(".favoriteSections");
|
||||||
|
|
||||||
if (!elem.innerHTML) {
|
if (!elem.innerHTML) {
|
||||||
var html = "";
|
var html = "";
|
||||||
for (i = 0, length = sections.length; i < length; i++) html += '<div class="verticalSection section' + sections[i].id + '"></div>';
|
|
||||||
elem.innerHTML = html
|
for (i = 0, length = sections.length; i < length; i++) {
|
||||||
|
html += '<div class="verticalSection section' + sections[i].id + '"></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elem.innerHTML = html;
|
||||||
|
}
|
||||||
|
|
||||||
var promises = [];
|
var promises = [];
|
||||||
|
|
||||||
for (i = 0, length = sections.length; i < length; i++) {
|
for (i = 0, length = sections.length; i < length; i++) {
|
||||||
var section = sections[i];
|
var section = sections[i];
|
||||||
elem = page.querySelector(".section" + section.id), promises.push(loadSection(elem, userId, topParentId, section, 1 === sections.length))
|
elem = page.querySelector(".section" + section.id);
|
||||||
|
promises.push(loadSection(elem, userId, topParentId, section, 1 === sections.length));
|
||||||
}
|
}
|
||||||
Promise.all(promises).then(function() {
|
|
||||||
loading.hide()
|
Promise.all(promises).then(function () {
|
||||||
})
|
loading.hide();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
render: loadSections
|
render: loadSections
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
|
@ -1,32 +1,45 @@
|
|||||||
define(["dom", "appRouter", "connectionManager"], function(dom, appRouter, connectionManager) {
|
define(["dom", "appRouter", "connectionManager"], function (dom, appRouter, connectionManager) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function onGroupedCardClick(e, card) {
|
function onGroupedCardClick(e, card) {
|
||||||
var itemId = card.getAttribute("data-id"),
|
var itemId = card.getAttribute("data-id");
|
||||||
serverId = card.getAttribute("data-serverid"),
|
var serverId = card.getAttribute("data-serverid");
|
||||||
apiClient = connectionManager.getApiClient(serverId),
|
var apiClient = connectionManager.getApiClient(serverId);
|
||||||
userId = apiClient.getCurrentUserId(),
|
var userId = apiClient.getCurrentUserId();
|
||||||
playedIndicator = card.querySelector(".playedIndicator"),
|
var playedIndicator = card.querySelector(".playedIndicator");
|
||||||
playedIndicatorHtml = playedIndicator ? playedIndicator.innerHTML : null,
|
var playedIndicatorHtml = playedIndicator ? playedIndicator.innerHTML : null;
|
||||||
options = {
|
var options = {
|
||||||
Limit: parseInt(playedIndicatorHtml || "10"),
|
Limit: parseInt(playedIndicatorHtml || "10"),
|
||||||
Fields: "PrimaryImageAspectRatio,DateCreated",
|
Fields: "PrimaryImageAspectRatio,DateCreated",
|
||||||
ParentId: itemId,
|
ParentId: itemId,
|
||||||
GroupItems: !1
|
GroupItems: false
|
||||||
},
|
};
|
||||||
actionableParent = dom.parentWithTag(e.target, ["A", "BUTTON", "INPUT"]);
|
var 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]);
|
if (!actionableParent || actionableParent.classList.contains("cardContent")) {
|
||||||
|
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;
|
var url = "itemdetails.html?id=" + itemId + "&serverId=" + serverId;
|
||||||
Dashboard.navigate(url)
|
Dashboard.navigate(url);
|
||||||
}), e.stopPropagation(), e.preventDefault(), !1
|
});
|
||||||
|
e.stopPropagation();
|
||||||
|
e.preventDefault();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onItemsContainerClick(e) {
|
function onItemsContainerClick(e) {
|
||||||
var groupedCard = dom.parentWithClass(e.target, "groupedCard");
|
var groupedCard = dom.parentWithClass(e.target, "groupedCard");
|
||||||
groupedCard && onGroupedCardClick(e, groupedCard)
|
|
||||||
|
if (groupedCard) {
|
||||||
|
onGroupedCardClick(e, groupedCard);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
onItemsContainerClick: onItemsContainerClick
|
onItemsContainerClick: onItemsContainerClick
|
||||||
}
|
};
|
||||||
});
|
});
|
@ -1,8 +1,9 @@
|
|||||||
define(["datetime"], function(datetime) {
|
define(["datetime"], function (datetime) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function humaneDate(date_str) {
|
function humaneDate(date_str) {
|
||||||
var format, time_formats = [
|
var format;
|
||||||
|
var time_formats = [
|
||||||
[90, "a minute"],
|
[90, "a minute"],
|
||||||
[3600, "minutes", 60],
|
[3600, "minutes", 60],
|
||||||
[5400, "an hour"],
|
[5400, "an hour"],
|
||||||
@ -15,14 +16,30 @@ define(["datetime"], function(datetime) {
|
|||||||
[31536e3, "months", 2628e3],
|
[31536e3, "months", 2628e3],
|
||||||
[47304e3, "a year"],
|
[47304e3, "a year"],
|
||||||
[31536e5, "years", 31536e3]
|
[31536e5, "years", 31536e3]
|
||||||
],
|
];
|
||||||
dt = new Date,
|
var dt = new Date();
|
||||||
date = datetime.parseISO8601Date(date_str, !0),
|
var date = datetime.parseISO8601Date(date_str, true);
|
||||||
seconds = (dt - date) / 1e3,
|
var seconds = (dt - date) / 1000.0;
|
||||||
i = 0;
|
var 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";
|
if (seconds < 0) {
|
||||||
return seconds > 47304e5 ? Math.round(seconds / 47304e5) + " centuries ago" : date_str
|
seconds = Math.abs(seconds);
|
||||||
|
}
|
||||||
|
for (; format = time_formats[i++];) {
|
||||||
|
if (seconds < format[0]) {
|
||||||
|
if (2 == format.length) {
|
||||||
|
return format[1] + " ago";
|
||||||
|
}
|
||||||
|
|
||||||
|
return Math.round(seconds / format[2]) + " " + format[1] + " ago";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (seconds > 47304e5) {
|
||||||
|
return Math.round(seconds / 47304e5) + " centuries ago";
|
||||||
|
}
|
||||||
|
|
||||||
|
return date_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
function humaneElapsed(firstDateStr, secondDateStr) {
|
function humaneElapsed(firstDateStr, secondDateStr) {
|
||||||
@ -30,12 +47,10 @@ define(["datetime"], function(datetime) {
|
|||||||
var dateOne = new Date(firstDateStr);
|
var dateOne = new Date(firstDateStr);
|
||||||
var dateTwo = new Date(secondDateStr);
|
var dateTwo = new Date(secondDateStr);
|
||||||
var delta = (dateTwo.getTime() - dateOne.getTime()) / 1e3;
|
var delta = (dateTwo.getTime() - dateOne.getTime()) / 1e3;
|
||||||
|
|
||||||
var days = Math.floor(delta % 31536e3 / 86400);
|
var days = Math.floor(delta % 31536e3 / 86400);
|
||||||
var hours = Math.floor(delta % 31536e3 % 86400 / 3600);
|
var hours = Math.floor(delta % 31536e3 % 86400 / 3600);
|
||||||
var minutes = Math.floor(delta % 31536e3 % 86400 % 3600 / 60);
|
var minutes = Math.floor(delta % 31536e3 % 86400 % 3600 / 60);
|
||||||
var seconds = Math.round(delta % 31536e3 % 86400 % 3600 % 60);
|
var seconds = Math.round(delta % 31536e3 % 86400 % 3600 % 60);
|
||||||
|
|
||||||
var elapsed = "";
|
var elapsed = "";
|
||||||
elapsed += 1 == days ? days + " day " : "";
|
elapsed += 1 == days ? days + " day " : "";
|
||||||
elapsed += days > 1 ? days + " days " : "";
|
elapsed += days > 1 ? days + " days " : "";
|
||||||
@ -46,15 +61,13 @@ define(["datetime"], function(datetime) {
|
|||||||
elapsed += elapsed.length > 0 ? "and " : "";
|
elapsed += elapsed.length > 0 ? "and " : "";
|
||||||
elapsed += 1 == seconds ? seconds + " second" : "";
|
elapsed += 1 == seconds ? seconds + " second" : "";
|
||||||
elapsed += 0 == seconds || seconds > 1 ? seconds + " seconds" : "";
|
elapsed += 0 == seconds || seconds > 1 ? seconds + " seconds" : "";
|
||||||
|
|
||||||
return elapsed;
|
return elapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.humaneDate = humaneDate;
|
window.humaneDate = humaneDate;
|
||||||
window.humaneElapsed = humaneElapsed;
|
window.humaneElapsed = humaneElapsed;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
humaneDate: humaneDate,
|
humaneDate: humaneDate,
|
||||||
humaneElapsed: humaneElapsed
|
humaneElapsed: humaneElapsed
|
||||||
}
|
};
|
||||||
});
|
});
|
@ -1,4 +1,4 @@
|
|||||||
define(["globalize", "dom", "dialogHelper", "emby-checkbox", "emby-select", "emby-input"], function(globalize, dom, dialogHelper) {
|
define(["globalize", "dom", "dialogHelper", "emby-checkbox", "emby-select", "emby-input"], function (globalize, dom, dialogHelper) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function getDefaultImageConfig(itemType, type) {
|
function getDefaultImageConfig(itemType, type) {
|
||||||
@ -6,72 +6,107 @@ define(["globalize", "dom", "dialogHelper", "emby-checkbox", "emby-select", "emb
|
|||||||
Type: type,
|
Type: type,
|
||||||
MinWidth: 0,
|
MinWidth: 0,
|
||||||
Limit: "Primary" === type ? 1 : 0
|
Limit: "Primary" === type ? 1 : 0
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function findImageOptions(imageOptions, type) {
|
function findImageOptions(imageOptions, type) {
|
||||||
return imageOptions.filter(function(i) {
|
return imageOptions.filter(function (i) {
|
||||||
return i.Type == type
|
return i.Type == type;
|
||||||
})[0]
|
})[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getImageConfig(options, availableOptions, imageType, itemType) {
|
function getImageConfig(options, availableOptions, imageType, itemType) {
|
||||||
return findImageOptions(options.ImageOptions || [], imageType) || findImageOptions(availableOptions.DefaultImageOptions || [], imageType) || getDefaultImageConfig(itemType, imageType)
|
return findImageOptions(options.ImageOptions || [], imageType) || findImageOptions(availableOptions.DefaultImageOptions || [], imageType) || getDefaultImageConfig(itemType, imageType);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setVisibilityOfBackdrops(elem, visible) {
|
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"))
|
if (visible) {
|
||||||
|
elem.classList.remove("hide");
|
||||||
|
elem.querySelector("input").setAttribute("required", "required");
|
||||||
|
} else {
|
||||||
|
elem.classList.add("hide");
|
||||||
|
elem.querySelector("input").setAttribute("required", "");
|
||||||
|
elem.querySelector("input").removeAttribute("required");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadValues(context, itemType, options, availableOptions) {
|
function loadValues(context, itemType, options, availableOptions) {
|
||||||
var supportedImageTypes = availableOptions.SupportedImageTypes || [];
|
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) {
|
setVisibilityOfBackdrops(context.querySelector(".backdropFields"), -1 != supportedImageTypes.indexOf("Backdrop"));
|
||||||
var imageType = i.getAttribute("data-imagetype"),
|
setVisibilityOfBackdrops(context.querySelector(".screenshotFields"), -1 != supportedImageTypes.indexOf("Screenshot"));
|
||||||
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
|
Array.prototype.forEach.call(context.querySelectorAll(".imageType"), function (i) {
|
||||||
|
var imageType = i.getAttribute("data-imagetype");
|
||||||
|
var container = dom.parentWithTag(i, "LABEL");
|
||||||
|
|
||||||
|
if (-1 == supportedImageTypes.indexOf(imageType)) {
|
||||||
|
container.classList.add("hide");
|
||||||
|
} else {
|
||||||
|
container.classList.remove("hide");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getImageConfig(options, availableOptions, imageType, itemType).Limit) {
|
||||||
|
i.checked = true;
|
||||||
|
} else {
|
||||||
|
i.checked = false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
var backdropConfig = getImageConfig(options, availableOptions, "Backdrop", itemType);
|
var backdropConfig = getImageConfig(options, availableOptions, "Backdrop", itemType);
|
||||||
context.querySelector("#txtMaxBackdrops").value = backdropConfig.Limit, context.querySelector("#txtMinBackdropDownloadWidth").value = backdropConfig.MinWidth;
|
context.querySelector("#txtMaxBackdrops").value = backdropConfig.Limit;
|
||||||
|
context.querySelector("#txtMinBackdropDownloadWidth").value = backdropConfig.MinWidth;
|
||||||
var screenshotConfig = getImageConfig(options, availableOptions, "Screenshot", itemType);
|
var screenshotConfig = getImageConfig(options, availableOptions, "Screenshot", itemType);
|
||||||
context.querySelector("#txtMaxScreenshots").value = screenshotConfig.Limit, context.querySelector("#txtMinScreenshotDownloadWidth").value = screenshotConfig.MinWidth
|
context.querySelector("#txtMaxScreenshots").value = screenshotConfig.Limit;
|
||||||
|
context.querySelector("#txtMinScreenshotDownloadWidth").value = screenshotConfig.MinWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveValues(context, options) {
|
function saveValues(context, options) {
|
||||||
options.ImageOptions = Array.prototype.map.call(context.querySelectorAll(".imageType:not(.hide)"), function(c) {
|
options.ImageOptions = Array.prototype.map.call(context.querySelectorAll(".imageType:not(.hide)"), function (c) {
|
||||||
return {
|
return {
|
||||||
Type: c.getAttribute("data-imagetype"),
|
Type: c.getAttribute("data-imagetype"),
|
||||||
Limit: c.checked ? 1 : 0,
|
Limit: c.checked ? 1 : 0,
|
||||||
MinWidth: 0
|
MinWidth: 0
|
||||||
}
|
};
|
||||||
}), options.ImageOptions.push({
|
});
|
||||||
|
options.ImageOptions.push({
|
||||||
Type: "Backdrop",
|
Type: "Backdrop",
|
||||||
Limit: context.querySelector("#txtMaxBackdrops").value,
|
Limit: context.querySelector("#txtMaxBackdrops").value,
|
||||||
MinWidth: context.querySelector("#txtMinBackdropDownloadWidth").value
|
MinWidth: context.querySelector("#txtMinBackdropDownloadWidth").value
|
||||||
}), options.ImageOptions.push({
|
});
|
||||||
|
options.ImageOptions.push({
|
||||||
Type: "Screenshot",
|
Type: "Screenshot",
|
||||||
Limit: context.querySelector("#txtMaxScreenshots").value,
|
Limit: context.querySelector("#txtMaxScreenshots").value,
|
||||||
MinWidth: context.querySelector("#txtMinScreenshotDownloadWidth").value
|
MinWidth: context.querySelector("#txtMinScreenshotDownloadWidth").value
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function editor() {
|
function editor() {
|
||||||
this.show = function(itemType, options, availableOptions) {
|
this.show = function (itemType, options, availableOptions) {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
var xhr = new XMLHttpRequest;
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.open("GET", "components/imageoptionseditor/imageoptionseditor.template.html", !0), xhr.onload = function(e) {
|
xhr.open("GET", "components/imageoptionseditor/imageoptionseditor.template.html", true);
|
||||||
var template = this.response,
|
|
||||||
dlg = dialogHelper.createDialog({
|
xhr.onload = function (e) {
|
||||||
|
var template = this.response;
|
||||||
|
var dlg = dialogHelper.createDialog({
|
||||||
size: "medium-tall",
|
size: "medium-tall",
|
||||||
removeOnClose: !0,
|
removeOnClose: true,
|
||||||
scrollY: !1
|
scrollY: false
|
||||||
});
|
});
|
||||||
dlg.classList.add("formDialog"), dlg.innerHTML = globalize.translateDocument(template), dlg.addEventListener("close", function() {
|
dlg.classList.add("formDialog");
|
||||||
saveValues(dlg, options)
|
dlg.innerHTML = globalize.translateDocument(template);
|
||||||
}), loadValues(dlg, itemType, options, availableOptions), dialogHelper.open(dlg).then(resolve, resolve), dlg.querySelector(".btnCancel").addEventListener("click", function() {
|
dlg.addEventListener("close", function () {
|
||||||
dialogHelper.close(dlg)
|
saveValues(dlg, options);
|
||||||
})
|
});
|
||||||
}, xhr.send()
|
loadValues(dlg, itemType, options, availableOptions);
|
||||||
})
|
dialogHelper.open(dlg).then(resolve, resolve);
|
||||||
|
dlg.querySelector(".btnCancel").addEventListener("click", function () {
|
||||||
|
dialogHelper.close(dlg);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
xhr.send();
|
||||||
|
});
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return editor
|
return editor;
|
||||||
});
|
});
|
@ -1,5 +1,5 @@
|
|||||||
define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize', 'scrollHelper', 'layoutManager', 'focusManager', 'browser', 'emby-input', 'emby-checkbox', 'paper-icon-button-light', 'css!./../formdialog', 'material-icons', 'cardStyle'], function (dialogHelper, loading, connectionManager, require, globalize, scrollHelper, layoutManager, focusManager, browser) {
|
define(["dialogHelper", "loading", "connectionManager", "require", "globalize", "scrollHelper", "layoutManager", "focusManager", "browser", "emby-input", "emby-checkbox", "paper-icon-button-light", "css!./../formdialog", "material-icons", "cardStyle"], function (dialogHelper, loading, connectionManager, require, globalize, scrollHelper, layoutManager, focusManager, browser) {
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
var currentItem;
|
var currentItem;
|
||||||
var currentItemType;
|
var currentItemType;
|
||||||
@ -20,7 +20,7 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
|||||||
};
|
};
|
||||||
|
|
||||||
var i, length;
|
var i, length;
|
||||||
var identifyField = page.querySelectorAll('.identifyField');
|
var identifyField = page.querySelectorAll(".identifyField");
|
||||||
var value;
|
var value;
|
||||||
for (i = 0, length = identifyField.length; i < length; i++) {
|
for (i = 0, length = identifyField.length; i < length; i++) {
|
||||||
|
|
||||||
@ -28,17 +28,17 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
|||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
|
|
||||||
if (identifyField[i].type === 'number') {
|
if (identifyField[i].type === "number") {
|
||||||
value = parseInt(value);
|
value = parseInt(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
lookupInfo[identifyField[i].getAttribute('data-lookup')] = value;
|
lookupInfo[identifyField[i].getAttribute("data-lookup")] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var hasId = false;
|
var hasId = false;
|
||||||
|
|
||||||
var txtLookupId = page.querySelectorAll('.txtLookupId');
|
var txtLookupId = page.querySelectorAll(".txtLookupId");
|
||||||
for (i = 0, length = txtLookupId.length; i < length; i++) {
|
for (i = 0, length = txtLookupId.length; i < length; i++) {
|
||||||
|
|
||||||
value = txtLookupId[i].value;
|
value = txtLookupId[i].value;
|
||||||
@ -46,12 +46,12 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
|||||||
if (value) {
|
if (value) {
|
||||||
hasId = true;
|
hasId = true;
|
||||||
}
|
}
|
||||||
lookupInfo.ProviderIds[txtLookupId[i].getAttribute('data-providerkey')] = value;
|
lookupInfo.ProviderIds[txtLookupId[i].getAttribute("data-providerkey")] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasId && !lookupInfo.Name) {
|
if (!hasId && !lookupInfo.Name) {
|
||||||
require(['toast'], function (toast) {
|
require(["toast"], function (toast) {
|
||||||
toast(globalize.translate('PleaseEnterNameOrId'));
|
toast(globalize.translate("PleaseEnterNameOrId"));
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
|||||||
url: apiClient.getUrl("Items/RemoteSearch/" + currentItemType),
|
url: apiClient.getUrl("Items/RemoteSearch/" + currentItemType),
|
||||||
data: JSON.stringify(lookupInfo),
|
data: JSON.stringify(lookupInfo),
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
dataType: 'json'
|
dataType: "json"
|
||||||
|
|
||||||
}).then(function (results) {
|
}).then(function (results) {
|
||||||
|
|
||||||
@ -87,14 +87,14 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
|||||||
|
|
||||||
function showIdentificationSearchResults(page, results) {
|
function showIdentificationSearchResults(page, results) {
|
||||||
|
|
||||||
var identificationSearchResults = page.querySelector('.identificationSearchResults');
|
var identificationSearchResults = page.querySelector(".identificationSearchResults");
|
||||||
|
|
||||||
page.querySelector('.popupIdentifyForm').classList.add('hide');
|
page.querySelector(".popupIdentifyForm").classList.add("hide");
|
||||||
identificationSearchResults.classList.remove('hide');
|
identificationSearchResults.classList.remove("hide");
|
||||||
page.querySelector('.identifyOptionsForm').classList.add('hide');
|
page.querySelector(".identifyOptionsForm").classList.add("hide");
|
||||||
page.querySelector('.dialogContentInner').classList.remove('dialog-content-centered');
|
page.querySelector(".dialogContentInner").classList.remove("dialog-content-centered");
|
||||||
|
|
||||||
var html = '';
|
var html = "";
|
||||||
var i, length;
|
var i, length;
|
||||||
for (i = 0, length = results.length; i < length; i++) {
|
for (i = 0, length = results.length; i < length; i++) {
|
||||||
|
|
||||||
@ -102,11 +102,11 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
|||||||
html += getSearchResultHtml(result, i);
|
html += getSearchResultHtml(result, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
var elem = page.querySelector('.identificationSearchResultList');
|
var elem = page.querySelector(".identificationSearchResultList");
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
|
|
||||||
function onSearchImageClick() {
|
function onSearchImageClick() {
|
||||||
var index = parseInt(this.getAttribute('data-index'));
|
var index = parseInt(this.getAttribute("data-index"));
|
||||||
|
|
||||||
var currentResult = results[index];
|
var currentResult = results[index];
|
||||||
|
|
||||||
@ -119,10 +119,10 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var searchImages = elem.querySelectorAll('.card');
|
var searchImages = elem.querySelectorAll(".card");
|
||||||
for (i = 0, length = searchImages.length; i < length; i++) {
|
for (i = 0, length = searchImages.length; i < length; i++) {
|
||||||
|
|
||||||
searchImages[i].addEventListener('click', onSearchImageClick);
|
searchImages[i].addEventListener("click", onSearchImageClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
@ -140,13 +140,13 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
|||||||
|
|
||||||
function showIdentifyOptions(page, identifyResult) {
|
function showIdentifyOptions(page, identifyResult) {
|
||||||
|
|
||||||
var identifyOptionsForm = page.querySelector('.identifyOptionsForm');
|
var identifyOptionsForm = page.querySelector(".identifyOptionsForm");
|
||||||
|
|
||||||
page.querySelector('.popupIdentifyForm').classList.add('hide');
|
page.querySelector(".popupIdentifyForm").classList.add("hide");
|
||||||
page.querySelector('.identificationSearchResults').classList.add('hide');
|
page.querySelector(".identificationSearchResults").classList.add("hide");
|
||||||
identifyOptionsForm.classList.remove('hide');
|
identifyOptionsForm.classList.remove("hide");
|
||||||
page.querySelector('#chkIdentifyReplaceImages').checked = true;
|
page.querySelector("#chkIdentifyReplaceImages").checked = true;
|
||||||
page.querySelector('.dialogContentInner').classList.add('dialog-content-centered');
|
page.querySelector(".dialogContentInner").classList.add("dialog-content-centered");
|
||||||
|
|
||||||
currentSearchResult = identifyResult;
|
currentSearchResult = identifyResult;
|
||||||
|
|
||||||
@ -157,47 +157,47 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
|||||||
lines.push(identifyResult.ProductionYear);
|
lines.push(identifyResult.ProductionYear);
|
||||||
}
|
}
|
||||||
|
|
||||||
var resultHtml = lines.join('<br/>');
|
var resultHtml = lines.join("<br/>");
|
||||||
|
|
||||||
if (identifyResult.ImageUrl) {
|
if (identifyResult.ImageUrl) {
|
||||||
var displayUrl = getSearchImageDisplayUrl(identifyResult.ImageUrl, identifyResult.SearchProviderName);
|
var displayUrl = getSearchImageDisplayUrl(identifyResult.ImageUrl, identifyResult.SearchProviderName);
|
||||||
|
|
||||||
resultHtml = '<div style="display:flex;align-items:center;"><img src="' + displayUrl + '" style="max-height:240px;" /><div style="margin-left:1em;">' + resultHtml + '</div>';
|
resultHtml = '<div style="display:flex;align-items:center;"><img src="' + displayUrl + '" style="max-height:240px;" /><div style="margin-left:1em;">' + resultHtml + "</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
page.querySelector('.selectedSearchResult').innerHTML = resultHtml;
|
page.querySelector(".selectedSearchResult").innerHTML = resultHtml;
|
||||||
|
|
||||||
focusManager.focus(identifyOptionsForm.querySelector('.btnSubmit'));
|
focusManager.focus(identifyOptionsForm.querySelector(".btnSubmit"));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSearchResultHtml(result, index) {
|
function getSearchResultHtml(result, index) {
|
||||||
|
|
||||||
var html = '';
|
var html = "";
|
||||||
var cssClass = "card scalableCard";
|
var cssClass = "card scalableCard";
|
||||||
var cardBoxCssClass = 'cardBox';
|
var cardBoxCssClass = "cardBox";
|
||||||
var padderClass;
|
var padderClass;
|
||||||
|
|
||||||
if (currentItemType === "Episode") {
|
if (currentItemType === "Episode") {
|
||||||
cssClass += " backdropCard backdropCard-scalable";
|
cssClass += " backdropCard backdropCard-scalable";
|
||||||
padderClass = 'cardPadder-backdrop';
|
padderClass = "cardPadder-backdrop";
|
||||||
}
|
}
|
||||||
else if (currentItemType === "MusicAlbum" || currentItemType === "MusicArtist") {
|
else if (currentItemType === "MusicAlbum" || currentItemType === "MusicArtist") {
|
||||||
cssClass += " squareCard squareCard-scalable";
|
cssClass += " squareCard squareCard-scalable";
|
||||||
padderClass = 'cardPadder-square';
|
padderClass = "cardPadder-square";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cssClass += " portraitCard portraitCard-scalable";
|
cssClass += " portraitCard portraitCard-scalable";
|
||||||
padderClass = 'cardPadder-portrait';
|
padderClass = "cardPadder-portrait";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layoutManager.tv && !browser.slow) {
|
if (layoutManager.tv && !browser.slow) {
|
||||||
cardBoxCssClass += ' cardBox-focustransform';
|
cardBoxCssClass += " cardBox-focustransform";
|
||||||
}
|
}
|
||||||
|
|
||||||
cardBoxCssClass += ' cardBox-bottompadded';
|
cardBoxCssClass += " cardBox-bottompadded";
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
cardBoxCssClass += ' card-focuscontent cardBox-withfocuscontent';
|
cardBoxCssClass += " card-focuscontent cardBox-withfocuscontent";
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '<button type="button" class="' + cssClass + '" data-index="' + index + '">';
|
html += '<button type="button" class="' + cssClass + '" data-index="' + index + '">';
|
||||||
@ -215,8 +215,8 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
|||||||
|
|
||||||
html += '<div class="cardImageContainer coveredImage defaultCardBackground defaultCardBackground1"><div class="cardText cardCenteredText">' + result.Name + '</div></div>';
|
html += '<div class="cardImageContainer coveredImage defaultCardBackground defaultCardBackground1"><div class="cardText cardCenteredText">' + result.Name + '</div></div>';
|
||||||
}
|
}
|
||||||
html += '</div>';
|
html += "</div>";
|
||||||
html += '</div>';
|
html += "</div>";
|
||||||
|
|
||||||
var numLines = 2;
|
var numLines = 2;
|
||||||
if (currentItemType === "MusicAlbum") {
|
if (currentItemType === "MusicAlbum") {
|
||||||
@ -239,12 +239,12 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
|||||||
} else {
|
} else {
|
||||||
html += '<div class="cardText cardText-secondary cardTextCentered">';
|
html += '<div class="cardText cardText-secondary cardTextCentered">';
|
||||||
}
|
}
|
||||||
html += lines[i] || ' ';
|
html += lines[i] || " ";
|
||||||
html += '</div>';
|
html += "</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '</div>';
|
html += "</div>";
|
||||||
html += '</button>';
|
html += "</button>";
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
|||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
ReplaceAllImages: page.querySelector('#chkIdentifyReplaceImages').checked
|
ReplaceAllImages: page.querySelector("#chkIdentifyReplaceImages").checked
|
||||||
};
|
};
|
||||||
|
|
||||||
var apiClient = getApiClient();
|
var apiClient = getApiClient();
|
||||||
@ -291,7 +291,7 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
|||||||
|
|
||||||
apiClient.getJSON(apiClient.getUrl("Items/" + item.Id + "/ExternalIdInfos")).then(function (idList) {
|
apiClient.getJSON(apiClient.getUrl("Items/" + item.Id + "/ExternalIdInfos")).then(function (idList) {
|
||||||
|
|
||||||
var html = '';
|
var html = "";
|
||||||
|
|
||||||
var providerIds = item.ProviderIds || {};
|
var providerIds = item.ProviderIds || {};
|
||||||
|
|
||||||
@ -303,30 +303,30 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
|||||||
|
|
||||||
html += '<div class="inputContainer">';
|
html += '<div class="inputContainer">';
|
||||||
|
|
||||||
var idLabel = globalize.translate('LabelDynamicExternalId').replace('{0}', idInfo.Name);
|
var idLabel = globalize.translate("LabelDynamicExternalId").replace("{0}", idInfo.Name);
|
||||||
|
|
||||||
var value = providerIds[idInfo.Key] || '';
|
var value = providerIds[idInfo.Key] || "";
|
||||||
|
|
||||||
html += '<input is="emby-input" class="txtLookupId" data-providerkey="' + idInfo.Key + '" id="' + id + '" label="' + idLabel + '"/>';
|
html += '<input is="emby-input" class="txtLookupId" data-providerkey="' + idInfo.Key + '" id="' + id + '" label="' + idLabel + '"/>';
|
||||||
|
|
||||||
html += '</div>';
|
html += "</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
page.querySelector('#txtLookupName').value = '';
|
page.querySelector("#txtLookupName").value = "";
|
||||||
|
|
||||||
if (item.Type === "Person" || item.Type === "BoxSet") {
|
if (item.Type === "Person" || item.Type === "BoxSet") {
|
||||||
|
|
||||||
page.querySelector('.fldLookupYear').classList.add('hide');
|
page.querySelector(".fldLookupYear").classList.add("hide");
|
||||||
page.querySelector('#txtLookupYear').value = '';
|
page.querySelector("#txtLookupYear").value = "";
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
page.querySelector('.fldLookupYear').classList.remove('hide');
|
page.querySelector(".fldLookupYear").classList.remove("hide");
|
||||||
page.querySelector('#txtLookupYear').value = '';
|
page.querySelector("#txtLookupYear").value = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
page.querySelector('.identifyProviderIds').innerHTML = html;
|
page.querySelector(".identifyProviderIds").innerHTML = html;
|
||||||
|
|
||||||
page.querySelector('.formDialogHeaderTitle').innerHTML = globalize.translate('Identify');
|
page.querySelector(".formDialogHeaderTitle").innerHTML = globalize.translate("Identify");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,7 +334,7 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
|||||||
|
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
require(['text!./itemidentifier.template.html'], function (template) {
|
require(["text!./itemidentifier.template.html"], function (template) {
|
||||||
|
|
||||||
var apiClient = getApiClient();
|
var apiClient = getApiClient();
|
||||||
|
|
||||||
@ -344,30 +344,30 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
|||||||
currentItemType = currentItem.Type;
|
currentItemType = currentItem.Type;
|
||||||
|
|
||||||
var dialogOptions = {
|
var dialogOptions = {
|
||||||
size: 'fullscreen-border',
|
size: "fullscreen-border",
|
||||||
removeOnClose: true,
|
removeOnClose: true,
|
||||||
scrollY: false
|
scrollY: false
|
||||||
};
|
};
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
dialogOptions.size = 'fullscreen';
|
dialogOptions.size = "fullscreen";
|
||||||
}
|
}
|
||||||
|
|
||||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
var dlg = dialogHelper.createDialog(dialogOptions);
|
||||||
|
|
||||||
dlg.classList.add('formDialog');
|
dlg.classList.add("formDialog");
|
||||||
dlg.classList.add('recordingDialog');
|
dlg.classList.add("recordingDialog");
|
||||||
|
|
||||||
var html = '';
|
var html = "";
|
||||||
html += globalize.translateDocument(template, 'core');
|
html += globalize.translateDocument(template, "core");
|
||||||
|
|
||||||
dlg.innerHTML = html;
|
dlg.innerHTML = html;
|
||||||
|
|
||||||
// Has to be assigned a z-index after the call to .open()
|
// Has to be assigned a z-index after the call to .open()
|
||||||
dlg.addEventListener('close', onDialogClosed);
|
dlg.addEventListener("close", onDialogClosed);
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
scrollHelper.centerFocus.on(dlg.querySelector('.formDialogContent'), false);
|
scrollHelper.centerFocus.on(dlg.querySelector(".formDialogContent"), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Path) {
|
if (item.Path) {
|
||||||
@ -380,26 +380,26 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
|||||||
|
|
||||||
dialogHelper.open(dlg);
|
dialogHelper.open(dlg);
|
||||||
|
|
||||||
dlg.querySelector('.popupIdentifyForm').addEventListener('submit', function (e) {
|
dlg.querySelector(".popupIdentifyForm").addEventListener("submit", function (e) {
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
searchForIdentificationResults(dlg);
|
searchForIdentificationResults(dlg);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
dlg.querySelector('.identifyOptionsForm').addEventListener('submit', function (e) {
|
dlg.querySelector(".identifyOptionsForm").addEventListener("submit", function (e) {
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
submitIdentficationResult(dlg);
|
submitIdentficationResult(dlg);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
dlg.querySelector('.btnCancel').addEventListener('click', function (e) {
|
dlg.querySelector(".btnCancel").addEventListener("click", function (e) {
|
||||||
|
|
||||||
dialogHelper.close(dlg);
|
dialogHelper.close(dlg);
|
||||||
});
|
});
|
||||||
|
|
||||||
dlg.classList.add('identifyDialog');
|
dlg.classList.add("identifyDialog");
|
||||||
|
|
||||||
showIdentificationForm(dlg, item);
|
showIdentificationForm(dlg, item);
|
||||||
loading.hide();
|
loading.hide();
|
||||||
@ -422,49 +422,49 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
|||||||
currentItem = null;
|
currentItem = null;
|
||||||
currentItemType = itemType;
|
currentItemType = itemType;
|
||||||
|
|
||||||
require(['text!./itemidentifier.template.html'], function (template) {
|
require(["text!./itemidentifier.template.html"], function (template) {
|
||||||
|
|
||||||
var dialogOptions = {
|
var dialogOptions = {
|
||||||
size: 'fullscreen-border',
|
size: "fullscreen-border",
|
||||||
removeOnClose: true,
|
removeOnClose: true,
|
||||||
scrollY: false
|
scrollY: false
|
||||||
};
|
};
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
dialogOptions.size = 'fullscreen';
|
dialogOptions.size = "fullscreen";
|
||||||
}
|
}
|
||||||
|
|
||||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
var dlg = dialogHelper.createDialog(dialogOptions);
|
||||||
|
|
||||||
dlg.classList.add('formDialog');
|
dlg.classList.add("formDialog");
|
||||||
dlg.classList.add('recordingDialog');
|
dlg.classList.add("recordingDialog");
|
||||||
|
|
||||||
var html = '';
|
var html = "";
|
||||||
html += globalize.translateDocument(template, 'core');
|
html += globalize.translateDocument(template, "core");
|
||||||
|
|
||||||
dlg.innerHTML = html;
|
dlg.innerHTML = html;
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
scrollHelper.centerFocus.on(dlg.querySelector('.formDialogContent'), false);
|
scrollHelper.centerFocus.on(dlg.querySelector(".formDialogContent"), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dialogHelper.open(dlg);
|
dialogHelper.open(dlg);
|
||||||
|
|
||||||
dlg.querySelector('.btnCancel').addEventListener('click', function (e) {
|
dlg.querySelector(".btnCancel").addEventListener("click", function (e) {
|
||||||
|
|
||||||
dialogHelper.close(dlg);
|
dialogHelper.close(dlg);
|
||||||
});
|
});
|
||||||
|
|
||||||
dlg.querySelector('.popupIdentifyForm').addEventListener('submit', function (e) {
|
dlg.querySelector(".popupIdentifyForm").addEventListener("submit", function (e) {
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
searchForIdentificationResults(dlg);
|
searchForIdentificationResults(dlg);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
dlg.addEventListener('close', function () {
|
dlg.addEventListener("close", function () {
|
||||||
|
|
||||||
loading.hide();
|
loading.hide();
|
||||||
var foundItem = hasChanges ? currentSearchResult : null;
|
var foundItem = hasChanges ? currentSearchResult : null;
|
||||||
@ -472,7 +472,7 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
|||||||
resolveFunc(foundItem);
|
resolveFunc(foundItem);
|
||||||
});
|
});
|
||||||
|
|
||||||
dlg.classList.add('identifyDialog');
|
dlg.classList.add("identifyDialog");
|
||||||
|
|
||||||
showIdentificationFormFindNew(dlg, itemName, itemYear, itemType);
|
showIdentificationFormFindNew(dlg, itemName, itemYear, itemType);
|
||||||
});
|
});
|
||||||
@ -480,20 +480,20 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
|||||||
|
|
||||||
function showIdentificationFormFindNew(dlg, itemName, itemYear, itemType) {
|
function showIdentificationFormFindNew(dlg, itemName, itemYear, itemType) {
|
||||||
|
|
||||||
dlg.querySelector('#txtLookupName').value = itemName;
|
dlg.querySelector("#txtLookupName").value = itemName;
|
||||||
|
|
||||||
if (itemType === "Person" || itemType === "BoxSet") {
|
if (itemType === "Person" || itemType === "BoxSet") {
|
||||||
|
|
||||||
dlg.querySelector('.fldLookupYear').classList.add('hide');
|
dlg.querySelector(".fldLookupYear").classList.add("hide");
|
||||||
dlg.querySelector('#txtLookupYear').value = '';
|
dlg.querySelector("#txtLookupYear").value = "";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
dlg.querySelector('.fldLookupYear').classList.remove('hide');
|
dlg.querySelector(".fldLookupYear").classList.remove("hide");
|
||||||
dlg.querySelector('#txtLookupYear').value = itemYear;
|
dlg.querySelector("#txtLookupYear").value = itemYear;
|
||||||
}
|
}
|
||||||
|
|
||||||
dlg.querySelector('.formDialogHeaderTitle').innerHTML = globalize.translate('Search');
|
dlg.querySelector(".formDialogHeaderTitle").innerHTML = globalize.translate("Search");
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -1,78 +1,171 @@
|
|||||||
define(["dialogHelper", "dom", "layoutManager", "connectionManager", "globalize", "loading", "material-icons", "formDialogStyle", "emby-button", "emby-itemscontainer", "cardStyle"], function(dialogHelper, dom, layoutManager, connectionManager, globalize, loading) {
|
define(["dialogHelper", "dom", "layoutManager", "connectionManager", "globalize", "loading", "material-icons", "formDialogStyle", "emby-button", "emby-itemscontainer", "cardStyle"], function (dialogHelper, dom, layoutManager, connectionManager, globalize, loading) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function getEditorHtml() {
|
function getEditorHtml() {
|
||||||
var html = "";
|
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>"
|
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>";
|
||||||
|
return html += "</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDeviceHtml(device) {
|
function getDeviceHtml(device) {
|
||||||
var padderClass, html = "",
|
var padderClass;
|
||||||
cssClass = "card scalableCard",
|
var html = "";
|
||||||
cardBoxCssClass = "cardBox visualCardBox";
|
var cssClass = "card scalableCard";
|
||||||
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>"
|
var cardBoxCssClass = "cardBox visualCardBox";
|
||||||
|
cssClass += " backdropCard backdropCard-scalable";
|
||||||
|
padderClass = "cardPadder-backdrop";
|
||||||
|
|
||||||
|
if (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>";
|
||||||
|
return html += "</button>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTunerName(providerId) {
|
function getTunerName(providerId) {
|
||||||
switch (providerId = providerId.toLowerCase()) {
|
switch (providerId = providerId.toLowerCase()) {
|
||||||
case "m3u":
|
case "m3u":
|
||||||
return "M3U";
|
return "M3U";
|
||||||
|
|
||||||
case "hdhomerun":
|
case "hdhomerun":
|
||||||
return "HDHomerun";
|
return "HDHomerun";
|
||||||
|
|
||||||
case "hauppauge":
|
case "hauppauge":
|
||||||
return "Hauppauge";
|
return "Hauppauge";
|
||||||
|
|
||||||
case "satip":
|
case "satip":
|
||||||
return "DVB";
|
return "DVB";
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return "Unknown"
|
return "Unknown";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderDevices(view, devices) {
|
function renderDevices(view, devices) {
|
||||||
var i, length, html = "";
|
var i;
|
||||||
for (i = 0, length = devices.length; i < length; i++) html += getDeviceHtml(devices[i]);
|
var length;
|
||||||
devices.length ? view.querySelector(".devicesHeader").classList.remove("hide") : (html = "<p><br/>" + globalize.translate("NoNewDevicesFound") + "</p>", view.querySelector(".devicesHeader").classList.add("hide"));
|
var html = "";
|
||||||
|
|
||||||
|
for (i = 0, length = devices.length; i < length; i++) {
|
||||||
|
html += getDeviceHtml(devices[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (devices.length) {
|
||||||
|
view.querySelector(".devicesHeader").classList.remove("hide");
|
||||||
|
} else {
|
||||||
|
html = "<p><br/>" + globalize.translate("NoNewDevicesFound") + "</p>";
|
||||||
|
view.querySelector(".devicesHeader").classList.add("hide");
|
||||||
|
}
|
||||||
|
|
||||||
var elem = view.querySelector(".results");
|
var elem = view.querySelector(".results");
|
||||||
elem.innerHTML = html, layoutManager.tv && focusManager.autoFocus(elem)
|
elem.innerHTML = html;
|
||||||
|
|
||||||
|
if (layoutManager.tv) {
|
||||||
|
focusManager.autoFocus(elem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function discoverDevices(view, apiClient) {
|
function discoverDevices(view, apiClient) {
|
||||||
return loading.show(), view.querySelector(".loadingContent").classList.remove("hide"), ApiClient.getJSON(ApiClient.getUrl("LiveTv/Tuners/Discvover", {
|
loading.show();
|
||||||
NewDevicesOnly: !0
|
view.querySelector(".loadingContent").classList.remove("hide");
|
||||||
})).then(function(devices) {
|
return ApiClient.getJSON(ApiClient.getUrl("LiveTv/Tuners/Discvover", {
|
||||||
currentDevices = devices, renderDevices(view, devices), view.querySelector(".loadingContent").classList.add("hide"), loading.hide()
|
NewDevicesOnly: true
|
||||||
})
|
})).then(function (devices) {
|
||||||
|
currentDevices = devices;
|
||||||
|
renderDevices(view, devices);
|
||||||
|
view.querySelector(".loadingContent").classList.add("hide");
|
||||||
|
loading.hide();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function tunerPicker() {
|
function tunerPicker() {
|
||||||
this.show = function(options) {
|
this.show = function (options) {
|
||||||
var dialogOptions = {
|
var dialogOptions = {
|
||||||
removeOnClose: !0,
|
removeOnClose: true,
|
||||||
scrollY: !1
|
scrollY: false
|
||||||
};
|
};
|
||||||
layoutManager.tv ? dialogOptions.size = "fullscreen" : dialogOptions.size = "small";
|
|
||||||
|
if (layoutManager.tv) {
|
||||||
|
dialogOptions.size = "fullscreen";
|
||||||
|
} else {
|
||||||
|
dialogOptions.size = "small";
|
||||||
|
}
|
||||||
|
|
||||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
var dlg = dialogHelper.createDialog(dialogOptions);
|
||||||
dlg.classList.add("formDialog");
|
dlg.classList.add("formDialog");
|
||||||
var html = "";
|
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() {
|
html += '<div class="formDialogHeader">';
|
||||||
dialogHelper.close(dlg)
|
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;
|
var deviceResult;
|
||||||
dlg.querySelector(".results").addEventListener("click", function(e) {
|
dlg.querySelector(".results").addEventListener("click", function (e) {
|
||||||
var tunerCard = dom.parentWithClass(e.target, "card");
|
var tunerCard = dom.parentWithClass(e.target, "card");
|
||||||
|
|
||||||
if (tunerCard) {
|
if (tunerCard) {
|
||||||
var deviceId = tunerCard.getAttribute("data-id");
|
var deviceId = tunerCard.getAttribute("data-id");
|
||||||
deviceResult = currentDevices.filter(function(d) {
|
deviceResult = currentDevices.filter(function (d) {
|
||||||
return d.DeviceId === deviceId
|
return d.DeviceId === deviceId;
|
||||||
})[0], dialogHelper.close(dlg)
|
})[0];
|
||||||
|
dialogHelper.close(dlg);
|
||||||
}
|
}
|
||||||
}), layoutManager.tv && centerFocus(dlg.querySelector(".formDialogContent"), !1, !0);
|
});
|
||||||
|
|
||||||
|
if (layoutManager.tv) {
|
||||||
|
centerFocus(dlg.querySelector(".formDialogContent"), false, true);
|
||||||
|
}
|
||||||
|
|
||||||
var apiClient = connectionManager.getApiClient(options.serverId);
|
var apiClient = connectionManager.getApiClient(options.serverId);
|
||||||
return discoverDevices(dlg, apiClient), layoutManager.tv && centerFocus(dlg.querySelector(".formDialogContent"), !1, !1), dialogHelper.open(dlg).then(function() {
|
discoverDevices(dlg, apiClient);
|
||||||
return deviceResult ? Promise.resolve(deviceResult) : Promise.reject()
|
|
||||||
})
|
if (layoutManager.tv) {
|
||||||
|
centerFocus(dlg.querySelector(".formDialogContent"), false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return dialogHelper.open(dlg).then(function () {
|
||||||
|
if (deviceResult) {
|
||||||
|
return Promise.resolve(deviceResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Promise.reject();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
var currentDevices = [];
|
var currentDevices = [];
|
||||||
return tunerPicker
|
return tunerPicker;
|
||||||
});
|
});
|
@ -1,119 +1,196 @@
|
|||||||
define(["jQuery", "loading", "emby-checkbox", "listViewStyle", "emby-input", "emby-select", "emby-button", "flexStyles"], function($, loading) {
|
define(["jQuery", "loading", "emby-checkbox", "listViewStyle", "emby-input", "emby-select", "emby-button", "flexStyles"], function ($, loading) {
|
||||||
"use strict";
|
"use strict";
|
||||||
return function(page, providerId, options) {
|
|
||||||
|
return function (page, providerId, options) {
|
||||||
function reload() {
|
function reload() {
|
||||||
loading.show(), ApiClient.getNamedConfiguration("livetv").then(function(config) {
|
loading.show();
|
||||||
var info = config.ListingProviders.filter(function(i) {
|
ApiClient.getNamedConfiguration("livetv").then(function (config) {
|
||||||
return i.Id === providerId
|
var info = config.ListingProviders.filter(function (i) {
|
||||||
|
return i.Id === providerId;
|
||||||
})[0] || {};
|
})[0] || {};
|
||||||
listingsId = info.ListingsId, $("#selectListing", page).val(info.ListingsId || ""), page.querySelector(".txtUser").value = info.Username || "", page.querySelector(".txtPass").value = "", page.querySelector(".txtZipCode").value = info.ZipCode || "", info.Username && info.Password ? page.querySelector(".listingsSection").classList.remove("hide") : page.querySelector(".listingsSection").classList.add("hide"), page.querySelector(".chkAllTuners").checked = info.EnableAllTuners, page.querySelector(".chkAllTuners").checked ? page.querySelector(".selectTunersSection").classList.add("hide") : page.querySelector(".selectTunersSection").classList.remove("hide"), setCountry(info), refreshTunerDevices(page, info, config.TunerHosts)
|
listingsId = info.ListingsId;
|
||||||
})
|
$("#selectListing", page).val(info.ListingsId || "");
|
||||||
|
page.querySelector(".txtUser").value = info.Username || "";
|
||||||
|
page.querySelector(".txtPass").value = "";
|
||||||
|
page.querySelector(".txtZipCode").value = info.ZipCode || "";
|
||||||
|
|
||||||
|
if (info.Username && info.Password) {
|
||||||
|
page.querySelector(".listingsSection").classList.remove("hide");
|
||||||
|
} else {
|
||||||
|
page.querySelector(".listingsSection").classList.add("hide");
|
||||||
|
}
|
||||||
|
|
||||||
|
page.querySelector(".chkAllTuners").checked = info.EnableAllTuners;
|
||||||
|
|
||||||
|
if (info.EnableAllTuners) {
|
||||||
|
page.querySelector(".selectTunersSection").classList.add("hide");
|
||||||
|
} else {
|
||||||
|
page.querySelector(".selectTunersSection").classList.remove("hide");
|
||||||
|
}
|
||||||
|
|
||||||
|
setCountry(info);
|
||||||
|
refreshTunerDevices(page, info, config.TunerHosts);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCountry(info) {
|
function setCountry(info) {
|
||||||
ApiClient.getJSON(ApiClient.getUrl("LiveTv/ListingProviders/SchedulesDirect/Countries")).then(function(result) {
|
ApiClient.getJSON(ApiClient.getUrl("LiveTv/ListingProviders/SchedulesDirect/Countries")).then(function (result) {
|
||||||
var i, length, countryList = [];
|
var i;
|
||||||
|
var length;
|
||||||
|
var countryList = [];
|
||||||
|
|
||||||
for (var region in result) {
|
for (var region in result) {
|
||||||
var countries = result[region];
|
var countries = result[region];
|
||||||
if (countries.length && "ZZZ" !== region)
|
|
||||||
for (i = 0, length = countries.length; i < length; i++) countryList.push({
|
if (countries.length && "ZZZ" !== region) {
|
||||||
|
for (i = 0, length = countries.length; i < length; i++) {
|
||||||
|
countryList.push({
|
||||||
name: countries[i].fullName,
|
name: countries[i].fullName,
|
||||||
value: countries[i].shortName
|
value: countries[i].shortName
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
countryList.sort(function(a, b) {
|
}
|
||||||
return a.name > b.name ? 1 : a.name < b.name ? -1 : 0
|
}
|
||||||
}), $("#selectCountry", page).html(countryList.map(function(c) {
|
|
||||||
return '<option value="' + c.value + '">' + c.name + "</option>"
|
countryList.sort(function (a, b) {
|
||||||
}).join("")).val(info.Country || ""), $(page.querySelector(".txtZipCode")).trigger("change")
|
if (a.name > b.name) {
|
||||||
}, function() {
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (a.name < b.name) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
$("#selectCountry", page).html(countryList.map(function (c) {
|
||||||
|
return '<option value="' + c.value + '">' + c.name + "</option>";
|
||||||
|
}).join("")).val(info.Country || "");
|
||||||
|
$(page.querySelector(".txtZipCode")).trigger("change");
|
||||||
|
}, function () { // ApiClient.getJSON() error handler
|
||||||
Dashboard.alert({
|
Dashboard.alert({
|
||||||
message: Globalize.translate("ErrorGettingTvLineups")
|
message: Globalize.translate("ErrorGettingTvLineups")
|
||||||
})
|
});
|
||||||
}), loading.hide()
|
});
|
||||||
|
loading.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
function sha256(str) {
|
function sha256(str) {
|
||||||
if (!self.TextEncoder) return Promise.resolve("");
|
if (!self.TextEncoder) {
|
||||||
|
return Promise.resolve("");
|
||||||
|
}
|
||||||
|
|
||||||
var buffer = new TextEncoder("utf-8").encode(str);
|
var buffer = new TextEncoder("utf-8").encode(str);
|
||||||
return crypto.subtle.digest("SHA-256", buffer).then(function(hash) {
|
return crypto.subtle.digest("SHA-256", buffer).then(function (hash) {
|
||||||
return hex(hash)
|
return hex(hash);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function hex(buffer) {
|
function hex(buffer) {
|
||||||
for (var hexCodes = [], view = new DataView(buffer), i = 0; i < view.byteLength; i += 4) {
|
var hexCodes = [];
|
||||||
var value = view.getUint32(i),
|
var view = new DataView(buffer);
|
||||||
stringValue = value.toString(16),
|
|
||||||
paddedValue = ("00000000" + stringValue).slice(-"00000000".length);
|
for (var i = 0; i < view.byteLength; i += 4) {
|
||||||
hexCodes.push(paddedValue)
|
var value = view.getUint32(i);
|
||||||
|
var stringValue = value.toString(16);
|
||||||
|
var paddedValue = ("00000000" + stringValue).slice(-"00000000".length);
|
||||||
|
hexCodes.push(paddedValue);
|
||||||
}
|
}
|
||||||
return hexCodes.join("")
|
|
||||||
|
return hexCodes.join("");
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitLoginForm() {
|
function submitLoginForm() {
|
||||||
loading.show(), sha256(page.querySelector(".txtPass").value).then(function(passwordHash) {
|
loading.show();
|
||||||
|
sha256(page.querySelector(".txtPass").value).then(function (passwordHash) {
|
||||||
var info = {
|
var info = {
|
||||||
Type: "SchedulesDirect",
|
Type: "SchedulesDirect",
|
||||||
Username: page.querySelector(".txtUser").value,
|
Username: page.querySelector(".txtUser").value,
|
||||||
EnableAllTuners: !0,
|
EnableAllTuners: true,
|
||||||
Password: passwordHash,
|
Password: passwordHash,
|
||||||
Pw: page.querySelector(".txtPass").value
|
Pw: page.querySelector(".txtPass").value
|
||||||
},
|
};
|
||||||
id = providerId;
|
var id = providerId;
|
||||||
id && (info.Id = id), ApiClient.ajax({
|
|
||||||
|
if (id) {
|
||||||
|
info.Id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
ApiClient.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: ApiClient.getUrl("LiveTv/ListingProviders", {
|
url: ApiClient.getUrl("LiveTv/ListingProviders", {
|
||||||
ValidateLogin: !0
|
ValidateLogin: true
|
||||||
}),
|
}),
|
||||||
data: JSON.stringify(info),
|
data: JSON.stringify(info),
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
dataType: "json"
|
dataType: "json"
|
||||||
}).then(function(result) {
|
}).then(function (result) {
|
||||||
Dashboard.processServerConfigurationUpdateResult(), providerId = result.Id, reload()
|
Dashboard.processServerConfigurationUpdateResult();
|
||||||
}, function() {
|
providerId = result.Id;
|
||||||
Dashboard.alert({
|
reload();
|
||||||
|
}, function () {
|
||||||
|
Dashboard.alert({ // ApiClient.ajax() error handler
|
||||||
message: Globalize.translate("ErrorSavingTvProvider")
|
message: Globalize.translate("ErrorSavingTvProvider")
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitListingsForm() {
|
function submitListingsForm() {
|
||||||
var selectedListingsId = $("#selectListing", page).val();
|
var selectedListingsId = $("#selectListing", page).val();
|
||||||
if (!selectedListingsId) return void Dashboard.alert({
|
|
||||||
|
if (!selectedListingsId) {
|
||||||
|
return void Dashboard.alert({
|
||||||
message: Globalize.translate("ErrorPleaseSelectLineup")
|
message: Globalize.translate("ErrorPleaseSelectLineup")
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
loading.show();
|
loading.show();
|
||||||
var id = providerId;
|
var id = providerId;
|
||||||
ApiClient.getNamedConfiguration("livetv").then(function(config) {
|
ApiClient.getNamedConfiguration("livetv").then(function (config) {
|
||||||
var info = config.ListingProviders.filter(function(i) {
|
var info = config.ListingProviders.filter(function (i) {
|
||||||
return i.Id === id
|
return i.Id === id;
|
||||||
})[0];
|
})[0];
|
||||||
info.ZipCode = page.querySelector(".txtZipCode").value, info.Country = $("#selectCountry", page).val(), info.ListingsId = selectedListingsId, info.EnableAllTuners = page.querySelector(".chkAllTuners").checked, info.EnabledTuners = info.EnableAllTuners ? [] : $(".chkTuner", page).get().filter(function(i) {
|
info.ZipCode = page.querySelector(".txtZipCode").value;
|
||||||
return i.checked
|
info.Country = $("#selectCountry", page).val();
|
||||||
}).map(function(i) {
|
info.ListingsId = selectedListingsId;
|
||||||
return i.getAttribute("data-id")
|
info.EnableAllTuners = page.querySelector(".chkAllTuners").checked;
|
||||||
}), ApiClient.ajax({
|
info.EnabledTuners = info.EnableAllTuners ? [] : $(".chkTuner", page).get().filter(function (i) {
|
||||||
|
return i.checked;
|
||||||
|
}).map(function (i) {
|
||||||
|
return i.getAttribute("data-id");
|
||||||
|
});
|
||||||
|
ApiClient.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: ApiClient.getUrl("LiveTv/ListingProviders", {
|
url: ApiClient.getUrl("LiveTv/ListingProviders", {
|
||||||
ValidateListings: !0
|
ValidateListings: true
|
||||||
}),
|
}),
|
||||||
data: JSON.stringify(info),
|
data: JSON.stringify(info),
|
||||||
contentType: "application/json"
|
contentType: "application/json"
|
||||||
}).then(function(result) {
|
}).then(function (result) {
|
||||||
loading.hide(), !1 !== options.showConfirmation && Dashboard.processServerConfigurationUpdateResult(), Events.trigger(self, "submitted")
|
loading.hide();
|
||||||
}, function() {
|
|
||||||
loading.hide(), Dashboard.alert({
|
if (options.showConfirmation) {
|
||||||
|
Dashboard.processServerConfigurationUpdateResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
Events.trigger(self, "submitted");
|
||||||
|
}, function () {
|
||||||
|
loading.hide();
|
||||||
|
Dashboard.alert({
|
||||||
message: Globalize.translate("ErrorAddingListingsToSchedulesDirect")
|
message: Globalize.translate("ErrorAddingListingsToSchedulesDirect")
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshListings(value) {
|
function refreshListings(value) {
|
||||||
if (!value) return void $("#selectListing", page).html("");
|
if (!value) {
|
||||||
loading.show(), ApiClient.ajax({
|
return void $("#selectListing", page).html("");
|
||||||
|
}
|
||||||
|
|
||||||
|
loading.show();
|
||||||
|
ApiClient.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: ApiClient.getUrl("LiveTv/ListingProviders/Lineups", {
|
url: ApiClient.getUrl("LiveTv/ListingProviders/Lineups", {
|
||||||
Id: providerId,
|
Id: providerId,
|
||||||
@ -121,15 +198,23 @@ define(["jQuery", "loading", "emby-checkbox", "listViewStyle", "emby-input", "em
|
|||||||
Country: $("#selectCountry", page).val()
|
Country: $("#selectCountry", page).val()
|
||||||
}),
|
}),
|
||||||
dataType: "json"
|
dataType: "json"
|
||||||
}).then(function(result) {
|
}).then(function (result) {
|
||||||
$("#selectListing", page).html(result.map(function(o) {
|
$("#selectListing", page).html(result.map(function (o) {
|
||||||
return '<option value="' + o.Id + '">' + o.Name + "</option>"
|
return '<option value="' + o.Id + '">' + o.Name + "</option>";
|
||||||
})), listingsId && $("#selectListing", page).val(listingsId), loading.hide()
|
}));
|
||||||
}, function(result) {
|
|
||||||
|
if (listingsId) {
|
||||||
|
$("#selectListing", page).val(listingsId);
|
||||||
|
}
|
||||||
|
|
||||||
|
loading.hide();
|
||||||
|
}, function (result) {
|
||||||
Dashboard.alert({
|
Dashboard.alert({
|
||||||
message: Globalize.translate("ErrorGettingTvLineups")
|
message: Globalize.translate("ErrorGettingTvLineups")
|
||||||
}), refreshListings(""), loading.hide()
|
});
|
||||||
})
|
refreshListings("");
|
||||||
|
loading.hide();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTunerName(providerId) {
|
function getTunerName(providerId) {
|
||||||
@ -141,34 +226,76 @@ define(["jQuery", "loading", "emby-checkbox", "listViewStyle", "emby-input", "em
|
|||||||
case "satip":
|
case "satip":
|
||||||
return "DVB";
|
return "DVB";
|
||||||
default:
|
default:
|
||||||
return "Unknown"
|
return "Unknown";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshTunerDevices(page, providerInfo, devices) {
|
function refreshTunerDevices(page, providerInfo, devices) {
|
||||||
for (var html = "", i = 0, length = devices.length; i < length; i++) {
|
var html = "";
|
||||||
|
|
||||||
|
for (var i = 0, length = devices.length; i < length; i++) {
|
||||||
var device = devices[i];
|
var device = devices[i];
|
||||||
html += '<div class="listItem">';
|
html += '<div class="listItem">';
|
||||||
var enabledTuners = providerInfo.EnabledTuners || [],
|
var enabledTuners = providerInfo.EnabledTuners || [];
|
||||||
isChecked = providerInfo.EnableAllTuners || -1 !== enabledTuners.indexOf(device.Id),
|
var isChecked = providerInfo.EnableAllTuners || -1 !== enabledTuners.indexOf(device.Id);
|
||||||
checkedAttribute = isChecked ? " checked" : "";
|
var checkedAttribute = isChecked ? " checked" : "";
|
||||||
html += '<label class="checkboxContainer listItemCheckboxContainer"><input type="checkbox" is="emby-checkbox" data-id="' + device.Id + '" class="chkTuner" ' + checkedAttribute + "/><span></span></label>", html += '<div class="listItemBody two-line">', html += '<div class="listItemBodyText">', html += device.FriendlyName || getTunerName(device.Type), html += "</div>", html += '<div class="listItemBodyText secondary">', html += device.Url, html += "</div>", html += "</div>", html += "</div>"
|
html += '<label class="checkboxContainer listItemCheckboxContainer"><input type="checkbox" is="emby-checkbox" data-id="' + device.Id + '" class="chkTuner" ' + checkedAttribute + "/><span></span></label>";
|
||||||
|
html += '<div class="listItemBody two-line">';
|
||||||
|
html += '<div class="listItemBodyText">';
|
||||||
|
html += device.FriendlyName || getTunerName(device.Type);
|
||||||
|
html += "</div>";
|
||||||
|
html += '<div class="listItemBodyText secondary">';
|
||||||
|
html += device.Url;
|
||||||
|
html += "</div>";
|
||||||
|
html += "</div>";
|
||||||
|
html += "</div>";
|
||||||
}
|
}
|
||||||
page.querySelector(".tunerList").innerHTML = html
|
|
||||||
|
page.querySelector(".tunerList").innerHTML = html;
|
||||||
}
|
}
|
||||||
var listingsId, self = this;
|
|
||||||
self.submit = function() {
|
var listingsId;
|
||||||
page.querySelector(".btnSubmitListingsContainer").click()
|
var self = this;
|
||||||
}, self.init = function() {
|
|
||||||
options = options || {}, !1 !== options.showCancelButton ? page.querySelector(".btnCancel").classList.remove("hide") : page.querySelector(".btnCancel").classList.add("hide"), !1 !== options.showSubmitButton ? page.querySelector(".btnSubmitListings").classList.remove("hide") : page.querySelector(".btnSubmitListings").classList.add("hide"), $(".formLogin", page).on("submit", function() {
|
self.submit = function () {
|
||||||
return submitLoginForm(), !1
|
page.querySelector(".btnSubmitListingsContainer").click();
|
||||||
}), $(".formListings", page).on("submit", function() {
|
};
|
||||||
return submitListingsForm(), !1
|
|
||||||
}), $(".txtZipCode", page).on("change", function() {
|
self.init = function () {
|
||||||
refreshListings(this.value)
|
options = options || {};
|
||||||
}), page.querySelector(".chkAllTuners").addEventListener("change", function(e) {
|
|
||||||
e.target.checked ? page.querySelector(".selectTunersSection").classList.add("hide") : page.querySelector(".selectTunersSection").classList.remove("hide")
|
if (options.showCancelButton) {
|
||||||
}), $(".createAccountHelp", page).html(Globalize.translate("MessageCreateAccountAt", '<a is="emby-linkbutton" class="button-link" href="http://www.schedulesdirect.org" target="_blank">http://www.schedulesdirect.org</a>')), reload()
|
page.querySelector(".btnCancel").classList.remove("hide");
|
||||||
|
} else {
|
||||||
|
page.querySelector(".btnCancel").classList.add("hide");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.showSubmitButton) {
|
||||||
|
page.querySelector(".btnSubmitListings").classList.remove("hide");
|
||||||
|
} else {
|
||||||
|
page.querySelector(".btnSubmitListings").classList.add("hide");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(".formLogin", page).on("submit", function () {
|
||||||
|
submitLoginForm();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
$(".formListings", page).on("submit", function () {
|
||||||
|
submitListingsForm();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
$(".txtZipCode", page).on("change", function () {
|
||||||
|
refreshListings(this.value);
|
||||||
|
});
|
||||||
|
page.querySelector(".chkAllTuners").addEventListener("change", function (e) {
|
||||||
|
if (e.target.checked) {
|
||||||
|
page.querySelector(".selectTunersSection").classList.add("hide");
|
||||||
|
} else {
|
||||||
|
page.querySelector(".selectTunersSection").classList.remove("hide");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$(".createAccountHelp", page).html(Globalize.translate("MessageCreateAccountAt", '<a is="emby-linkbutton" class="button-link" href="http://www.schedulesdirect.org" target="_blank">http://www.schedulesdirect.org</a>'));
|
||||||
|
reload();
|
||||||
|
};
|
||||||
|
};
|
||||||
});
|
});
|
@ -1,4 +1,4 @@
|
|||||||
define(["jQuery", "loading", "emby-checkbox", "emby-input", "listViewStyle", "paper-icon-button-light"], function ($__q, loading) {
|
define(["jQuery", "loading", "emby-checkbox", "emby-input", "listViewStyle", "paper-icon-button-light"], function ($, loading) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
return function (page, providerId, options) {
|
return function (page, providerId, options) {
|
||||||
@ -69,7 +69,7 @@ define(["jQuery", "loading", "emby-checkbox", "emby-input", "listViewStyle", "pa
|
|||||||
info.NewsCategories = getCategories(page.querySelector(".txtNews"));
|
info.NewsCategories = getCategories(page.querySelector(".txtNews"));
|
||||||
info.SportsCategories = getCategories(page.querySelector(".txtSports"));
|
info.SportsCategories = getCategories(page.querySelector(".txtSports"));
|
||||||
info.EnableAllTuners = page.querySelector(".chkAllTuners").checked;
|
info.EnableAllTuners = page.querySelector(".chkAllTuners").checked;
|
||||||
info.EnabledTuners = info.EnableAllTuners ? [] : $__q(".chkTuner", page).get().filter(function (tuner) {
|
info.EnabledTuners = info.EnableAllTuners ? [] : $(".chkTuner", page).get().filter(function (tuner) {
|
||||||
return tuner.checked;
|
return tuner.checked;
|
||||||
}).map(function (tuner) {
|
}).map(function (tuner) {
|
||||||
return tuner.getAttribute("data-id");
|
return tuner.getAttribute("data-id");
|
||||||
@ -135,8 +135,8 @@ define(["jQuery", "loading", "emby-checkbox", "emby-input", "listViewStyle", "pa
|
|||||||
page.querySelector(".tunerList").innerHTML = html;
|
page.querySelector(".tunerList").innerHTML = html;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSelectPathClick(e__u) {
|
function onSelectPathClick(e) {
|
||||||
var page = $__q(e__u.target).parents(".xmltvForm")[0];
|
var page = $(e.target).parents(".xmltvForm")[0];
|
||||||
|
|
||||||
require(["directorybrowser"], function (directoryBrowser) {
|
require(["directorybrowser"], function (directoryBrowser) {
|
||||||
var picker = new directoryBrowser();
|
var picker = new directoryBrowser();
|
||||||
@ -175,7 +175,7 @@ define(["jQuery", "loading", "emby-checkbox", "emby-input", "listViewStyle", "pa
|
|||||||
page.querySelector(".btnSubmitListings").classList.add("hide");
|
page.querySelector(".btnSubmitListings").classList.add("hide");
|
||||||
}
|
}
|
||||||
|
|
||||||
$__q("form", page).on("submit", function () {
|
$("form", page).on("submit", function () {
|
||||||
submitListingsForm();
|
submitListingsForm();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user