jellyfin-web/dashboard-ui/scripts/moviestudios.js
2017-03-25 17:32:04 -04:00

1 line
1.1 KiB
JavaScript

define(["libraryBrowser","cardBuilder","loading"],function(libraryBrowser,cardBuilder,loading){"use strict";function getQuery(params){var key=getSavedQueryKey(),pageData=data[key];return pageData||(pageData=data[key]={query:{SortBy:"SortName",SortOrder:"Ascending",Recursive:!0,Fields:"DateCreated,PrimaryImageAspectRatio",StartIndex:0}},pageData.query.ParentId=params.topParentId),pageData.query}function getSavedQueryKey(){return libraryBrowser.getSavedQueryKey("studios")}function getPromise(context,params){var query=getQuery(params);return loading.show(),ApiClient.getStudios(Dashboard.getCurrentUserId(),query)}function reloadItems(context,params,promise){promise.then(function(result){var elem=context.querySelector("#items");cardBuilder.buildCards(result.Items,{itemsContainer:elem,shape:"backdrop",preferThumb:!0,showTitle:!0,scalable:!0,centerText:!0,overlayMoreButton:!0}),loading.hide()})}var data={};return function(view,params,tabContent){var promise,self=this;self.preRender=function(){promise=getPromise(view,params)},self.renderTab=function(){reloadItems(tabContent,params,promise)}}});