Turbo Subscription Button Remover

Edits the Turbo ad banner to be a transparent placeholder. Check GitHub page for the demonstration image.

  1. // ==UserScript==
  2. // @name Turbo Subscription Button Remover
  3. // @namespace https://github.com/mirbyte/TwitchTV-Userscripts/edit/main/Turbo%20Subscription%20Button%20Remover.js
  4. // @match *://www.twitch.tv/*
  5. // @grant none
  6. // @version 1.9
  7. // @author mirbyte
  8. // @description Edits the Turbo ad banner to be a transparent placeholder. Check GitHub page for the demonstration image.
  9. // @icon https://banner2.cleanpng.com/20180513/xie/kisspng-twitch-computer-icons-logo-5af8037d689af0.0981376915262032614285.jpg
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. function editAdBanner() {
  16. const adButtons = document.querySelectorAll('[data-a-target="tw-core-button-label-text"]');
  17. const adButtonTexts = [
  18. "Go Ad-Free for Free",
  19. "Poista mainokset ilmaiseksi",
  20. "Poista mainokset",
  21. "Get Ad-Free",
  22. "Go Ad-Free",
  23. // add more here
  24. ];
  25.  
  26. let bannerReplaced = false;
  27.  
  28. adButtons.forEach(adButton => {
  29. if (adButton && adButtonTexts.includes(adButton.textContent.trim())) {
  30. const adContainer = adButton.closest('.InjectLayout-sc-1i43xsx-0.kBtJDm');
  31. if (adContainer) {
  32. adContainer.innerHTML = `
  33. <div style="background: transparent; border: none; padding: 0; margin: 0; width: 100%; height: 100%;"></div>
  34. `;
  35. console.log("Turbo Subscription Banner found.");
  36. bannerReplaced = true;
  37. } else {
  38. // console.warn("Turbo Subscription Banner container not found.");
  39. }
  40. }
  41. });
  42. }
  43.  
  44. editAdBanner();
  45.  
  46.  
  47. // Observer to handle dynamic changes in the DOM
  48. var observer = new MutationObserver(function(mutations) {
  49. mutations.forEach(function(mutation) {
  50. editAdBanner();
  51. });
  52. });
  53. observer.observe(document.body, { subtree: true, childList: true });
  54. })();