Skip to content

Instantly share code, notes, and snippets.

@kevashcraft
Created April 20, 2019 13:09
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 kevashcraft/f582083b82aae99ea1423ce1dba0159a to your computer and use it in GitHub Desktop.
Save kevashcraft/f582083b82aae99ea1423ce1dba0159a to your computer and use it in GitHub Desktop.
Mute Ads
clearInterval(aa)
function mv() {
var found_one = false
var primary = 0
let el = document.querySelectorAll('.mlbtv-media-player')[primary]
let has_ads = !!el.querySelector('.interruption-link')
if (!has_ads) {
el.querySelector('video').muted = false
found_one = true
} else {
el.querySelector('video').muted = true
}
document.querySelectorAll('.mlbtv-media-player').forEach((el, idx) => {
if (idx === primary) return
if (!found_one) {
let has_ads = !!el.querySelector('.interruption-link')
if (!has_ads) {
el.querySelector('video').muted = false
found_one = true
} else {
el.querySelector('video').muted = true
}
} else {
el.querySelector('video').muted = true
}
})
}
var aa = setInterval(mv, 1500)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment