AA for S1

Modify Stage1 text property for AA

当前为 2021-01-12 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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();