diff --git a/src/scripts/itembynamedetailpage.js b/src/scripts/itembynamedetailpage.js index 1de421e6a3..74d69eecf8 100644 --- a/src/scripts/itembynamedetailpage.js +++ b/src/scripts/itembynamedetailpage.js @@ -312,27 +312,21 @@ define(["connectionManager", "listView", "cardBuilder", "imageLoader", "libraryB } function addCurrentItemToQuery(query, item) { - if ("Person" == item.Type) { + if (item.Type == "Person") { query.PersonIds = item.Id; - } else { - if ("Genre" == item.Type) { - query.GenreIds = item.Id; + } else if (item.Type == "Genre") { + query.Genres = item.Name; + } 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 { - if ("MusicGenre" == item.Type) { - 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; - } - } - } - } + query.ArtistIds = item.Id; } } } diff --git a/src/scripts/librarybrowser.js b/src/scripts/librarybrowser.js index f2edc9030c..4f3eaf4144 100644 --- a/src/scripts/librarybrowser.js +++ b/src/scripts/librarybrowser.js @@ -156,11 +156,10 @@ define(["userSettings"], function (userSettings) { html += '

'; html += Globalize.translate("HeaderSortBy"); html += "

"; - var i; - var length; + var i, length; var isChecked; - - for (html += "
", i = 0, length = options.items.length; i < length; i++) { + html += '
'; + for (i = 0, length = options.items.length; i < length; i++) { var option = options.items[i]; var radioValue = option.id.replace(",", "_"); isChecked = (options.query.SortBy || "").replace(",", "_") == radioValue ? " checked" : ""; diff --git a/src/scripts/librarymenu.js b/src/scripts/librarymenu.js index 6b64041966..50031b33b8 100644 --- a/src/scripts/librarymenu.js +++ b/src/scripts/librarymenu.js @@ -206,8 +206,9 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", " html += 'exit_to_app' + globalize.translate("ButtonSignOut") + ""; html += "
"; - } // add buttons to navigation drawer + } + // add buttons to navigation drawer navDrawerScrollContainer.innerHTML = html; // bind logout button click to method @@ -501,8 +502,9 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", " showBySelector(".libraryMenuDownloads", false); showBySelector(".lnkSyncToOtherDevices", false); return void showBySelector(".userMenuOptions", false); - } // FIXME: Potentially the same as above + } + // FIXME: Potentially the same as above if (user.Policy.EnableContentDownloading) { showBySelector(".lnkSyncToOtherDevices", true); diff --git a/src/scripts/livetvcomponents.js b/src/scripts/livetvcomponents.js index a883885df1..cc0e94ca3f 100644 --- a/src/scripts/livetvcomponents.js +++ b/src/scripts/livetvcomponents.js @@ -6,11 +6,7 @@ define(["layoutManager", "datetime", "cardBuilder", "apphost"], function (layout } function getBackdropShape() { - if (enableScrollX()) { - return "overflowBackdrop"; - } - - return "backdrop"; + return enableScrollX() ? 'overflowBackdrop' : 'backdrop'; } function getTimersHtml(timers, options) { @@ -29,7 +25,7 @@ define(["layoutManager", "datetime", "cardBuilder", "apphost"], function (layout var item = items[i]; var dateText = ""; - if (false !== options.indexByDate && item.StartDate) { + if (options.indexByDate !== false && item.StartDate) { try { var premiereDate = datetime.parseISO8601Date(item.StartDate, true); dateText = datetime.toLocaleDateString(premiereDate, { @@ -69,7 +65,12 @@ define(["layoutManager", "datetime", "cardBuilder", "apphost"], function (layout var supportsImageAnalysis = appHost.supports("imageanalysis"); var cardLayout = appHost.preferVisualCards || supportsImageAnalysis; - if (cardLayout = true, group.name && (html += '
', html += '

' + group.name + "

"), enableScrollX()) { + cardLayout = true; + if (group.name) { + html += '
'; + html += '

' + group.name + "

"; + } + if (enableScrollX()) { var scrollXClass = "scrollX hiddenScrollX"; if (layoutManager.tv) { diff --git a/src/scripts/playlists.js b/src/scripts/playlists.js index 606a34c787..91c49017da 100644 --- a/src/scripts/playlists.js +++ b/src/scripts/playlists.js @@ -85,36 +85,46 @@ define(["loading", "listView", "cardBuilder", "libraryMenu", "libraryBrowser", " }); if (result.TotalRecordCount) { - html = "List" == viewStyle ? listView.getListViewHtml({ - items: result.Items, - sortBy: query.SortBy - }) : "PosterCard" == viewStyle ? cardBuilder.getCardsHtml({ - items: result.Items, - shape: "square", - coverImage: true, - showTitle: true, - cardLayout: true - }) : "Thumb" == viewStyle ? cardBuilder.getCardsHtml({ - items: result.Items, - shape: "backdrop", - showTitle: true, - centerText: true, - preferThumb: true, - overlayPlayButton: true - }) : "ThumbCard" == viewStyle ? cardBuilder.getCardsHtml({ - items: result.Items, - shape: "backdrop", - showTitle: true, - preferThumb: true, - cardLayout: true - }) : cardBuilder.getCardsHtml({ - items: result.Items, - shape: "square", - showTitle: true, - coverImage: true, - centerText: true, - overlayPlayButton: true - }); + if (viewStyle == "List") { + html = listView.getListViewHtml({ + items: result.Items, + sortBy: query.SortBy + }); + } else if (viewStyle == "PosterCard") { + html = cardBuilder.getCardsHtml({ + items: result.Items, + shape: "square", + coverImage: true, + showTitle: true, + cardLayout: true + }); + } else if (viewStyle == "Thumb") { + html = cardBuilder.getCardsHtml({ + items: result.Items, + shape: "backdrop", + showTitle: true, + centerText: true, + preferThumb: true, + overlayPlayButton: true + }); + } else if (viewStyle == "ThumbCard") { + html = cardBuilder.getCardsHtml({ + items: result.Items, + shape: "backdrop", + showTitle: true, + preferThumb: 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"); } else { view.querySelector(".noItemsMessage").classList.remove("hide"); diff --git a/src/scripts/taskbutton.js b/src/scripts/taskbutton.js index 37e4a3c973..7e75e9423b 100644 --- a/src/scripts/taskbutton.js +++ b/src/scripts/taskbutton.js @@ -13,32 +13,48 @@ define(["events", "userSettings", "serverNotifications", "connectionManager", "e return t.Key == options.taskKey; })[0]; - if (options.panel && (task ? options.panel.classList.remove("hide") : options.panel.classList.add("hide")), task) { - if ("Idle" == task.State) { - button.removeAttribute("disabled"); + if (options.panel) { + if (task) { + options.panel.classList.remove('hide'); } else { - button.setAttribute("disabled", "disabled"); + options.panel.classList.add('hide'); } + } - button.setAttribute("data-taskid", task.Id); - var progress = (task.CurrentProgressPercentage || 0).toFixed(1); + if (!task) { + return; + } - if (options.progressElem && (options.progressElem.value = progress, "Running" == task.State ? options.progressElem.classList.remove("hide") : options.progressElem.classList.add("hide")), options.lastResultElem) { - var lastResult = task.LastExecutionResult ? task.LastExecutionResult.Status : ""; + if (task.State == 'Idle') { + button.removeAttribute("disabled"); + } else { + button.setAttribute("disabled", "disabled"); + } - if ("Failed" == lastResult) { - options.lastResultElem.html('(' + Globalize.translate("LabelFailed") + ")"); - } else { - if ("Cancelled" == lastResult) { - options.lastResultElem.html('(' + Globalize.translate("LabelCancelled") + ")"); - } else { - if ("Aborted" == lastResult) { - options.lastResultElem.html('' + Globalize.translate("LabelAbortedByServerShutdown") + ""); - } else { - options.lastResultElem.html(lastResult); - } - } - } + button.setAttribute("data-taskid", task.Id); + var progress = (task.CurrentProgressPercentage || 0).toFixed(1); + + if (options.progressElem) { + options.progressElem.value = progress; + + if (task.State == 'Running') { + options.progressElem.classList.remove('hide'); + } else { + options.progressElem.classList.add('hide'); + } + } + + if (options.lastResultElem) { + var lastResult = task.LastExecutionResult ? task.LastExecutionResult.Status : ''; + + if (lastResult == "Failed") { + options.lastResultElem.html('(' + Globalize.translate('LabelFailed') + ')'); + } else if (lastResult == "Cancelled") { + options.lastResultElem.html('(' + Globalize.translate('LabelCancelled') + ')'); + } else if (lastResult == "Aborted") { + options.lastResultElem.html('' + Globalize.translate('LabelAbortedByServerShutdown') + ''); + } else { + options.lastResultElem.html(lastResult); } } } @@ -71,7 +87,7 @@ define(["events", "userSettings", "serverNotifications", "connectionManager", "e options.panel.classList.add("hide"); } - if ("off" == options.mode) { + if (options.mode == 'off') { button.removeEventListener("click", onButtonClick); events.off(serverNotifications, "ScheduledTasksInfo", onScheduledTasksUpdate);