Skip to content

Instantly share code, notes, and snippets.

@71
Created March 22, 2019 07:59
Show Gist options
  • Save 71/13b0a367ef23ad850cb4109ab7e3bd44 to your computer and use it in GitHub Desktop.
Save 71/13b0a367ef23ad850cb4109ab7e3bd44 to your computer and use it in GitHub Desktop.
Violent Monkey script that removes closed captions from subtitles on Netflix.
// ==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