Bing 跳转 Google

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

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==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);
    }
})();