开发者论坛

 找回密码
 注册 (请使用非IE浏览器)
查看: 1488|回复: 0

屏蔽经常发广告的用户 的油猴脚本

[复制链接]

0

精华

0

贡献

6

赞扬

帖子
23
软币
465
在线时间
44 小时
注册时间
2018-2-5
发表于 2019-11-20 13:26:09 | 显示全部楼层 |阅读模式
[JavaScript] 纯文本查看 复制代码
// ==UserScript==
// @name  黑名单-屏蔽指定用户帖子(Discuz论坛通用)
// @namespace      Violentmonkey Scripts
// @author         https://www.opo8.com
// @description    屏蔽与相应用户有关的所有内容,来源于网络(Discuz 论坛通用!)
// @include        http*://www.dxper.net/*
// @grant 	   none
// @version        1.0
// ==/UserScript==

var ID = new Array("sdfdfde3r31","asfsdfg355s","sdsdf33sd32","大乾工作室","tianttttsdf","出嘿者","daimasan");    //用户名屏蔽列表  备注: 如需屏蔽多人   按照 "用户名1","用户名2" 格式
var displaymessage = false;                  //如不需要显示屏蔽提示   请将"true"改为"false"

for (var x in ID) {
        thread = document.evaluate('//table/tbody[tr[1]/td[2]//cite/a[text()="' + ID[x] + '"]]', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
        if (thread.snapshotLength) {
                for (var i = 0; i < thread.snapshotLength; i++) {
                     if(displaymessage) {
                             thread.snapshotItem(i).innerHTML = "<tr><td class='icn'><img src='static/image/common/folder_common.gif' /></a></td><th class='common'><b>已屏蔽主题 " + "<font color=grey></th><td class='by'><cite><font color=grey>" + ID[x] + "</font></cite></td><td class='num'></td><td class='by'></td></tr>";
                         }
                         else {
                                 thread.snapshotItem(i).innerHTML = "";
                     }
                }
        }
        post = document.evaluate('//table/tbody[tr[1]/td[1]//a[text()="' + ID[x] + '"]]', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
        if (post.snapshotLength) {
                for (var i = 0, c = ""; i < post.snapshotLength; i++) {
                        c = post.snapshotItem(i).firstChild.childNodes[3].textContent.replace(/\s*/g, "").slice(0, 3);
                        c = (Number(c) > 99) ? c + "#" : c;
                        if(displaymessage) {
                             post.snapshotItem(i).innerHTML = "<p><center>已屏蔽" + " <font color=grey>" + ID[x] + "</font></center></p>";
                         }
                         else {
                                 post.snapshotItem(i).innerHTML = "";
                     }
                }
        }
         quote = document.evaluate('//blockquote[font/a/font[contains(text(),"' + ID[x] + '")]]', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
     if (quote.snapshotLength) {
        for (var i = 0; i < quote.snapshotLength; i++) {
                         if(displaymessage) {
                             quote.snapshotItem(i).innerHTML = '<p>已屏蔽引用 <font color=grey>' + ID[x] + '</font>的言论</p>';
                         }
                         else {
                                 quote.snapshotItem(i).innerHTML = '<br />';
                     }
                }
        }
         title = document.evaluate('//table/tbody[tr[1]/th[1]//a[contains(text(),"' + ID[x] + '")]]', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
                        if (title.snapshotLength) {
                                for (var i = 0, c = ""; i < title.snapshotLength; i++) {
                                        title.snapshotItem(i).innerHTML = "";
                                }
                        }

}

回复

使用道具 举报

Archiver|手机版|小黑屋|开发者网 ( 苏ICP备08004430号-2 )
版权所有:南京韵文教育信息咨询有限公司

GMT+8, 2024-4-20 21:16

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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