Greasy Fork is available in English.

知乎去除懒加载、禁止重定向

f**k zhihu!

您查看的为 2019-12-10 提交的版本。查看 最新版本

// ==UserScript==
// @name         知乎去除懒加载、禁止重定向
// @namespace https://greasyfork.org/users/2646
// @version      0.2
// @description  f**k zhihu!
// @author       https://clso.fun
// @contributionURL    https://clso.fun/donate/
// @contributionAmount 6.66
// @match        http://www.zhihu.com/*
// @match        https://www.zhihu.com/*
// @grant        none
// @require      https://cdn.staticfile.org/jquery/1.9.1/jquery.min.js
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    var cleardoc = function(doc) {
        doc.querySelectorAll("a").forEach(function(e){
            var regRet = e.href.match(/target=(.+?)(&|$)/);
            if(regRet && regRet.length==3){
                e.href = decodeURIComponent(regRet[1]);
            }
        });

        $("img.lazy").each(function(){
            var orig = this.getAttribute("data-original");
            var hd = this.getAttribute("data-actualsrc");
            this.src = (orig) ? orig : hd;
            this.setAttribute("data-lazy-status", "ok");
        }).removeClass("lazy");

    };

    //cleardoc(document);

	$("body").bind("DOMNodeInserted", function(e) {
        cleardoc(e.target);
	});

})();