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

73 lines
1.9 KiB
JavaScript
Raw Normal View History

2016-06-17 11:35:21 -07:00
define([], function () {
2016-04-03 11:47:49 -07:00
// The base query options
var data = {};
function getQuery(params) {
var key = getSavedQueryKey();
var pageData = data[key];
if (!pageData) {
pageData = data[key] = {
query: {
SortBy: "SortName",
SortOrder: "Ascending",
IncludeItemTypes: "Movie",
Recursive: true,
Fields: "DateCreated,ItemCounts",
2016-06-17 11:35:21 -07:00
StartIndex: 0
2016-04-03 11:47:49 -07:00
}
};
pageData.query.ParentId = params.topParentId;
LibraryBrowser.loadSavedQueryValues(key, pageData.query);
}
return pageData.query;
}
function getSavedQueryKey() {
return LibraryBrowser.getSavedQueryKey('studios');
}
function reloadItems(context, params) {
var query = getQuery(params);
Dashboard.showLoadingMsg();
ApiClient.getStudios(Dashboard.getCurrentUserId(), query).then(function (result) {
var html = '';
html += LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "backdrop",
showTitle: false,
2016-05-10 12:20:17 -07:00
context: 'movies',
2016-04-03 11:47:49 -07:00
preferThumb: true,
showItemCounts: true,
centerText: true,
lazy: true
});
2016-06-17 11:35:21 -07:00
var elem = context.querySelector('#items');
2016-04-03 11:47:49 -07:00
elem.innerHTML = html;
ImageLoader.lazyChildren(elem);
LibraryBrowser.saveQueryValues(getSavedQueryKey(), query);
Dashboard.hideLoadingMsg();
});
2015-08-15 11:17:22 -07:00
}
2016-04-03 11:47:49 -07:00
return function (view, params, tabContent) {
var self = this;
self.renderTab = function () {
reloadItems(tabContent, params);
};
};
});