Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
YouTube.com fullscreen injection to put the video in fullscreen. (Scrubber disabled due to issues with the fullscreen mode)
var sizeButton = document.getElementsByClassName("ytp-size-button")[0];
var sizeButtonTitle = sizeButton.getAttribute('title');
var shouldDefaultView = sizeButtonTitle != null && sizeButtonTitle.toLowerCase() == 'default view';
if (shouldDefaultView) {
sizeButton.click();
}
setTimeout(function() {
var playButton = document.getElementsByClassName("ytp-play-button")[0];
var playButtonLabel = playButton.getAttribute('aria-label');
var shouldPlay = playButtonLabel != null && playButtonLabel.toLowerCase() == 'pause';
var moviePlayer = document.getElementById('movie_player');
document.body.appendChild(moviePlayer);
var elements = document.body.children;
for (var i=elements.length-1; i>=0; i--)
{
var element = elements[i];
if (element != moviePlayer) {
element.parentNode.removeChild(element);
}
}
(function() {
var css = `
body, html {
height: 100% !important;
}
#movie_player, .html5-video-container, .video-stream {
width: 100% !important;
height: 100% !important;
}
.ytp-chrome-bottom {
width: 100% !important;
left: 0px !important;
}
.ytp-progress-bar-container {
pointer-events: none;
}
`;
var cssDiv = document.createElement('div'); cssDiv.innerHTML = '&shy;<style>' + css + '</style>'; document.body.appendChild(cssDiv.childNodes[1]);
})();
if (shouldPlay) {
setTimeout(function() { playButton.click(); }, 100);
}
}, 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.