Anti Filter Bubble

Google anti-filter engine:hide big tech globally, forums & pre-2015 filters search

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

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

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Anti Filter Bubble 
// @namespace    https://openweb-tools.example
// @version      1.0
// @description  Google anti-filter engine:hide big tech globally, forums & pre-2015 filters search 
// @match        https://www.google.*/*
// @grant        none
// @license      GPL-3.0-or-later
// @run-at       document-idle
// ==/UserScript==

/*
GPL v3
https://www.gnu.org/licenses/gpl-3.0.html
*/

(function () {
'use strict';

if (!location.href.includes("/search")) return;
if (document.getElementById("afb-v5")) return;

/* ---------- STORAGE ---------- */

const STORAGE = {
    hide: "afb_hide_bigtech",
    forums: "afb_forums",
    old: "afb_old"
};

/* ---------- STATE ---------- */

let hide = localStorage.getItem(STORAGE.hide) === "1";
let forums = localStorage.getItem(STORAGE.forums) === "1";
let old = localStorage.getItem(STORAGE.old) === "1";

/* ---------- CONFIG ---------- */

const BLOCK = [
"reddit.com","quora.com","youtube.com",
"facebook.com","instagram.com","tiktok.com",
"twitter.com","x.com","pinterest.com","medium.com"
];

/* ---------- HELPERS ---------- */

function preservePage(u){
    const current = new URL(location.href);
    const start = current.searchParams.get("start");
    if (start) u.searchParams.set("start", start);
}

/* ---------- UI (OFFSET LEFT) ---------- */

const panel = document.createElement("div");
panel.id = "afb-v5";

panel.style = `
position:fixed;
bottom:20px;
right:200px; /* <-- KEY FIX: shifted left from Deep Search Jumper */
z-index:999999;
background:rgba(0,0,0,0.9);
color:#0f0;
padding:10px;
border-radius:10px;
font-family:monospace;
font-size:12px;
box-shadow:0 0 10px rgba(0,0,0,.6);
`;

panel.innerHTML = `
<b>AntiFilter</b><br>

<button id="afb-hide">Hide BigTech</button>
<button id="afb-forum">Forums</button>
<button id="afb-old">Pre2015</button>
`;

document.body.appendChild(panel);

/* ---------- FILTER ---------- */

function applyFilter(){
    if (!hide) return;

    document.querySelectorAll("div.g, div.MjjYud").forEach(el=>{
        const a = el.querySelector("a");
        if (!a) return;

        if (BLOCK.some(d => a.href.includes(d))){
            el.style.display = "none";
        }
    });
}

/* ---------- BUTTONS ---------- */

document.getElementById("afb-hide").onclick = () => {
    hide = !hide;
    localStorage.setItem(STORAGE.hide, hide ? "1" : "0");
    applyFilter();
};

document.getElementById("afb-forum").onclick = () => {
    forums = !forums;
    localStorage.setItem(STORAGE.forums, forums ? "1" : "0");

    const u = new URL(location.href);
    let q = u.searchParams.get("q") || "";

    if (forums && !q.match(/\bforum\b/i)) q += " forum";
    if (!forums) q = q.replace(/\bforum\b/gi,"").trim();

    u.searchParams.set("q", q);
    preservePage(u);

    location.href = u.toString();
};

document.getElementById("afb-old").onclick = () => {
    old = !old;
    localStorage.setItem(STORAGE.old, old ? "1" : "0");

    const u = new URL(location.href);

    if (old){
        u.searchParams.set("tbs","cdr:1,cd_min:1/1/1990,cd_max:12/31/2014");
    } else {
        u.searchParams.delete("tbs");
    }

    preservePage(u);
    location.href = u.toString();
};

/* ---------- AUTO APPLY ---------- */

setInterval(applyFilter, 1200);

})();