Bing to Google Tab

Adds a Google button to Bing search header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Bing to Google Tab
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Adds a Google button to Bing search header
// @author       Your Name
// @match        https://www.bing.com/search*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // 1. Get the current search query from the URL
    const urlParams = new URLSearchParams(window.location.search);
    const query = urlParams.get('q');

    if (query) {
        // 2. Find the Bing navigation menu (where "Images", "Videos", etc. are)
        const navBar = document.querySelector('#b_header .b_scopebar ul') || document.querySelector('.b_scopebar ul');

        if (navBar) {
            // 3. Create the new list item and link
            const googleLi = document.createElement('li');
            const googleLink = document.createElement('a');

            googleLink.href = `https://www.google.com/search?q=${encodeURIComponent(query)}`;
            googleLink.target = "_blank"; // Opens in a new tab
            googleLink.innerText = "Google";
            googleLink.style.color = "#4285F4"; // Google Blue
            googleLink.style.fontWeight = "bold";

            googleLi.appendChild(googleLink);
            navBar.appendChild(googleLi);
        }
    }
})();