Update Suggested change

This commit is contained in:
grafixeyehero 2019-10-08 19:54:02 +03:00
parent 307e664286
commit e7570d856f
6 changed files with 106 additions and 84 deletions

View File

@ -312,19 +312,17 @@ define(["connectionManager", "listView", "cardBuilder", "imageLoader", "libraryB
} }
function addCurrentItemToQuery(query, item) { function addCurrentItemToQuery(query, item) {
if ("Person" == item.Type) { if (item.Type == "Person") {
query.PersonIds = item.Id; query.PersonIds = item.Id;
} else { } else if (item.Type == "Genre") {
if ("Genre" == item.Type) { query.Genres = item.Name;
query.GenreIds = item.Id; } else if (item.Type == "MusicGenre") {
} else { query.Genres = item.Name;
if ("MusicGenre" == item.Type) { } else if (item.Type == "GameGenre") {
query.GenreIds = item.Id; query.Genres = item.Name;
} else { } else if (item.Type == "Studio") {
if ("Studio" == item.Type) {
query.StudioIds = item.Id; query.StudioIds = item.Id;
} else { } else if (item.Type == "MusicArtist") {
if ("MusicArtist" == item.Type) {
if (connectionManager.getApiClient(item.ServerId).isMinServerVersion("3.4.1.18")) { if (connectionManager.getApiClient(item.ServerId).isMinServerVersion("3.4.1.18")) {
query.AlbumArtistIds = item.Id; query.AlbumArtistIds = item.Id;
} else { } else {
@ -332,10 +330,6 @@ define(["connectionManager", "listView", "cardBuilder", "imageLoader", "libraryB
} }
} }
} }
}
}
}
}
function getQuery(options, item) { function getQuery(options, item) {
var query = { var query = {

View File

@ -156,11 +156,10 @@ define(["userSettings"], function (userSettings) {
html += '<h2 style="margin:0 0 .5em;">'; html += '<h2 style="margin:0 0 .5em;">';
html += Globalize.translate("HeaderSortBy"); html += Globalize.translate("HeaderSortBy");
html += "</h2>"; html += "</h2>";
var i; var i, length;
var length;
var isChecked; var isChecked;
html += '<div>';
for (html += "<div>", i = 0, length = options.items.length; i < length; i++) { for (i = 0, length = options.items.length; i < length; i++) {
var option = options.items[i]; var option = options.items[i];
var radioValue = option.id.replace(",", "_"); var radioValue = option.id.replace(",", "_");
isChecked = (options.query.SortBy || "").replace(",", "_") == radioValue ? " checked" : ""; isChecked = (options.query.SortBy || "").replace(",", "_") == radioValue ? " checked" : "";

View File

@ -206,8 +206,9 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "
html += '<a is="emby-linkbutton" class="navMenuOption lnkMediaFolder btnLogout" data-itemid="logout" href="#"><i class="md-icon navMenuOptionIcon">exit_to_app</i><span class="navMenuOptionText">' + globalize.translate("ButtonSignOut") + "</span></a>"; html += '<a is="emby-linkbutton" class="navMenuOption lnkMediaFolder btnLogout" data-itemid="logout" href="#"><i class="md-icon navMenuOptionIcon">exit_to_app</i><span class="navMenuOptionText">' + globalize.translate("ButtonSignOut") + "</span></a>";
html += "</div>"; html += "</div>";
} // add buttons to navigation drawer }
// add buttons to navigation drawer
navDrawerScrollContainer.innerHTML = html; // bind logout button click to method navDrawerScrollContainer.innerHTML = html; // bind logout button click to method
@ -501,8 +502,9 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "
showBySelector(".libraryMenuDownloads", false); showBySelector(".libraryMenuDownloads", false);
showBySelector(".lnkSyncToOtherDevices", false); showBySelector(".lnkSyncToOtherDevices", false);
return void showBySelector(".userMenuOptions", false); return void showBySelector(".userMenuOptions", false);
} // FIXME: Potentially the same as above }
// FIXME: Potentially the same as above
if (user.Policy.EnableContentDownloading) { if (user.Policy.EnableContentDownloading) {
showBySelector(".lnkSyncToOtherDevices", true); showBySelector(".lnkSyncToOtherDevices", true);

View File

@ -6,11 +6,7 @@ define(["layoutManager", "datetime", "cardBuilder", "apphost"], function (layout
} }
function getBackdropShape() { function getBackdropShape() {
if (enableScrollX()) { return enableScrollX() ? 'overflowBackdrop' : 'backdrop';
return "overflowBackdrop";
}
return "backdrop";
} }
function getTimersHtml(timers, options) { function getTimersHtml(timers, options) {
@ -29,7 +25,7 @@ define(["layoutManager", "datetime", "cardBuilder", "apphost"], function (layout
var item = items[i]; var item = items[i];
var dateText = ""; var dateText = "";
if (false !== options.indexByDate && item.StartDate) { if (options.indexByDate !== false && item.StartDate) {
try { try {
var premiereDate = datetime.parseISO8601Date(item.StartDate, true); var premiereDate = datetime.parseISO8601Date(item.StartDate, true);
dateText = datetime.toLocaleDateString(premiereDate, { dateText = datetime.toLocaleDateString(premiereDate, {
@ -69,7 +65,12 @@ define(["layoutManager", "datetime", "cardBuilder", "apphost"], function (layout
var supportsImageAnalysis = appHost.supports("imageanalysis"); var supportsImageAnalysis = appHost.supports("imageanalysis");
var cardLayout = appHost.preferVisualCards || supportsImageAnalysis; var cardLayout = appHost.preferVisualCards || supportsImageAnalysis;
if (cardLayout = true, group.name && (html += '<div class="verticalSection">', html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + group.name + "</h2>"), enableScrollX()) { cardLayout = true;
if (group.name) {
html += '<div class="verticalSection">';
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + group.name + "</h2>";
}
if (enableScrollX()) {
var scrollXClass = "scrollX hiddenScrollX"; var scrollXClass = "scrollX hiddenScrollX";
if (layoutManager.tv) { if (layoutManager.tv) {

View File

@ -85,29 +85,38 @@ define(["loading", "listView", "cardBuilder", "libraryMenu", "libraryBrowser", "
}); });
if (result.TotalRecordCount) { if (result.TotalRecordCount) {
html = "List" == viewStyle ? listView.getListViewHtml({ if (viewStyle == "List") {
html = listView.getListViewHtml({
items: result.Items, items: result.Items,
sortBy: query.SortBy sortBy: query.SortBy
}) : "PosterCard" == viewStyle ? cardBuilder.getCardsHtml({ });
} else if (viewStyle == "PosterCard") {
html = cardBuilder.getCardsHtml({
items: result.Items, items: result.Items,
shape: "square", shape: "square",
coverImage: true, coverImage: true,
showTitle: true, showTitle: true,
cardLayout: true cardLayout: true
}) : "Thumb" == viewStyle ? cardBuilder.getCardsHtml({ });
} else if (viewStyle == "Thumb") {
html = cardBuilder.getCardsHtml({
items: result.Items, items: result.Items,
shape: "backdrop", shape: "backdrop",
showTitle: true, showTitle: true,
centerText: true, centerText: true,
preferThumb: true, preferThumb: true,
overlayPlayButton: true overlayPlayButton: true
}) : "ThumbCard" == viewStyle ? cardBuilder.getCardsHtml({ });
} else if (viewStyle == "ThumbCard") {
html = cardBuilder.getCardsHtml({
items: result.Items, items: result.Items,
shape: "backdrop", shape: "backdrop",
showTitle: true, showTitle: true,
preferThumb: true, preferThumb: true,
cardLayout: true cardLayout: true
}) : cardBuilder.getCardsHtml({ });
} else {
html = cardBuilder.getCardsHtml({
items: result.Items, items: result.Items,
shape: "square", shape: "square",
showTitle: true, showTitle: true,
@ -115,6 +124,7 @@ define(["loading", "listView", "cardBuilder", "libraryMenu", "libraryBrowser", "
centerText: true, centerText: true,
overlayPlayButton: true overlayPlayButton: true
}); });
}
view.querySelector(".noItemsMessage").classList.add("hide"); view.querySelector(".noItemsMessage").classList.add("hide");
} else { } else {
view.querySelector(".noItemsMessage").classList.remove("hide"); view.querySelector(".noItemsMessage").classList.remove("hide");

View File

@ -13,8 +13,19 @@ define(["events", "userSettings", "serverNotifications", "connectionManager", "e
return t.Key == options.taskKey; return t.Key == options.taskKey;
})[0]; })[0];
if (options.panel && (task ? options.panel.classList.remove("hide") : options.panel.classList.add("hide")), task) { if (options.panel) {
if ("Idle" == task.State) { if (task) {
options.panel.classList.remove('hide');
} else {
options.panel.classList.add('hide');
}
}
if (!task) {
return;
}
if (task.State == 'Idle') {
button.removeAttribute("disabled"); button.removeAttribute("disabled");
} else { } else {
button.setAttribute("disabled", "disabled"); button.setAttribute("disabled", "disabled");
@ -23,25 +34,30 @@ define(["events", "userSettings", "serverNotifications", "connectionManager", "e
button.setAttribute("data-taskid", task.Id); button.setAttribute("data-taskid", task.Id);
var progress = (task.CurrentProgressPercentage || 0).toFixed(1); var progress = (task.CurrentProgressPercentage || 0).toFixed(1);
if (options.progressElem && (options.progressElem.value = progress, "Running" == task.State ? options.progressElem.classList.remove("hide") : options.progressElem.classList.add("hide")), options.lastResultElem) { if (options.progressElem) {
var lastResult = task.LastExecutionResult ? task.LastExecutionResult.Status : ""; options.progressElem.value = progress;
if ("Failed" == lastResult) { if (task.State == 'Running') {
options.lastResultElem.html('<span style="color:#FF0000;">(' + Globalize.translate("LabelFailed") + ")</span>"); options.progressElem.classList.remove('hide');
} else { } else {
if ("Cancelled" == lastResult) { options.progressElem.classList.add('hide');
options.lastResultElem.html('<span style="color:#0026FF;">(' + Globalize.translate("LabelCancelled") + ")</span>"); }
} else { }
if ("Aborted" == lastResult) {
options.lastResultElem.html('<span style="color:#FF0000;">' + Globalize.translate("LabelAbortedByServerShutdown") + "</span>"); if (options.lastResultElem) {
var lastResult = task.LastExecutionResult ? task.LastExecutionResult.Status : '';
if (lastResult == "Failed") {
options.lastResultElem.html('<span style="color:#FF0000;">(' + Globalize.translate('LabelFailed') + ')</span>');
} else if (lastResult == "Cancelled") {
options.lastResultElem.html('<span style="color:#0026FF;">(' + Globalize.translate('LabelCancelled') + ')</span>');
} else if (lastResult == "Aborted") {
options.lastResultElem.html('<span style="color:#FF0000;">' + Globalize.translate('LabelAbortedByServerShutdown') + '</span>');
} else { } else {
options.lastResultElem.html(lastResult); options.lastResultElem.html(lastResult);
} }
} }
} }
}
}
}
function onScheduledTaskMessageConfirmed(id) { function onScheduledTaskMessageConfirmed(id) {
connectionManager.getApiClient(serverId).startScheduledTask(id).then(pollTasks); connectionManager.getApiClient(serverId).startScheduledTask(id).then(pollTasks);
@ -71,7 +87,7 @@ define(["events", "userSettings", "serverNotifications", "connectionManager", "e
options.panel.classList.add("hide"); options.panel.classList.add("hide");
} }
if ("off" == options.mode) { if (options.mode == 'off') {
button.removeEventListener("click", onButtonClick); button.removeEventListener("click", onButtonClick);
events.off(serverNotifications, "ScheduledTasksInfo", onScheduledTasksUpdate); events.off(serverNotifications, "ScheduledTasksInfo", onScheduledTasksUpdate);