Closed raszpl closed 1 month ago
hi @rasz_pl
could also use tab.id 😁 https://github.com/code-charity/youtube/blob/6538d6af42c27635489b2b19c294377042f1d4c9/background.js#L162
and to undo if the low quality makes it to a new session...? :
if (ImprovedTube.qualityBeforeBlur) { ... }
else { if ( qualityWithoutFocus === player.getPlaybackQuality() ) {ImprovedTube.playerQuality(ImprovedTube.player_quality || undefined); } )
hi @rasz_pl
could also use tab.id 😁
should. I dont know why background.js is doing what its doing, but whatever its doing its doing too much of it to elaborate: why is this code in background.js to begin with? all this mess(double messages, messaging all the tabs) can be replaced by sticking
window.addEventListener("blur", (event) => {
});
window.addEventListener("focus", (event) => {
});
somewhere around here https://github.com/code-charity/youtube/blob/8223c7d3cd56d465003c8196e301732855ee443f/js%26css/web-accessible/init.js#L134
hi! @raszpl
idk, previously assumed manifest3 broke it: https://github.com/code-charity/youtube/issues/1516#issuecomment-1422957257
brings us back here: #1439 and #bugs
+#important
At least we should still look at 3.965 to fetch the features not migrated to 4.0 (Mixer, Analyzer & Custom CSS & JS) (and there might be more good code missing since 4.0)
( obvious change in 4.0 stuff was moving stuff from web-accessible youtube-scripts.js to content scripts:
"content-scripts/extension-context/youtube-features/night-mode/night-mode.js",
"content-scripts/extension-context/youtube-features/general/general.js",
"content-scripts/extension-context/youtube-features/appearance/player/player.js",
"content-scripts/extension-context/youtube-features/appearance/details/details.js",
"content-scripts/extension-context/youtube-features/appearance/sidebar/sidebar.js",
"content-scripts/extension-context/youtube-features/appearance/comments/comments.js",
And there was the plan to allow HTMLmediaelement features on all sites. Or integrate/invite https://github.com/xxxily/h5player / & https://greasyfork.org/en/scripts/30545. ( And care for top URLs like m.youtube & facebook.com/watch) (So that must be why the sub-folders were called "youtube" for 4.0 )
https://github.com/code-charity/youtube/blob/d8065714b67e4bbb891b11eedd72ef68f0afed38/background.js#L179-L202
sends additional second blur message on tab switch
this https://github.com/code-charity/youtube/blob/d8065714b67e4bbb891b11eedd72ef68f0afed38/js%26css/web-accessible/www.youtube.com/player.js#L411 sets qualityBeforeBlur again when already minimized, this time to this.storage.player_quality_without_focus. After rocusing back video quality is "restored" to qualityBeforeBlur === this.storage.player_quality_without_focus.
background.js is sending second blur event. Its sending multiple ones when whole browser is minimized for example, or tab switched. Dont know why and if its needed. Definitely sending events to tabs where extension is not running is not good.