Greasy Fork

Greasy Fork is available in English.

纯享阅读-知乎

让知乎指定内容全屏,减少干扰

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

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

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

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        纯享阅读-知乎
// @namespace    https://qinlili.bid
// @version      0.1
// @description  让知乎指定内容全屏,减少干扰
// @author       琴梨梨
// @match        *://www.zhihu.com/*
// @icon         https://static.zhihu.com/heifetz/favicon.ico
// @grant        none
// @run-at        document-end
// ==/UserScript==

(function() {
    'use strict';
    var down = false;
    var up = false;
    var divForExec = document.body;
    document.onkeydown=function(e){
        var keyNum=window.event ? e.keyCode :e.which;
        if(keyNum==174){//VolDown
            down = true;
            check();
        }
        if(keyNum==175){//VolUp
            up = true;
            check();
        }
    }
    function check(){
        if(up && down){
            exec();
            up = false;
            down = false;
        }
    }
    function exec(){
        if(!document.location.pathname.indexOf("/pub/reader/")){
            divForExec=document.querySelector("#root > div > main > div > div > div.reader-container > div.reader-chapter-content.PubHTML.justify.collapse-fw");
            fs();
        };
        if(!document.location.pathname.indexOf("/market/paid_column/")||!document.location.pathname.indexOf("/market/literature/")||!document.location.pathname.indexOf("/market/paid_magazine/")){
            divForExec=document.querySelector("#app > div");
            fs();
        };
        if(document.location.pathname=="/"){
            divForExec=document.querySelector("#root > div > main > div > div > div.Topstory-mainColumn > div");
            fs();
        };
    }
    function fs(){
        divForExec.style.overflow="scroll";
        divForExec.requestFullscreen();
    }
})();