FanFiction

enable the right-left arrow to change chapter, enable the selection of text and make the text more readable

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         FanFiction
// @namespace    http://tampermonkey.net/
// @version      1
// @description  enable the right-left arrow to change chapter, enable the selection of text and make the text more readable
// @author       Erzak78
// @match        https://www.fanfiction.net/*
// @grant        none
// ==/UserScript==

(function() {

    if(!!document.getElementById("storytext")){
        document.getElementById("storytext").style.userSelect = "text";
    }
    if(!!document.getElementById("content_wrapper")){
        document.getElementById("content_wrapper").style.width = "30%";
    }

    if(document.getElementsByClassName("timeline-Widget").length != 0){
        document.getElementsByClassName("timeline-Widget")[0].style.background="#333333";
    }

    if(document.getElementsByClassName("lc-wrapper").length != 0){
        document.getElementsByClassName("lc-wrapper")[0].children[0].style.background="#333333";
    }

    if( document.getElementsByClassName("lc").length != 0){
        document.getElementsByClassName("lc")[0].style.background = "#333333";
    }

    document.getElementById("content_parent").style.background = "#666666";
    document.getElementById("content_wrapper_inner").style.background = "rgb(51, 51, 51)";
    document.getElementById("content_wrapper_inner").style.color="#FFFFFF";

    colorLinks("#5ebfff");

    var elem = document.getElementsByClassName("reviews");
    for(var i = 0;i< elem.length;i++){
        elem[i].style.color="#f50";
    }

    elem = document.getElementsByClassName("tcat");
    for(i = 0;i< elem.length;i++){
        elem[i].style.background="#333333";
    }

    elem = document.getElementsByClassName("z-padtop2 xgray");
    for(i = 0;i< elem.length;i++){
        elem[i].style.color="#ADADAD";
    }
    document.addEventListener("keydown", keyDownTextField, false);
})();

function keyDownTextField(e) {
    var keyCode = e.keyCode;
    var url = window.location.href;
    var res = url.split("/");
    if(keyCode==39) {
        var n = document.getElementById("chap_select").length
        if(res[res.length-2]<n){
            res[res.length-2]=Number(res[res.length-2])+1;
            window.location.href = res.join("/");
        }
    } else {
        if(keyCode==37){
            if(res[res.length-2]>1){
                res[res.length-2]=Number(res[res.length-2])-1;
                window.location.href = res.join("/");
            }
        }
        if(keyCode==83){
            window.scrollBy(0,50);
        }
        if(keyCode==87){
            window.scrollBy(0,-50);
        }
    }
}

function colorLinks(hex)
{
    var links = document.getElementById("content_wrapper_inner").getElementsByTagName("a");
    for(var i=0;i<links.length;i++)
    {
        if(links[i].href)
        {
            links[i].style.color = hex;
        }
    }
}