Created
March 22, 2019 07:59
-
-
Save 71/13b0a367ef23ad850cb4109ab7e3bd44 to your computer and use it in GitHub Desktop.
Violent Monkey script that removes closed captions from subtitles on Netflix.
This file contains hidden or 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 No closed captions | |
// @namespace Violentmonkey Scripts | |
// @match https://www.netflix.com/watch/* | |
// @grant none | |
// ==/UserScript== | |
let lastContainer = null | |
function removeClosedCaptions() { | |
const els = document.getElementsByClassName('player-timedtext-text-container') | |
if (els.length === 1) { | |
const el = els[0] | |
if (el != lastContainer && el.children != null) { | |
lastContainer = el | |
el.parentElement.style.display = 'flex' | |
el.parentElement.style.justifyContent = 'center' | |
el.style.left = 'auto' | |
for (const e of el.children) { | |
for (const n of e.childNodes) | |
if (n.nodeValue) | |
n.nodeValue = n.nodeValue.replace(/ *-? *\[.+?\] */g, '') | |
} | |
} | |
} | |
requestAnimationFrame(removeClosedCaptions) | |
} | |
requestAnimationFrame(removeClosedCaptions) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment