Skip to content

Instantly share code, notes, and snippets.

@prr21
Last active April 12, 2023 00:59
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 prr21/bcab57d74e4aa8245568dc0e17b841a0 to your computer and use it in GitHub Desktop.
Save prr21/bcab57d74e4aa8245568dc0e17b841a0 to your computer and use it in GitHub Desktop.
Youtube hidden spoilers.user
// ==UserScript==
// @name Youtube hidden spoilers
// @namespace http://tampermonkey.net/
// @version 1.2
// @description try to take over the world!
// @author You
// @match *://*.youtube.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant none
// ==/UserScript==
(function() {
hideTitleOnChange()
applyStyles()
})();
function hideTitleOnChange() {
const maskedTitle = '*****'
document.title = maskedTitle
const titleEl = document.getElementsByTagName("title")[0];
const docEl = document.documentElement;
if (docEl && docEl.addEventListener) {
docEl.addEventListener("DOMSubtreeModified", function(evt) {
if (document.title === maskedTitle) return;
const t = evt.target;
if (t === titleEl || (t.parentNode && t.parentNode === titleEl)) {
document.title = maskedTitle
}
}, false);
} else {
document.onpropertychange = function() {
if (document.title == maskedTitle) return;
if (window.event.propertyName == "title") {
document.title = maskedTitle
}
};
}
}
function applyStyles(){
const style = document.createElement('style')
style.innerHTML = `
ytd-rich-grid-media[mini-mode] #video-title.ytd-rich-grid-media {
font-size: 0
}
img.yt-core-image--fill-parent-height, img.yt-img-shadow {filter: blur(60px)}
.ytp-ce-element.ytp-ce-element-show,
#video-title {filter: blur(10px)}
ytd-thumbnail-overlay-time-status-renderer,
.title.ytd-video-primary-info-renderer {opacity: 0 !important}
.ytp-larger-tap-buttons .ytp-time-display,
#video-title.ytd-compact-video-renderer,
.ytp-time-duration,
h1.ytd-watch-metadata,
.ytp-progress-bar {display: none !important}
#video-title.ytd-video-renderer,
.html5-video-player a {font-size: 0 !important}
`
document.body.appendChild(style)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment