Skip to content

Instantly share code, notes, and snippets.

@stefnotch
Created August 31, 2020 07:34
Show Gist options
  • Save stefnotch/4824a9621e4dfa0e0a4a34043cdb544a to your computer and use it in GitHub Desktop.
Save stefnotch/4824a9621e4dfa0e0a4a34043cdb544a to your computer and use it in GitHub Desktop.
A simple bookmarklet to hide your YouTube controls

Hide YouTube Controls

A simple bookmarklet to hide your YouTube controls. Click on it to hide the controls, click on it again to show the controls again.

javascript:var s=document.getElementById("stylehidecontrols");if(s){s.remove();}else{s=document.createElement("style");s.id="stylehidecontrols";var r="#movie_player .ytp-gradient-top, #movie_player .ytp-gradient-bottom, #movie_player .ytp-chrome-top, #movie_player .ytp-chrome-bottom{display:none !important}";s.appendChild(document.createTextNode(r));document.body.appendChild(s);}void 0;

(The code is an adapted version of jscher2000's code on the Mozilla support site)

Setup

  1. Copy the script
  2. Right click onto your bookmarks and create a new bookmark
  3. Paste the script as the location
  4. Type in a descriptive name and add the bookmark
@AmirhosseinDotZip
Copy link

this did exactly what i wanted it to do, but how can i undo the remove funcntion with another bookmarklet

@stefnotch
Copy link
Author

stefnotch commented Jan 29, 2023

@ambient-work You can just press the bookmarklet again, it toggles it.

Though, if you really want two separate ones

javascript:var s=document.createElement("style");s.id="stylehidecontrols";var r="#movie_player .ytp-gradient-top, #movie_player .ytp-gradient-bottom, #movie_player .ytp-chrome-top, #movie_player .ytp-chrome-bottom{display:none !important}";s.appendChild(document.createTextNode(r));document.body.appendChild(s);void 0;
javascript:var s=document.getElementById("stylehidecontrols");if(s){s.remove();}void 0;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment