WikiHow Free Expert Answers

Paying for wikiHow "expert answers"? No way!

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 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")
    }
})();