2013-04-01 17:54:06 -07:00
|
|
|
|
(function ($, document) {
|
|
|
|
|
|
2015-07-06 09:40:55 -07:00
|
|
|
|
var data = {};
|
|
|
|
|
|
2015-08-15 11:46:57 -07:00
|
|
|
|
function getPageData() {
|
2015-07-06 09:40:55 -07:00
|
|
|
|
var key = getSavedQueryKey();
|
|
|
|
|
var pageData = data[key];
|
|
|
|
|
|
|
|
|
|
if (!pageData) {
|
|
|
|
|
pageData = data[key] = {
|
|
|
|
|
query: {
|
|
|
|
|
SortBy: "SortName",
|
|
|
|
|
SortOrder: "Ascending",
|
|
|
|
|
IncludeItemTypes: "Movie",
|
|
|
|
|
Recursive: true,
|
|
|
|
|
Fields: "PrimaryImageAspectRatio,SortName,MediaSourceCount,IsUnidentified,SyncInfo",
|
|
|
|
|
ImageTypeLimit: 1,
|
|
|
|
|
EnableImageTypes: "Primary,Backdrop,Banner,Thumb",
|
|
|
|
|
StartIndex: 0,
|
|
|
|
|
Limit: LibraryBrowser.getDefaultPageSize()
|
2015-08-15 11:46:57 -07:00
|
|
|
|
},
|
|
|
|
|
view: LibraryBrowser.getSavedView(key) || LibraryBrowser.getDefaultItemsView('Poster', 'Poster')
|
2015-07-06 09:40:55 -07:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
pageData.query.ParentId = LibraryMenu.getTopParentId();
|
|
|
|
|
LibraryBrowser.loadSavedQueryValues(key, pageData.query);
|
|
|
|
|
}
|
2015-08-15 11:46:57 -07:00
|
|
|
|
return pageData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getQuery() {
|
|
|
|
|
|
|
|
|
|
return getPageData().query;
|
2015-07-06 09:40:55 -07:00
|
|
|
|
}
|
2013-04-01 20:28:20 -07:00
|
|
|
|
|
2014-05-01 19:54:33 -07:00
|
|
|
|
function getSavedQueryKey() {
|
|
|
|
|
|
2015-07-06 09:40:55 -07:00
|
|
|
|
return getWindowUrl();
|
2014-05-01 19:54:33 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
function reloadItems(page, viewPanel) {
|
2013-04-01 20:28:20 -07:00
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
2013-04-10 22:27:27 -07:00
|
|
|
|
|
2014-11-09 21:20:11 -07:00
|
|
|
|
var userId = Dashboard.getCurrentUserId();
|
|
|
|
|
|
2015-07-06 09:40:55 -07:00
|
|
|
|
var query = getQuery();
|
2015-08-15 11:46:57 -07:00
|
|
|
|
var view = getPageData().view;
|
2015-07-06 09:40:55 -07:00
|
|
|
|
|
2014-11-09 21:20:11 -07:00
|
|
|
|
ApiClient.getItems(userId, query).done(function (result) {
|
2013-04-01 17:54:06 -07:00
|
|
|
|
|
2013-05-17 12:18:54 -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);
|
2013-05-17 12:18:54 -07:00
|
|
|
|
|
2013-04-08 14:05:00 -07:00
|
|
|
|
var html = '';
|
|
|
|
|
|
2015-01-28 12:30:45 -07:00
|
|
|
|
var pagingHtml = LibraryBrowser.getQueryPagingHtml({
|
2014-07-19 21:46:29 -07:00
|
|
|
|
startIndex: query.StartIndex,
|
|
|
|
|
limit: query.Limit,
|
|
|
|
|
totalRecordCount: result.TotalRecordCount,
|
|
|
|
|
viewButton: true,
|
|
|
|
|
showLimit: false,
|
2015-08-15 11:17:22 -07:00
|
|
|
|
addSelectionButton: true,
|
|
|
|
|
viewPanelClass: 'movieViewPanel'
|
2015-01-28 12:30:45 -07:00
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2015-06-28 07:45:21 -07:00
|
|
|
|
page.querySelector('.listTopPaging').innerHTML = pagingHtml;
|
2013-04-08 14:05:00 -07:00
|
|
|
|
|
2013-10-18 09:09:47 -07:00
|
|
|
|
updateFilterControls(page);
|
2015-01-22 23:15:15 -07:00
|
|
|
|
var trigger = false;
|
2013-10-18 09:09:47 -07:00
|
|
|
|
|
2013-12-22 10:16:24 -07:00
|
|
|
|
if (view == "Thumb") {
|
|
|
|
|
html = LibraryBrowser.getPosterViewHtml({
|
2013-04-10 22:27:27 -07:00
|
|
|
|
items: result.Items,
|
2013-12-22 10:16:24 -07:00
|
|
|
|
shape: "backdrop",
|
|
|
|
|
preferThumb: true,
|
2014-08-01 19:34:45 -07:00
|
|
|
|
lazy: true,
|
2015-05-14 19:16:57 -07:00
|
|
|
|
showDetailsMenu: true
|
2013-04-10 22:27:27 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
2014-11-10 20:41:19 -07:00
|
|
|
|
else if (view == "ThumbCard") {
|
|
|
|
|
|
|
|
|
|
html = LibraryBrowser.getPosterViewHtml({
|
|
|
|
|
items: result.Items,
|
|
|
|
|
shape: "backdrop",
|
|
|
|
|
preferThumb: true,
|
|
|
|
|
lazy: true,
|
|
|
|
|
showTitle: true,
|
|
|
|
|
cardLayout: true,
|
2015-05-14 19:16:57 -07:00
|
|
|
|
showYear: true,
|
|
|
|
|
showDetailsMenu: true
|
2014-11-10 20:41:19 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
2014-04-02 14:55:19 -07:00
|
|
|
|
else if (view == "Banner") {
|
|
|
|
|
|
|
|
|
|
html = LibraryBrowser.getPosterViewHtml({
|
|
|
|
|
items: result.Items,
|
|
|
|
|
shape: "banner",
|
|
|
|
|
preferBanner: true,
|
2015-05-14 19:16:57 -07:00
|
|
|
|
lazy: true,
|
|
|
|
|
showDetailsMenu: true
|
2014-04-02 14:55:19 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
2014-07-05 09:51:39 -07:00
|
|
|
|
else if (view == "List") {
|
|
|
|
|
|
|
|
|
|
html = LibraryBrowser.getListViewHtml({
|
|
|
|
|
items: result.Items,
|
2014-07-05 12:57:18 -07:00
|
|
|
|
sortBy: query.SortBy
|
2014-07-05 09:51:39 -07:00
|
|
|
|
});
|
2015-01-22 23:15:15 -07:00
|
|
|
|
trigger = true;
|
2014-07-05 09:51:39 -07:00
|
|
|
|
}
|
2013-04-10 22:27:27 -07:00
|
|
|
|
else if (view == "Poster") {
|
2013-12-22 10:16:24 -07:00
|
|
|
|
html = LibraryBrowser.getPosterViewHtml({
|
2013-04-04 21:15:00 -07:00
|
|
|
|
items: result.Items,
|
2013-12-22 10:16:24 -07:00
|
|
|
|
shape: "portrait",
|
2014-03-17 18:45:41 -07:00
|
|
|
|
centerText: true,
|
2014-08-01 19:34:45 -07:00
|
|
|
|
lazy: true,
|
2015-05-14 19:16:57 -07:00
|
|
|
|
showDetailsMenu: true
|
2013-04-08 14:05:00 -07:00
|
|
|
|
});
|
2013-05-15 05:05:07 -07:00
|
|
|
|
}
|
2014-11-11 21:51:40 -07:00
|
|
|
|
else if (view == "PosterCard") {
|
|
|
|
|
html = LibraryBrowser.getPosterViewHtml({
|
|
|
|
|
items: result.Items,
|
|
|
|
|
shape: "portrait",
|
|
|
|
|
showTitle: true,
|
|
|
|
|
showYear: true,
|
|
|
|
|
lazy: true,
|
2015-05-14 19:16:57 -07:00
|
|
|
|
cardLayout: true,
|
|
|
|
|
showDetailsMenu: true
|
2014-11-11 21:51:40 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
2013-05-15 05:05:07 -07:00
|
|
|
|
else if (view == "Timeline") {
|
2014-01-02 14:21:06 -07:00
|
|
|
|
html = LibraryBrowser.getPosterViewHtml({
|
2013-05-15 05:05:07 -07:00
|
|
|
|
items: result.Items,
|
2014-01-02 14:21:06 -07:00
|
|
|
|
shape: "portrait",
|
|
|
|
|
showTitle: true,
|
2014-01-13 09:48:37 -07:00
|
|
|
|
timeline: true,
|
2014-03-17 18:45:41 -07:00
|
|
|
|
centerText: true,
|
2015-05-14 19:16:57 -07:00
|
|
|
|
lazy: true,
|
|
|
|
|
showDetailsMenu: true
|
2013-05-15 05:05:07 -07:00
|
|
|
|
});
|
2013-04-04 21:15:00 -07:00
|
|
|
|
}
|
2013-04-08 14:05:00 -07:00
|
|
|
|
|
2015-06-28 07:45:21 -07:00
|
|
|
|
var elem = page.querySelector('.itemsContainer');
|
|
|
|
|
elem.innerHTML = html + pagingHtml;
|
|
|
|
|
ImageLoader.lazyChildren(elem);
|
2013-04-01 20:28:20 -07:00
|
|
|
|
|
2015-01-22 23:15:15 -07:00
|
|
|
|
if (trigger) {
|
2015-06-28 07:45:21 -07:00
|
|
|
|
Events.trigger(elem, 'create');
|
2015-01-22 23:15:15 -07:00
|
|
|
|
}
|
2013-04-08 14:05:00 -07:00
|
|
|
|
|
2013-04-18 22:08:18 -07:00
|
|
|
|
$('.btnNextPage', page).on('click', function () {
|
2013-04-15 15:03:05 -07:00
|
|
|
|
query.StartIndex += query.Limit;
|
2015-08-15 11:17:22 -07:00
|
|
|
|
reloadItems(page, viewPanel);
|
2013-04-15 15:03:05 -07:00
|
|
|
|
});
|
|
|
|
|
|
2013-04-18 22:08:18 -07:00
|
|
|
|
$('.btnPreviousPage', page).on('click', function () {
|
2013-04-15 15:03:05 -07:00
|
|
|
|
query.StartIndex -= query.Limit;
|
2015-08-15 11:17:22 -07:00
|
|
|
|
reloadItems(page, viewPanel);
|
2013-04-15 15:03:05 -07:00
|
|
|
|
});
|
2013-04-08 14:05:00 -07:00
|
|
|
|
|
2014-05-01 19:54:33 -07:00
|
|
|
|
LibraryBrowser.saveQueryValues(getSavedQueryKey(), query);
|
2013-10-18 09:09:47 -07:00
|
|
|
|
|
2015-07-06 09:40:55 -07:00
|
|
|
|
LibraryBrowser.setLastRefreshed(page);
|
2015-08-15 11:17:22 -07:00
|
|
|
|
|
2013-04-01 20:28:20 -07:00
|
|
|
|
Dashboard.hideLoadingMsg();
|
2013-04-01 17:54:06 -07:00
|
|
|
|
});
|
2015-08-15 11:17:22 -07:00
|
|
|
|
|
|
|
|
|
Dashboard.getCurrentUser().done(function (user) {
|
|
|
|
|
if (user.Policy.IsAdministrator) {
|
|
|
|
|
$('.btnMergeVersions', page).show();
|
|
|
|
|
} else {
|
|
|
|
|
$('.btnMergeVersions', page).hide();
|
|
|
|
|
}
|
|
|
|
|
});
|
2013-04-01 20:28:20 -07:00
|
|
|
|
}
|
2013-04-01 17:54:06 -07:00
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
function updateFilterControls(tabContent, viewPanel) {
|
2013-10-18 09:09:47 -07:00
|
|
|
|
|
2015-07-06 09:40:55 -07:00
|
|
|
|
var query = getQuery();
|
2013-10-18 09:09:47 -07:00
|
|
|
|
// Reset form values using the last used query
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.radioSortBy', viewPanel).each(function () {
|
2013-10-18 09:09:47 -07:00
|
|
|
|
|
|
|
|
|
this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase();
|
|
|
|
|
|
|
|
|
|
}).checkboxradio('refresh');
|
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.radioSortOrder', viewPanel).each(function () {
|
2013-10-18 09:09:47 -07:00
|
|
|
|
|
|
|
|
|
this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase();
|
|
|
|
|
|
|
|
|
|
}).checkboxradio('refresh');
|
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.chkStandardFilter', viewPanel).each(function () {
|
2013-10-18 09:09:47 -07:00
|
|
|
|
|
|
|
|
|
var filters = "," + (query.Filters || "");
|
|
|
|
|
var filterName = this.getAttribute('data-filter');
|
|
|
|
|
|
|
|
|
|
this.checked = filters.indexOf(',' + filterName) != -1;
|
|
|
|
|
|
|
|
|
|
}).checkboxradio('refresh');
|
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.chkVideoTypeFilter', viewPanel).each(function () {
|
2013-10-18 09:09:47 -07:00
|
|
|
|
|
|
|
|
|
var filters = "," + (query.VideoTypes || "");
|
|
|
|
|
var filterName = this.getAttribute('data-filter');
|
|
|
|
|
|
|
|
|
|
this.checked = filters.indexOf(',' + filterName) != -1;
|
|
|
|
|
|
|
|
|
|
}).checkboxradio('refresh');
|
|
|
|
|
|
2015-08-15 11:46:57 -07:00
|
|
|
|
$('select.selectView', viewPanel).val(getPageData().view).selectmenu('refresh');
|
2013-10-18 09:09:47 -07:00
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.chk3D', viewPanel).checked(query.Is3D == true).checkboxradio('refresh');
|
|
|
|
|
$('.chkHD', viewPanel).checked(query.IsHD == true).checkboxradio('refresh');
|
|
|
|
|
$('.chkSD', viewPanel).checked(query.IsHD == false).checkboxradio('refresh');
|
2013-10-18 09:09:47 -07:00
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.chkSubtitle', viewPanel).checked(query.HasSubtitles == true).checkboxradio('refresh');
|
|
|
|
|
$('.chkTrailer', viewPanel).checked(query.HasTrailer == true).checkboxradio('refresh');
|
|
|
|
|
$('.chkSpecialFeature', viewPanel).checked(query.HasSpecialFeature == true).checkboxradio('refresh');
|
|
|
|
|
$('.chkThemeSong', viewPanel).checked(query.HasThemeSong == true).checkboxradio('refresh');
|
|
|
|
|
$('.chkThemeVideo', viewPanel).checked(query.HasThemeVideo == true).checkboxradio('refresh');
|
2013-10-18 09:09:47 -07:00
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.alphabetPicker', tabContent).alphaValue(query.NameStartsWithOrGreater);
|
|
|
|
|
$('select.selectPageSize', viewPanel).val(query.Limit).selectmenu('refresh');
|
2013-10-18 09:09:47 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-11-09 21:20:11 -07:00
|
|
|
|
var filtersLoaded;
|
2015-08-15 11:17:22 -07:00
|
|
|
|
function reloadFiltersIfNeeded(tabContent, viewPanel) {
|
2014-11-09 21:20:11 -07:00
|
|
|
|
|
|
|
|
|
if (!filtersLoaded) {
|
|
|
|
|
|
|
|
|
|
filtersLoaded = true;
|
|
|
|
|
|
2015-07-06 09:40:55 -07:00
|
|
|
|
var query = getQuery();
|
2015-08-15 11:17:22 -07:00
|
|
|
|
QueryFilters.loadFilters(viewPanel, Dashboard.getCurrentUserId(), query, function () {
|
2014-11-09 21:20:11 -07:00
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
reloadItems(tabContent, viewPanel);
|
2014-11-09 21:20:11 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-15 11:30:52 -07:00
|
|
|
|
function initPage(tabContent, viewPanel) {
|
2014-11-09 21:20:11 -07:00
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$(viewPanel).on('panelopen', function () {
|
|
|
|
|
|
|
|
|
|
reloadFiltersIfNeeded(tabContent, viewPanel);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('.radioSortBy', viewPanel).on('click', function () {
|
2015-07-06 09:40:55 -07:00
|
|
|
|
var query = getQuery();
|
2013-04-08 14:05:00 -07:00
|
|
|
|
query.StartIndex = 0;
|
2013-04-01 20:28:20 -07:00
|
|
|
|
query.SortBy = this.getAttribute('data-sortby');
|
2015-08-15 11:17:22 -07:00
|
|
|
|
reloadItems(tabContent, viewPanel);
|
2013-04-01 20:28:20 -07:00
|
|
|
|
});
|
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.radioSortOrder', viewPanel).on('click', function () {
|
2015-07-06 09:40:55 -07:00
|
|
|
|
var query = getQuery();
|
2013-04-08 14:05:00 -07:00
|
|
|
|
query.StartIndex = 0;
|
2013-04-01 20:28:20 -07:00
|
|
|
|
query.SortOrder = this.getAttribute('data-sortorder');
|
2015-08-15 11:17:22 -07:00
|
|
|
|
reloadItems(tabContent, viewPanel);
|
2013-04-01 20:28:20 -07:00
|
|
|
|
});
|
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.chkStandardFilter', viewPanel).on('change', function () {
|
2013-04-01 20:28:20 -07:00
|
|
|
|
|
2015-07-06 09:40:55 -07:00
|
|
|
|
var query = getQuery();
|
2013-04-01 20:28:20 -07:00
|
|
|
|
var filterName = this.getAttribute('data-filter');
|
|
|
|
|
var filters = query.Filters || "";
|
|
|
|
|
|
|
|
|
|
filters = (',' + filters).replace(',' + filterName, '').substring(1);
|
|
|
|
|
|
|
|
|
|
if (this.checked) {
|
|
|
|
|
filters = filters ? (filters + ',' + filterName) : filterName;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-08 14:05:00 -07:00
|
|
|
|
query.StartIndex = 0;
|
2013-04-01 20:28:20 -07:00
|
|
|
|
query.Filters = filters;
|
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
reloadItems(tabContent, viewPanel);
|
2013-04-01 20:28:20 -07:00
|
|
|
|
});
|
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('select.selectView', viewPanel).on('change', function () {
|
2013-04-04 21:15:00 -07:00
|
|
|
|
|
2015-08-15 11:46:57 -07:00
|
|
|
|
var newView = this.value;
|
|
|
|
|
getPageData().view = newView;
|
2013-04-04 21:15:00 -07:00
|
|
|
|
|
2015-07-06 09:40:55 -07:00
|
|
|
|
var query = getQuery();
|
2015-08-15 11:46:57 -07:00
|
|
|
|
if (newView == "Timeline") {
|
2013-05-15 05:05:07 -07:00
|
|
|
|
|
|
|
|
|
query.SortBy = "PremiereDate";
|
2014-01-02 14:21:06 -07:00
|
|
|
|
query.SortOrder = "Descending";
|
2013-05-15 05:05:07 -07:00
|
|
|
|
query.StartIndex = 0;
|
2015-08-15 11:30:52 -07:00
|
|
|
|
$('.radioPremiereDate', viewPanel)[0].click();
|
2013-05-15 05:05:07 -07:00
|
|
|
|
|
|
|
|
|
} else {
|
2015-08-15 11:17:22 -07:00
|
|
|
|
reloadItems(tabContent, viewPanel);
|
2013-05-15 05:05:07 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-08-15 11:46:57 -07:00
|
|
|
|
LibraryBrowser.saveViewSetting(getSavedQueryKey(), newView);
|
2013-04-04 21:15:00 -07:00
|
|
|
|
});
|
2013-04-04 08:38:41 -07:00
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.chkVideoTypeFilter', viewPanel).on('change', function () {
|
2014-03-02 13:44:48 -07:00
|
|
|
|
|
2015-07-06 09:40:55 -07:00
|
|
|
|
var query = getQuery();
|
2014-03-02 13:44:48 -07:00
|
|
|
|
var filterName = this.getAttribute('data-filter');
|
|
|
|
|
var filters = query.VideoTypes || "";
|
|
|
|
|
|
|
|
|
|
filters = (',' + filters).replace(',' + filterName, '').substring(1);
|
|
|
|
|
|
|
|
|
|
if (this.checked) {
|
|
|
|
|
filters = filters ? (filters + ',' + filterName) : filterName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
query.StartIndex = 0;
|
|
|
|
|
query.VideoTypes = filters;
|
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
reloadItems(tabContent, viewPanel);
|
2014-03-02 13:44:48 -07:00
|
|
|
|
});
|
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.chk3D', viewPanel).on('change', function () {
|
2013-04-07 06:34:46 -07:00
|
|
|
|
|
2015-07-06 09:40:55 -07:00
|
|
|
|
var query = getQuery();
|
2013-04-08 14:05:00 -07:00
|
|
|
|
query.StartIndex = 0;
|
2013-07-11 06:56:09 -07:00
|
|
|
|
query.Is3D = this.checked ? true : null;
|
2013-04-07 06:34:46 -07:00
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
reloadItems(tabContent, viewPanel);
|
2013-04-07 06:34:46 -07:00
|
|
|
|
});
|
2013-05-15 05:05:07 -07:00
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.chkHD', viewPanel).on('change', function () {
|
2013-10-26 15:01:21 -07:00
|
|
|
|
|
2015-07-06 09:40:55 -07:00
|
|
|
|
var query = getQuery();
|
2013-10-26 15:01:21 -07:00
|
|
|
|
query.StartIndex = 0;
|
|
|
|
|
query.IsHD = this.checked ? true : null;
|
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
reloadItems(tabContent, viewPanel);
|
2013-10-26 15:01:21 -07:00
|
|
|
|
});
|
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.chkSD', viewPanel).on('change', function () {
|
2013-10-26 15:01:21 -07:00
|
|
|
|
|
2015-07-06 09:40:55 -07:00
|
|
|
|
var query = getQuery();
|
2013-10-26 15:01:21 -07:00
|
|
|
|
query.StartIndex = 0;
|
|
|
|
|
query.IsHD = this.checked ? false : null;
|
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
reloadItems(tabContent, viewPanel);
|
2013-10-26 15:01:21 -07:00
|
|
|
|
});
|
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.chkSubtitle', viewPanel).on('change', function () {
|
2013-04-29 18:29:04 -07:00
|
|
|
|
|
2015-07-06 09:40:55 -07:00
|
|
|
|
var query = getQuery();
|
2013-04-29 18:29:04 -07:00
|
|
|
|
query.StartIndex = 0;
|
|
|
|
|
query.HasSubtitles = this.checked ? true : null;
|
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
reloadItems(tabContent, viewPanel);
|
2013-04-29 18:29:04 -07:00
|
|
|
|
});
|
2013-05-15 05:05:07 -07:00
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.chkTrailer', viewPanel).on('change', function () {
|
2013-04-29 18:29:04 -07:00
|
|
|
|
|
2015-07-06 09:40:55 -07:00
|
|
|
|
var query = getQuery();
|
2013-04-29 18:29:04 -07:00
|
|
|
|
query.StartIndex = 0;
|
|
|
|
|
query.HasTrailer = this.checked ? true : null;
|
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
reloadItems(tabContent, viewPanel);
|
2013-04-29 18:29:04 -07:00
|
|
|
|
});
|
2013-05-15 05:05:07 -07:00
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.chkSpecialFeature', viewPanel).on('change', function () {
|
2013-04-29 18:29:04 -07:00
|
|
|
|
|
2015-07-06 09:40:55 -07:00
|
|
|
|
var query = getQuery();
|
2013-04-29 18:29:04 -07:00
|
|
|
|
query.StartIndex = 0;
|
|
|
|
|
query.HasSpecialFeature = this.checked ? true : null;
|
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
reloadItems(tabContent, viewPanel);
|
2013-04-29 18:29:04 -07:00
|
|
|
|
});
|
2013-05-15 05:05:07 -07:00
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.chkThemeSong', viewPanel).on('change', function () {
|
2013-04-29 18:29:04 -07:00
|
|
|
|
|
2015-07-06 09:40:55 -07:00
|
|
|
|
var query = getQuery();
|
2013-04-29 18:29:04 -07:00
|
|
|
|
query.StartIndex = 0;
|
|
|
|
|
query.HasThemeSong = this.checked ? true : null;
|
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
reloadItems(tabContent, viewPanel);
|
2013-04-29 18:29:04 -07:00
|
|
|
|
});
|
2013-05-15 05:05:07 -07:00
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.chkThemeVideo', viewPanel).on('change', function () {
|
2013-04-29 18:29:04 -07:00
|
|
|
|
|
2015-07-06 09:40:55 -07:00
|
|
|
|
var query = getQuery();
|
2013-04-29 18:29:04 -07:00
|
|
|
|
query.StartIndex = 0;
|
|
|
|
|
query.HasThemeVideo = this.checked ? true : null;
|
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
reloadItems(tabContent, viewPanel);
|
2013-04-29 18:29:04 -07:00
|
|
|
|
});
|
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.alphabetPicker', tabContent).on('alphaselect', function (e, character) {
|
2013-05-16 12:00:42 -07:00
|
|
|
|
|
2015-07-06 09:40:55 -07:00
|
|
|
|
var query = getQuery();
|
2013-05-16 20:24:41 -07:00
|
|
|
|
query.NameStartsWithOrGreater = character;
|
2013-05-17 11:05:49 -07:00
|
|
|
|
query.StartIndex = 0;
|
2013-05-16 12:00:42 -07:00
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
reloadItems(tabContent, viewPanel);
|
2013-10-18 09:09:47 -07:00
|
|
|
|
|
2013-05-16 12:00:42 -07:00
|
|
|
|
}).on('alphaclear', function (e) {
|
|
|
|
|
|
2015-07-06 09:40:55 -07:00
|
|
|
|
var query = getQuery();
|
2013-05-16 20:24:41 -07:00
|
|
|
|
query.NameStartsWithOrGreater = '';
|
2013-05-16 12:00:42 -07:00
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
reloadItems(tabContent, viewPanel);
|
2013-05-16 12:00:42 -07:00
|
|
|
|
});
|
2013-04-07 06:34:46 -07:00
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.radioBasicFilters', viewPanel).on('change', function () {
|
2013-12-01 19:24:14 -07:00
|
|
|
|
|
|
|
|
|
if (this.checked) {
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.basicFilters', viewPanel).show();
|
|
|
|
|
$('.advancedFilters', viewPanel).hide();
|
2013-12-01 19:24:14 -07:00
|
|
|
|
} else {
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.basicFilters', viewPanel).hide();
|
2013-12-01 19:24:14 -07:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.radioAdvancedFilters', viewPanel).on('change', function () {
|
2013-12-01 19:24:14 -07:00
|
|
|
|
|
|
|
|
|
if (this.checked) {
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.advancedFilters', viewPanel).show();
|
|
|
|
|
$('.basicFilters', viewPanel).hide();
|
2013-12-01 19:24:14 -07:00
|
|
|
|
} else {
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.advancedFilters', viewPanel).hide();
|
2013-12-01 19:24:14 -07:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('.itemsContainer', tabContent).on('needsrefresh', function () {
|
2014-03-18 18:35:40 -07:00
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
reloadItems(tabContent, viewPanel);
|
2014-03-18 18:35:40 -07:00
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
$('select.selectPageSize', viewPanel).on('change', function () {
|
2015-07-06 09:40:55 -07:00
|
|
|
|
var query = getQuery();
|
2014-07-19 21:46:29 -07:00
|
|
|
|
query.Limit = parseInt(this.value);
|
|
|
|
|
query.StartIndex = 0;
|
2015-08-15 11:17:22 -07:00
|
|
|
|
reloadItems(tabContent, viewPanel);
|
2014-07-19 21:46:29 -07:00
|
|
|
|
});
|
2015-08-15 11:30:52 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-08-18 09:11:56 -07:00
|
|
|
|
window.MoviesPage.initMoviesTab = function (page, tabContent) {
|
2015-08-15 11:30:52 -07:00
|
|
|
|
|
2015-08-18 09:11:56 -07:00
|
|
|
|
var viewPanel = page.querySelector('.movieViewPanel');
|
|
|
|
|
initPage(tabContent, viewPanel);
|
|
|
|
|
};
|
2015-08-15 11:30:52 -07:00
|
|
|
|
|
2015-08-18 09:11:56 -07:00
|
|
|
|
window.MoviesPage.renderMoviesTab = function (page, tabContent) {
|
2015-08-15 11:30:52 -07:00
|
|
|
|
|
2015-08-18 09:11:56 -07:00
|
|
|
|
if (LibraryBrowser.needsRefresh(tabContent)) {
|
|
|
|
|
var viewPanel = page.querySelector('.movieViewPanel');
|
|
|
|
|
reloadItems(tabContent, viewPanel);
|
|
|
|
|
updateFilterControls(tabContent, viewPanel);
|
|
|
|
|
}
|
|
|
|
|
};
|
2013-04-01 17:54:06 -07:00
|
|
|
|
|
2015-08-15 11:17:22 -07:00
|
|
|
|
})(jQuery, document);
|