Skip to content

Instantly share code, notes, and snippets.

@Silica163
Created March 2, 2024 12:08
Show Gist options
  • Select an option

  • Save Silica163/403b66aa7f4eef7866c9ff20e421fec2 to your computer and use it in GitHub Desktop.

Select an option

Save Silica163/403b66aa7f4eef7866c9ff20e421fec2 to your computer and use it in GitHub Desktop.
auto mute spotify ads
// only work with spotify webapp
// paste this script and run in developer console
// or load this script before spotify loaded
var footer,muteBtn,footObserver;
function onAttrChange(record,observe){
let event = record[0];
console.log(event,record);
if(event.attributeName == "data-testadtype"){
muteBtn.click();
}
}
window.onload = function (){
setTimeout(()=>{
console.log('adsblock loaded.');
footer = document.getElementsByTagName('footer')[0];
muteBtn = document.getElementById('volume-icon').parentElement;
footObserver = new MutationObserver(onAttrChange);
footObserver.observe(footer,{attributes:true});
console.log(footer,muteBtn);
},5000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment