WikiHow Free Expert Answers

Paying for wikiHow "expert answers"? No way!

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         WikiHow Free Expert Answers
// @namespace    http://tampermonkey.net/
// @version      0.1.1
// @description  Paying for wikiHow "expert answers"? No way!
// @author       ae2Q
// @match        https://www.wikihow.com/*
// @grant        none
// ==/UserScript==

(function() {
    "use strict";

    // Variables that describe the classes that must be modified to make the code prettier and shorter.
    var sac = "qa_answer answer qa_obscured_answer qa_obscured_answer_purchase",
        oc = "qa_obscured_prompt";

    var o=document.getElementsByClassName(oc).length, // The "pls support us to unlock these expert answers" overlays.
        sa=document.getElementsByClassName(sac).length, // The amount of obscured answers.
        x=sa+o; // This is a fail-safe variable.

    if(o>0){for(;x>1;){
            x=document.getElementsByClassName(sac).length+document.getElementsByClassName(oc).length;

            for(var j=0;j<document.getElementsByClassName(sac).length;j++){ // Unblur the answers.
                document.getElementsByClassName(sac)[j].className="qa_answer answer"
            }

            for(var i=0;i<document.getElementsByClassName(oc).length;i++){ // Remove the overlays.
                document.getElementsByClassName(oc)[i].parentNode.removeChild(document.getElementsByClassName(oc)[i])
            }
        }
        // Remove the text that lets you know you can 'unlock premium answers'.
        document.getElementsByClassName("qa_obscured_cta")[0].parentNode.removeChild(document.getElementsByClassName("qa_obscured_cta")[0])

        // Let the user know that their answers have been unobscured.
        document.getElementById("qa").innerHTML=
            "<p><b>Removed "+o+" overlays and unblurred "+sa+" answers.</b></p>"+document.getElementById("qa").innerHTML;
        console.log("Removed "+o+" overlays and unblurred "+sa+" answers")
    }
})();