百度搜索跳转到google

百度搜索跳转到google,快捷跳转

目前為 2023-05-10 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         百度搜索跳转到google
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  百度搜索跳转到google,快捷跳转
// @author       You
// @match        https://www.baidu.com/s?ie=UTF-8&wd=v2ex
// @match        *://www.baidu.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=baidu.com
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
let parent = document.querySelectorAll("#su")[0].parentElement;
    //position: relative;
    parent.style.position = "relative";

    //添加字节点
    let child = document.createElement("div");
    child.style.width = "80px";
    child.style.height = "40px";
    child.style.backgroundColor = "#5772e7";
    child.style.display = "flex";
    child.style.alignItems = "center";
    child.style.justifyContent = "center";
    child.style.borderRadius = "5px";
    child.innerHTML = "GOOGLE";
    child.style.marginLeft = "10px";
    child.style.position = "absolute";
    child.style.top = "0px";
    child.style.right = "-100px";
    child.style.color = "#fff";
    child.style.cursor = "pointer";
    child.style.fontSize = "14px";
    child.style.boxShadow = "2px 5px 8px 0px rgb(0 0 0 / 37%)";

    let inputWrapper = document.querySelectorAll("#kw")[0];
    let inputValue = inputWrapper.value;
    inputWrapper.addEventListener("input", function() {
      inputValue = inputWrapper.value;
    });
    //点击事件
    child.onclick = function() {
      window.open("https://www.google.com/search?q=" + inputValue);
    }

    //添加到父节点
    parent.appendChild(child);
})();