您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Block the "...also search for..." and "...also ask" boxes in Google search results. Does not rely on hardcoded class names, so it's more future proof.
// ==UserScript== // @name Google - Block "People also search for" & "People also ask" // @namespace https://github.com/dymk/block-google-also-search-for // @license gpl-3.0 // @version 1.2 // @description Block the "...also search for..." and "...also ask" boxes in Google search results. Does not rely on hardcoded class names, so it's more future proof. // @author dymk // @match https://www.google.com/search* // @icon https://www.google.com/s2/favicons?sz=64&domain=google.com // @run-at document-start // @grant none // ==/UserScript== (function () { 'use strict'; const DEBUG = false; function removeElements() { let removed = 0; removed += removeXpath("//*[text() = 'People also search for']/../../../../../node()"); removed += removeXpath("//*[text() = 'People also ask']/../../../../../node()"); if (DEBUG) { console.log(`Removed ${removed} "...also..." elems`); } } function removeXpath(path) { let xpath = document.evaluate(path, document, null, XPathResult.ANY_TYPE, null); if (!xpath) { return 0; } let elems = []; for (let elem = xpath.iterateNext(); elem; elem = xpath.iterateNext()) { elems.push(elem); } for (let elem of elems) { elem.remove(); } return elems.length; } // run immediately on page paint, after DOM loaded, and after every // DOM update new MutationObserver(() => { removeElements(); }).observe(document, { subtree: true, childList: true }); document.addEventListener('DOMContentLoaded', removeElements, false); removeElements(); })();