Geoguessr avatar ad remover

Removes the new Geoguessr avatar ad

  1. // ==UserScript==
  2. // @name Geoguessr avatar ad remover
  3. // @description Removes the new Geoguessr avatar ad
  4. // @version 1.0.0
  5. // @license MIT
  6. // @author joniber#5011
  7. // @namespace https://greasyfork.org/users/1072330
  8. // @match https://www.geoguessr.com/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=geoguessr.com
  10. // ==/UserScript==
  11.  
  12.  
  13. //=====================================================================================\\
  14. // don't edit anything after this point unless you know what you're doing \\
  15. //=====================================================================================\\
  16.  
  17. const OBSERVER_CONFIG = {
  18. characterDataOldValue: false,
  19. subtree: true,
  20. childList: true,
  21. characterData: false,
  22. };
  23.  
  24. const ERROR_MESSAGE = (wrong) => '${wrong}';
  25.  
  26. function pathMatches(path) {
  27. return location.pathname.match(new RegExp(`^/(?:[^/]+/)?${path}$`));
  28. }
  29.  
  30.  
  31. function onMutationsStandard(mutations, observer) {
  32.  
  33. let button = document.querySelector('.deal-promo-button_root__nUfyK')
  34. if(button){
  35. let div = button.parentNode
  36. if(div){
  37. div.remove()
  38. button.remove()
  39. }
  40. }
  41.  
  42.  
  43. }
  44.  
  45. const observer = new MutationObserver(onMutationsStandard);
  46.  
  47. observer.observe(document.body, OBSERVER_CONFIG);