Remove promoted answers on Quora

Removes promoted answers that have nothing to do with the question you're looking up

目前为 2021-04-28 提交的版本。查看 最新版本

// ==UserScript==
// @name         Remove promoted answers on Quora
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Removes promoted answers that have nothing to do with the question you're looking up
// @author       A long-time Quora user annoyed by the irrelevant ads that pollute the site
// @match        https://www.quora.com/*
// @match        https://quora.com/*
// @icon         https://www.google.com/s2/favicons?domain=quora.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var logRemovalsToDevConsole = false; // Change this to true to log removals to the console

    setInterval(function() {
        // search for the "Promoted by" string
        var xpathResult = document.evaluate("//div[contains(@class, 'qu-fontSize--small') and contains(., 'Promoted by')]", document, null, XPathResult.ANY_TYPE, null);
        if (xpathResult) {
            var textBlock = null;
            while ((textBlock = xpathResult.iterateNext()) !== null) {
                var node = textBlock;
                do {
                    node = node.parentNode;
                } while (node && node.className.indexOf('CssComponent') == -1); // find the parent node with a CssComponent class, this is the block we want to remove
                if (node && node.parentNode) {
                    logRemovalsToDevConsole && console.log('Removing promoted block', node);
                    node.parentNode.removeChild(node);
                }
            }
        }
    }, 200); // repeat as more results are loaded (every 200ms)
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址