您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Hides specific Google search results based on href values. Motivation: I keep wasting my time opening reddit from search results and realizing that I don't have an access there
// ==UserScript== // @name Google Search Results Filter // @namespace https://gf.zukizuki.org/en/users/1413127-tumoxep // @version 1.0 // @description Hides specific Google search results based on href values. Motivation: I keep wasting my time opening reddit from search results and realizing that I don't have an access there // @license WTFPL // @match https://www.google.com/search* // @grant none // ==/UserScript== (function () { 'use strict'; // List of keywords or URL substrings to hide const blacklist = [ "reddit.com", ]; // Function to hide unwanted search results function filterResults() { // Select all results inside the #search element const results = document.querySelectorAll(`#search div[data-async-context*="query:"] > div`); // Adjust if necessary based on class structure results.forEach((result) => { try { // Get the link nested 9 levels deep const link = result.querySelector("a"); if (link && blacklist.some(keyword => link.href.includes(keyword))) { // Hide the result if it matches the blacklist result.style.display = "none"; } } catch (e) { console.error("Error processing result:", e); } }); } // Run the filter when the page loads or updates const observer = new MutationObserver(filterResults); observer.observe(document.body, { childList: true, subtree: true }); // Initial filter run filterResults(); })();