|
// ==UserScript== |
|
// @name Youtube hidden spoilers |
|
// @namespace http://tampermonkey.net/ |
|
// @version 1.4 |
|
// @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(){ |
|
if (window.trustedTypes && window.trustedTypes.createPolicy && !window.trustedTypes.defaultPolicy) { |
|
window.trustedTypes.createPolicy('default', { |
|
createHTML: string => string |
|
// Optional, only needed for script (url) tags |
|
//,createScriptURL: string => string |
|
//,createScript: string => string, |
|
}); |
|
} |
|
|
|
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-time-display, |
|
.ytp-progress-bar {display: none !important} |
|
|
|
#video-title.ytd-video-renderer, |
|
.html5-video-player a {font-size: 0 !important} |
|
` |
|
|
|
document.body.appendChild(style) |
|
} |