Skip to content

Instantly share code, notes, and snippets.

@neodigm
Last active October 26, 2023 22:30
Show Gist options
  • Save neodigm/390912e570487648c3130bc7ef360b50 to your computer and use it in GitHub Desktop.
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).
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! 🎶
*/
@neodigm
Copy link
Author

neodigm commented Jul 12, 2020

🎶 Automatically mute the Music player when Ads are playing (Desktop PWA | Progressive Web App | Mac or Windows)

@neodigm
Copy link
Author

neodigm commented Oct 26, 2023

Shopify PWA Polaris Liquid GraphQL 🍭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment