Modify Stage1 text property for AA
当前为
// ==UserScript==
// @name AA for S1
// @namespace http://tampermonkey.net/
// @version 0.5
// @description Modify Stage1 text property for AA
// @author 冰箱研会长
// @match https://bbs.saraba1st.com/2b/*
// @grant GM_addStyle
// ==/UserScript==
var AA_author_array = new Array("冰箱研会长e-3M","冰箱研会长");
function getElementByXpath(path) {
return document.evaluate(path, document, null,
XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}
function Reset_BlockCode(NodeRoot){
var CodeBlocks = NodeRoot.getElementsByClassName("blockcode");
if(CodeBlocks){
for(var i = 0; i < CodeBlocks.length;i++){
var CodeBlock=CodeBlocks[i];
CodeBlock.style.fontSize="12px";
CodeBlock.style.lineHeight="22px";
CodeBlock.style.fontFamily="Monaco, Consolas, Lucida Console, Courier New, serif";
CodeBlock.style.whiteSpace = "normal";
}
}
}
function Reset_BlockQuote(NodeRoot){
var QuoteBlocks = NodeRoot.getElementsByClassName("blockquote");
if(QuoteBlocks){
for(var i = 0; i < QuoteBlocks.length;i++){
var QuoteBlock=QuoteBlocks[i];
QuoteBlock.style.fontSize="12px";
QuoteBlock.style.lineHeight="22px";
QuoteBlock.style.fontFamily="Monaco, Consolas, Lucida Console, Courier New, serif";
QuoteBlock.style.whiteSpace = "pre-wrap";
}
}
}
function AAPosts_Modifier(){
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( AA_author_array.includes(PostAuthor.innerText) ){
var ReplyBox = getElementByXpath(`//div[@id='postlist']/div[${PostCounter}]/table/tbody/tr[1]/td[2]/div[2]/div/div[1]/table/tbody/tr/td`);
ReplyBox.style.fontSize = "16px";
ReplyBox.style.lineHeight = "18px";
ReplyBox.style.fontFamily = "MS PGothic";
ReplyBox.style.whiteSpace = "normal";
Reset_BlockCode(ReplyBox);
Reset_BlockQuote(ReplyBox);
}
}
PostCounter = PostCounter + 1;
}
}
}
AAPosts_Modifier();