Created
March 2, 2024 12:08
-
-
Save Silica163/403b66aa7f4eef7866c9ff20e421fec2 to your computer and use it in GitHub Desktop.
auto mute spotify ads
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
| // 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