Disable Google Ai OverView

Google検索で表示されるAI概要を抑制・削除します。

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Disable Google Ai OverView
// @namespace    http://tampermonkey.net/
// @version      2025-10-04-2
// @description  Google検索で表示されるAI概要を抑制・削除します。
//               方法: 
//                 1. data-subtree="mfc,mfl" のDOMを非表示&削除
//                 2. URLを https://www.google.com/search?udm=14&q=キーワード に書き換え
//                    (動作保証はなく環境依存)
// @author       Ruku
// @match        https://www.google.com/search*
// @match        http://www.google.com/search*
// @grant        none
// @run-at       document-start
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // --- ① URL書き換え (udm=14 がなければ追加してリロード) ---
    (function enforceUDM14() {
        const url = new URL(window.location.href);
        if (url.hostname === "www.google.com" && url.pathname === "/search") {
            if (!url.searchParams.has("udm")) {
                url.searchParams.set("udm", "14");
                window.location.replace(url.toString());
            }
        }
    })();

    // --- ② CSSで初期から非表示にする ---
    const style = document.createElement('style');
    style.textContent = '[data-subtree="mfc,mfl"] { display: none !important; }';
    document.documentElement.appendChild(style);

    // --- ③ MutationObserverで追加ノードを監視し削除 ---
    new MutationObserver(mutations => {
        for (const m of mutations) {
            for (const node of m.addedNodes) {
                if (node.nodeType === 1) {
                    if (node.matches?.('[data-subtree="mfc,mfl"]')) {
                        node.remove();
                    }
                    node.querySelectorAll?.('[data-subtree="mfc,mfl"]').forEach(el => el.remove());
                }
            }
        }
    }).observe(document, { childList: true, subtree: true });

})();