Created
April 20, 2019 13:09
-
-
Save kevashcraft/f582083b82aae99ea1423ce1dba0159a to your computer and use it in GitHub Desktop.
Mute Ads
This file contains 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
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