mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-04 20:36:03 +01:00
Fixed media picker autoscroll
This commit is contained in:
@@ -15,6 +15,9 @@ $(function() {
|
||||
cards.each(function() {
|
||||
$(this).css('width', width);
|
||||
});
|
||||
|
||||
treescroll.update();
|
||||
thumbscroll.update();
|
||||
});
|
||||
|
||||
$(document).on('opened', '.remodal', function() {
|
||||
|
||||
@@ -114,7 +114,7 @@ var filterFiles = function filterFiles() {
|
||||
files_ended = false;
|
||||
$('.empty-space').remove();
|
||||
loadMedia(filters, function(content) {
|
||||
if (!$(content).length) {
|
||||
if (!content.trim().length) {
|
||||
showEmptyState();
|
||||
} else {
|
||||
if (!filters.page && (!filters.date || filters.date === '*') && (!filters.type || filters.type === '*')) {
|
||||
@@ -164,8 +164,15 @@ $('body').on('click', '.js__reset-pages-filter', (event) => {
|
||||
/* handle infinite loading */
|
||||
var enableInfiniteScrolling = function enableInfiniteScrolling() {
|
||||
$('.spinning-wheel').hide();
|
||||
var view = $('.mediapicker-scroll');
|
||||
view.scroll(function() {
|
||||
var view = $('.mediapicker-scroll').last();
|
||||
var gemini = view.data('scrollbar');
|
||||
if (gemini) {
|
||||
gemini = gemini.getViewElement();
|
||||
}
|
||||
|
||||
if (!gemini.length && !view.length) { return; }
|
||||
|
||||
$(gemini || view).on('scroll', function() {
|
||||
if (($(this).scrollTop() + $(this).innerHeight() + 100) >= $(this)[0].scrollHeight) {
|
||||
fillView();
|
||||
}
|
||||
@@ -185,6 +192,8 @@ var loadNextBatch = function loadNextBatch(callback) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
$('.media-container .media-range').trigger('input');
|
||||
});
|
||||
};
|
||||
|
||||
@@ -197,7 +206,8 @@ var fillView = function fillView() {
|
||||
|
||||
return;
|
||||
}
|
||||
if ($('.js__files').find('.card-item').last().offset().top < $('.media-container').height()) {
|
||||
|
||||
if ($('.js__files').find('.card-item').last().offset().top - 1 <= $('.media-container').height()) {
|
||||
loadNextBatch(function() {
|
||||
fillView();
|
||||
});
|
||||
|
||||
6
themes/grav/js/admin.min.js
vendored
6
themes/grav/js/admin.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user