2016-04-10 21:24:16 -07:00
|
|
|
|
define(['jQuery', 'libraryBrowser', 'scrollStyles'], function ($, libraryBrowser) {
|
2013-04-01 08:59:56 -07:00
|
|
|
|
|
2015-05-12 21:55:19 -07:00
|
|
|
|
function getView() {
|
2015-05-16 12:09:02 -07:00
|
|
|
|
|
2015-05-29 16:51:33 -07:00
|
|
|
|
return 'Poster';
|
2015-05-12 21:55:19 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getResumeView() {
|
|
|
|
|
|
2015-05-29 16:51:33 -07:00
|
|
|
|
return 'Thumb';
|
2015-05-12 21:55:19 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-05-16 12:09:02 -07:00
|
|
|
|
function enableScrollX() {
|
2015-12-14 08:43:03 -07:00
|
|
|
|
return browserInfo.mobile && AppInfo.enableAppLayouts;
|
2015-05-16 12:09:02 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getPortraitShape() {
|
|
|
|
|
return enableScrollX() ? 'overflowPortrait' : 'portrait';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getThumbShape() {
|
|
|
|
|
return enableScrollX() ? 'overflowBackdrop' : 'backdrop';
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-02 09:26:42 -07:00
|
|
|
|
function loadLatest(page, userId, parentId) {
|
|
|
|
|
|
2015-05-12 21:55:19 -07:00
|
|
|
|
var limit = 18;
|
2015-05-07 07:04:10 -07:00
|
|
|
|
|
2015-04-02 09:26:42 -07:00
|
|
|
|
var options = {
|
|
|
|
|
|
|
|
|
|
IncludeItemTypes: "Movie",
|
2015-05-07 07:04:10 -07:00
|
|
|
|
Limit: limit,
|
2015-04-02 09:26:42 -07:00
|
|
|
|
Fields: "PrimaryImageAspectRatio,MediaSourceCount,SyncInfo",
|
|
|
|
|
ParentId: parentId,
|
|
|
|
|
ImageTypeLimit: 1,
|
2016-05-08 20:13:38 -07:00
|
|
|
|
EnableImageTypes: "Primary,Backdrop,Banner,Thumb",
|
|
|
|
|
EnableTotalRecordCount: false
|
2015-04-02 09:26:42 -07:00
|
|
|
|
};
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).then(function (items) {
|
2015-04-02 09:26:42 -07:00
|
|
|
|
|
2015-05-12 21:55:19 -07:00
|
|
|
|
var view = getView();
|
|
|
|
|
var html = '';
|
|
|
|
|
|
|
|
|
|
if (view == 'PosterCard') {
|
|
|
|
|
|
2016-04-03 11:47:49 -07:00
|
|
|
|
html += libraryBrowser.getPosterViewHtml({
|
2015-05-12 21:55:19 -07:00
|
|
|
|
items: items,
|
|
|
|
|
lazy: true,
|
2015-05-16 12:09:02 -07:00
|
|
|
|
shape: getPortraitShape(),
|
2015-05-12 21:55:19 -07:00
|
|
|
|
overlayText: false,
|
|
|
|
|
showTitle: true,
|
|
|
|
|
showYear: true,
|
2015-05-14 19:16:57 -07:00
|
|
|
|
cardLayout: true,
|
|
|
|
|
showDetailsMenu: true
|
2015-05-12 21:55:19 -07:00
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
} else if (view == 'Poster') {
|
2015-05-16 12:09:02 -07:00
|
|
|
|
|
2016-04-03 11:47:49 -07:00
|
|
|
|
html += libraryBrowser.getPosterViewHtml({
|
2015-05-12 21:55:19 -07:00
|
|
|
|
items: items,
|
2015-05-16 12:09:02 -07:00
|
|
|
|
shape: getPortraitShape(),
|
2015-05-12 21:55:19 -07:00
|
|
|
|
centerText: true,
|
|
|
|
|
lazy: true,
|
2015-08-21 10:45:56 -07:00
|
|
|
|
overlayText: false,
|
2016-02-12 13:26:03 -07:00
|
|
|
|
showDetailsMenu: true,
|
|
|
|
|
overlayPlayButton: true
|
2015-05-12 21:55:19 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
2015-04-02 09:26:42 -07:00
|
|
|
|
|
2015-09-28 20:35:50 -07:00
|
|
|
|
var recentlyAddedItems = page.querySelector('#recentlyAddedItems');
|
|
|
|
|
recentlyAddedItems.innerHTML = html;
|
|
|
|
|
ImageLoader.lazyChildren(recentlyAddedItems);
|
2015-04-02 09:26:42 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-07 07:04:10 -07:00
|
|
|
|
function loadResume(page, userId, parentId) {
|
|
|
|
|
|
|
|
|
|
var screenWidth = $(window).width();
|
|
|
|
|
|
|
|
|
|
var options = {
|
|
|
|
|
|
|
|
|
|
SortBy: "DatePlayed",
|
|
|
|
|
SortOrder: "Descending",
|
|
|
|
|
IncludeItemTypes: "Movie",
|
|
|
|
|
Filters: "IsResumable",
|
|
|
|
|
Limit: screenWidth >= 1920 ? 6 : (screenWidth >= 1600 ? 4 : 3),
|
|
|
|
|
Recursive: true,
|
|
|
|
|
Fields: "PrimaryImageAspectRatio,MediaSourceCount,SyncInfo",
|
|
|
|
|
CollapseBoxSetItems: false,
|
|
|
|
|
ParentId: parentId,
|
|
|
|
|
ImageTypeLimit: 1,
|
2016-05-08 20:13:38 -07:00
|
|
|
|
EnableImageTypes: "Primary,Backdrop,Banner,Thumb",
|
|
|
|
|
EnableTotalRecordCount: false
|
2015-05-07 07:04:10 -07:00
|
|
|
|
};
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getItems(userId, options).then(function (result) {
|
2015-05-07 07:04:10 -07:00
|
|
|
|
|
|
|
|
|
if (result.Items.length) {
|
|
|
|
|
$('#resumableSection', page).show();
|
|
|
|
|
} else {
|
|
|
|
|
$('#resumableSection', page).hide();
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-12 21:55:19 -07:00
|
|
|
|
var view = getResumeView();
|
|
|
|
|
var html = '';
|
|
|
|
|
|
|
|
|
|
if (view == 'ThumbCard') {
|
|
|
|
|
|
2016-04-03 11:47:49 -07:00
|
|
|
|
html += libraryBrowser.getPosterViewHtml({
|
2015-05-12 21:55:19 -07:00
|
|
|
|
items: result.Items,
|
|
|
|
|
preferThumb: true,
|
2015-05-16 12:09:02 -07:00
|
|
|
|
shape: getThumbShape(),
|
2015-05-12 21:55:19 -07:00
|
|
|
|
showTitle: true,
|
|
|
|
|
showYear: true,
|
|
|
|
|
lazy: true,
|
2015-05-14 19:16:57 -07:00
|
|
|
|
cardLayout: true,
|
|
|
|
|
showDetailsMenu: true
|
2015-05-07 07:04:10 -07:00
|
|
|
|
|
2015-05-12 21:55:19 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
} else if (view == 'Thumb') {
|
|
|
|
|
|
2016-04-03 11:47:49 -07:00
|
|
|
|
html += libraryBrowser.getPosterViewHtml({
|
2015-05-12 21:55:19 -07:00
|
|
|
|
items: result.Items,
|
|
|
|
|
preferThumb: true,
|
2015-05-16 12:09:02 -07:00
|
|
|
|
shape: getThumbShape(),
|
2015-05-12 21:55:19 -07:00
|
|
|
|
overlayText: true,
|
2015-10-25 22:29:32 -07:00
|
|
|
|
showTitle: false,
|
2015-05-14 19:16:57 -07:00
|
|
|
|
lazy: true,
|
2015-07-17 15:32:00 -07:00
|
|
|
|
showDetailsMenu: true,
|
|
|
|
|
overlayPlayButton: true
|
2015-05-12 21:55:19 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
var resumableItems = page.querySelector('#resumableItems');
|
|
|
|
|
resumableItems.innerHTML = html;
|
|
|
|
|
ImageLoader.lazyChildren(resumableItems);
|
2015-05-07 07:04:10 -07:00
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-11 19:11:01 -07:00
|
|
|
|
function getRecommendationHtml(recommendation) {
|
2013-04-01 08:59:56 -07:00
|
|
|
|
|
2014-03-11 19:11:01 -07:00
|
|
|
|
var html = '';
|
2014-01-30 14:23:54 -07:00
|
|
|
|
|
2014-03-11 19:11:01 -07:00
|
|
|
|
var title = '';
|
2014-05-10 22:11:53 -07:00
|
|
|
|
|
2014-03-11 19:11:01 -07:00
|
|
|
|
switch (recommendation.RecommendationType) {
|
2014-05-10 22:11:53 -07:00
|
|
|
|
|
2014-03-11 19:11:01 -07:00
|
|
|
|
case 'SimilarToRecentlyPlayed':
|
2014-05-30 12:23:56 -07:00
|
|
|
|
title = Globalize.translate('RecommendationBecauseYouWatched').replace("{0}", recommendation.BaselineItemName);
|
2014-03-11 19:11:01 -07:00
|
|
|
|
break;
|
|
|
|
|
case 'SimilarToLikedItem':
|
2014-05-30 12:23:56 -07:00
|
|
|
|
title = Globalize.translate('RecommendationBecauseYouLike').replace("{0}", recommendation.BaselineItemName);
|
2014-03-11 19:11:01 -07:00
|
|
|
|
break;
|
|
|
|
|
case 'HasDirectorFromRecentlyPlayed':
|
|
|
|
|
case 'HasLikedDirector':
|
2014-05-30 12:23:56 -07:00
|
|
|
|
title = Globalize.translate('RecommendationDirectedBy').replace("{0}", recommendation.BaselineItemName);
|
2014-03-11 19:11:01 -07:00
|
|
|
|
break;
|
|
|
|
|
case 'HasActorFromRecentlyPlayed':
|
|
|
|
|
case 'HasLikedActor':
|
2014-05-30 12:23:56 -07:00
|
|
|
|
title = Globalize.translate('RecommendationStarring').replace("{0}", recommendation.BaselineItemName);
|
2014-03-11 19:11:01 -07:00
|
|
|
|
break;
|
|
|
|
|
}
|
2014-05-10 22:11:53 -07:00
|
|
|
|
|
2015-05-16 12:09:02 -07:00
|
|
|
|
html += '<div class="homePageSection">';
|
2014-03-11 19:11:01 -07:00
|
|
|
|
html += '<h1 class="listHeader">' + title + '</h1>';
|
2013-04-01 08:59:56 -07:00
|
|
|
|
|
2015-05-16 12:09:02 -07:00
|
|
|
|
if (enableScrollX()) {
|
|
|
|
|
html += '<div class="hiddenScrollX">';
|
|
|
|
|
} else {
|
|
|
|
|
html += '<div>';
|
|
|
|
|
}
|
2015-05-12 21:55:19 -07:00
|
|
|
|
|
|
|
|
|
var view = getView();
|
|
|
|
|
|
|
|
|
|
if (view == 'PosterCard') {
|
|
|
|
|
|
2016-04-03 11:47:49 -07:00
|
|
|
|
html += libraryBrowser.getPosterViewHtml({
|
2015-05-12 21:55:19 -07:00
|
|
|
|
items: recommendation.Items,
|
|
|
|
|
lazy: true,
|
2015-05-16 12:09:02 -07:00
|
|
|
|
shape: getPortraitShape(),
|
2015-05-12 21:55:19 -07:00
|
|
|
|
overlayText: false,
|
|
|
|
|
showTitle: true,
|
|
|
|
|
showYear: true,
|
2015-05-14 19:16:57 -07:00
|
|
|
|
cardLayout: true,
|
|
|
|
|
showDetailsMenu: true
|
2015-05-12 21:55:19 -07:00
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
} else if (view == 'Poster') {
|
|
|
|
|
|
2016-04-03 11:47:49 -07:00
|
|
|
|
html += libraryBrowser.getPosterViewHtml({
|
2015-05-12 21:55:19 -07:00
|
|
|
|
items: recommendation.Items,
|
2015-05-16 12:09:02 -07:00
|
|
|
|
shape: getPortraitShape(),
|
2015-05-12 21:55:19 -07:00
|
|
|
|
centerText: true,
|
|
|
|
|
lazy: true,
|
2016-02-12 13:31:48 -07:00
|
|
|
|
showDetailsMenu: true,
|
|
|
|
|
overlayPlayButton: true
|
2015-05-12 21:55:19 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
2014-03-11 19:11:01 -07:00
|
|
|
|
html += '</div>';
|
2015-05-16 12:09:02 -07:00
|
|
|
|
html += '</div>';
|
2014-03-11 19:11:01 -07:00
|
|
|
|
|
|
|
|
|
return html;
|
|
|
|
|
}
|
2014-05-10 22:11:53 -07:00
|
|
|
|
|
2015-05-07 07:04:10 -07:00
|
|
|
|
function loadSuggestions(page, userId, parentId) {
|
2014-05-01 19:54:33 -07:00
|
|
|
|
|
2014-03-11 19:11:01 -07:00
|
|
|
|
var screenWidth = $(window).width();
|
2013-04-01 08:59:56 -07:00
|
|
|
|
|
2014-03-11 19:11:01 -07:00
|
|
|
|
var url = ApiClient.getUrl("Movies/Recommendations", {
|
2014-05-10 22:11:53 -07:00
|
|
|
|
|
2015-04-02 09:26:42 -07:00
|
|
|
|
userId: userId,
|
2014-07-04 22:21:13 -07:00
|
|
|
|
categoryLimit: screenWidth >= 1200 ? 4 : 3,
|
2015-04-15 20:23:13 -07:00
|
|
|
|
ItemLimit: screenWidth >= 1920 ? 9 : (screenWidth >= 1600 ? 8 : (screenWidth >= 1200 ? 7 : 6)),
|
2014-12-10 23:20:28 -07:00
|
|
|
|
Fields: "PrimaryImageAspectRatio,MediaSourceCount,SyncInfo",
|
2014-11-30 12:01:33 -07:00
|
|
|
|
ImageTypeLimit: 1,
|
2014-12-01 05:43:34 -07:00
|
|
|
|
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
|
2014-03-11 19:11:01 -07:00
|
|
|
|
});
|
2013-04-04 21:15:00 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getJSON(url).then(function (recommendations) {
|
2013-04-04 21:15:00 -07:00
|
|
|
|
|
2014-03-11 19:11:01 -07:00
|
|
|
|
if (!recommendations.length) {
|
2013-04-04 21:15:00 -07:00
|
|
|
|
|
2014-05-30 12:23:56 -07:00
|
|
|
|
$('.noItemsMessage', page).show();
|
2015-09-28 20:35:50 -07:00
|
|
|
|
page.querySelector('.recommendations').innerHTML = '';
|
2014-03-11 19:11:01 -07:00
|
|
|
|
return;
|
2013-04-04 21:15:00 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-03-11 19:11:01 -07:00
|
|
|
|
var html = recommendations.map(getRecommendationHtml).join('');
|
2013-04-04 21:15:00 -07:00
|
|
|
|
|
2014-05-30 12:23:56 -07:00
|
|
|
|
$('.noItemsMessage', page).hide();
|
2015-09-28 20:35:50 -07:00
|
|
|
|
|
|
|
|
|
var recs = page.querySelector('.recommendations');
|
|
|
|
|
recs.innerHTML = html;
|
|
|
|
|
ImageLoader.lazyChildren(recs);
|
2013-04-04 21:15:00 -07:00
|
|
|
|
});
|
2015-05-07 07:04:10 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-09-28 20:35:50 -07:00
|
|
|
|
function initSuggestedTab(page, tabContent) {
|
2015-05-07 07:04:10 -07:00
|
|
|
|
|
2015-08-18 09:11:56 -07:00
|
|
|
|
var containers = tabContent.querySelectorAll('.itemsContainer');
|
2015-05-16 12:09:02 -07:00
|
|
|
|
if (enableScrollX()) {
|
2015-06-28 07:45:21 -07:00
|
|
|
|
$(containers).addClass('hiddenScrollX');
|
2015-05-16 12:09:02 -07:00
|
|
|
|
} else {
|
2015-06-28 07:45:21 -07:00
|
|
|
|
$(containers).removeClass('hiddenScrollX');
|
2015-05-16 12:09:02 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-09-28 20:35:50 -07:00
|
|
|
|
$(containers).createCardMenus();
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-03 11:47:49 -07:00
|
|
|
|
function loadSuggestionsTab(view, params, tabContent) {
|
2015-09-28 20:35:50 -07:00
|
|
|
|
|
2016-04-03 11:47:49 -07:00
|
|
|
|
var parentId = params.topParentId;
|
2015-09-28 20:35:50 -07:00
|
|
|
|
|
|
|
|
|
var userId = Dashboard.getCurrentUserId();
|
|
|
|
|
|
2016-04-03 11:47:49 -07:00
|
|
|
|
console.log('loadSuggestionsTab');
|
|
|
|
|
loadResume(tabContent, userId, parentId);
|
|
|
|
|
loadLatest(tabContent, userId, parentId);
|
2015-05-07 07:04:10 -07:00
|
|
|
|
|
2016-04-03 11:47:49 -07:00
|
|
|
|
if (AppInfo.enableMovieHomeSuggestions) {
|
|
|
|
|
loadSuggestions(tabContent, userId, parentId);
|
2015-05-07 07:04:10 -07:00
|
|
|
|
}
|
2015-08-15 11:17:22 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-03 11:47:49 -07:00
|
|
|
|
return function (view, params) {
|
|
|
|
|
|
|
|
|
|
var self = this;
|
2015-08-18 09:11:56 -07:00
|
|
|
|
|
2016-05-15 09:30:32 -07:00
|
|
|
|
self.initTab = function () {
|
|
|
|
|
var tabContent = view.querySelector('.pageTabContent[data-index=\'' + 0 + '\']');
|
2016-04-03 11:47:49 -07:00
|
|
|
|
initSuggestedTab(view, tabContent);
|
|
|
|
|
};
|
2015-08-15 11:17:22 -07:00
|
|
|
|
|
2016-04-03 11:47:49 -07:00
|
|
|
|
self.renderTab = function () {
|
2016-05-15 09:30:32 -07:00
|
|
|
|
var tabContent = view.querySelector('.pageTabContent[data-index=\'' + 0 + '\']');
|
2016-04-03 11:47:49 -07:00
|
|
|
|
loadSuggestionsTab(view, params, tabContent);
|
|
|
|
|
};
|
2015-08-15 11:17:22 -07:00
|
|
|
|
|
2016-04-03 11:47:49 -07:00
|
|
|
|
$('.recommendations', view).createCardMenus();
|
2015-08-15 11:17:22 -07:00
|
|
|
|
|
2016-05-15 09:30:32 -07:00
|
|
|
|
var mdlTabs = view.querySelector('.libraryViewNav');
|
2016-05-09 12:27:38 -07:00
|
|
|
|
|
|
|
|
|
function onPlaybackStop(e, state) {
|
|
|
|
|
|
|
|
|
|
if (state.NowPlayingItem && state.NowPlayingItem.MediaType == 'Video') {
|
|
|
|
|
|
|
|
|
|
mdlTabs.dispatchEvent(new CustomEvent("tabchange", {
|
|
|
|
|
detail: {
|
|
|
|
|
selectedTabIndex: libraryBrowser.selectedTab(mdlTabs)
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-01 08:31:50 -07:00
|
|
|
|
var baseUrl = 'movies.html';
|
2016-04-03 11:47:49 -07:00
|
|
|
|
var topParentId = params.topParentId;
|
2015-09-01 08:31:50 -07:00
|
|
|
|
if (topParentId) {
|
|
|
|
|
baseUrl += '?topParentId=' + topParentId;
|
|
|
|
|
}
|
2015-08-15 11:17:22 -07:00
|
|
|
|
|
2016-05-16 10:11:49 -07:00
|
|
|
|
libraryBrowser.configurePaperLibraryTabs(view, mdlTabs, view.querySelectorAll('.pageTabContent'), [0, 4, 5]);
|
2016-04-03 11:47:49 -07:00
|
|
|
|
|
|
|
|
|
var tabControllers = [];
|
|
|
|
|
var renderedTabs = [];
|
|
|
|
|
|
|
|
|
|
function loadTab(page, index) {
|
|
|
|
|
|
2016-05-15 09:30:32 -07:00
|
|
|
|
var tabContent = view.querySelector('.pageTabContent[data-index=\'' + index + '\']');
|
2016-04-03 11:47:49 -07:00
|
|
|
|
var depends = [];
|
|
|
|
|
|
|
|
|
|
switch (index) {
|
|
|
|
|
|
|
|
|
|
case 0:
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
depends.push('scripts/movies');
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
depends.push('scripts/movietrailers');
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
depends.push('scripts/moviecollections');
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
depends.push('scripts/moviegenres');
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
depends.push('scripts/moviestudios');
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2015-08-15 11:17:22 -07:00
|
|
|
|
|
2016-04-03 11:47:49 -07:00
|
|
|
|
require(depends, function (controllerFactory) {
|
2015-08-15 11:17:22 -07:00
|
|
|
|
|
2016-04-03 11:47:49 -07:00
|
|
|
|
if (index == 0) {
|
|
|
|
|
self.tabContent = tabContent;
|
|
|
|
|
}
|
|
|
|
|
var controller = tabControllers[index];
|
|
|
|
|
if (!controller) {
|
|
|
|
|
controller = index ? new controllerFactory(view, params, tabContent) : self;
|
|
|
|
|
tabControllers[index] = controller;
|
|
|
|
|
|
|
|
|
|
if (controller.initTab) {
|
|
|
|
|
controller.initTab();
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-08-15 11:17:22 -07:00
|
|
|
|
|
2016-04-03 11:47:49 -07:00
|
|
|
|
if (renderedTabs.indexOf(index) == -1) {
|
|
|
|
|
renderedTabs.push(index);
|
|
|
|
|
controller.renderTab();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2015-08-15 11:17:22 -07:00
|
|
|
|
|
2016-05-09 12:27:38 -07:00
|
|
|
|
mdlTabs.addEventListener('tabchange', function (e) {
|
2016-04-03 11:47:49 -07:00
|
|
|
|
loadTab(view, parseInt(e.detail.selectedTabIndex));
|
|
|
|
|
});
|
2015-08-15 11:17:22 -07:00
|
|
|
|
|
2016-04-03 11:47:49 -07:00
|
|
|
|
view.addEventListener('viewbeforeshow', function (e) {
|
|
|
|
|
if (!view.getAttribute('data-title')) {
|
2015-08-15 11:17:22 -07:00
|
|
|
|
|
2016-04-03 11:47:49 -07:00
|
|
|
|
var parentId = params.topParentId;
|
2015-08-15 11:17:22 -07:00
|
|
|
|
|
2016-04-03 11:47:49 -07:00
|
|
|
|
if (parentId) {
|
2014-05-10 22:11:53 -07:00
|
|
|
|
|
2016-04-03 11:47:49 -07:00
|
|
|
|
ApiClient.getItem(Dashboard.getCurrentUserId(), parentId).then(function (item) {
|
2015-09-20 11:17:57 -07:00
|
|
|
|
|
2016-04-03 11:47:49 -07:00
|
|
|
|
view.setAttribute('data-title', item.Name);
|
|
|
|
|
LibraryMenu.setTitle(item.Name);
|
|
|
|
|
});
|
2015-09-20 11:17:57 -07:00
|
|
|
|
|
2013-04-01 08:59:56 -07:00
|
|
|
|
|
2016-04-03 11:47:49 -07:00
|
|
|
|
} else {
|
|
|
|
|
view.setAttribute('data-title', Globalize.translate('TabMovies'));
|
|
|
|
|
LibraryMenu.setTitle(Globalize.translate('TabMovies'));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2015-09-20 11:17:57 -07:00
|
|
|
|
|
2016-04-03 11:47:49 -07:00
|
|
|
|
view.addEventListener('viewshow', function (e) {
|
|
|
|
|
Events.on(MediaController, 'playbackstop', onPlaybackStop);
|
|
|
|
|
});
|
2015-09-20 11:17:57 -07:00
|
|
|
|
|
2016-04-03 11:47:49 -07:00
|
|
|
|
view.addEventListener('viewbeforehide', function (e) {
|
|
|
|
|
Events.off(MediaController, 'playbackstop', onPlaybackStop);
|
|
|
|
|
});
|
|
|
|
|
};
|
2015-09-20 11:17:57 -07:00
|
|
|
|
|
2016-03-18 21:26:17 -07:00
|
|
|
|
});
|