FreeCodeCamp No Pop-up

Remove all popup in FreeCodeCamp

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name            FreeCodeCamp No Pop-up
// @name:vi         FreeCodeCamp Không Phiền Phức
// @namespace       https://lelinhtinh.github.io
// @description     Remove all popup in FreeCodeCamp
// @description:vi  Xóa các bảng xác nhận trên FreeCodeCamp
// @version         1.0.0
// @icon            https://www.freecodecamp.org/icons/icon-72x72.png
// @author          lelinhtinh
// @oujs:author     baivong
// @license         MIT; https://baivong.mit-license.org/license.txt
// @match           https://www.freecodecamp.org/learn/*
// @require         https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js?v=a834d46
// @noframes
// @supportURL      https://github.com/lelinhtinh/Userscript/issues
// @grant           GM_addStyle
// ==/UserScript==

GM_addStyle(`[role="dialog"]:not([class]) {
  visibility: hidden;
  pointer-events: none;
}`);

const targetNode = document.body;
const observerOptions = {
  childList: false,
  attributes: true,
};
const removePopup = () => {
  const $submit = document.querySelector('.modal button:not(.close,.confirm-donation-btn)');
  if ($submit) $submit.click();
};
const watchBody = (mutationList, observer) => {
  mutationList.forEach((mutation) => {
    if (mutation.type !== 'attributes') return;
    if (mutation.attributeName === 'class' && targetNode.classList.contains('modal-open')) removePopup();
  });
};
const observer = new MutationObserver(removePopup);
observer.observe(targetNode, observerOptions);