2018-05-20 03:12:42 +00:00
|
|
|
$(document).ready(function() {
|
|
|
|
$('.pagination').hide();
|
2018-08-10 04:01:35 +00:00
|
|
|
$('.container.timeline-container').removeClass('d-none');
|
2018-05-20 03:12:42 +00:00
|
|
|
let elem = document.querySelector('.timeline-feed');
|
2018-08-10 04:01:35 +00:00
|
|
|
pixelfed.fetchLikes();
|
|
|
|
|
2018-05-20 03:12:42 +00:00
|
|
|
let infScroll = new InfiniteScroll( elem, {
|
|
|
|
path: '.pagination__next',
|
|
|
|
append: '.timeline-feed',
|
2018-06-05 06:38:48 +00:00
|
|
|
status: '.page-load-status',
|
2018-05-20 03:12:42 +00:00
|
|
|
history: false,
|
|
|
|
});
|
2018-08-10 04:01:35 +00:00
|
|
|
|
2018-06-04 03:04:01 +00:00
|
|
|
infScroll.on( 'append', function( response, path, items ) {
|
|
|
|
pixelfed.hydrateLikes();
|
2018-08-10 04:01:35 +00:00
|
|
|
$('.status-card > .card-footer').each(function() {
|
|
|
|
var el = $(this);
|
|
|
|
if(!el.hasClass('d-none') && !el.find('input[name="comment"]').val()) {
|
|
|
|
$(this).addClass('d-none');
|
|
|
|
}
|
|
|
|
});
|
2018-06-04 03:04:01 +00:00
|
|
|
});
|
2018-08-10 04:01:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$(document).on("DOMContentLoaded", function() {
|
|
|
|
|
|
|
|
var active = false;
|
|
|
|
|
|
|
|
var lazyLoad = function() {
|
|
|
|
if (active === false) {
|
|
|
|
active = true;
|
|
|
|
|
|
|
|
var lazyImages = [].slice.call(document.querySelectorAll("img.lazy"));
|
|
|
|
lazyImages.forEach(function(lazyImage) {
|
|
|
|
if ((lazyImage.getBoundingClientRect().top <= window.innerHeight && lazyImage.getBoundingClientRect().bottom >= 0) && getComputedStyle(lazyImage).display !== "none") {
|
|
|
|
lazyImage.src = lazyImage.dataset.src;
|
|
|
|
lazyImage.srcset = lazyImage.dataset.srcset;
|
|
|
|
lazyImage.classList.remove("lazy");
|
|
|
|
|
|
|
|
lazyImages = lazyImages.filter(function(image) {
|
|
|
|
return image !== lazyImage;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
active = false;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
document.addEventListener("scroll", lazyLoad);
|
|
|
|
window.addEventListener("resize", lazyLoad);
|
|
|
|
window.addEventListener("orientationchange", lazyLoad);
|
2018-06-05 06:38:48 +00:00
|
|
|
});
|