Skip to content

Instantly share code, notes, and snippets.

@JKirchartz
Created February 21, 2020 17:57
Show Gist options
  • Save JKirchartz/e9a5c128f5e902496d406a6bc0b95d90 to your computer and use it in GitHub Desktop.
Save JKirchartz/e9a5c128f5e902496d406a6bc0b95d90 to your computer and use it in GitHub Desktop.
Unstick the header from youtube & scroll the movie_player into view
// ==UserScript==
// @name Unstick Youtube
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://*.youtube.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var i, elements = document.querySelectorAll('body *');
setTimeout( function() {
for (i = 0; i < elements.length; i++) {
if (["sticky", "fixed"].includes(getComputedStyle(elements[i]).position)) {
console.log("element found:", elements[i]);
elements[i].setAttribute("style", "position: static");
}
}
}, 5000);
setTimeout( function(){
document.getElementById("movie_player").scrollIntoView();
}, 5100);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment