Keeps YouTube progress bar visible all the time.
< 腳本YouTube Permanent ProgressBar的回應
Thanks for the feedback & tips to improve this. I figured hiding the scrubber would be useful as a standalone css style in case for e.g. you don't want to use this script just to hide the scrubber but I could import it to this too.
About trustedpolicy, I simply saw that error, looked it up & added this to make the browser happy :P
If there's any problems with it in the future I can try the GM_addStyle option.
Yup fair enough, also another thing that could be worth looking into is throttling how often updateLoop
is called, calling it now via requestAnimationFrame will invoke it around 60 times a second (depending on the users refresh rate) which is definitely not needed (imagine doing multiple calls to querySelector/updating the progressbar possibly hundred times per second)
I modified the script and edited the updateLoop function to look like this
updateLoop: function() {
const ThrottledRequestAnimationFrame = (aps) => {
setTimeout(() => {
permanentProgressBar.update();
requestAnimationFrame(permanentProgressBar.updateLoop);
}, 1000 / aps);
};
// This will only be called at most 1 time per second
const MaxActionsPerSecond = 1;
ThrottledRequestAnimationFrame(MaxActionsPerSecond);
}
Might not be the best way to throttle it but it works :D
This probably wont be an issue for people with new hardware, but there will be an occasional shitty hardware user who is gonna come through who wants to preserve as much computing power as possible
Nice stuff, I tried to make my own code but it wouldn't for the life of it use the number if I set it in options list, I hope you don't mind if I integrate this.
Works well, good stuff :)
Also the trustedpolicy stuff when creating a new style element can be all skipped by using GM_addStyle instead (but perhaps there is a reason you dont want to use that), and the userstyles css for fixing the scrubber stuff could just be added directly along with the custom css that is being added at the start of this script
either way, good job :)