Open raszpl opened 5 months ago
why
small in the first moment could make the transition less harsh / more smooth. While it also might changes position & removing URL bar makes the window a bit smaller (can account for that at least)
Resizing window forces very slow DOM redraw and slows down popup load. I would understand animation, but 1 frame in between is not an animation :) We can instead create new popup window with no url bar directly in background.js. That way there is no need to catch/guess newly created window.open. I just dont understant what this is fixing: https://github.com/code-charity/youtube/blob/011ea52b9f30ea0c9562967b5bb4697851397448/js%26css/web-accessible/www.youtube.com/player.js#L951-L956
(disclaimer: just adding detail.)
1 frame in between is not an animation :)
1 frame makes a more smooth transition than 0 frames. just reminding of the direction where more change is about to happen
Resizing window forces very slow DOM redraw
contradictory to 1 frame? what to redraw at that point?
initial popup opens in small window https://github.com/code-charity/youtube/blob/011ea52b9f30ea0c9562967b5bb4697851397448/js%26css/web-accessible/www.youtube.com/player.js#L944-L948 why open small and resize couple of lines later?
https://github.com/code-charity/youtube/blob/011ea52b9f30ea0c9562967b5bb4697851397448/js%26css/web-accessible/www.youtube.com/player.js#L959-L963
lets just open popup at `directories=no,toolbar=no,location=no,menubar=no,status=no,titlebar=no,scrollbars=no,resizable=no,width=${ytPlayer.offsetWidth 0.75},height=${ytPlayer.offsetHeight 0.75}
popup resizing works in Chrome 125 and FF 125, but not in Vivaldi 126 because this very fragile (making bad assumptions) code: https://github.com/code-charity/youtube/blob/011ea52b9f30ea0c9562967b5bb4697851397448/background.js#L255-L260 guesses our just opened popup will be the 'active: true' tab. in Vivaldi at the moment of this call our main browser window is still the active one (UI is slooow, maybe thats the reason). This wrong window has state: 'maximized' and :
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/windows/create#state
means we error out
Unchecked runtime.lastError: Invalid value for state
so thankfully at least Vivaldi doesnt resize its main window :-)Also why go to so much trouble in https://github.com/code-charity/youtube/blob/011ea52b9f30ea0c9562967b5bb4697851397448/background.js#L274-L281
when we can append title with https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/windows/create#titlepreface edit: because its not supported by anything :/ https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/windows/update#browser_compatibility
Finally autoplay.
&autoplay=${ImprovedTube.storage.player_autoplay_disable ? '0' : '1'}
Imho instead playerPopupButton should check if video was playing at the moment of clicking it and pass that state to the popup.Edit: also found a bug that only shows up in popups /embeds
because embeds dont have player controls :)