ytorg / Yotter

Youtube and Twitter with privacy.
GNU Affero General Public License v3.0
467 stars 37 forks source link

Infinite Scrolling #49

Open FireMasterK opened 4 years ago

FireMasterK commented 4 years ago

This definitely requires JavaScript, but is definitely a nice to have.

pluja commented 4 years ago

I am really thinking to be using Javascript for other things, as it would make things much easier and smooth. Always without breaking the site if disabled.

FireMasterK commented 4 years ago

That's definitely a possibility, I can start working on that

pluja commented 4 years ago

You can go ahead. I would also like to change the UI to look more 'youtube-like'. Other JS things that would be nice is using AJAX in order to be able to follow a user without reloading the whole page.

FireMasterK commented 4 years ago

I've got a general idea of how this can be done,

We create a function like https://stackoverflow.com/a/814649

function create(htmlStr) {
    var frag = document.createDocumentFragment(),
        temp = document.createElement('div');
    temp.innerHTML = htmlStr;
    while (temp.firstChild) {
        frag.appendChild(temp.firstChild);
    }
    return frag;
}
var fragment = create(...) // html content from a fetch request, the server generates the next set of cards for the videos, we can do this pagewise
document.querySelector(".cards").appendChild(fragment);