From 04c9b666bc060f57a1c63f71234765f654917b55 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 10 Feb 2019 21:23:15 -0700 Subject: [PATCH] Update timeline.js --- resources/assets/js/timeline.js | 72 ++------------------------------- 1 file changed, 4 insertions(+), 68 deletions(-) diff --git a/resources/assets/js/timeline.js b/resources/assets/js/timeline.js index ff9587d6c..f41361fc8 100644 --- a/resources/assets/js/timeline.js +++ b/resources/assets/js/timeline.js @@ -1,68 +1,4 @@ -$(document).ready(function() { - $('.pagination').hide(); - $('.container.timeline-container').removeClass('d-none'); - let elem = document.querySelector('.timeline-feed'); - let type = elem.getAttribute('data-timeline'); - $('.timeline-sidenav .nav-link[data-type="'+type+'"]').addClass('active'); - pixelfed.readmore(); - pixelfed.fetchLikes(); - $('video').on('play', function() { - activated = this; - $('video').each(function() { - if(this != activated) this.pause(); - }); - }); - let infScroll = new InfiniteScroll( elem, { - path: '.pagination__next', - append: '.timeline-feed', - status: '.page-load-status', - history: false, - }); - - infScroll.on( 'append', function( response, path, items ) { - pixelfed.hydrateLikes(); - $('.status-card > .card-footer').each(function() { - var el = $(this); - if(!el.hasClass('d-none') && !el.find('input[name="comment"]').val()) { - $(this).addClass('d-none'); - } - }); - $('video').on('play', function() { - activated = this; - $('video').each(function() { - if(this != activated) this.pause(); - }); - }); - }); - - -}); - -$(document).on("DOMContentLoaded", function() { - - var active = false; - var lazyLoad = function() { - pixelfed.readmore(); - 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); -}); +Vue.component( + 'timeline', + require('./components/Timeline.vue').default +); \ No newline at end of file