Greasy Fork is available in English.
Watch page description below the video with proper open/close toggle, instead of a side bar.
< Σχολιασμός για τον κώδικα YouTube - Proper Description
I have an idea why it might happen, although it shouldn't.
Can you open the console and see if there's any errors coming from this script.
Also, can you describe what you did when that happened? What kind of pages you opened and in what order?
I did some changes anyway.
If it happens again, please reply back. Thankyou
Ah, it looks like you redid a lot of the code. Not sure if there were any errors before. I think it's because I use the back/forward arrows a lot in YouTube which sometimes doesn't count as a page refresh. I had to use this method to fix a different userscript too. Good job - the code looks a lot more refined now.
I've used the back/forward as well, but never noticed any issues.
Am I right to assume the changes I did had some effect to fixing the problem?
To be honest I haven't updated the script yet. I'll create a backup of the old one and update now. I'll try to remember to get back to you, but if I don't then you can assume that your changes fixed the problem. Thanks for the help though.
The new script version seems to fix my previous problem for now. But for some reason the more button went missing once. There were no errors in the console and I'm not sure what order I opened the videos in. I do know that at first I saw that it was missing, so I clicked on another video and it was still missing. So I refreshed and then it fixed itself.
I never noticed that even on multiple accounts.
But I did notice that long collapsed comments have the same selectors, so I made the buttons more specific. The issue should be fixed for good now.
On a side note, I've made the script display 'show more' instead of 'more'. Or if you had the side bar description it won't show 'open description' anymore.
I've found that sometimes the description doesn't update and it reverts to the normal youtube description.
I tried to fix it by adding replacing the bottom part with this and it seems to work so far:
function onLoad() {
findElement("ytd-expander #content ~ tp-yt-paper-button#more").then(function(el){
addSTUFF();
});
}
window.addEventListener("yt-navigate-finish", onLoad);
However, now it renders the MORE and SHOW LESS buttons multiple times so I did this to fix that:
if (!Array.from(description.children).includes(document.getElementById("description_open"))) {
description.appendChild(button_open);
description.appendChild(button_close);
}
Everything seems to be working so far - you could consider adding something like this to your original version. Sorry about the indentation BTW.