Greasy Fork is available in English.

GOTOES Fit File Editor - Auto Close Popup

Automatically clicks the close button on popup donation nag

  1. // ==UserScript==
  2. // @name GOTOES Fit File Editor - Auto Close Popup
  3. // @namespace typpi.online
  4. // @version 2024.11.06
  5. // @description Automatically clicks the close button on popup donation nag
  6. // @author Nick2bad4u
  7. // @match https://gotoes.org/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=gotoes.org
  9. // @grant none
  10. // @homepageURL https://github.com/Nick2bad4u/UserStyles
  11. // @supportURL https://github.com/Nick2bad4u/UserStyles/issues
  12. // @license UnLicense
  13. // ==/UserScript==
  14.  
  15. (function () {
  16. 'use strict';
  17.  
  18. // Function to click the close button
  19. function closePopup() {
  20. const popupContent = document.querySelector(
  21. 'a[href="https://gotoes.org/stravatoolsforum/viewtopic.php?f=2&t=115"] h3',
  22. );
  23. console.log('closePopup: popupContent', popupContent);
  24. if (
  25. popupContent &&
  26. popupContent.innerHTML.includes('Option 2:<br>Help Others (FREE)')
  27. ) {
  28. const closeButton = document.getElementById('cboxClose');
  29. console.log('closePopup: closeButton', closeButton);
  30. if (closeButton) {
  31. closeButton.click();
  32. console.log('closePopup: closeButton clicked');
  33. }
  34. }
  35. }
  36.  
  37. // Observe changes in the DOM to detect when the popup appears
  38. const observer = new MutationObserver(() => {
  39. const popupContent = document.querySelector(
  40. 'a[href="https://gotoes.org/stravatoolsforum/viewtopic.php?f=2&t=115"] h3',
  41. );
  42. console.log('MutationObserver: popupContent', popupContent);
  43. if (popupContent) {
  44. closePopup();
  45. }
  46. });
  47. observer.observe(document.body, {
  48. childList: true,
  49. subtree: true,
  50. });
  51.  
  52. // Initial check in case the popup is already present
  53. const popupContent = document.querySelector(
  54. 'a[href="https://gotoes.org/stravatoolsforum/viewtopic.php?f=2&t=115"] h3',
  55. );
  56. console.log('Initial check: popupContent', popupContent);
  57. if (popupContent) {
  58. closePopup();
  59. }
  60. })();