Hi. I am trying to modify some things that require Javascript to be used. So I use the custom JS section.
My issue is, the code seems to be executed before the page fully load.
I have tried following solutions:
window.addEventListener('load',() => {
// more code
});
window.onload = function(){
// more code
};
document.onreadystatechange = function () {
// more code
};
But all 3 of them seems not working. I am not sure how Peertube work, but I believe the custom JS loaded in the main part of the website, then the content loaded separately after.
The only solution now is to set timeout. But this is quite ugly since everyone have different loading time.
Any idea?
Thanks!