您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Removes promoted answers that have nothing to do with the question you're looking up
// ==UserScript== // @name Remove promoted questions and answers on Quora // @namespace http://tampermonkey.net/ // @version 0.4 // @description Removes promoted answers that have nothing to do with the question you're looking up // @author https://gf.qytechs.cn/en/users/728793-keyboard-shortcuts // @match https://www.quora.com/* // @match https://quora.com/* // @icon https://www.google.com/s2/favicons?domain=quora.com&sz=128 // @grant none // @license MIT // ==/UserScript== /* jshint esversion: 6 */ (function() { 'use strict'; var logRemovalsToDevConsole = false; // Change this to true to log removals to the console function selectNodesWithXpath(selector) { const xpathResult = document.evaluate(selector, document, null, XPathResult.ANY_TYPE, null); const elements = []; var curElement; while (xpathResult && (curElement = xpathResult.iterateNext()) !== null) { elements.push(curElement); } return elements; } setInterval(function() { const removedClass = '__quora_ad_removed__'; // search for the "Promoted" or "Sponsored" string in a block with a small font ("q-text" or "q-click-wrapper") const elements = selectNodesWithXpath(`//div[(contains(@class, 'q-text') or contains(@class, 'q-click-wrapper')) and (not(contains(@class, '${removedClass}'))) and (text() = 'Promoted' or text() = 'Sponsored')]`); const toRemove = []; var textBlock = null; for (const textBlock of elements) { var node = textBlock; // find the first parent node with a class containing the string "Card_", this is the block we want to hide do { node = node.parentNode; } while (node && (node.className || '').indexOf('Card_') === -1); if (node) { // found! if (logRemovalsToDevConsole) { console.log('Removing promoted block', node); } textBlock.classList.add(removedClass); // avoid picking up the same ad on the next page scan node.style.display = 'none'; } } }, 250); // repeat as more results are loaded (every 250ms) })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址