2014-03-18 10:05:57 -07:00
|
|
|
|
(function ($, document) {
|
|
|
|
|
|
|
|
|
|
// The base query options
|
|
|
|
|
var query = {
|
|
|
|
|
|
|
|
|
|
StartIndex: 0
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function reloadItems(page) {
|
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
|
|
|
|
query.UserId = Dashboard.getCurrentUserId();
|
|
|
|
|
|
2014-07-01 22:16:59 -07:00
|
|
|
|
ApiClient.getJSON(ApiClient.getUrl("Channels", query)).done(function (result) {
|
2014-03-18 10:05:57 -07:00
|
|
|
|
|
|
|
|
|
// Scroll back up so they can see the results from the beginning
|
2015-06-28 07:45:21 -07:00
|
|
|
|
window.scrollTo(0, 0);
|
2014-03-18 10:05:57 -07:00
|
|
|
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
|
|
|
|
updateFilterControls(page);
|
|
|
|
|
|
2015-05-12 21:55:19 -07:00
|
|
|
|
var view = 'Thumb';
|
|
|
|
|
|
|
|
|
|
if (view == "Thumb") {
|
|
|
|
|
|
|
|
|
|
html = LibraryBrowser.getPosterViewHtml({
|
|
|
|
|
items: result.Items,
|
|
|
|
|
shape: "backdrop",
|
|
|
|
|
context: 'channels',
|
|
|
|
|
showTitle: true,
|
2015-06-09 21:01:14 -07:00
|
|
|
|
lazy: true,
|
2015-05-12 21:55:19 -07:00
|
|
|
|
centerText: true,
|
|
|
|
|
preferThumb: true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (view == "ThumbCard") {
|
|
|
|
|
|
|
|
|
|
html = LibraryBrowser.getPosterViewHtml({
|
|
|
|
|
items: result.Items,
|
|
|
|
|
shape: "backdrop",
|
|
|
|
|
preferThumb: true,
|
|
|
|
|
context: 'channels',
|
|
|
|
|
lazy: true,
|
|
|
|
|
cardLayout: true,
|
|
|
|
|
showTitle: true
|
|
|
|
|
});
|
|
|
|
|
}
|
2014-03-18 10:05:57 -07:00
|
|
|
|
|
2015-06-28 07:45:21 -07:00
|
|
|
|
var elem = page.querySelector('#items');
|
|
|
|
|
elem.innerHTML = html;
|
|
|
|
|
ImageLoader.lazyChildren(elem);
|
2014-03-18 10:05:57 -07:00
|
|
|
|
|
|
|
|
|
LibraryBrowser.saveQueryValues('channels', query);
|
|
|
|
|
|
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function updateFilterControls(page) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-18 21:23:55 -07:00
|
|
|
|
$(document).on('pagebeforeshowready', "#channelsPage", function () {
|
2014-03-18 10:05:57 -07:00
|
|
|
|
|
|
|
|
|
LibraryBrowser.loadSavedQueryValues('channels', query);
|
|
|
|
|
|
|
|
|
|
reloadItems(this);
|
|
|
|
|
|
|
|
|
|
updateFilterControls(this);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
})(jQuery, document);
|