diff --git a/src/controllers/music/musicrecommended.js b/src/controllers/music/musicrecommended.js
index a93bfea4e3..7b11a8eb21 100644
--- a/src/controllers/music/musicrecommended.js
+++ b/src/controllers/music/musicrecommended.js
@@ -177,9 +177,9 @@ import 'flexStyles';
function getTabs() {
return [{
- name: globalize.translate('Suggestions')
- }, {
name: globalize.translate('Albums')
+ }, {
+ name: globalize.translate('Suggestions')
}, {
name: globalize.translate('HeaderAlbumArtists')
}, {
@@ -195,7 +195,7 @@ import 'flexStyles';
function getDefaultTabIndex(folderId) {
switch (userSettings.get('landing-' + folderId)) {
- case 'albums':
+ case 'suggestions':
return 1;
case 'albumartists':
@@ -221,7 +221,7 @@ import 'flexStyles';
export default function (view, params) {
function reload() {
loading.show();
- const tabContent = view.querySelector(".pageTabContent[data-index='0']");
+ const tabContent = view.querySelector(".pageTabContent[data-index='" + suggestionsTabIndex + "']");
loadSuggestionsTab(view, tabContent, params.topParentId);
}
@@ -268,11 +268,11 @@ import 'flexStyles';
switch (index) {
case 0:
- depends = 'controllers/music/musicrecommended';
+ depends = 'controllers/music/musicalbums';
break;
case 1:
- depends = 'controllers/music/musicalbums';
+ depends = 'controllers/music/musicrecommended';
break;
case 2:
@@ -296,7 +296,7 @@ import 'flexStyles';
import(depends).then(({default: controllerFactory}) => {
let tabContent;
- if (index == 0) {
+ if (index == 1) {
tabContent = view.querySelector(".pageTabContent[data-index='" + index + "']");
this.tabContent = tabContent;
}
@@ -306,7 +306,7 @@ import 'flexStyles';
if (!controller) {
tabContent = view.querySelector(".pageTabContent[data-index='" + index + "']");
- if (index === 0) {
+ if (index === 1) {
controller = this;
} else if (index === 7) {
controller = new controllerFactory(view, tabContent, {
@@ -360,9 +360,10 @@ import 'flexStyles';
}
let currentTabIndex = parseInt(params.tab || getDefaultTabIndex(params.topParentId));
+ const suggestionsTabIndex = 1;
this.initTab = function () {
- const tabContent = view.querySelector(".pageTabContent[data-index='0']");
+ const tabContent = view.querySelector(".pageTabContent[data-index='" + suggestionsTabIndex + "']");
const containers = tabContent.querySelectorAll('.itemsContainer');
for (let i = 0, length = containers.length; i < length; i++) {
diff --git a/src/controllers/shows/tvrecommended.js b/src/controllers/shows/tvrecommended.js
index 048d27d45d..da47f9f318 100644
--- a/src/controllers/shows/tvrecommended.js
+++ b/src/controllers/shows/tvrecommended.js
@@ -66,16 +66,16 @@ import 'emby-button';
}
function initSuggestedTab(page, tabContent) {
- var containers = tabContent.querySelectorAll('.itemsContainer');
+ const containers = tabContent.querySelectorAll('.itemsContainer');
- for (var i = 0, length = containers.length; i < length; i++) {
+ for (let i = 0, length = containers.length; i < length; i++) {
setScrollClasses(containers[i], enableScrollX());
}
}
function loadSuggestionsTab(view, params, tabContent) {
- var parentId = params.topParentId;
- var userId = ApiClient.getCurrentUserId();
+ const parentId = params.topParentId;
+ const userId = ApiClient.getCurrentUserId();
console.debug('loadSuggestionsTab');
loadResume(tabContent, userId, parentId);
loadLatest(tabContent, userId, parentId);
@@ -83,8 +83,8 @@ import 'emby-button';
}
function loadResume(view, userId, parentId) {
- var screenWidth = dom.getWindowSize().innerWidth;
- var options = {
+ const screenWidth = dom.getWindowSize().innerWidth;
+ const options = {
SortBy: 'DatePlayed',
SortOrder: 'Descending',
IncludeItemTypes: 'Episode',
@@ -105,8 +105,8 @@ import 'emby-button';
view.querySelector('#resumableSection').classList.add('hide');
}
- var allowBottomPadding = !enableScrollX();
- var container = view.querySelector('#resumableItems');
+ const allowBottomPadding = !enableScrollX();
+ const container = view.querySelector('#resumableItems');
cardBuilder.buildCards(result.Items, {
itemsContainer: container,
preferThumb: true,
@@ -128,7 +128,7 @@ import 'emby-button';
}
function loadLatest(view, userId, parentId) {
- var options = {
+ const options = {
userId: userId,
IncludeItemTypes: 'Episode',
Limit: 30,
@@ -138,9 +138,9 @@ import 'emby-button';
EnableImageTypes: 'Primary,Backdrop,Thumb'
};
ApiClient.getLatestItems(options).then(function (items) {
- var section = view.querySelector('#latestItemsSection');
- var allowBottomPadding = !enableScrollX();
- var container = section.querySelector('#latestEpisodesItems');
+ const section = view.querySelector('#latestItemsSection');
+ const allowBottomPadding = !enableScrollX();
+ const container = section.querySelector('#latestEpisodesItems');
cardBuilder.buildCards(items, {
parentContainer: section,
itemsContainer: container,
@@ -169,7 +169,7 @@ import 'emby-button';
}
function loadNextUp(view, userId, parentId) {
- var query = {
+ const query = {
userId: userId,
Limit: 24,
Fields: 'PrimaryImageAspectRatio,SeriesInfo,DateCreated,BasicSyncInfo',
@@ -186,8 +186,8 @@ import 'emby-button';
view.querySelector('.noNextUpItems').classList.remove('hide');
}
- var section = view.querySelector('#nextUpItemsSection');
- var container = section.querySelector('#nextUpItems');
+ const section = view.querySelector('#nextUpItemsSection');
+ const container = section.querySelector('#nextUpItems');
cardBuilder.buildCards(result.Items, {
parentContainer: section,
itemsContainer: container,
@@ -345,12 +345,12 @@ import 'emby-button';
const suggestionsTabIndex = 1;
self.initTab = function () {
- var tabContent = view.querySelector(".pageTabContent[data-index='" + suggestionsTabIndex + "']");
+ const tabContent = view.querySelector(".pageTabContent[data-index='" + suggestionsTabIndex + "']");
initSuggestedTab(view, tabContent);
};
self.renderTab = function () {
- var tabContent = view.querySelector(".pageTabContent[data-index='" + suggestionsTabIndex + "']");
+ const tabContent = view.querySelector(".pageTabContent[data-index='" + suggestionsTabIndex + "']");
loadSuggestionsTab(view, params, tabContent);
};