Opens “Tools” Menu by Default on Google

Opens the “Tools” menu on Google Search automatically when page loaded.

As of 2023-02-18. See the latest version.

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 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.

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

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               Opens “Tools” Menu by Default on Google
// @name:zh-TW         預設開啟 Google 的「工具」選單
// @description        Opens the “Tools” menu on Google Search automatically when page loaded.
// @description:zh-TW  在 Google 搜尋載入後自動打開「工具」選單。
// @icon               https://wsrv.nl/?url=https://www.google.com/images/branding/googleg/1x/googleg_standard_color_128dp.png
// @author             Jason Kwok
// @namespace          https://jasonhk.dev/
// @version            1.0.0
// @license            MIT
// @match              https://www.google.com/search
// @run-at             document-end
// @grant              none
// ==/UserScript==

const toolsButton = document.querySelector("#hdtb-tls, [jsname=I4bIT], [jscontroller=LbcJwc]");
if (toolsButton)
{
    const interval = setInterval(() =>
    {
        if (toolsButton.getAttribute("aria-expanded") !== "true")
        {
            toolsButton.click();
        }
        else
        {
            clearInterval(interval);
        }
    }, 250);
}