Greasy Fork

来自缓存

Greasy Fork is available in English.

YouTube JS Engine Tamer

修改 YouTube 的 JS 引擎以提升性能

< 脚本 YouTube JS Engine Tamer 的反馈

评价:好评 - 脚本运行良好

§
发布于:2025-07-05
编辑于:2025-07-05

Script works as expected with a minor exception. When injected into youtube's live chat iframe (default behaviour), the chat no longers overrides scrolling events correctly and would cause the entire youtube page to scroll when trying and failing to scroll past the end/beginning of chat.

(tested on version 0.42.1 on July 6th)

§
发布于:2026-02-15

Can you please try to disable all other user scripts and extensions first? It seems like the conflict because I do not receive any other similar bug report.

You might also try to use YouTube Super Fast Chat and/or YouTube Boost Chat to see whether such issue can be gone.

§
发布于:2026-02-19
编辑于:2026-02-19

I have retested with Google Chrome 145 Stable, using both Tampermonkey 5.4.1 and ScriptCat 1.2.6 (not at the same time). Confound variables should be minimal as this was tested on a clean reinstall of Windows 11, in addition to all other extensions and scripts disabled. This script was still able to alone cause the problematic behavior as described originally.

§
发布于:2026-05-03

I can reproduce the scroll behavior difference. However, it is not something a bug.


This script changes the scrolling behavior due to the following

const DISABLE_COOLDOWN_SCROLLING = true;

You can change it from true to false to disable this fix.

BTW, this fix is one of the performance boost.


However, I don't think it is a bad thing. Just like a text box or any other element. When it scroll to the end/beginning, you can scroll the outer container if you scroll further more.

Anyway, you can also use Stylish or something similar to add the following CSS so that it would not scroll the outer.

#chat {
    overscroll-behavior: contain;
}
§
发布于:2026-05-03

Sorry not Stylish.

It is Stylus.

I made the UserStyle here. You can also use ScriptCat to install it (JavaScript Version).

http://greasyfork.icu/scripts/576391-youtube-css-overscroll-behavior-for-chat

§
发布于:2026-05-03

Can confirm that it is indeed caused by DISABLE_COOLDOWN_SCROLLING = true. I'll put the rating to good for the meantime as the new userstyle DOES patch the issue, but it would be more ideal if integrated into the main script.

I do agree that overscrolling can be a good thing, but personally in this case it has been unreliable, and for 2 main reasons.

  1. Live stream chats are typically constantly auto-scrolled to the bottom.
  2. It is highly probable for one to scroll up then back down to the end of the chat during typical use cases.

With 1 and 2 combined it make it so that overscrolling become a common occurrence when using the chat. And when overscrolled, users must move their cursor outside of the chat container area to reset the scroll of the main YouTube container.

However, if this is consistent behaviour I could see some people preferring this, but in my case overscrolling the chat only scrolls the main container about 10% of the time as is practically unpredictable, and sometimes the overscrolling suddenly no longer scrolls the outer container suddenly. (probably race condition?) This makes it hard for users to anticipate the behaviour for comfortable use.

Also, it seems like in somewhat rarer but not exceptionally rare cases, scrolling will randomly switch between scrolling the chat to scrolling the main outer YouTube container, and vise versa, even in non-overscrolling cases. This behaviours happens even when the cursor has never left the chat area while scrolling. (also probably race condition?)

And as a side thing I want to thank you for the continuous work on this script. That said, while this script is very technically impressive, it is also complex and includes various flags that are not super obvious to users the effects of. This makes it difficult for users to edit the flags without breaking things and difficult for users to provide feedback beyond vague behavioural descriptions unless they studied the code thoroughly before hand.

§
发布于:2026-05-03
编辑于:2026-05-03

Thanks for supporting.

All the flags and options are NOT for averaged users to modify.


This script tries to modify the JavaScript Engine used in YouTube to fix glitches, enhance performance/responsiveness, etc.

YouTube Engine is a tower of building blocks. There are changes over the time, by different engineers, with different architectures. Therefore all patches provided by this script must be flexible so that they can be changed along with the new update in YouTube JS Engine.

I made this script since Aug 2023 after seeing Youtube Player perf. That is the origin of this script.

In the past, I added "DISABLE_COOLDOWN_SCROLLING". If this brings negative impact in 2026, I will disable it or remove it entirely.

"DISABLE_COOLDOWN_SCROLLING" is a simple flag. It removes the wheel event blocking in YouTube.

Instead, you should use the CSS solution (overscroll-behavior) which is the modern way and recommended practice.

There is no guarantee that it is 100% equivalent to the YouTube without this script.

Just like this "DISABLE_COOLDOWN_SCROLLING". It changes this minor scrolling behavior.

I understand that to you the fix shall be added in this script. However I don't think the same. Adding CSS is not the main focus of this script. This might also break the compatibility with other UserScript / UserStyle / Extensions. Also adding CSS is somehow a performance degradation which is the opposite of having this script.

( It will also add the burden of maintenance for the CSS patches )

So if it is not a major discrepancy, I would just leave it be.


Thanks for changing the review to GOOD.

§
发布于:2026-05-03
编辑于:2026-05-03

I just changed my mind.

I added ytd-live-chat-frame#chat{overscroll-behavior:contain;} in v0.42.19

Thanks for supporting.

发布留言

登录以发布留言。