Youtube scroll lock timestamp in picture-in-picture

ziopuzzle
2022-09-18T11:33:32Z

When using Picture-in-Picture (PiP), don't scroll to the top of the page when clicking on a timestamp that displays the time of the video.

Youtube scroll lock time link in picture-in-picture

The playback time link in the comment is very useful.
However, it scrolls to the top of the page each time it is clicked.
If you are using picture-in-picture, it can be annoying to go back to the top of the page.
This user script is intended to remedy that.

🔍Feature
・When using picture-in-picture (in Chrome, you can select this option by right-clicking twice on video),
clicking chapter link or timestamp will hold the scroll position.

Note: Firefox does not seem to support the Picture-in-Picture API.
Therefore, if you are using Firefox, scrolling is disabled regardless of whether PIP is enabled or disabled.
https://bugzilla.mozilla.org/show_bug.cgi?id=1463402

🔧How to
・Install this userscript.

😀Special thanks
・q1k
Since with version 1.4, the following script is referenced (scrolling when clicking on timestamps has been completely disabled).
https://greasyfork.org/en/scripts/438943-youtube-no-scroll-to-top-on-timestamps

📃Change log
1.0 : release
1.1 : bugfix
1.2 : support https://greasyfork.org/en/scripts/444382-youtube-mini-player
But, "delay: 500" add to the IntersectionObserver options.With the Ver 1.4 update, it is no longer necessary to fix.
ex) "threshold: 0.5" -> "threshold: 0.5, delay: 500"
1.3 : fix broken script.
1.4 : scrolling when clicking on timestamps has been completely disabled.