全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

IP归属甄别会员请立即修改密码
查看: 1107|回复: 5
打印 上一主题 下一主题

论坛屏蔽virmach帖子油猴脚本

[复制链接]
跳转到指定楼层
1#
发表于 2018-11-27 19:56:28 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
关键词自己适当改改



  1. // ==UserScript==
  2. // @name           Discuz论坛 基于ID/标题关键词 屏蔽帖子
  3. // @namespace      lisanye
  4. // @description    根据用户名、关键词,屏蔽帖子。支持配合翻页工具(例如uAutoPagerize2)
  5. // @include        */viewthread.php*
  6. // @include        */thread*
  7. // @include        */redirect.php*
  8. // @include        */forum-redirect-tid*
  9. // @include        */forum-viewthread-tid*
  10. // @include        */forum.php?mod=viewthread*
  11. // @include        */forum.php?mod=forumdisplay*
  12. // @include        */forum-*.html
  13. // @version        20171009
  14. // @grant          none
  15. // ==/UserScript==

  16. blockAll();

  17. var mo = new MutationObserver(function(allmutations) {
  18.     blockAll();
  19. });
  20. mo.observe(document.querySelector('body'), {'childList': true,'characterData':false,'subtree': true});

  21. function blockAll() {
  22.                 var dogs = new Array("nouserid");    //要屏蔽的ID,写在这行,注意英文引号
  23.                 var dogtitles = new Array("Vir", "vir","VIR","刀","$");                        //要屏蔽的标题关键字,写在这行,注意英文引号

  24.                 // 主题列表页 针对ID
  25.                 for (x in dogs) {
  26.                         dog = document.evaluate('//table/tbody[tr[1]/td[2]//cite/a[text()="' + dogs[x] + '"]]', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  27.                         if (dog.snapshotLength) {
  28.                                 for (var i = 0, c = ""; i < dog.snapshotLength; i++) {
  29.                                         //dog.snapshotItem(i).innerHTML = "<tr><td class='icn'><img src='static/image/common/folder_common.gif' /></a></td><th class='common'><b>造谣一时爽,全家火葬场:被屏蔽帖子 " + c + "<font color=red></th><td class='by'><cite><font color=red>" + dogs[x] + "</font></cite></td><td class='num'></td><td class='by'></td></tr>";
  30.                                         dog.snapshotItem(i).innerHTML = "";
  31.                                 }
  32.                         }
  33.                 }

  34.                 // 内容页 针对ID
  35.                 for (x in dogs) {
  36.                         dog = document.evaluate('//table/tbody[tr[1]/td[1]//a[text()="' + dogs[x] + '"]]', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  37.                         if (dog.snapshotLength) {
  38.                                 for (var i = 0, c = ""; i < dog.snapshotLength; i++) {
  39.                                         //c = dog.snapshotItem(i).firstChild.childNodes[3].textContent.replace(/\s*/g, "").slice(0, 2);
  40.                                         //c = (Number(c) > 9) ? c + "楼" : c;
  41.                                         //dog.snapshotItem(i).innerHTML = "<font color='#999'><center>" + c + " " + dogs[x] + "</center></font>";
  42.                                         dog.snapshotItem(i).innerHTML = "";
  43.                                 }
  44.                         }
  45.                 }

  46.                 // 主题列表页 针对标题
  47.                 for (x in dogtitles) {
  48.                         dog = document.evaluate('//table/tbody[tr[1]/th[1]/a[contains(text(),"' + dogtitles[x] + '")]]', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  49.                         if (dog.snapshotLength) {
  50.                                 for (var i = 0, c = ""; i < dog.snapshotLength; i++) {
  51.                                         dog.snapshotItem(i).innerHTML = "";
  52.                                 }
  53.                         }
  54.                 }

  55.                 // 不明
  56.                 for (x in dogs) {
  57.                         dog = document.evaluate('//table/tbody[tr[1]/td[1]/div[1]//font[text()="' + dogs[x] + '"]]', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  58.                         if (dog.snapshotLength) {
  59.                                 for (var i = 0, c = ""; i < dog.snapshotLength; i++) {
  60.                                         c = String(dog.snapshotItem(i).firstChild.childNodes[3].textContent.match(/\d+#/)).replace(/#/, "楼");
  61.                                         dog.snapshotItem(i).innerHTML = "<b><center>c被屏蔽帖子 " + c + " <font color=red>" + dogs[x] + "</font></center></b>";
  62.                                         //dog.snapshotItem(i).innerHTML = "";
  63.                                 }
  64.                         }
  65.                 }
  66. }
复制代码


脚本原地址:https://greasyfork.org/zh-CN/scripts/27275-discuz%E8%AE%BA%E5%9D%9B-%E5%9F%BA%E4%BA%8Eid-%E6%A0%87%E9%A2%98%E5%85%B3%E9%94%AE%E8%AF%8D-%E5%B1%8F%E8%94%BD%E5%B8%96%E5%AD%90/code
2#
发表于 2018-11-27 20:06:27 来自手机 | 只看该作者
这么硬核的嘛?
3#
发表于 2018-11-27 20:07:04 | 只看该作者
给力,不然要输光光了
4#
发表于 2018-11-27 20:08:11 | 只看该作者
下次黑五早点发出来
5#
发表于 2018-11-27 20:09:29 | 只看该作者
手机端解决不了呀
6#
发表于 2018-11-27 20:09:35 | 只看该作者
此脚本已被删除
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2025-11-3 15:54 , Processed in 0.076776 second(s), 10 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表