diff --git a/src/bower_components/emby-webcomponents/homesections/homesections.js b/src/bower_components/emby-webcomponents/homesections/homesections.js index 65c7b2d934..9f47607e19 100644 --- a/src/bower_components/emby-webcomponents/homesections/homesections.js +++ b/src/bower_components/emby-webcomponents/homesections/homesections.js @@ -273,31 +273,20 @@ } function loadlibraryButtons(elem, apiClient, user, userSettings, userViews) { + elem.classList.remove('verticalSection'); + var html = getLibraryButtonsHtml(userViews); + elem.innerHTML = html; - return Promise.all([getAppInfo(apiClient), getDownloadsSectionHtml(apiClient, user, userSettings)]).then(function (responses) { + bindHomeScreenSettingsIcon(elem, apiClient, user.Id, userSettings); - var infoHtml = responses[0]; - var downloadsHtml = responses[1]; - - elem.classList.remove('verticalSection'); - - var html = getLibraryButtonsHtml(userViews); - - elem.innerHTML = html + downloadsHtml + infoHtml; - - bindHomeScreenSettingsIcon(elem, apiClient, user.Id, userSettings); - - if (infoHtml) { - bindAppInfoEvents(elem); - } - imageLoader.lazyChildren(elem); - }); + if (infoHtml) { + bindAppInfoEvents(elem); + } + imageLoader.lazyChildren(elem); } function bindAppInfoEvents(elem) { - elem.querySelector('.appInfoSection').addEventListener('click', function (e) { - if (dom.parentWithClass(e.target, 'card')) { registrationServices.showPremiereInfo(); } @@ -312,106 +301,6 @@ return Math.floor(Math.random() * (max - min + 1)) + min; } - function getAppInfo(apiClient) { - - var frequency = 172800000; - - var cacheKey = 'lastappinfopresent5'; - var lastDatePresented = parseInt(appSettings.get(cacheKey) || '0'); - - // Don't show the first time, right after installation - if (!lastDatePresented) { - appSettings.set(cacheKey, new Date().getTime()); - return Promise.resolve(''); - } - - if ((new Date().getTime() - lastDatePresented) < frequency) { - return Promise.resolve(''); - } - - return registrationServices.validateFeature('dvr', { - - showDialog: false, - viewOnly: true - - }).then(function () { - - appSettings.set(cacheKey, new Date().getTime()); - return ''; - - }, function () { - - appSettings.set(cacheKey, new Date().getTime()); - - var infos = [getPremiereInfo]; - - if (appHost.supports('otherapppromotions')) { - infos.push(getTheaterInfo); - } - - return infos[getRandomInt(0, infos.length - 1)](); - }); - } - - function getCard(img, shape) { - - shape = shape || 'backdropCard'; - var html = '
'; - - html += '
'; - - html += '
'; - - html += '
'; - - html += '
'; - - return html; - } - - function getTheaterInfo() { - - var html = ''; - html += '
'; - html += '
'; - html += '

Discover Jellyfin Theater

'; - html += ''; - html += '
'; - - var nameText = 'Jellyfin Theater'; - html += '
'; - html += '

A beautiful app for your TV and large screen tablet. ' + nameText + ' runs on Windows, Xbox One, Raspberry Pi, Samsung Smart TVs, Sony PS4, Web Browsers, and more.

'; - html += '
'; - html += getCard('https://raw.githubusercontent.com/MediaBrowser/Emby.Resources/master/apps/theater1.png'); - html += getCard('https://raw.githubusercontent.com/MediaBrowser/Emby.Resources/master/apps/theater2.png'); - html += getCard('https://raw.githubusercontent.com/MediaBrowser/Emby.Resources/master/apps/theater3.png'); - html += '
'; - html += '
'; - html += '
'; - return html; - } - - function getPremiereInfo() { - - var html = ''; - html += '
'; - html += '
'; - html += '

Discover Emby Premiere

'; - html += ''; - html += '
'; - - html += '
'; - html += '

Enjoy Emby DVR, get free access to Emby apps, and more.

'; - html += '
'; - html += getCard('https://raw.githubusercontent.com/MediaBrowser/Emby.Resources/master/apps/theater1.png'); - html += getCard('https://raw.githubusercontent.com/MediaBrowser/Emby.Resources/master/apps/theater2.png'); - html += getCard('https://raw.githubusercontent.com/MediaBrowser/Emby.Resources/master/apps/theater3.png'); - html += '
'; - html += '
'; - html += '
'; - return html; - } - function getFetchLatestItemsFn(serverId, parentId, collectionType) { return function () { @@ -588,72 +477,6 @@ }); } - function getDownloadsSectionHtml(apiClient, user, userSettings) { - - if (!appHost.supports('sync') || !user.Policy.EnableContentDownloading) { - return Promise.resolve(''); - } - - var promise = apiClient.getLatestOfflineItems ? apiClient.getLatestOfflineItems({ - - Limit: 20, - Filters: 'IsNotFolder' - - }) : Promise.resolve([]); - - return promise.then(function (items) { - - var html = ''; - - html += '
'; - - html += '
'; - - if (!layoutManager.tv) { - - html += ''; - html += '

'; - html += globalize.translate('sharedcomponents#HeaderMyDownloads'); - html += '

'; - html += ''; - html += '
'; - - html += ''; - - } else { - html += '

' + globalize.translate('sharedcomponents#HeaderMyDownloads') + '

'; - } - html += '
'; - - html += '
'; - - var cardLayout = false; - - html += cardBuilder.getCardsHtml({ - items: items, - preferThumb: 'auto', - shape: 'autooverflow', - overlayText: false, - showTitle: true, - showParentTitle: true, - lazy: true, - showDetailsMenu: true, - overlayPlayButton: true, - context: 'home', - centerText: !cardLayout, - allowBottomPadding: false, - cardLayout: cardLayout, - showYear: true, - lines: 2 - }); - - html += '
'; - html += '
'; - - return html; - }); - } - function loadLibraryTiles(elem, apiClient, user, userSettings, shape, userViews, allSections) { elem.classList.remove('verticalSection'); @@ -699,21 +522,14 @@ html += '
'; } - return Promise.all([getAppInfo(apiClient), getDownloadsSectionHtml(apiClient, user, userSettings)]).then(function (responses) { + elem.innerHTML = html; + bindHomeScreenSettingsIcon(elem, apiClient, user.Id, userSettings); - var infoHtml = responses[0]; - var downloadsHtml = responses[1]; + if (infoHtml) { + bindAppInfoEvents(elem); + } - elem.innerHTML = html + downloadsHtml + infoHtml; - - bindHomeScreenSettingsIcon(elem, apiClient, user.Id, userSettings); - - if (infoHtml) { - bindAppInfoEvents(elem); - } - - imageLoader.lazyChildren(elem); - }); + imageLoader.lazyChildren(elem); } function getContinueWatchingFetchFn(serverId) {