jellyfin-web/dashboard-ui/scripts/homenextup.js
2017-01-27 22:16:59 -05:00

1 line
1.3 KiB
JavaScript

define(["components/categorysyncbuttons","cardBuilder","apphost","imageLoader","emby-itemscontainer"],function(categorysyncbuttons,cardBuilder,appHost,imageLoader){"use strict";function getNextUpPromise(){var query={Limit:24,Fields:"PrimaryImageAspectRatio,SeriesInfo,DateCreated,BasicSyncInfo",UserId:Dashboard.getCurrentUserId(),ImageTypeLimit:1,EnableImageTypes:"Primary,Backdrop,Thumb"};return ApiClient.getNextUpEpisodes(query)}function loadNextUp(page,promise){promise.then(function(result){result.Items.length?page.querySelector(".noNextUpItems").classList.add("hide"):page.querySelector(".noNextUpItems").classList.remove("hide");var html="",supportsImageAnalysis=appHost.supports("imageanalysis");html+=cardBuilder.getCardsHtml({items:result.Items,shape:"backdrop",showTitle:!0,showParentTitle:!0,overlayText:!1,lazy:!0,preferThumb:!0,showDetailsMenu:!0,centerText:!supportsImageAnalysis,overlayPlayButton:!0,context:"home-nextup",cardLayout:supportsImageAnalysis,vibrant:supportsImageAnalysis});var elem=page.querySelector("#nextUpItems");elem.innerHTML=html,imageLoader.lazyChildren(elem),Dashboard.hideLoadingMsg()})}return function(view,params,tabContent){var nextUpPromise,self=this;categorysyncbuttons.init(view),self.preRender=function(){nextUpPromise=getNextUpPromise()},self.renderTab=function(){Dashboard.showLoadingMsg(),loadNextUp(view,nextUpPromise)}}});