When window width is resized to be smaller than some size (~800-1200 pixels) YouTube switches to a different player layout, where #player-theater-container exists but is empty and instead it puts the player in a different container #columns. This causes a large blank space at the top of the page.
Simple solution: disable the script when #player-theater-container is empty. Implementing this is not trivial though, and as this behavior might be changed in the future so I'm leaving this open for now.
When window width is resized to be smaller than some size (~800-1200 pixels) YouTube switches to a different player layout, where
#player-theater-container
exists but is empty and instead it puts the player in a different container#columns
. This causes a large blank space at the top of the page.Simple solution: disable the script when
#player-theater-container
is empty. Implementing this is not trivial though, and as this behavior might be changed in the future so I'm leaving this open for now.