friendship ended with social-app. php is my new best friend
at main 836 B view raw
1if (document.querySelector('.refreshBar')) { 2 document.querySelector('.refreshBar').addEventListener('click', async (e) => { 3 e.preventDefault(); 4 const feedUri = e.target.getAttribute('data-feed'); 5 const cursor = document.querySelector('.post').getAttribute('data-cursor'); 6 console.log(cursor); 7 fetch('lib/asyncRequestHandler.php', { 8 method: 'POST', 9 headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, 10 body: "action=updateFeed&feed="+feedUri+"&cursor="+cursor+"&newer=true", 11 mode: 'cors' 12 }).then(response => response.text()) 13 .then((data) => { 14 const htmlNodes = new DOMParser().parseFromString(data, 'text/html'); 15 const refreshBar = document.querySelector('.refreshBar'); 16 refreshBar.after(...htmlNodes.querySelectorAll('.post')); 17 }); 18 }); 19}