Damn, I should have tested this more thoroughly before submitting it to the Chrome Web Store.
I didn't realise there'd be a difference between running it through Tampermonkey vs as an extension, but here we are! It works fine in Tampermonkey, but when run as an extension (using the CRX file), it mistakenly detects the leaving fullscreen transition as the entering fullscreen one, thus when leaving fullscreen, it logs:
[YT-FFT] Entering fullscreen; fluff has been hidden
[YT-FFT] Finished entering fullscreen transition; showing fluff again
So it immediately shows the fluff again, nullifying the performance improvement of having hidden it.
Perhaps the addEventListener
s run at a different time, and so we end up with a different order of event handlers firing (mine and YouTube's)...
I'm detecting whether we're fullscreen (and so what the direction of the transition is) by the presence of the fullscreen
attribute on ytd-watch-flexy
. I guess by the time the extension checks that, it's too late, as it's already been removed?