Kill CSDN popup

Remove CSDN Blog's annoying code scanning pop-ups

  1. // ==UserScript==
  2. // @name Kill CSDN popup
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Remove CSDN Blog's annoying code scanning pop-ups
  6. // @author roshanca
  7. // @match https://blog.csdn.net/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=csdn.net
  9. // @license MIT License;
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. const POPUP_CLS = 'passport-login-container';
  16. const config = {
  17. attributes: false,
  18. childList: true,
  19. subtree: true
  20. };
  21. let DOMObserver = new MutationObserver((mutationList) => {
  22. for (const mutation of mutationList) {
  23. if (mutation.type === 'childList') {
  24. const { classList } = mutation.previousSibling;
  25. if (classList.contains(POPUP_CLS)) {
  26. document.body.removeChild(mutation.previousSibling);
  27. DOMObserver.disconnect();
  28. console.log('Kill one popup which className is:', '"' + POPUP_CLS + '"');
  29. }
  30. }
  31. }
  32. });
  33. setTimeout(() => DOMObserver.observe(document.body, config), 500);
  34. })();

QingJ © 2025

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