Skip to content

Instantly share code, notes, and snippets.

@CairX
Last active April 4, 2021 11:45
Show Gist options
  • Save CairX/f3995c4d5df46305dbf197e1e764d87b to your computer and use it in GitHub Desktop.
Save CairX/f3995c4d5df46305dbf197e1e764d87b to your computer and use it in GitHub Desktop.
YouTube: Hide Comments
// ==UserScript==
// @name YouTube: Hide Comments
// @namespace https://gist.github.com/CairX
// @version 0.1
// @grant none
// @include https://www.youtube.com/*
// @run-at document-end
// ==/UserScript==
// An alternative approach would be:
// document.getElementById("comments").remove();
//
// However that does not work as YouTube manipulates the DOM after
// the page is loaded and therefore the comments-element doesn't exist
// at the time of execution.
var style = document.createElement("style");
style.innerHTML = "#comments { display: none; }";
document.body.appendChild(style);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment