您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
在百度搜索页面添加一个按钮可以快速跳转到 Google 搜索页面
当前为
// ==UserScript== // @name 在百度 Google一下 // @namespace none // @version 1.1 // @description 在百度搜索页面添加一个按钮可以快速跳转到 Google 搜索页面 // @author RainForest // @match https://www.baidu.com/* // @grant none // @license GNU GPL // ==/UserScript== (function() { 'use strict'; // 获取class为"bg s_btn_wr"的span标签,并插入一个input按钮 var span = document.querySelector("form#form span.bg.s_btn_wr"); var input = document.createElement("input"); input.type = "button"; input.value = "Google一下"; input.classList = "bg s_btn googlebotton"; // 将按钮添加到span的最后面 span.appendChild(input); // 修改class值为"bg s_btn_wr" 的span标签,增加一个class为Googlebox span.classList.add("bottonbox"); // 给百度一下按钮添加一个class var suInput = document.getElementById("su"); if (suInput) { suInput.classList.add("baidubotton"); } // 给Googlebox添加css,将span中的2个input调整为横排 var style = document.createElement("style"); style.textContent = ".bottonbox { display: inline; }.baidubotton { border-radius: 0 !important; }.googlebotton{ background-color: #34a853 !important;}"; document.head.appendChild(style); // 点击按钮后,获取name为wd的input标签的内容,并在Google搜索 input.addEventListener("click", function() { var keyword = document.querySelector("input[name='wd']").value; window.open("https://www.google.com/search?q=" + encodeURIComponent(keyword), '_blank'); }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址