Last active
August 24, 2020 17:49
-
-
Save piousdeer/6161edfae0e6c34fb8b0b76f35b5807c to your computer and use it in GitHub Desktop.
Force fullscreen UI on sites like YouTube without actually making your browser window fullscreen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let fullscreenElement; | |
Object.defineProperty(document, "fullscreenElement", { | |
get() { | |
return fullscreenElement; | |
}, | |
set(value) { | |
fullscreenElement = value; | |
}, | |
}); | |
Element.prototype.requestFullscreen = async function () { | |
document.fullscreenElement = this; | |
document.dispatchEvent(new Event("fullscreenchange")); | |
}; | |
document.exitFullscreen = () => { | |
document.fullscreenElement = null; | |
document.dispatchEvent(new Event("fullscreenchange")); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment