1024净化

1024论坛净化,屏蔽成人内容,改变主题样式

  1. // ==UserScript==
  2. // @name 1024净化
  3. // @namespace https://sxxskeji.com/
  4. // @version 0.2
  5. // @description 1024论坛净化,屏蔽成人内容,改变主题样式
  6. // @author geek from 2023
  7. // @match *://t66y.com/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=zhihu.com
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. var banner = document.getElementsByClassName('banner')[0];
  16. banner.style.display='none';
  17.  
  18. document.getElementsByClassName('guide')[0].style.display='none';
  19.  
  20. document.body.innerHTML = document.body.innerHTML.replace(/草榴社區/g, '学习强国');
  21. document.head.innerHTML = document.head.innerHTML.replace(/草榴社區/g, '学习强国');
  22.  
  23. document.head.innerHTML += '<link rel="icon" href="https://www.google.com/s2/favicons?sz=64&domain=zhihu.com" type="image/x-icon">';
  24.  
  25. function replaceColor(node, originalColor, targetColor) {
  26. // 递归基:如果节点为null或者不是元素节点,则直接返回
  27. if (!node || node.nodeType !== Node.ELEMENT_NODE) { return; }
  28. // 替换指定颜色为目标颜色
  29. const currentColor = window.getComputedStyle(node).backgroundColor;
  30. if (currentColor === originalColor) {
  31. node.style.backgroundColor = targetColor;
  32. }
  33. // 获取当前节点的所有子节点
  34. const children = node.childNodes;
  35. // 遍历当前节点的子节点
  36. for (const child of children) {
  37. // 递归遍历子节点
  38. replaceColor(child, originalColor, targetColor);
  39. }
  40. }
  41. // 调用replaceColor函数并传入整个DOM树的根节点、原始颜色和目标颜色
  42. replaceColor(document.body, 'rgb(177, 211, 224)', '#334154');
  43.  
  44. function changeAllTextColor(node){
  45. // 递归基:如果节点为null或者不是元素节点,则直接返回
  46. if (!node || node.nodeType !== Node.ELEMENT_NODE) { return; }
  47. node.style.color='#fff';
  48. // 获取当前节点的所有子节点
  49. const children = node.childNodes;
  50. // 遍历当前节点的子节点
  51. for (const child of children) {
  52. // 递归遍历子节点
  53. changeAllTextColor(child);
  54. }
  55. }
  56. var h_list = document.getElementsByClassName('h');
  57. for (const h of h_list){
  58. if (h.querySelector('b')!=null && h.querySelector('b').innerText == '版塊公告'){
  59. h.parentNode.parentNode.parentNode.parentNode.style.display='none';
  60. }
  61. changeAllTextColor(h);
  62. }
  63.  
  64. function hidePrevNode(node){
  65. if (!node || node.nodeType !== Node.ELEMENT_NODE) { return; }
  66. node.style.display='none';
  67. var prev_node = node.previousElementSibling;
  68. if (prev_node && prev_node.firstElementChild.innerHTML == '贊'){ return;}
  69. hidePrevNode(prev_node);
  70. }
  71.  
  72. var tac_head = document.querySelector('.tr2 .tac');
  73. if(tac_head != null && tac_head.innerText == '普通主題'){
  74. hidePrevNode(tac_head.parentNode);
  75. }
  76.  
  77. var exclude_title = [
  78. '淫妻',
  79. '反差婊',
  80. '母狗',
  81. '一夜精品',
  82. '国货MM',
  83. '每日有货',
  84. '精选照片',
  85. '国产小姐姐的芳菲斗艳',
  86. '翻墙后看什么',
  87. '性话题',
  88. '抖快直播闪现',
  89. 'GIF',
  90. '女优',
  91. '榴影分享',
  92. 'AV',
  93. '后入',
  94. '原创',
  95. '爱看twitter',
  96. '推上经典',
  97. '榴影分享',
  98. '花样年华的姐姐',
  99. '图文解说',
  100. '宅男姬',
  101. '杏林春暖',
  102. '爱妻分享',
  103. '时来孕转',
  104. '双飞',
  105. 'sm',
  106. '字母圈',
  107. '绿帽奴',
  108. '性奴',
  109. '爆乳',
  110. '操我',
  111. 'ntr',
  112. '3p',
  113. '多人运动',
  114. '动图',
  115. '反差',
  116. '淫荡',
  117. '吃鸡',
  118. '约啪',
  119. '奶子',
  120. '露出',
  121. '屁股',
  122. '私房',
  123. '抖奶',
  124. '色而不淫',
  125. '上推特看',
  126. '看美女能长寿',
  127.  
  128. ]
  129.  
  130. var exclude_author = [
  131. '熵增',
  132. '费曼',
  133. '北方彭于晏',
  134. '海龙云石三',
  135. '桜木花道',
  136. '赵奕欢',
  137. '榴九',
  138. '第七日魔人',
  139. ]
  140.  
  141. var tr3_list = document.getElementsByClassName('tr3');
  142. for (const tr3 of tr3_list) {
  143. if(tr3.querySelector('.tal h3 a') == null)
  144. {
  145. break;
  146. }
  147. var tr_title = tr3.querySelector('.tal h3 a').innerText;
  148. var tr_author = tr3.querySelector('td .bl').innerText
  149. console.log(tr_author);
  150. for(const ex_title of exclude_title)
  151. {
  152. if(tr_title.includes(ex_title))
  153. {
  154. tr3.style.display='none';
  155. break;
  156. }
  157. }
  158. for(const ex_author of exclude_author)
  159. {
  160. if(ex_author == tr_author)
  161. {
  162. tr3.style.display='none';
  163. break;
  164. }
  165. }
  166. }
  167.  
  168. var head_list = document.querySelectorAll('.tac img');
  169. for(const head of head_list){ head.style.display='none';}
  170.  
  171.  
  172. })();