Last active
September 6, 2021 14:38
-
-
Save hardiksondagar/ba8bad0baf01d5ec8d75efda383db28b to your computer and use it in GitHub Desktop.
Mute ads on sonyliv.com
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
/** | |
* | |
* Tired/irritated of hearing ads on sonyliv.com while watching cricket match? | |
* Follow below steps to mute when ads are running. | |
* 1. Start live cricket match | |
* 2. Open console ( press F12 in chrome ) and paste all the code below. | |
* | |
* @author : Hardik Sondagar | |
* | |
*/ | |
function muteAds() { | |
// mute ads on sonyliv.com | |
var elems = document.querySelectorAll("video"); | |
[].forEach.call(elems, function(elem) { | |
// var is_ads_running = document.querySelector(".adClick").style.display == "block"; | |
var is_ads_running = document.querySelector('.vjs-tech').style["pointer-events"] == "none"; | |
if (is_ads_running) { | |
elem.muted = true; | |
} else { | |
elem.muted = false; | |
} | |
}); | |
} | |
setInterval(function(){ | |
muteAds() | |
}, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment