YouTube - Proper Description

Watch page description below the video with proper open/close toggle, instead of a side bar.

< 腳本YouTube - Proper Description的回應

評論:正評 - 腳本一切正常

§
發表於:2022-05-16

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.

q1k作者
§
發表於:2022-05-16
編輯:2022-05-16

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?

q1k作者
§
發表於:2022-05-16

I did some changes anyway.
If it happens again, please reply back. Thankyou

§
發表於:2022-05-17

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.

q1k作者
§
發表於:2022-05-17

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?

§
發表於:2022-05-18

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.

§
發表於:2022-05-20

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.

q1k作者
§
發表於:2022-05-20

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.

發表回覆

登入以回覆

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址