mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
added an alphabet picker to some screens
This commit is contained in:
parent
a46c0b8a2d
commit
3e88762620
16 changed files with 271 additions and 9 deletions
|
@ -7,11 +7,11 @@
|
|||
getDefaultPageSize: function () {
|
||||
|
||||
var saved = localStorage.getItem('pagesize');
|
||||
|
||||
|
||||
if (saved) {
|
||||
return parseInt(saved);
|
||||
}
|
||||
|
||||
|
||||
if (window.location.toString().toLowerCase().indexOf('localhost') != -1) {
|
||||
return 100;
|
||||
}
|
||||
|
@ -777,7 +777,7 @@
|
|||
if (query.Limit) {
|
||||
localStorage.setItem('pagesize', query.Limit);
|
||||
}
|
||||
|
||||
|
||||
var html = '';
|
||||
|
||||
var pageCount = Math.ceil(totalRecordCount / query.Limit);
|
||||
|
@ -1467,7 +1467,7 @@
|
|||
if (item.BackdropImageTags && item.BackdropImageTags.length) {
|
||||
|
||||
imgUrl = LibraryBrowser.getImageUrl(item, 'Backdrop', 0, {
|
||||
maxwidth: screenWidth
|
||||
maxwidth: screenWidth
|
||||
});
|
||||
|
||||
$('#itemBackdrop', page).removeClass('noBackdrop').css('background-image', 'url("' + imgUrl + '")');
|
||||
|
@ -1608,7 +1608,7 @@
|
|||
|
||||
var screenWidth = Math.max(screen.height, screen.width);
|
||||
screenWidth = Math.min(screenWidth, 1280);
|
||||
|
||||
|
||||
var html = '';
|
||||
|
||||
if (typeof (index) == "undefined") index = 0;
|
||||
|
@ -1726,4 +1726,98 @@
|
|||
}
|
||||
});
|
||||
|
||||
})(window, document, jQuery);
|
||||
|
||||
(function (window, document, $) {
|
||||
|
||||
function getPickerHtml() {
|
||||
|
||||
var html = '';
|
||||
|
||||
html += '<a href="#">#</a>';
|
||||
html += '<a href="#">A</a>';
|
||||
html += '<a href="#">B</a>';
|
||||
html += '<a href="#">C</a>';
|
||||
html += '<a href="#">D</a>';
|
||||
html += '<a href="#">E</a>';
|
||||
html += '<a href="#">F</a>';
|
||||
html += '<a href="#">G</a>';
|
||||
html += '<a href="#">H</a>';
|
||||
html += '<a href="#">I</a>';
|
||||
html += '<a href="#">J</a>';
|
||||
html += '<a href="#">K</a>';
|
||||
html += '<a href="#">L</a>';
|
||||
html += '<a href="#">M</a>';
|
||||
html += '<a href="#">N</a>';
|
||||
html += '<a href="#">O</a>';
|
||||
html += '<a href="#">P</a>';
|
||||
html += '<a href="#">Q</a>';
|
||||
html += '<a href="#">R</a>';
|
||||
html += '<a href="#">S</a>';
|
||||
html += '<a href="#">T</a>';
|
||||
html += '<a href="#">U</a>';
|
||||
html += '<a href="#">V</a>';
|
||||
html += '<a href="#">W</a>';
|
||||
html += '<a href="#">X</a>';
|
||||
html += '<a href="#">Y</a>';
|
||||
html += '<a href="#">Z</a>';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
$(document).on('pageinit', ".libraryPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
var picker = $('.alphabetPicker', page);
|
||||
|
||||
if (!picker.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
$('.itemsContainer', page).addClass('itemsContainerWithAlphaPicker');
|
||||
|
||||
picker.html(getPickerHtml()).trigger('create').on('click', 'a', function () {
|
||||
|
||||
var elem = $(this);
|
||||
|
||||
var isSelected = elem.hasClass('selectedCharacter');
|
||||
|
||||
$('.selectedCharacter', picker).removeClass('selectedCharacter');
|
||||
|
||||
if (!isSelected) {
|
||||
|
||||
elem.addClass('selectedCharacter');
|
||||
picker.trigger('alphaselect', [this.innerHTML]);
|
||||
} else {
|
||||
picker.trigger('alphaclear');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$.fn.alphaValue = function (val) {
|
||||
|
||||
if (val == null) {
|
||||
return $('.selectedCharacter', this).html();
|
||||
}
|
||||
|
||||
val = val.toLowerCase();
|
||||
|
||||
$('.selectedCharacter', this).removeClass('selectedCharacter');
|
||||
|
||||
$('a', this).each(function () {
|
||||
|
||||
if (this.innerHTML.toLowerCase() == val) {
|
||||
|
||||
$(this).addClass('selectedCharacter');
|
||||
|
||||
} else {
|
||||
$(this).removeClass('selectedCharacter');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
})(window, document, jQuery);
|
Loading…
Add table
Add a link
Reference in a new issue