1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

add channels infrastructure

This commit is contained in:
Luke Pulverenti 2014-05-03 00:20:04 -04:00
parent 5218e67d4e
commit be0861a1ee
18 changed files with 453 additions and 224 deletions

View file

@ -3,6 +3,8 @@
// The base query options
var query = {
SortBy: "SortName",
SortOrder: "Ascending",
StartIndex: 0
};
@ -10,9 +12,18 @@
return 'channels-' + getParameterByName('id');
}
function showLoadingMessage(page) {
$('#popupDialog', page).popup('open');
}
function hideLoadingMessage(page) {
$('#popupDialog', page).popup('close');
}
function reloadItems(page) {
Dashboard.showLoadingMsg();
showLoadingMessage(page);
var channelId = getParameterByName('id');
@ -57,16 +68,90 @@
LibraryBrowser.saveQueryValues(getSavedQueryId(), query);
Dashboard.hideLoadingMsg();
hideLoadingMessage(page);
});
}
function updateFilterControls(page) {
// Reset form values using the last used query
$('.radioSortBy', page).each(function () {
this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase();
}).checkboxradio('refresh');
$('.radioSortOrder', page).each(function () {
this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase();
}).checkboxradio('refresh');
$('.chkStandardFilter', page).each(function () {
var filters = "," + (query.Filters || "");
var filterName = this.getAttribute('data-filter');
this.checked = filters.indexOf(',' + filterName) != -1;
}).checkboxradio('refresh');
$('.alphabetPicker', page).alphaValue(query.NameStartsWith);
}
$(document).on('pagebeforeshow', "#channelItemsPage", function () {
$(document).on('pageinit', "#channelItemsPage", function () {
var page = this;
$('.radioSortBy', this).on('click', function () {
query.StartIndex = 0;
query.SortBy = this.getAttribute('data-sortby');
reloadItems(page);
});
$('.radioSortOrder', this).on('click', function () {
query.StartIndex = 0;
query.SortOrder = this.getAttribute('data-sortorder');
reloadItems(page);
});
$('.chkStandardFilter', this).on('change', function () {
var filterName = this.getAttribute('data-filter');
var filters = query.Filters || "";
filters = (',' + filters).replace(',' + filterName, '').substring(1);
if (this.checked) {
filters = filters ? (filters + ',' + filterName) : filterName;
}
query.StartIndex = 0;
query.Filters = filters;
reloadItems(page);
});
$('.alphabetPicker', this).on('alphaselect', function (e, character) {
query.NameStartsWithOrGreater = character;
query.StartIndex = 0;
reloadItems(page);
}).on('alphaclear', function (e) {
query.NameStartsWithOrGreater = '';
reloadItems(page);
});
}).on('pagebeforeshow', "#channelItemsPage", function () {
}).on('pageshow', "#channelItemsPage", function () {
var page = this;
var limit = LibraryBrowser.getDefaultPageSize();
// If the default page size has changed, the start index will have to be reset
@ -77,11 +162,9 @@
LibraryBrowser.loadSavedQueryValues(getSavedQueryId(), query);
reloadItems(this);
reloadItems(page);
}).on('pageshow', "#channelItemsPage", function () {
updateFilterControls(this);
updateFilterControls(page);
});
})(jQuery, document);