Skip to content

Instantly share code, notes, and snippets.

@julian-weinert
Last active June 15, 2021 03:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julian-weinert/425fa15d7117785e84cad6fbf8df460c to your computer and use it in GitHub Desktop.
Save julian-weinert/425fa15d7117785e84cad6fbf8df460c to your computer and use it in GitHub Desktop.
User script which can be used with TamperMonkey and similar browser extensions.
// ==UserScript==
// @name YouTube Remove Themed Scrollbar
// @version 1.0.1
// @description This script removes the themed YT-scrollbar one second after load.
// @author Julian Weinert
// @run-at document-start
// @match *://*.youtube.com/*
// @match *://*.youtu.be/*
// @updateURL https://gist.githubusercontent.com/julian-weinert/425fa15d7117785e84cad6fbf8df460c/raw/remove-youtube-scrollbar.js
// ==/UserScript==
function wrapSetAttribute(a) {
a._setAttribute = a.setAttribute;
a.setAttribute = function(attr) {
if (attr.includes('scrollbar')) {
return;
}
a._setAttribute(...arguments);
}
var attrs = [...a.attributes];
attrs.forEach(attr => {
if (attr.nodeName.includes('scrollbar')) {
a.removeAttribute(attr.nodeName);
}
});
}
wrapSetAttribute(document.documentElement);
wrapSetAttribute(document.body);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment