大贤者
精华
|
战斗力 鹅
|
回帖 0
注册时间 2020-10-21
|
本帖最后由 冰箱研会长e-3M 于 2021-1-12 21:43 编辑
https://greasyfork.org/zh-CN/scripts/420012-aa-for-s1
不需要手动输入了...
-------------
删除了GITHUB和GITEE的仓库, 下面的链接基本都作废了.
这里可以安装最新版
试着用XPATH重新写了一遍, 有好好在工作呢(
- // ==UserScript==
- // @name AA for S1
- // @namespace http://tampermonkey.net/
- // @version 0.3
- // @updateURL https://gitee.com/Arxher/AA-For-Stage1st/raw/main/AA4S1.user.js
- // @downloadURL https://gitee.com/Arxher/AA-For-Stage1st/raw/main/AA4S1.user.js
- // @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(`/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();
复制代码
-------------------
项目GITHUB地址
一键安装! GITEE版本无需翻墙, 就是可能我会忘记同步, 所以版本有落后一点...
一键安装!可能需要翻墙
请先确认浏览器有安装Tampermonkey或者其他userscript引擎.
简单更新了一下, 之前的版本启用之后,“对整个S1的影响, 不可估量”,
所以这次的版本的逻辑就是
1. 建立一个 "发布AA的人" 的id列表
2. 找到他们发的贴子
3. 对他们的帖子内容进行修饰
学习JS已经半天的我给出的代码是这样的, 诸君感觉有喷点不用藏着掖着, 指出来就当帮我进步了.
- // ==UserScript==
- // @name AA for S1
- // @namespace http://tampermonkey.net/
- // @version 0.g
- // @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","冰箱研会长");
- // 在这里加入发布AA的人的ID
- function AAPosts_Modifier(NodeRoot){
- var PostLists = NodeRoot.getElementById("postlist");
- var PostTables = PostLists.getElementsByClassName("plhin");
- for (var i=0;i< PostTables.length;i++){
- var PostTable = PostTables[i];
- if(AA_author_array.includes( PostTable.getElementsByClassName("pls favatar")[0].
- getElementsByClassName("authi")[0].
- getElementsByTagName("a")[0].
- innerText)){
- //PostTable.getElementsByClassName("t_fsz")[0].style.color = "#022c80";
- PostTable.getElementsByClassName("t_fsz")[0].style.fontSize = "14px";
- PostTable.getElementsByClassName("t_fsz")[0].style.lineHeight = "8px";
- PostTable.getElementsByClassName("t_fsz")[0].style.fontFamily = "aahub, MS PGothic";
- PostTable.getElementsByClassName("t_fsz")[0].style.whiteSpace = "pre";
- Reset_BlockCode(PostTable.getElementsByClassName("t_fsz")[0]);
- }
- }
- }
- //专门用来重置代码块的函数... 这个实现直觉上让我觉得好笨
- function Reset_BlockCode(NodeRoot){
- var CodeBlocks = NodeRoot.getElementsByClassName("blockcode");
- for(var i = 0; i < CodeBlocks.length;i++){
- var CodeBlock=CodeBlocks[i];
- //CodeBlock.style.color="#022c80";
- CodeBlock.style.fontSize="12px";
- CodeBlock.style.lineHeight="22px";
- CodeBlock.style.fontFamily="Monaco, Consolas, Lucida Console, Courier New, serif";
- CodeBlock.style.whiteSpace = "normal";
- }
- }
- AAPosts_Modifier(document)
复制代码
---因为/[page/]标签会刷新掉脚本做的修改所以手动打出来的更新分界线---
本来是不想发这个帖子, 想着日后真的要弄一个AA串的话, 就写在主楼的,
但是我在编辑草稿(测试)的时候点错直接发出来了, 所以将错就错了...
脚本是很简单的, 用GM_addStyle方法把S1的t_fsz的 样式 修改为适合显示AA的样式就完事了.
脚本一共用了两个字体AAHUB和MS PGothic, 后者系统应该会自带.
现在, 没弄明白的是启用脚本之后, 代码块的行距会变得异常的大, CSS我不是了解的很清楚, 不知道有没有巨巨指教一下
代码如下:
- // ==UserScript==
- // @name AA for S1
- // @namespace http://tampermonkey.net/
- // @version 0.e
- // @description Modify Stage1 text property for AA
- // @author 冰箱研会长
- // @match https://bbs.saraba1st.com/2b/*
- // @grant GM_addStyle
- // ==/UserScript==
- GM_addStyle ( `
- .t_fsz {
- font-family: aahub,MS PGothic;
- white-space: pre;
- font-size: 14px;
- line-height: 8px;
- }
- `);
复制代码
去TamperMoneky里新建脚本, 复制粘贴之后刷新页面, 应该就可以看到下方正确显示的AA画了.
(PC ONLY)
i| | i| / _ -ニニ=- _ // __
i| | ∨ _-ニニニニニニ- _ , / |、 ―=ミ 、
i| | | j/ニニニニニニニニ- __ _,/ / _jニ〉 ./ \
i| | | _-ニニニニニ-=<_¨⌒ ー==‐/ / __ -ニア /  ̄ ̄>x、
:, i| | 〈ニニニニニ=-----――へ、_/ /_ -=ニニニニニニア / / _/-=ニニニ\
′ , ∨/ , ヘ_jニニニ‐'" ___ -=ニア'厂/ /ニニニニニニニニア _/ / . /ニニ=-  ̄ ̄`
∧ ∨ ∨/ / /)=ァ ̄_ -ニニニニニニ=‐'" ∨./ニニニニニニ=- ----=<_ ̄ ̄ < //-  ̄ -===―'⌒
/∧ ∨ ∨/ _j _∠斗ニニ=-―――<_ 、 / /¨ -弌ニニア´ __ z――― __`弌ix、 `く _ -ニ- __¨__<ニニ
、 ∨/ _厂ア´-ニニニニ- i圦. \ 、\ ( ̄ ' / _厂 _ ___/ /ア´/⌒)x マ_)hx \_/ニニニニニ
、\ 弌__,厂 -=ニニニ厂 | 、(\xf示ト、 j// ̄x┐ /⌒ア´ ノ |/___/⌒)x ( ̄)x ⌒!~ <ニニニニ
\ 、弌ニニニニア / i|. j_x=、/ Vソ| iト、 |(__厂 j/ . イ ∠ ア⌒丁>=- 寸{ }i ∧ `寸ニニ
__ -=ニ)hx 寸ニニニニ7j| ./ i| 圦 v) | l|个 | \./ / / / ∠=- 厂ニ/ ,i V ∧ |ニ 〈\ 寸ニ
` -ニニニニニ)hx 寸-¨下弌i|/ 八 、 乂V 、 / / ./ / ∠ --=<ニ/_∠i| 〈ニ| .|ニ |ニニ⌒ニニ
`¨¨¨¨¨¨弌ニニ)x 寸∧ニニ寸ニ‐| 厂个 _`_/ __j/ 厂- _ | i| \/ j'" __  ̄\| i|ニ| i|ニ |ニニニニニ
^寸ニ)x 寸ニニニニ{ 〈ニア 厂⌒j厂/ .イニニニ! { | く\/ニニ7⌒>x / 八i |ニ マニニニニ
x/ ̄ ̄ ⌒)x`弌-=ニニ {〈 { _/Z / i|ニ( ̄`寸x `く| ( -ニニニニ|/ /∨ /ニ| !' ノニニニニ
___)\_ ( 〈 / /)hx `弌i厂) Ⅵ j厂 ____/} 厂}\ `⌒>圦 ___`寸ニ| j=- イ ∨ _ イニニニニニ
ニニニ-_ `弌L_ / ̄_ イ厂 i|)hx `弌x\ ̄ /]/ニ〈 {\ [/ /ノ `、 弌=- __(ニニニ| ,ニニニニニニ厂
寸ニニニニ-_ 寸/ /ア´ / | { ≧=- _` __ [_/.ア^弌_ \{/ {ノ \ ー― (_厂〉 | /ニニニニ- j/
マニニニニ} 乂 //i| { .〉i圦 i| ≧=― / |/ 、 ⌒7 〈 /〉 )hx__ イニノ ⌒!ニ=- /
. マニニ[__] |i/ 乂! 、 八_jk | _/ / / i| ノ__/〈 /ニニニ=- __ 彡 / __ノ/⌒> /
.}ニニニニ| i〈 ( ゝ ト、 \[ ̄,ノ、\ _____厂_∧ 、 / /| 〈⌒ア 寸ニニニ| マニニニ| jN/ |_ア^>'" _ <
.}ニニニニ| |个x弌=--=彡厂ア二\ \―― ア //ニi\___j{ i|| /⌒ix `弌ニニ| マニ=- / L=- <  ̄ ̄
./ニニニニi| |ニニ{≧z--<ニ/ > `ー//i |ニニニ八 i|| 寸-x 寸=- ___. -=彡 >'" __/ ir‐=< \
/ニニニ厂 ̄ ]寸_乂_厂ア/ /厂ア/| .人寸ニニ{ \ 、 寸ニx `ー=====―'"´____ ア⌒i| | \ 、
./ニニニニニ≧=-----=≦ニ′ |∧[/} j 寸 7^弌乂_ \ \`弌ニ=------=≦ニニニjア |ト、 \ `、
ニニニニニニニニニニニニ{ | / {  ̄`寸ix ` -\ \ 弌x ` < / _ -='" 八 \ `、 j!
`寸ニニニニニニニニニ厂/ i| | .∧ { ⌒ -ニ=- 寸x、` ⌒ ̄  ̄ ̄ ̄__∠/ イ `、 V∧|
\ 寸ニニニニニニニニ/ i| i|__ -=- {\ `弌\_>ニ=―――― __彡' _ -ニ ∨|
ニニ)x -==ニニニニニ/____jL -==-⌒ 、 `、 \  ̄ ̄ ̄ アZ-=≦ニニニア´ /ニア´ ∠=-ニニ 、 } Ⅵ
ニニニ=― __ ィ⌒厂 , 、 `、 `¨¨ア¨¨⌒ `寸ニニア´ /ニア´ _. 彡ニニニニ〉 ∨ ∧ jノ
≧=――――=⇒'" / | ′ 丶、 `、 / 、 i|ニニア ∠=‐'" _ -ニニニニニニニ/ /__ ∧ |
ニニニニニア´ ./ | ', /{ `、 /| `、 /-ア '"´ _-ニニニニニニニニニア} 「⌒∨| |
`マニニニニi{ ′ 、 / 乂 ∨| `弌/ _ -ニニニニニニニニニニア } | j__厂
. }ニニニニ 、 , iL___ `弌{  ̄ 八 厂 _ -ニニニニニニニニニニニイ j/⌒´
マニニニニ\ { 「 ̄\ ___j / / _ -ニニニニニニニニニニ> '| ノ
寸ニニニニ/` { __〉 丶、___厂 / /_ -ニニニニニニニニニニ‐ .ノ ∧
` ―=/ ー< ̄∧ __/ __ ,___//ニニ‐  ̄ ̄ ー‐ ∠_/
. 〈____厂 ̄ 、 〈::::/ /::::\ , -====j /=-
/\ ∧:' /::::::::::::::::>'
,.-、 ,,-‐、
| :`ヽ、 ,..--..,, ,,.--‐'" |
| ゞ''"" ヾ /
! ,.' |
‐‐┼- ;
‐┼- ● ● ー┼-
.‐十 ‐┼-
- ヽ、 (_人_) ゙メ、
_______ ` 、 ヽ_ノ /
/ \/ ヽ /、
/ ,.. -‐‐- 、 \ ヽ
}∠,..艦__これ_ \ \ `、
/.:.:.:./ \|\:.:.:.\\ , / ./|
.(二)i:/n n\i:.:.:.:.i‘, } ./ ./ .|
. i:人| U U l:.:.:Λ:‘,/ ./ ./ |
<人( u ,':.:./´ヽ:.:´ ./ ./ |
/:.个: . __▽__ ,./:∠:.ヽ ヽ ./ ./ .|
{:.:.:‘, ....| | | ヽ ヽ _ノ ./ .|
人:.:.:.: .| | | ノi:.:.ヽ _ _ ノ |
`¨¨´. .| | | `、_,.ノ |
| | | |
| | | |
| | | |
_| |_ ', |
く´ヽ| |/`ゝ 、 /
| |`-∞-´{`l { ┬┬┬┬ ,′
ヽ!__ ___{O | .| .|| | ,
ノ | | ̄| | |ヽ | | .|| .| .|
\|_|_|_|_|_/ } | || .| |
|_| |_| ノ | ヽ_`| ヽ──、
」.| 」.| ` ー┘ `└一 ' ̄ ̄´
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
×
评分
-
查看全部评分
|