1

I found a command line to make a bookmarklet that hides the progress/controls bar on a YouTube video, so now I can pause the video and see the full image and take screenshots. Now I'm wondering how can I do the inverse, make a bookmarklet to reverse this command and unhide the progress/controls bar. I tried to figure it out myself but my knowledge in code and javascript is practically null.

Does anybody know what javascript string would work? The original command is:

javascript:(function(){var goaway=".ytp-gradient-bottom,.ytp-gradient-top,.ytp-chrome-top,
.ytp-chrome-bottom{display:none;}";
if("\v"=="v"){document.createStyleSheet().cssText=goaway}
else{var tag=document.createElement("style");
tag.type="text/css";document.getElementsByTagName("head")[0].appendChild(tag);
tag[(typeof document.body.style.WebkitAppearance=="string")?"innerText":"innerHTML"]=goaway}})();

1 Answers1

0

Exactly such a script existed on reddit prior your question:

Bookmarklet to hide/unhide all YouTube Progress/Toolbars with one click : youtube

To ADD the bookmarklet to your browser:

Highlight the text in the following codeblock:

javascript:(function(){var ytp_element_css=document.getElementsByClassName("ytp-chrome-bottom");var ytp_element_style=window.getComputedStyle(ytp_element_css[0]);var ytp_element_display=ytp_element_style.getPropertyValue("display");var ytp_elements=".ytp-chrome-top,.ytp-chrome-bottom,.ytp-gradient-top,.ytp-gradient-bottom";var ytp_css="empty";var x=document.getElementsByClassName("ytp-chrome-bottom").length;if(ytp_element_display=="none"){var ytpon="{display:block;}";ytp_css=ytp_elements+ytpon}else{var ytpoff="{display:none;}";ytp_css=ytp_elements+ytpoff}var tag=document.createElement("style");tag.type="text/css";document.getElementsByTagName("head")[0].appendChild(tag);tag[(typeof document.body.style.WebkitAppearance=="string")?"innerText":"innerHTML"]=ytp_css})();

Drag the highlighted text to your browser bookmarks toolbar.

OPTIONAL Rename the bookmarklet for clarity.

To USE the bookmarklet:

Load any YouTube video.

Click on the bookmarklet.

All the progress/toolbars will disappear (or reappear if they were already gone).

jis
  • 101