AA for S1

Modify Stage1 text property for AA

目前為 2021-01-12 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==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();