知乎自动关闭弹窗

自动移除知乎登录(不可用)窗口和其他后续加载的弹窗

  1. // ==UserScript==
  2. // @name 知乎自动关闭弹窗
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description 自动移除知乎登录(不可用)窗口和其他后续加载的弹窗
  6. // @author nia3y
  7. // @match https://www.zhihu.com/question/*
  8. // @match https://zhuanlan.zhihu.com/*
  9.  
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. const removeNode = (node) => {
  16. node.remove();
  17. };
  18. const callback = (mutationList) => {
  19. document.querySelector('html').style.overflow = '';
  20. mutationList.forEach(mutationRecord => {
  21. mutationRecord.addedNodes.forEach(removeNode)
  22. })
  23. };
  24. const config = {
  25. childList: true,
  26. };
  27.  
  28. let observer = new MutationObserver(callback);
  29. let node = document.querySelector('body');
  30. observer.observe(node, config);
  31. })();

QingJ © 2025

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