防覆盖

避免 content-wrapper 被覆盖

  1. // ==UserScript==
  2. // @name 防覆盖
  3. // @namespace https://yffjglcms.com/
  4. // @version 1.0
  5. // @description 避免 content-wrapper 被覆盖
  6. // @match https://doc.iocoder.cn/*
  7. // @grant none
  8. // @run-at document-start
  9. // @run-at document-body
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // 保存原始的 jQuery.html 方法
  17. const originalHtml = $.fn.html;
  18.  
  19. // 重写 jQuery.html 方法
  20. $.fn.html = function(content) {
  21. if (this.hasClass("content-wrapper")) {
  22. console.log("拦截了对 .content-wrapper 的修改:", content);
  23. return this; // 阻止修改
  24. }
  25. return originalHtml.apply(this, arguments);
  26. };
  27.  
  28. // 拦截 setTimeout,阻止指定的代码执行
  29. const originalSetTimeout = setTimeout;
  30. window.setTimeout = function(callback, delay) {
  31. const callbackStr = callback.toString();
  32. if (callbackStr.includes('$(".content-wrapper").html')) {
  33. console.log("拦截了 setTimeout 中的修改操作:", callbackStr);
  34. return; // 阻止执行
  35. }
  36. return originalSetTimeout(callback, delay);
  37. };
  38. })();

QingJ © 2025

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