jellyfin-web/dashboard-ui/scripts/indexpage.js

645 lines
21 KiB
JavaScript
Raw Normal View History

2014-10-15 20:26:39 -07:00
(function ($, document) {
2013-02-20 18:33:05 -07:00
2014-06-07 12:46:24 -07:00
function getUserViews(userId) {
var deferred = $.Deferred();
ApiClient.getUserViews(userId).done(function (result) {
var items = result.Items;
deferred.resolveWith(null, [items]);
});
return deferred.promise();
}
2014-06-24 14:45:21 -07:00
function createMediaLinks(options) {
var html = "";
var items = options.items;
// "My Library" backgrounds
for (var i = 0, length = items.length; i < length; i++) {
var item = items[i];
2015-02-02 21:54:52 -07:00
var icon;
2014-06-24 14:45:21 -07:00
switch (item.CollectionType) {
case "movies":
2015-02-02 21:54:52 -07:00
icon = "fa-film";
2014-06-24 14:45:21 -07:00
break;
case "music":
2015-02-02 21:54:52 -07:00
icon = "fa-music";
2014-06-24 14:45:21 -07:00
break;
case "photos":
2015-02-02 21:54:52 -07:00
icon = "fa-photo";
2014-06-24 14:45:21 -07:00
break;
case "livetv":
case "tvshows":
2015-02-02 21:54:52 -07:00
icon = "fa-video-camera";
2014-06-24 14:45:21 -07:00
break;
case "games":
2015-02-02 21:54:52 -07:00
icon = "fa-gamepad";
2014-06-24 14:45:21 -07:00
break;
case "trailers":
2015-02-02 21:54:52 -07:00
icon = "fa-film";
2014-06-24 14:45:21 -07:00
break;
case "homevideos":
2015-02-02 21:54:52 -07:00
icon = "fa-video-camera";
2014-06-24 14:45:21 -07:00
break;
case "musicvideos":
2015-02-02 21:54:52 -07:00
icon = "fa-video-camera";
2014-06-24 14:45:21 -07:00
break;
case "books":
2015-02-02 21:54:52 -07:00
icon = "fa-book";
2014-06-24 14:45:21 -07:00
break;
case "channels":
2015-02-03 14:06:56 -07:00
icon = "fa-globe";
break;
case "playlists":
icon = "fa-list";
2014-06-24 14:45:21 -07:00
break;
default:
2015-02-02 21:54:52 -07:00
icon = "fa-folder-o";
2014-06-24 14:45:21 -07:00
break;
}
var cssClass = "posterItem";
cssClass += ' ' + options.shape + 'PosterItem';
if (item.CollectionType) {
cssClass += ' ' + item.CollectionType + 'PosterItem';
}
var href = item.url || LibraryBrowser.getHref(item, options.context);
html += '<a data-itemid="' + item.Id + '" class="' + cssClass + '" href="' + href + '">';
2014-12-19 23:06:27 -07:00
var imageCssClass = '';
2014-06-24 14:45:21 -07:00
2015-02-02 21:54:52 -07:00
html += '<div class="posterItemImage ' + imageCssClass + '">';
2014-06-24 14:45:21 -07:00
html += '</div>';
html += "<div class='posterItemDefaultText posterItemText'>";
2015-02-02 21:54:52 -07:00
html += '<i class="fa ' + icon + '"></i>';
2015-02-03 11:14:53 -07:00
html += '<span>' + item.Name + '</span>';
2014-06-24 14:45:21 -07:00
html += "</div>";
html += "</a>";
}
return html;
}
function loadlibraryButtons(elem, userId, index) {
getUserViews(userId).done(function (items) {
var html = '<br/>';
if (index) {
2015-04-10 07:01:16 -07:00
html += '<h1 class="listHeader">' + Globalize.translate('HeaderMyMedia') + '</h1>';
2014-06-24 14:45:21 -07:00
}
html += '<div>';
html += createMediaLinks({
items: items,
shape: 'myLibrary',
showTitle: true,
centerText: true
});
html += '</div>';
$(elem).html(html);
handleLibraryLinkNavigations(elem);
});
}
2015-03-24 18:14:24 -07:00
function loadRecentlyAdded(elem, user, context) {
2014-05-20 17:56:24 -07:00
var options = {
2014-05-13 17:46:45 -07:00
2014-10-30 21:57:24 -07:00
Limit: 24,
2014-12-10 23:20:28 -07:00
Fields: "PrimaryImageAspectRatio,SyncInfo",
2015-01-27 15:45:59 -07:00
ImageTypeLimit: 1,
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
2014-05-01 19:54:33 -07:00
};
2015-03-24 18:14:24 -07:00
return ApiClient.getJSON(ApiClient.getUrl('Users/' + user.Id + '/Items/Latest', options)).done(function (items) {
2014-05-21 12:33:46 -07:00
var html = '';
2013-11-20 14:08:12 -07:00
if (items.length) {
2014-10-30 21:57:24 -07:00
html += '<div>';
html += '<h1 style="display:inline-block; vertical-align:middle;" class="listHeader">' + Globalize.translate('HeaderLatestMedia') + '</h1>';
2015-03-24 18:14:24 -07:00
if (user.Policy.EnableUserPreferenceAccess) {
html += '<a href="mypreferencesdisplay.html" class="accentButton"><i class="fa fa-pencil"></i>' + Globalize.translate('ButtonEdit') + '</a>';
}
2014-10-30 21:57:24 -07:00
html += '</div>';
2015-01-22 23:15:15 -07:00
html += '<div class="itemsContainer">';
2014-05-21 20:35:18 -07:00
html += LibraryBrowser.getPosterViewHtml({
items: items,
2014-05-21 20:35:18 -07:00
preferThumb: true,
2015-01-22 23:15:15 -07:00
shape: 'backdrop',
2014-09-29 21:47:30 -07:00
context: context || 'home',
showUnplayedIndicator: false,
showChildCountIndicator: true,
2014-09-29 21:47:30 -07:00
lazy: true,
2014-05-21 20:35:18 -07:00
});
html += '</div>';
}
2015-01-22 23:15:15 -07:00
$(elem).html(html).lazyChildren();
$(elem).createCardMenus();
2014-05-21 12:33:46 -07:00
});
}
function loadLatestChannelMedia(elem, userId) {
var screenWidth = $(window).width();
var options = {
2014-07-17 15:21:35 -07:00
Limit: screenWidth >= 2400 ? 10 : (screenWidth >= 1600 ? 10 : (screenWidth >= 1440 ? 8 : (screenWidth >= 800 ? 7 : 6))),
2014-12-10 23:20:28 -07:00
Fields: "PrimaryImageAspectRatio,SyncInfo",
Filters: "IsUnplayed",
UserId: userId
};
2014-07-01 22:16:59 -07:00
ApiClient.getJSON(ApiClient.getUrl("Channels/Items/Latest", options)).done(function (result) {
var html = '';
if (result.Items.length) {
html += '<h1 class="listHeader">' + Globalize.translate('HeaderLatestChannelMedia') + '</h1>';
2015-01-22 23:15:15 -07:00
html += '<div class="itemsContainer">';
html += LibraryBrowser.getPosterViewHtml({
items: result.Items,
preferThumb: true,
2014-08-01 19:34:45 -07:00
shape: 'auto',
showTitle: true,
centerText: true,
lazy: true
});
html += '</div>';
}
2015-01-22 23:15:15 -07:00
$(elem).html(html).lazyChildren();
$(elem).createCardMenus();
});
}
2015-03-24 18:14:24 -07:00
function loadLibraryTiles(elem, user, shape, index, autoHideOnMobile, showTitles) {
2014-05-21 12:33:46 -07:00
2014-07-11 19:31:08 -07:00
if (autoHideOnMobile) {
$(elem).addClass('hiddenSectionOnMobile');
} else {
$(elem).removeClass('hiddenSectionOnMobile');
}
2014-09-25 20:47:46 -07:00
2015-03-24 18:14:24 -07:00
getUserViews(user.Id).done(function (items) {
2014-05-21 12:33:46 -07:00
var html = '';
2014-06-07 12:46:24 -07:00
if (items.length) {
2014-06-14 16:13:09 -07:00
2014-06-23 09:05:19 -07:00
var cssClass = index !== 0 ? 'listHeader' : 'listHeader firstListHeader';
2014-06-19 21:50:30 -07:00
2014-06-23 09:05:19 -07:00
html += '<div>';
2015-04-10 07:01:16 -07:00
html += '<h1 style="display:inline-block; vertical-align:middle;" class="' + cssClass + '">' + Globalize.translate('HeaderMyMedia') + '</h1>';
2015-03-24 18:14:24 -07:00
if (user.Policy.EnableUserPreferenceAccess) {
html += '<a href="mypreferencesdisplay.html" class="accentButton"><i class="fa fa-pencil"></i>' + Globalize.translate('ButtonEdit') + '</a>';
}
2014-06-23 09:05:19 -07:00
html += '</div>';
2014-06-14 16:13:09 -07:00
2015-03-25 21:44:24 -07:00
html += '<div class="homeTopViews">';
2014-05-21 20:35:18 -07:00
html += LibraryBrowser.getPosterViewHtml({
2014-06-07 12:46:24 -07:00
items: items,
shape: shape,
2015-03-14 18:58:06 -07:00
showTitle: showTitles,
2014-05-29 21:16:31 -07:00
centerText: true,
lazy: true,
2014-06-30 21:06:28 -07:00
autoThumb: true,
context: 'home'
2014-05-21 20:35:18 -07:00
});
html += '</div>';
}
2013-08-06 12:21:42 -07:00
2015-01-24 12:03:55 -07:00
$(elem).html(html).lazyChildren().createCardMenus();
handleLibraryLinkNavigations(elem);
});
2014-05-21 12:33:46 -07:00
}
2013-04-04 10:27:36 -07:00
2014-06-14 16:13:09 -07:00
function loadLibraryFolders(elem, userId, shape, index) {
ApiClient.getItems(userId, {
2015-01-27 15:45:59 -07:00
SortBy: "SortName",
ImageTypeLimit: 1
2014-06-14 16:13:09 -07:00
}).done(function (result) {
var html = '';
var items = result.Items;
for (var i = 0, length = items.length; i < length; i++) {
items[i].url = 'itemlist.html?parentid=' + items[i].Id;
}
if (items.length) {
html += '<h1 class="listHeader">' + Globalize.translate('HeaderLibraryFolders') + '</h1>';
html += '<div>';
html += LibraryBrowser.getPosterViewHtml({
items: items,
shape: shape,
showTitle: true,
centerText: true,
lazy: true
});
html += '</div>';
}
2015-01-22 23:15:15 -07:00
$(elem).html(html).lazyChildren();
2014-06-14 16:13:09 -07:00
handleLibraryLinkNavigations(elem);
});
}
2014-05-21 12:33:46 -07:00
function loadResume(elem, userId) {
2014-05-01 19:54:33 -07:00
2014-05-21 12:33:46 -07:00
var screenWidth = $(window).width();
var options = {
SortBy: "DatePlayed",
2014-05-01 19:54:33 -07:00
SortOrder: "Descending",
2014-05-21 12:33:46 -07:00
MediaTypes: "Video",
Filters: "IsResumable",
2014-08-11 07:15:53 -07:00
Limit: screenWidth >= 1920 ? 10 : (screenWidth >= 1600 ? 8 : (screenWidth >= 1200 ? 9 : 6)),
2014-05-01 19:54:33 -07:00
Recursive: true,
2014-12-10 23:20:28 -07:00
Fields: "PrimaryImageAspectRatio,SyncInfo",
2014-05-01 19:54:33 -07:00
CollapseBoxSetItems: false,
2015-01-27 15:45:59 -07:00
ExcludeLocationTypes: "Virtual",
ImageTypeLimit: 1,
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
2013-08-06 12:21:42 -07:00
};
2014-05-21 12:33:46 -07:00
ApiClient.getItems(userId, options).done(function (result) {
2013-04-04 10:27:36 -07:00
2014-05-21 12:33:46 -07:00
var html = '';
2014-05-03 16:38:23 -07:00
2014-05-21 20:35:18 -07:00
if (result.Items.length) {
2014-06-07 12:46:24 -07:00
html += '<h1 class="listHeader">' + Globalize.translate('HeaderResume') + '</h1>';
2014-05-21 20:35:18 -07:00
html += '<div>';
html += LibraryBrowser.getPosterViewHtml({
items: result.Items,
2015-02-25 11:11:49 -07:00
preferThumb: true,
2015-01-22 23:15:15 -07:00
shape: 'backdrop',
2015-02-26 11:24:38 -07:00
overlayText: true,
2014-05-21 20:35:18 -07:00
showTitle: true,
2014-05-29 12:34:20 -07:00
showParentTitle: true,
2014-05-29 21:16:31 -07:00
context: 'home',
lazy: true
2014-05-21 20:35:18 -07:00
});
html += '</div>';
}
2013-04-04 10:27:36 -07:00
2015-01-22 23:15:15 -07:00
$(elem).html(html).lazyChildren();
2015-02-02 09:49:33 -07:00
$(elem).createCardMenus();
2013-04-04 10:27:36 -07:00
});
2014-05-21 12:33:46 -07:00
}
2014-06-23 09:05:19 -07:00
function handleLibraryLinkNavigations(elem) {
$('a.posterItem', elem).on('click', function () {
2015-02-03 11:14:53 -07:00
var textElem = $('.posterItemText span', this);
if (!textElem.length) {
textElem = $('.posterItemText', this);
}
var text = textElem.html();
2014-06-23 09:05:19 -07:00
LibraryMenu.setText(text);
});
}
function loadLatestChannelItems(elem, userId, options) {
options = $.extend(options || {}, {
UserId: userId,
SupportsLatestItems: true
});
2014-07-01 22:16:59 -07:00
ApiClient.getJSON(ApiClient.getUrl("Channels", options)).done(function (result) {
2014-06-23 09:05:19 -07:00
var channels = result.Items;
var channelsHtml = channels.map(function (c) {
return '<div id="channel' + c.Id + '"></div>';
}).join('');
$(elem).html(channelsHtml);
for (var i = 0, length = channels.length; i < length; i++) {
var channel = channels[i];
loadLatestChannelItemsFromChannel(elem, channel, i);
}
});
}
function loadLatestChannelItemsFromChannel(page, channel, index) {
var screenWidth = $(window).width();
var options = {
2015-01-22 23:15:15 -07:00
Limit: screenWidth >= 1600 ? 10 : (screenWidth >= 1440 ? 5 : (screenWidth >= 800 ? 6 : 6)),
2014-12-10 23:20:28 -07:00
Fields: "PrimaryImageAspectRatio,SyncInfo",
2014-06-23 09:05:19 -07:00
Filters: "IsUnplayed",
UserId: Dashboard.getCurrentUserId(),
ChannelIds: channel.Id
};
2014-07-01 22:16:59 -07:00
ApiClient.getJSON(ApiClient.getUrl("Channels/Items/Latest", options)).done(function (result) {
2014-06-23 09:05:19 -07:00
var html = '';
if (result.Items.length) {
var cssClass = index !== 0 ? 'listHeader' : 'listHeader firstListHeader';
html += '<div>';
var text = Globalize.translate('HeaderLatestFromChannel').replace('{0}', channel.Name);
html += '<h1 style="display:inline-block; vertical-align:middle;" class="' + cssClass + '">' + text + '</h1>';
2015-01-22 23:15:15 -07:00
html += '<a href="channelitems.html?context=channels&id=' + channel.Id + '" data-role="button" data-icon="arrow-r" data-mini="true" data-inline="true" data-iconpos="notext" class="sectionHeaderButton"></a>';
2014-06-23 09:05:19 -07:00
html += '</div>';
}
2015-01-22 23:15:15 -07:00
html += '<div class="itemsContainer">';
2014-06-23 09:05:19 -07:00
html += LibraryBrowser.getPosterViewHtml({
items: result.Items,
2014-08-01 19:34:45 -07:00
shape: 'autohome',
2014-06-23 09:05:19 -07:00
defaultShape: 'square',
showTitle: true,
centerText: true,
context: 'channels',
lazy: true
});
2015-01-22 23:15:15 -07:00
html += '</div>';
2014-06-23 09:05:19 -07:00
2015-01-22 23:15:15 -07:00
var elem = $('#channel' + channel.Id + '', page).html(html).lazyChildren().trigger('create');
$(elem).createCardMenus();
2014-06-23 09:05:19 -07:00
});
}
function loadLatestLiveTvRecordings(elem, userId, index) {
ApiClient.getLiveTvRecordings({
userId: userId,
2014-07-11 19:31:08 -07:00
limit: 5,
2014-06-23 09:05:19 -07:00
IsInProgress: false
}).done(function (result) {
var html = '';
if (result.Items.length) {
var cssClass = index !== 0 ? 'listHeader' : 'listHeader firstListHeader';
html += '<div>';
html += '<h1 style="display:inline-block; vertical-align:middle;" class="' + cssClass + '">' + Globalize.translate('HeaderLatestTvRecordings') + '</h1>';
2015-02-04 20:01:37 -07:00
html += '<a href="livetvrecordings.html?context=livetv" data-role="button" data-icon="arrow-r" data-mini="true" data-inline="true" data-iconpos="notext" class="sectionHeaderButton"></a>';
2014-06-23 09:05:19 -07:00
html += '</div>';
}
var screenWidth = $(window).width();
html += LibraryBrowser.getPosterViewHtml({
items: result.Items,
2014-08-01 19:34:45 -07:00
shape: "autohome",
2014-06-23 09:05:19 -07:00
showTitle: true,
showParentTitle: true,
overlayText: screenWidth >= 600,
coverImage: true,
lazy: true
});
2015-02-04 20:01:37 -07:00
elem.html(html).lazyChildren().trigger('create');
2014-06-23 09:05:19 -07:00
});
}
window.Sections = {
loadRecentlyAdded: loadRecentlyAdded,
loadLatestChannelMedia: loadLatestChannelMedia,
loadLibraryTiles: loadLibraryTiles,
loadLibraryFolders: loadLibraryFolders,
loadResume: loadResume,
loadLatestChannelItems: loadLatestChannelItems,
2014-06-24 14:45:21 -07:00
loadLatestLiveTvRecordings: loadLatestLiveTvRecordings,
loadlibraryButtons: loadlibraryButtons
2014-06-23 09:05:19 -07:00
};
2014-10-25 11:32:58 -07:00
})(jQuery, document);
2014-06-23 09:05:19 -07:00
2014-10-15 20:26:39 -07:00
(function ($, document) {
2014-06-23 09:05:19 -07:00
function getDefaultSection(index) {
switch (index) {
case 0:
2015-04-02 09:24:59 -07:00
return 'librarytiles-automobile';
2014-06-23 09:05:19 -07:00
case 1:
return 'resume';
case 2:
2014-07-11 19:31:08 -07:00
return 'latestmedia';
2014-06-23 09:05:19 -07:00
case 3:
return '';
default:
return '';
}
}
2015-03-24 18:14:24 -07:00
function loadSection(page, user, displayPreferences, index) {
var userId = user.Id;
2014-05-21 12:33:46 -07:00
var section = displayPreferences.CustomPrefs['home' + index] || getDefaultSection(index);
2015-03-14 18:58:06 -07:00
var showLibraryTileNames = displayPreferences.CustomPrefs.enableLibraryTileNames != '0';
2014-05-21 12:33:46 -07:00
var elem = $('.section' + index, page);
2014-06-19 21:50:30 -07:00
2014-05-21 12:33:46 -07:00
if (section == 'latestmedia') {
2015-03-24 18:14:24 -07:00
Sections.loadRecentlyAdded(elem, user);
2014-05-21 12:33:46 -07:00
}
else if (section == 'librarytiles') {
2015-03-24 18:14:24 -07:00
Sections.loadLibraryTiles(elem, user, 'backdrop', index, false, showLibraryTileNames);
2014-06-07 12:46:24 -07:00
}
2014-06-24 14:45:21 -07:00
else if (section == 'smalllibrarytiles') {
2015-03-24 18:14:24 -07:00
Sections.loadLibraryTiles(elem, user, 'homePageSmallBackdrop', index, false, showLibraryTileNames);
2014-07-11 19:31:08 -07:00
}
else if (section == 'smalllibrarytiles-automobile') {
2015-03-24 18:14:24 -07:00
Sections.loadLibraryTiles(elem, user, 'homePageSmallBackdrop', index, true, showLibraryTileNames);
2015-03-13 21:50:23 -07:00
}
else if (section == 'librarytiles-automobile') {
2015-03-24 18:14:24 -07:00
Sections.loadLibraryTiles(elem, user, 'backdrop', index, true, showLibraryTileNames);
2014-05-21 12:33:46 -07:00
}
2014-06-24 14:45:21 -07:00
else if (section == 'librarybuttons') {
Sections.loadlibraryButtons(elem, userId, index);
}
2014-05-21 12:33:46 -07:00
else if (section == 'resume') {
2014-06-23 09:05:19 -07:00
Sections.loadResume(elem, userId);
}
else if (section == 'latesttvrecordings') {
Sections.loadLatestLiveTvRecordings(elem, userId);
2014-05-21 12:33:46 -07:00
}
2014-06-19 21:50:30 -07:00
else if (section == 'folders') {
2015-01-22 23:15:15 -07:00
Sections.loadLibraryFolders(elem, userId, 'backdrop', index);
2014-06-14 16:13:09 -07:00
} else if (section == 'latestchannelmedia') {
2014-06-23 09:05:19 -07:00
Sections.loadLatestChannelMedia(elem, userId);
2014-05-21 20:35:18 -07:00
} else {
2014-05-21 20:35:18 -07:00
elem.empty();
2014-05-21 12:33:46 -07:00
}
}
2015-03-24 18:14:24 -07:00
function loadSections(page, user, displayPreferences) {
2014-05-21 12:33:46 -07:00
var i, length;
var sectionCount = 4;
2014-05-21 12:33:46 -07:00
2014-05-21 20:35:18 -07:00
var elem = $('.sections', page);
2014-05-21 20:35:18 -07:00
if (!elem.html().length) {
var html = '';
for (i = 0, length = sectionCount; i < length; i++) {
2014-05-21 12:33:46 -07:00
2014-05-21 20:35:18 -07:00
html += '<div class="homePageSection section' + i + '"></div>';
}
2014-05-21 12:33:46 -07:00
2014-05-21 20:35:18 -07:00
elem.html(html);
}
2014-05-21 12:33:46 -07:00
for (i = 0, length = sectionCount; i < length; i++) {
2015-03-24 18:14:24 -07:00
loadSection(page, user, displayPreferences, i);
2014-05-21 12:33:46 -07:00
}
}
2015-02-11 13:23:07 -07:00
var homePageDismissValue = '5';
2014-09-25 20:47:46 -07:00
var homePageTourKey = 'homePageTour';
2014-06-07 12:46:24 -07:00
2014-05-30 14:06:57 -07:00
function dismissWelcome(page, userId) {
ApiClient.getDisplayPreferences('home', userId, 'webclient').done(function (result) {
2014-09-25 20:47:46 -07:00
result.CustomPrefs[homePageTourKey] = homePageDismissValue;
ApiClient.updateDisplayPreferences('home', result, userId, 'webclient');
});
}
2014-06-07 12:46:24 -07:00
2015-01-11 11:36:26 -07:00
function showWelcomeIfNeeded(page, displayPreferences) {
if (displayPreferences.CustomPrefs[homePageTourKey] == homePageDismissValue) {
$('.welcomeMessage', page).hide();
} else {
var elem = $('.welcomeMessage', page).show();
if (displayPreferences.CustomPrefs[homePageTourKey]) {
$('.tourHeader', elem).html(Globalize.translate('HeaderWelcomeBack'));
$('.tourButtonText', elem).html(Globalize.translate('ButtonTakeTheTourToSeeWhatsNew'));
} else {
2015-03-21 11:12:12 -07:00
$('.tourHeader', elem).html(Globalize.translate('HeaderWelcomeToProjectWebClient'));
2015-01-11 11:36:26 -07:00
$('.tourButtonText', elem).html(Globalize.translate('ButtonTakeTheTour'));
}
}
2014-10-04 11:05:24 -07:00
}
2014-09-25 20:47:46 -07:00
function takeTour(page, userId) {
$.swipebox([
{ href: 'css/images/tour/web/tourcontent.jpg', title: Globalize.translate('WebClientTourContent') },
{ href: 'css/images/tour/web/tourmovies.jpg', title: Globalize.translate('WebClientTourMovies') },
{ href: 'css/images/tour/web/tourmouseover.jpg', title: Globalize.translate('WebClientTourMouseOver') },
{ href: 'css/images/tour/web/tourtaphold.jpg', title: Globalize.translate('WebClientTourTapHold') },
2015-02-11 13:23:07 -07:00
{ href: 'css/images/tour/web/tourmysync.png', title: Globalize.translate('WebClientTourMySync') },
2014-09-25 20:47:46 -07:00
{ href: 'css/images/tour/web/toureditor.png', title: Globalize.translate('WebClientTourMetadataManager') },
{ href: 'css/images/tour/web/tourplaylist.png', title: Globalize.translate('WebClientTourPlaylists') },
{ href: 'css/images/tour/web/tourcollections.jpg', title: Globalize.translate('WebClientTourCollections') },
{ href: 'css/images/tour/web/tourusersettings1.png', title: Globalize.translate('WebClientTourUserPreferences1') },
{ href: 'css/images/tour/web/tourusersettings2.png', title: Globalize.translate('WebClientTourUserPreferences2') },
{ href: 'css/images/tour/web/tourusersettings3.png', title: Globalize.translate('WebClientTourUserPreferences3') },
{ href: 'css/images/tour/web/tourusersettings4.png', title: Globalize.translate('WebClientTourUserPreferences4') },
{ href: 'css/images/tour/web/tourmobile1.jpg', title: Globalize.translate('WebClientTourMobile1') },
{ href: 'css/images/tour/web/tourmobile2.png', title: Globalize.translate('WebClientTourMobile2') },
{ href: 'css/images/tour/enjoy.jpg', title: Globalize.translate('MessageEnjoyYourStay') }
], {
afterClose: function () {
dismissWelcome(page, userId);
2014-05-30 14:06:57 -07:00
$('.welcomeMessage', page).hide();
2014-09-25 20:47:46 -07:00
},
hideBarsDelay: 30000
2014-05-30 14:06:57 -07:00
});
}
$(document).on('pageinit', "#indexPage", function () {
var page = this;
var userId = Dashboard.getCurrentUserId();
2014-10-04 11:05:24 -07:00
$('.btnTakeTour', page).on('click', function () {
2014-09-25 20:47:46 -07:00
takeTour(page, userId);
2014-05-30 14:06:57 -07:00
});
}).on('pagebeforeshow', "#indexPage", function () {
2014-05-21 12:33:46 -07:00
var page = this;
var userId = Dashboard.getCurrentUserId();
ApiClient.getDisplayPreferences('home', userId, 'webclient').done(function (result) {
2015-01-11 11:36:26 -07:00
showWelcomeIfNeeded(page, result);
2015-03-24 18:14:24 -07:00
Dashboard.getCurrentUser().done(function (user) {
loadSections(page, user, result);
});
2014-05-21 12:33:46 -07:00
});
2013-07-23 05:29:28 -07:00
});
2014-10-25 11:32:58 -07:00
})(jQuery, document);