├── README.md └── adblock.js /README.md: -------------------------------------------------------------------------------- 1 | # Archive 2 | This repo doesn't add anything new anymore to the original adblock extension, charlie implemented all the changes I did in his original script so I'm archiving this 3 | 4 | # SpicetifyAdBlock 5 | This is an extension of @CharlieS1103 Ad blocker extension, 6 | most of the credit should go to him so go and drop a star at 7 | [his extension](https://github.com/CharlieS1103/spicetify-extensions) 8 | 9 | ## My modification 10 | I simply ~~added support to remove the htop(the big ad at the top of the main page) 11 | and~~ removed the Upgrade button from the UI 12 | 13 | ## Installation 14 | Simply run: 15 | `cp adblock.js ~/.config/spicetify/Extensions` 16 | `spicetify config extensions adblock.js` 17 | `spicetify apply` 18 | 19 | and enjoy an ad free spotify experience 20 | -------------------------------------------------------------------------------- /adblock.js: -------------------------------------------------------------------------------- 1 | (function adblock() { 2 | const { Platform} = Spicetify; 3 | if (!(Platform)) { 4 | setTimeout(adblock, 300) 5 | return 6 | } 7 | 8 | var styleSheet = document.createElement("style") 9 | 10 | styleSheet.innerHTML = 11 | ` 12 | .main-topBar-UpgradeButton, .MnW5SczTcbdFHxLZ_Z8j, .WiPggcPDzbwGxoxwLWFf, .ReyA3uE3K7oEz7PTTnAn, .main-leaderboardComponent-container, .sponsor-container, a.link-subtle.main-navBar-navBarLink.GKnnhbExo0U9l7Jz2rdc{ 13 | display: none !important; 14 | } 15 | ` 16 | document.body.appendChild(styleSheet) 17 | delayAds() 18 | var billboard = Spicetify.Platform.AdManagers.billboard.displayBillboard; 19 | Spicetify.Platform.AdManagers.billboard.displayBillboard = function (arguments) { 20 | Spicetify.Platform.AdManagers.billboard.finish() 21 | // hook before call 22 | var ret = billboard.apply(this, arguments); 23 | // hook after call 24 | console.log("Adblock.js: Billboard blocked! Leave a star!") 25 | Spicetify.Platform.AdManagers.billboard.finish() 26 | const observer = new MutationObserver((mutations, obs) => { 27 | const billboardAd = document.getElementById('view-billboard-ad'); 28 | if (billboardAd) { 29 | Spicetify.Platform.AdManagers.billboard.finish() 30 | obs.disconnect(); 31 | return; 32 | } 33 | }); 34 | 35 | observer.observe(document, { 36 | childList: true, 37 | subtree: true 38 | }); 39 | return ret; 40 | }; 41 | function delayAds() { 42 | console.log("Ads delayed: Adblock.js") 43 | Spicetify.Platform.AdManagers.audio.audioApi.cosmosConnector.increaseStreamTime(-100000000000) 44 | Spicetify.Platform.AdManagers.billboard.billboardApi.cosmosConnector.increaseStreamTime(-100000000000) 45 | } 46 | setInterval(delayAds, 720 *10000); 47 | 48 | 49 | })() 50 | 51 | --------------------------------------------------------------------------------