Bing 跳转 Google

在 Bing 搜索页面添加跳转到 Google 搜索的功能

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.

(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         Bing 跳转 Google
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  在 Bing 搜索页面添加跳转到 Google 搜索的功能
// @author       ChatGPT
// @match        https://cn.bing.com/search?q=*
// @match        https://www.bing.com/search?q=*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // 获取当前 URL 的搜索参数
    const urlParams = new URLSearchParams(window.location.search);
    const query = urlParams.get('q');
    if (!query) return;

    // 生成 Google 搜索 URL
    const googleSearchUrl = `https://www.google.com/search?q=${encodeURIComponent(query)}`;

    // 创建新的导航按钮
    const navItem = document.createElement('li');
    navItem.innerHTML = `<a href="${googleSearchUrl}" target="_blank" class="">谷歌</a>`;

    // 插入到导航栏中
    const navBar = document.querySelector('.b_scopebar ul');
    if (navBar) {
        navBar.appendChild(navItem);
    }
})();