Topic and Post remover

Removes posts and topics if user ID of author/post author is in bannedUsers. You add more users by using this format = ["id","id","id"] etc.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Topic and Post remover
// @namespace    http://tampermonkey.net/
// @version      1
// @description  Removes posts and topics if user ID of author/post author is in bannedUsers. You add more users by using this format = ["id","id","id"] etc.
// @author       Ehmmkay
// @include   https://forums.d2jsp.org/topic.php?t=*&f=*
// @include	  https://forums.d2jsp.org/topic.php?t=*
// @include	  https://forums.d2jsp.org/post.php
// @include	  https://forums.d2jsp.org/forum.php?f=104
// @icon      https://www.google.com/s2/favicons?domain=d2jsp.org
// @require https://code.jquery.com/jquery-latest.js
// @grant        none
// ==/UserScript==
 
var bannedUsers = [""];
 
function parsePosts(){
    $('dl').each(function(){
        if (typeof $('dt a', this).attr('href') !== 'undefined' && ~$('dt > a', this).attr('href').indexOf('user.php?i=')) {
            var userId = $('dt > a', this).attr('href').split("=")[1];
            if(bannedUsers.indexOf(userId) !== -1){
                 this.remove()
            }
        }
    });
    }
 
function parseTopics(){
    $('tr').each(function(){
        if (typeof $('td:nth-child(3) a', this).attr('href') !== 'undefined' && ~$('td:nth-child(3) a', this).attr('href').indexOf('user.php?i=')){
            var userId = $('td:nth-child(3) a', this).attr('href').split("=")[1];
            if(bannedUsers.indexOf(userId) !== -1){
                 this.remove()
            }
        }
    });
}
 
parsePosts();
parseTopics();