Skip to content

Instantly share code, notes, and snippets.

@swkidd
Last active May 13, 2020 09:15
Show Gist options
  • Save swkidd/f1a8d573ac31a67041938584f5f896e6 to your computer and use it in GitHub Desktop.
Save swkidd/f1a8d573ac31a67041938584f5f896e6 to your computer and use it in GitHub Desktop.
const url = window.location
const detectChange = () => {
if (/^.*:\/\/.*youtube.com\/?$/.test(url)) {
}
else if (/^.*:\/\/.*youtube.com\/watch\?v=.*$/.test(url)) {
const related = document.querySelectorAll("#related").forEach(e => e.remove())
const endscreen = document.querySelector(".html5-endscreen")
endscreen && endscreen.remove()
const upnext = document.querySelector(".ytp-upnext")
upnext && upnext.remove()
}
}
setInterval(detectChange, 1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment