// ==UserScript== // @name AA for S1 // @namespace http://tampermonkey.net/ // @version 0.3 // @description Modify Stage1 text property for AA // @author 冰箱研会长 // @match https://bbs.saraba1st.com/2b/* // @grant GM_addStyle // @downloadURL none // ==/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(`/html/body/div[8]/div[4]/div[2]`); if(PostLists){ //existence check if(PostLists.id == `mdly`){ //if this is your thread, the xpath of threadlist will be 8 4 3 //8 4 2 will have id "mdly" PostLists = getElementByXpath(`/html/body/div[8]/div[4]/div[3]`); if(PostLists){ //check if new postlists exist, if so, append normal procedure but for 842 var PostCounter = 1; while(getElementByXpath(`/html/body/div[8]/div[4]/div[3]/div[${PostCounter}]`)){ var PostAuthor = getElementByXpath(`/html/body/div[8]/div[4]/div[3]/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(`/html/body/div[8]/div[4]/div[3]/div[${PostCounter}]/table/tbody/tr[1]/td[2]/div[2]/div/div[1]/table/tbody/tr/td`); ReplyBox.style.fontSize = "14px"; ReplyBox.style.lineHeight = "8px"; ReplyBox.style.fontFamily = "aahub, MS PGothic"; ReplyBox.style.whiteSpace = "pre"; Reset_BlockCode(ReplyBox); Reset_BlockQuote(ReplyBox); } } PostCounter = PostCounter + 1; } } }else{ //this is not your thread, so normal 842 will be active var PostCounter = 1; while(getElementByXpath(`/html/body/div[8]/div[4]/div[2]/div[${PostCounter}]`)){ var PostAuthor = getElementByXpath(`/html/body/div[8]/div[4]/div[2]/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(`/html/body/div[8]/div[4]/div[2]/div[${PostCounter}]/table/tbody/tr[1]/td[2]/div[2]/div/div[1]/table/tbody/tr/td`); ReplyBox.style.fontSize = "14px"; ReplyBox.style.lineHeight = "8px"; ReplyBox.style.fontFamily = "aahub, MS PGothic"; ReplyBox.style.whiteSpace = "pre"; Reset_BlockCode(ReplyBox); Reset_BlockQuote(ReplyBox); } } PostCounter = PostCounter + 1; } } } } AAPosts_Modifier();