Disable Google AI Search & Hide Button (for AtCoder)

Redirects Google AI search (udm=50) and hides the "AI Mode" button from the UI to comply with AtCoder rules.

Від 13.09.2025. Дивіться остання версія.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Disable Google AI Search & Hide Button (for AtCoder)
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Redirects Google AI search (udm=50) and hides the "AI Mode" button from the UI to comply with AtCoder rules.
// @description:ja AtCoderのルールに準拠するため、GoogleのAI検索(udm=50)をリダイレクトし、UIから「AI モード」ボタンを非表示にします。
// @author       paruma184
// @license      MIT
// @match        *://www.google.com/search*
// @grant        GM_addStyle
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    // --- 機能1: AIモードのページを開いてしまった場合にリダイレクトする ---
    // この処理はページの読み込み開始時に即座に実行される
    if (window.location.href.includes('udm=50')) {
        const newUrl = window.location.href.replace('udm=50', 'udm=14');
        window.location.replace(newUrl);
        return; // リダイレクト後は以降の処理不要
    }

    // --- 機能2: 検索メニューから「AI モード」のボタンを非表示にする ---
    // ページのDOMが読み込まれた後、CSSを追加してボタンを消す
    // @grant GM_addStyle がこの機能のために必要
    const css = `
        /* hrefに "udm=50" を含むリンクを持つメニュー項目を非表示にする */
        div[role="listitem"]:has(a[href*="udm=50"]) {
            display: none !important;
        }
    `;

    // ページが読み込まれるのを待ってからCSSを適用
    // Tampermonkeyの機能であるGM_addStyleを使ってCSSを注入
    GM_addStyle(css);

})();