Last active
April 12, 2020 13:57
-
-
Save chidea/c5324f8d7141185e634353c63bb6c384 to your computer and use it in GitHub Desktop.
This file contains 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
// ==UserScript== | |
// @name Youtube masthead hider | |
// @namespace http://tampermonkey.net/ | |
// @version 0.9 | |
// @description press h key to hide Youtube masthead menu | |
// @author ChIdea | |
// @match https://www.youtube.com/* | |
// @grant none | |
// @updateURL https://gist.githubusercontent.com/chidea/c5324f8d7141185e634353c63bb6c384/raw/yt_mh_hider.js | |
// @downloadURL https://gist.githubusercontent.com/chidea/c5324f8d7141185e634353c63bb6c384/raw/yt_mh_hider.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
document.onkeypress=function(e){ | |
if(document.querySelector('ytd-searchbox').hasAttribute('has-focus')) return; | |
var k = e.key; | |
if (k==='h'){ | |
if (window.hideheadopt) { | |
document.querySelector('#masthead-container').style.display=''; | |
document.querySelector('#page-manager').style.marginTop=''; | |
document.querySelector('#primary').style.paddingTop=''; | |
window.hideheadopt=false; | |
}else { | |
document.querySelector('#masthead-container').style.display='none'; | |
document.querySelector('#page-manager').style.marginTop=0; | |
document.querySelector('#primary').style.paddingTop=0; | |
document.querySelector('#player-theater-container').style.zoom='95%'; | |
window.hideheadopt=true; | |
} | |
} | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment