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,27 +312,21 @@ 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") {
query.Genres = item.Name;
} else if (item.Type == "GameGenre") {
query.Genres = item.Name;
} else if (item.Type == "Studio") {
query.StudioIds = item.Id;
} else if (item.Type == "MusicArtist") {
if (connectionManager.getApiClient(item.ServerId).isMinServerVersion("3.4.1.18")) {
query.AlbumArtistIds = item.Id;
} else { } else {
if ("MusicGenre" == item.Type) { query.ArtistIds = item.Id;
query.GenreIds = item.Id;
} else {
if ("Studio" == item.Type) {
query.StudioIds = item.Id;
} else {
if ("MusicArtist" == item.Type) {
if (connectionManager.getApiClient(item.ServerId).isMinServerVersion("3.4.1.18")) {
query.AlbumArtistIds = item.Id;
} else {
query.ArtistIds = item.Id;
}
}
}
}
} }
} }
} }

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,36 +85,46 @@ define(["loading", "listView", "cardBuilder", "libraryMenu", "libraryBrowser", "
}); });
if (result.TotalRecordCount) { if (result.TotalRecordCount) {
html = "List" == viewStyle ? listView.getListViewHtml({ if (viewStyle == "List") {
items: result.Items, html = listView.getListViewHtml({
sortBy: query.SortBy items: result.Items,
}) : "PosterCard" == viewStyle ? cardBuilder.getCardsHtml({ sortBy: query.SortBy
items: result.Items, });
shape: "square", } else if (viewStyle == "PosterCard") {
coverImage: true, html = cardBuilder.getCardsHtml({
showTitle: true, items: result.Items,
cardLayout: true shape: "square",
}) : "Thumb" == viewStyle ? cardBuilder.getCardsHtml({ coverImage: true,
items: result.Items, showTitle: true,
shape: "backdrop", cardLayout: true
showTitle: true, });
centerText: true, } else if (viewStyle == "Thumb") {
preferThumb: true, html = cardBuilder.getCardsHtml({
overlayPlayButton: true items: result.Items,
}) : "ThumbCard" == viewStyle ? cardBuilder.getCardsHtml({ shape: "backdrop",
items: result.Items, showTitle: true,
shape: "backdrop", centerText: true,
showTitle: true, preferThumb: true,
preferThumb: true, overlayPlayButton: true
cardLayout: true });
}) : cardBuilder.getCardsHtml({ } else if (viewStyle == "ThumbCard") {
items: result.Items, html = cardBuilder.getCardsHtml({
shape: "square", items: result.Items,
showTitle: true, shape: "backdrop",
coverImage: true, showTitle: true,
centerText: true, preferThumb: true,
overlayPlayButton: true cardLayout: true
}); });
} else {
html = cardBuilder.getCardsHtml({
items: result.Items,
shape: "square",
showTitle: true,
coverImage: true,
centerText: 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,32 +13,48 @@ 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) {
button.removeAttribute("disabled"); options.panel.classList.remove('hide');
} else { } else {
button.setAttribute("disabled", "disabled"); options.panel.classList.add('hide');
} }
}
button.setAttribute("data-taskid", task.Id); if (!task) {
var progress = (task.CurrentProgressPercentage || 0).toFixed(1); return;
}
if (options.progressElem && (options.progressElem.value = progress, "Running" == task.State ? options.progressElem.classList.remove("hide") : options.progressElem.classList.add("hide")), options.lastResultElem) { if (task.State == 'Idle') {
var lastResult = task.LastExecutionResult ? task.LastExecutionResult.Status : ""; button.removeAttribute("disabled");
} else {
button.setAttribute("disabled", "disabled");
}
if ("Failed" == lastResult) { button.setAttribute("data-taskid", task.Id);
options.lastResultElem.html('<span style="color:#FF0000;">(' + Globalize.translate("LabelFailed") + ")</span>"); var progress = (task.CurrentProgressPercentage || 0).toFixed(1);
} else {
if ("Cancelled" == lastResult) { if (options.progressElem) {
options.lastResultElem.html('<span style="color:#0026FF;">(' + Globalize.translate("LabelCancelled") + ")</span>"); options.progressElem.value = progress;
} else {
if ("Aborted" == lastResult) { if (task.State == 'Running') {
options.lastResultElem.html('<span style="color:#FF0000;">' + Globalize.translate("LabelAbortedByServerShutdown") + "</span>"); options.progressElem.classList.remove('hide');
} else { } else {
options.lastResultElem.html(lastResult); options.progressElem.classList.add('hide');
} }
} }
}
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 {
options.lastResultElem.html(lastResult);
} }
} }
} }
@ -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);