Last active
October 26, 2023 22:30
-
-
Save neodigm/390912e570487648c3130bc7ef360b50 to your computer and use it in GitHub Desktop.
Automatically mute the Music player when Ads are playing and unmute when they are done (in Chrome).
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
let spotADify = ( (_d, _q, _t) => { | |
let eS = _d.querySelector( _q ), bS = true; | |
if( eS ){ // 🏖️ Play your Jams! 🎶 | |
bS = ( eS.getAttribute("aria-label") == "Mute" ); | |
setInterval( () => {spotADify.tick();}, _t); | |
return { | |
"tick": () => { | |
if((_d.title.indexOf("Adve") != -1) || (_d.title.indexOf("Spoti") != -1)){ | |
if( bS ){ eS.click(); bS=!true; } | |
}else{ | |
if( !bS ){ eS.click(); bS=true; } | |
} | |
} | |
} | |
} | |
})( document, "[aria-label='Mute'],[aria-label='Unmute']", 256); | |
/* Install: Open Chrome Dev Tools (Command+option+I on Mac). Menu > Sources > Snippets | |
Install: Create a new Snippet named spotADify.js, Paste this script, Save (Command+S). | |
Usage: Run the Snippet once each time you start the Music Web Player. | |
Usage: Right-Click the snippet named musicADify.js and choose Run from the drop-down. | |
Usage: Close Chrome Dev Tools. 🏖️ Play your Jams! 🎶 | |
*/ |
Shopify PWA Polaris Liquid GraphQL 🍭
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🎶 Automatically mute the Music player when Ads are playing (Desktop PWA | Progressive Web App | Mac or Windows)