Block certain user's content
当前为
// ==UserScript==
// @name S1 User Blocker
// @namespace http://tampermonkey.net/
// @version 0.4
// @description Block certain user's content
// @author 冰箱研会长
// @match https://bbs.saraba1st.com/2b/*
// ==/UserScript==
var User_Blocked = new Array(`要屏蔽的用户1`,`这里用的是键盘左上角的backtick符号`,`逗号分隔主体`);
var Correspond_Section = new Array(`和用户1对应的板块名称`,`PC数码`,`动漫论坛PC数码`);
function S1_Reply_Blocker(){
var PostLists = getElementByXpath(`//div[@id='postlist']`);
if(PostLists){
var PostCounter = 1;
while(getElementByXpath(`//div[@id='postlist']/div[${PostCounter}]`)){
var PostAuthor = getElementByXpath(`//div[@id='postlist']/div[${PostCounter}]/table/tbody/tr[1]/td[1]/div/div[1]/div/a`);
if(PostAuthor){
if( User_Blocked.includes(PostAuthor.innerText) ){
var PostSection = getElementByXpath(`/html/body/div[8]/div[2]/div/a[4]`).innerText;
if(Correspond_Section[User_Blocked.indexOf(PostAuthor.innerText)] == ""){
getElementByXpath(`//div[@id='postlist']/div[${PostCounter}]`).style.display = `none`;
}else if(Correspond_Section[User_Blocked.indexOf(PostAuthor.innerText)].includes(PostSection)){
getElementByXpath(`//div[@id='postlist']/div[${PostCounter}]`).style.display = `none`;
}
}
}
PostCounter = PostCounter + 1;
}
}
}
function S1_Sure_Blocker(){
//var SureList = getElementByXpath('/html/body/div[8]/div[4]/div/div/div[5]/div[2]/form/table');
var SureList = getElementByXpath(`//*[@id="threadlisttableid"]`);
if(SureList){
var SureCounter = 1;
//while(getElementByXpath(`/html/body/div[8]/div[4]/div/div/div[5]/div[2]/form/table/tbody[${SureCounter}]`)){
while(getElementByXpath(`//*[@id="threadlisttableid"]/tbody[${SureCounter}]`)){
//var SureAuthor = getElementByXpath(`/html/body/div[8]/div[4]/div/div/div[5]/div[2]/form/table/tbody[${SureCounter}]/tr/td[2]/cite/a`);
var SureAuthor = getElementByXpath(`//*[@id="threadlisttableid"]/tbody[${SureCounter}]/tr/td[2]/cite/a`);
if(SureAuthor){
if(User_Blocked.includes(SureAuthor.innerText)){
var SureSection = getElementByXpath(`/html/body/div[8]/div[2]/div/a[4]`).innerText;
if(Correspond_Section[User_Blocked.indexOf(SureAuthor.innerText)] == ""){
getElementByXpath(`//*[@id="threadlisttableid"]/tbody[${SureCounter}]`).style.display = `none`;
}else if(Correspond_Section[User_Blocked.indexOf(SureAuthor.innerText)].includes(SureSection)){
getElementByXpath(`//*[@id="threadlisttableid"]/tbody[${SureCounter}]`).style.display = `none`;
}
}
}
SureCounter = SureCounter + 1;
}
}
}
S1_Reply_Blocker();
S1_Sure_Blocker();