FreeCodeCamp No Pop-up

Remove all popup in FreeCodeCamp

  1. // ==UserScript==
  2. // @name FreeCodeCamp No Pop-up
  3. // @name:vi FreeCodeCamp Không Phiền Phức
  4. // @namespace https://lelinhtinh.github.io
  5. // @description Remove all popup in FreeCodeCamp
  6. // @description:vi Xóa các bảng xác nhận trên FreeCodeCamp
  7. // @version 1.0.0
  8. // @icon https://www.freecodecamp.org/icons/icon-72x72.png
  9. // @author lelinhtinh
  10. // @oujs:author baivong
  11. // @license MIT; https://baivong.mit-license.org/license.txt
  12. // @match https://www.freecodecamp.org/learn/*
  13. // @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js?v=a834d46
  14. // @noframes
  15. // @supportURL https://github.com/lelinhtinh/Userscript/issues
  16. // @grant GM_addStyle
  17. // ==/UserScript==
  18.  
  19. GM_addStyle(`[role="dialog"]:not([class]) {
  20. visibility: hidden;
  21. pointer-events: none;
  22. }`);
  23.  
  24. const targetNode = document.body;
  25. const observerOptions = {
  26. childList: false,
  27. attributes: true,
  28. };
  29. const removePopup = () => {
  30. const $submit = document.querySelector('.modal button:not(.close,.confirm-donation-btn)');
  31. if ($submit) $submit.click();
  32. };
  33. const watchBody = (mutationList, observer) => {
  34. mutationList.forEach((mutation) => {
  35. if (mutation.type !== 'attributes') return;
  36. if (mutation.attributeName === 'class' && targetNode.classList.contains('modal-open')) removePopup();
  37. });
  38. };
  39. const observer = new MutationObserver(removePopup);
  40. observer.observe(targetNode, observerOptions);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址