2013-04-11 15:33:49 -07:00
|
|
|
|
(function ($, document) {
|
|
|
|
|
|
|
|
|
|
// The base query options
|
|
|
|
|
var query = {
|
|
|
|
|
|
|
|
|
|
SortBy: "SortName",
|
|
|
|
|
SortOrder: "Ascending",
|
|
|
|
|
IncludeItemTypes: "Series",
|
|
|
|
|
Recursive: true,
|
|
|
|
|
Fields: "PrimaryImageAspectRatio,ItemCounts,DateCreated,UserData",
|
|
|
|
|
Limit: LibraryBrowser.getDetaultPageSize(),
|
|
|
|
|
StartIndex: 0
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function reloadItems(page) {
|
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
|
|
|
|
ApiClient.getStudios(Dashboard.getCurrentUserId(), query).done(function (result) {
|
|
|
|
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
|
|
|
|
var showPaging = result.TotalRecordCount > query.Limit;
|
|
|
|
|
|
|
|
|
|
if (showPaging) {
|
|
|
|
|
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html += LibraryBrowser.getPosterDetailViewHtml({
|
|
|
|
|
items: result.Items,
|
|
|
|
|
useAverageAspectRatio: true,
|
|
|
|
|
countNameSingular: "Show",
|
|
|
|
|
countNamePlural: "Shows"
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (showPaging) {
|
|
|
|
|
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var elem = $('#items', page).html(html).trigger('create');
|
|
|
|
|
|
|
|
|
|
$('select', elem).on('change', function () {
|
|
|
|
|
query.StartIndex = (parseInt(this.value) - 1) * query.Limit;
|
|
|
|
|
reloadItems(page);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$(document).on('pagebeforeshow', "#tvStudiosPage", function () {
|
|
|
|
|
|
|
|
|
|
reloadItems(this);
|
|
|
|
|
|
|
|
|
|
}).on('pageshow', "#tvStudiosPage", function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
})(jQuery, document);
|