Skip to content

Instantly share code, notes, and snippets.

@akatopo
Last active December 9, 2019 09:15
Show Gist options
  • Save akatopo/4416756e8ca7a84098d6ab04dbc5dd71 to your computer and use it in GitHub Desktop.
Save akatopo/4416756e8ca7a84098d6ab04dbc5dd71 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Grayscale Youtube Previews
// @downloadURL https://gist.githubusercontent.com/akatopo/4416756e8ca7a84098d6ab04dbc5dd71/raw/filter_youtube_previews.js
// @version 0.3
// @description apply grayscale filter to youtube video previews
// @author Alex Katopodis
// @match https://www.youtube.com/*
// ==/UserScript==
(() => {
'use strict';
addGlobalStyle(`
.ytd-grid-renderer,
ytd-rich-grid-video-renderer,
yt-horizontal-list-renderer,
ytd-expanded-shelf-contents-renderer,
ytd-watch-next-secondary-results-renderer {
filter: grayscale(1);
}
`);
function addGlobalStyle(css) {
const head = document.getElementsByTagName('head')[0];
if (!head) {
return;
}
const style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment