您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Changes colors and formats stats to make it easier to read while scrolling, with Fandom blacklist included in the script.
当前为
// ==UserScript== // @name Fanfiction.net - Beautify Status Scrolling For Dark Reader // @namespace http://tampermonkey.net/ // @version 1.61 // @description Changes colors and formats stats to make it easier to read while scrolling, with Fandom blacklist included in the script. // @author バカなやつ // @license MIT // @match https://www.fanfiction.net/* // @icon https://www.google.com/s2/favicons?sz=64&domain=fanfiction.net // @grant GM_addStyle // ==/UserScript== GM_addStyle(".lightGreenHighlight {color:#C4FFCA;}"); GM_addStyle(".greenHighlight {color:#04AD5C;}"); GM_addStyle(".redHighlight {color:#CC5500;}"); GM_addStyle(".yellowHighlight {color:#FFC300;}"); GM_addStyle(".pinkHighlight {color:#FFC0CB;}"); GM_addStyle(".z-indent {padding-left: 60px;}"); GM_addStyle(".reviews {color: rgb(255, 102, 26); text-decoration-color: initial;}"); (function() { 'use strict'; // const blacklist_fandoms = ["Harry", "Doctor Who", "Crossover - Star Wars", "Yu-Gi-Oh"] const blacklist_fandoms = []; let isReadingPage = document.URL.startsWith("https://www.fanfiction.net/s/") function rep(pattern, text, replace){ let re = new RegExp(pattern); return text.replace(re, replace); } function mat(pattern, text){ let re = new RegExp(pattern) return re.exec(text)[1]; } // Short-form for replacematch function repmat(pattern, text, replace){ let re = new RegExp(pattern); let num = re.exec(text)[1]; if (replace.startsWith("<a")){ return text.replace(re, replace + num + "</a> "); }else{ return text.replace(re, replace + num + "</span> "); } } function cList(story, status){ let n_sub = status.innerHTML; let ahref if (isReadingPage){ ahref = mat(/Reviews:\s.*?>(.*?)<.*?>/g, n_sub); } else { ahref = mat(/<a class="reviews".*?f="(.*?)?">/g, story.innerHTML); } // Removes the original Review Link if (!isReadingPage){ let review = story.getElementsByClassName("reviews")[0] review.parentNode.removeChild(review); } let nStoryName; if(isReadingPage){ nStoryName = document.getElementsByClassName("xcontrast_txt")[3]; nStoryName.innerHTML = "<span class='greenHighlight'>" + nStoryName.innerHTML + "</span>"; } else { nStoryName = mat(/(.*?)\s-\sRated:/g, n_sub); n_sub = "<span class='greenHighlight'>" + nStoryName + rep(/(.*?)\s-\sRated:/g, n_sub, "</span> - Rated:"); } n_sub = repmat(/Chapters:\s(.*?)\s/g, n_sub, "<br><span class='yellowHighlight'>Ch: "); n_sub = repmat(/Words:\s(.*?)\s/g, n_sub, "<span class='pinkHighlight'>W: "); if (isReadingPage){ n_sub = repmat(/Reviews:\s.*?>(.*?)<.*?>/g, n_sub, "<a class='reviews'>Reviews: "); } else { n_sub = repmat(/Reviews:\s(.*?)\s/g, n_sub, "<a class='reviews'>Reviews: ");} n_sub = repmat(/Favs:\s(.*?)\s/g, n_sub, "<span class='lightGreenHighlight'>Favs: "); n_sub = repmat(/Follows:\s(.*?)\s/g, n_sub, "<span class='lightGreenHighlight'>Follows: "); if (n_sub.search(/Updated:\s.*?>(.*?)<.*?\>/) != -1){ n_sub = repmat(/Updated:\s.*?>(.*?)<.*?\>/g, n_sub, "<span class='lightGreenHighlight'>Updated: "); } // Moves the "Publish: ... Characters:" before "<br>Chapters:" let t = n_sub.slice(n_sub.search(/Published:/)); // Remove previous "Publish: ... Characters:" n_sub = n_sub.slice(0, n_sub.search(/\s\-\sPublished:/)); // puts <br> before <span class='yellowHighlight'>W: n_sub = rep(/<br>/, n_sub, t + "<br>"); status.innerHTML = n_sub; status.getElementsByClassName("reviews")[0].setAttribute("href", ahref); } window.addEventListener("load", function() { let stories = document.getElementsByClassName("z-list") for (let i = stories.length - 1; i > -1; i--){ let stat = stories[i].getElementsByClassName("z-padtop2") let text = stat[0].innerHTML if (blacklist_fandoms.some(v => text.includes(v))) { stories[i].parentNode.removeChild(stories[i]); } } let stat = document.getElementsByClassName("z-padtop2") for (let i = 0; i < stories.length; i++){ cList(stories[i], stat[i]); } stories = document.getElementsByClassName("profile_top"); stat = document.getElementsByClassName("xgray")[0]; cList(stories, stat); }); })();