qidian

起点,q开启换装,w关闭换装,a上一章,s下一章

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

Advertisement:

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

Advertisement:

// ==UserScript==
// @name         qidian
// @namespace    http://tampermonkey.net/
// @description	 起点,q开启换装,w关闭换装,a上一章,s下一章
// @version      0.1.1
// @description  try to take over the world!
// @author       You
// @match			https://vipreader.qidian.com/chapter*
// @include			https://vipreader.qidian.com/chapter*
// @require      https://cdn.bootcss.com/jquery/2.2.1/jquery.js
// @grant        GM_addStyle
// ==/UserScript==

(function () {
    'use strict';
    var $prevHref = document.querySelector('#j_chapterPrev')
    var $nextHref = document.querySelector('#j_chapterNext')
    var $favicon1 = document.querySelector('link[rel="shortcut icon"]');
    var $favicon2 = document.querySelector('link[rel="Bookmark"]');
    localStorage.setItem('qidianTitle', document.title)
    localStorage.setItem('qidianIconhref1', encodeURIComponent($favicon1.href))
    localStorage.setItem('qidianIconhref2', encodeURIComponent($favicon2.href))
    var format = function () {
        document.getElementsByTagName('body')[0].setAttribute('style', 'background:#fff;zoom:1')
        document.getElementById('readHeader').setAttribute('style', 'display:none')
        document.getElementsByClassName('crumbs-nav')[0].setAttribute('style', 'display:none')
        document.getElementById('j_leftBarList').setAttribute('style', 'display:none')
        document.getElementById('j_rightBarList').setAttribute('style', 'display:none')
        document.getElementsByClassName('text-wrap')[0].setAttribute('style', 'background:#fff;border:none')
        document.getElementsByClassName('section-comment-wrap')[0].setAttribute('style', 'background:#fff')
        document.getElementsByClassName('read-btn-box')[0].setAttribute('style', 'display:none')
        document.getElementsByClassName('chapter-control')[0].setAttribute('style', 'background:#fff')
        GM_addStyle('.review-count {background: #fff !important;color:#999 !important}')
        document.title = 'react'
        $favicon1.href = 'https://qidian.gtimg.com/qd/images/read.qidian.com/body_base_bg.5988a.png'
        $favicon2.href = 'https://qidian.gtimg.com/qd/images/read.qidian.com/body_base_bg.5988a.png'
    }
    var reset = function () {
        document.getElementsByTagName('body')[0].setAttribute('style', 'zoom:1')
        document.getElementById('readHeader').removeAttribute('style')
        document.getElementsByClassName('crumbs-nav')[0].removeAttribute('style')
        document.getElementById('j_leftBarList').removeAttribute('style')
        document.getElementById('j_rightBarList').removeAttribute('style')
        document.getElementsByClassName('text-wrap')[0].removeAttribute('style')
        document.getElementsByClassName('section-comment-wrap')[0].removeAttribute('style')
        document.getElementsByClassName('read-btn-box')[0].removeAttribute('style')
        document.getElementsByClassName('chapter-control')[0].removeAttribute('style')
        GM_addStyle('.review-count {background: #ddd;color:#999}')
        document.title = localStorage.getItem('qidianTitle')
        $favicon1.href = decodeURIComponent(localStorage.getItem('qidianIconhref1'))
        $favicon2.href = decodeURIComponent(localStorage.getItem('qidianIconhref2'))
    }
    document.onkeypress = function (event) {
        if (document.readyState != "interactive" &&
            document.readyState != "complete") {
            return;
        }
        var keycode = event.which || event.keyCode;
        if (keycode == 81 || keycode == 113) { //开启
            localStorage.setItem('qidianStyle', 'open')
            format()
        }
        if (keycode == 87 || keycode == 119) {
            localStorage.setItem('qidianStyle', 'close')
            reset()
        }
        if (keycode == 64 || keycode == 97) { //上一章
            window.location = $prevHref.href
        }
        if (keycode == 83 || keycode == 115) {//下一章
           window.location = $nextHref.href
        }
    };
    var qidianStyle = localStorage.getItem('qidianStyle')
    if (document.readyState != "interactive" && document.readyState != "complete") {
        document.onreadystatechange = function () {
            if (document.readyState == "interactive" || document.readyState == "complete") {
                setTimeout(function () {
                    if (qidianStyle == 'open') {
                        format()
                    } else {
                        reset()
                    }
                }, 55);
            }
        };
    } else {
        if (qidianStyle == 'open') {
            format()
        } else {
            reset()
        }
    }
})();