干扰码清除器

清除网页中隐藏的干扰码,便于内容复制和阅读模式下阅读。

  1. // ==UserScript==
  2. // @name 干扰码清除器
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.2
  5. // @description 清除网页中隐藏的干扰码,便于内容复制和阅读模式下阅读。
  6. // @author Mr.Po
  7. // @match http*://*/thread*
  8. // @match http*://*/forum.php*
  9. // @match https://*/showpaperword?action=showbook&actmode=showpaper*
  10. // @match https://www.lightnovel.us/cn/detail/*
  11. // @require https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.0/jquery.min.js
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. /*jshint esversion: 8 */
  18.  
  19. // 干扰码处理器数组
  20. const jammerCodeHandlers = [];
  21.  
  22. // 普通BBS论坛 - 样式干扰码
  23. jammerCodeHandlers.push({
  24. support: url => url.indexOf('thread') > -1 || url.indexOf('forum.php') > -1,
  25. handle: () => $('.jammer').remove()
  26. });
  27.  
  28. // 普通BBS论坛 - 隐藏块干扰码
  29. jammerCodeHandlers.push({
  30. support: url => url.indexOf('thread') > -1 || url.indexOf('forum.php') > -1,
  31. handle: () => $("#postlist span[style=\"display:none\"]").remove()
  32. });
  33.  
  34. // 海棠文化小说站
  35. jammerCodeHandlers.push({
  36. support: url => url.indexOf('showpaperword?action=showbook&actmode=showpaper') > -1,
  37. handle: () => {
  38.  
  39. // 当此节点被插入内容时
  40. $("#readpagewidth").on('DOMNodeInserted', function() {
  41.  
  42. // 移除指定节点
  43. $(this).find("font.OutStrRnds").remove();
  44. });
  45. }
  46. });
  47.  
  48. // 轻之国度 小说站
  49. jammerCodeHandlers.push({
  50. support: url => url.indexOf('www.lightnovel.us/cn/detail/') > -1,
  51. handle: () => {
  52.  
  53. // 注册(不可用)根节点拷贝事件
  54. document.oncopy = e => {
  55.  
  56. let content;
  57. try {
  58. content = document.selection.createRange().text;
  59. } catch (t) {
  60. content = window.getSelection().toString();
  61. }
  62.  
  63. const clipboardData = window.clipboardData || e.clipboardData;
  64.  
  65. clipboardData.setData("Text", content);
  66. };
  67. }
  68. });
  69.  
  70.  
  71. const url = window.location.href;
  72. jammerCodeHandlers.filter(it=>it.support(url)).forEach(it => it.handle());
  73. })();

QingJ © 2025

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