Hide ads clicker

Auto clicks the hide ads button

  1. // ==UserScript==
  2. // @name Hide ads clicker
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description Auto clicks the hide ads button
  6. // @author Roboapple
  7. // @match https://beta.sankakucomplex.com/*
  8. // @icon https://www.google.com/s2/favicons?domain=tampermonkey.net
  9. // @grant GM_log
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. console.log("Active");
  15. //calls the check every 10th of a second. im bad at javescript so idk how to invoke it based on the appearance of the html element.
  16. setInterval(function(){ CheckForButton();}, 100);
  17. })();
  18.  
  19. function CheckForButton(){
  20.  
  21. //checks if the button is there and if so click it
  22. if(document.getElementsByClassName("MuiButtonBase-root MuiIconButton-root")){
  23.  
  24. for (let i = 0; i < document.getElementsByClassName("MuiButtonBase-root MuiIconButton-root").length; i++) {
  25. if(document.getElementsByClassName("MuiButtonBase-root MuiIconButton-root")[i].ariaLabel == "close"){
  26. document.getElementsByClassName("MuiButtonBase-root MuiIconButton-root")[i].click();
  27. console.log("clicked!");
  28. }
  29. }
  30. }
  31. }