Last active
December 9, 2019 09:15
-
-
Save akatopo/4416756e8ca7a84098d6ab04dbc5dd71 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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