您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
2021/1/4 上午10:33:27
当前为
// ==UserScript== // @name 双搜索引擎 // @namespace Violentmonkey Scripts // @match https://www.google.com/search // @match https://www.baidu.com/s // @grant none // @version 1.0 // @author - // @description 2021/1/4 上午10:33:27 // ==/UserScript== if (window.location.hostname === "www.google.com") { const box = document.querySelector("div.RNNXgb[jsname='RNNXgb']"); const input = document.querySelector("input[aria-label='搜索']"); const btn = document.createElement('button'); btn.className = 'Tg7LZd' btn.ariaLabel = '百度搜索' btn.onclick = () => { window.open(`https://www.baidu.com/s?wd=${input.value}`) } btn.innerHTML = ` <div class="FAuhyb"> <span class="z1asCe MZy1Rb"> <svg focusable="false" xmlns="http://www.w3.org/2000/svg" fill="#4e6ef2" viewBox="0 0 24 24"> <path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path> </svg> </span> </div> ` box.appendChild(btn) } else if (window.location.hostname === "www.baidu.com") { const su = document.getElementById('su') su.style = 'border-radius: 0' const input = document.createElement('input') const kw = document.getElementById('kw') input.style = ` float: right; cursor: pointer; width: 60px; height: 40px; line-height: 41px; line-height: 40px\\9; background-color: #4e6ef2; border-radius: 0 10px 10px 0; font-size: 17px; box-shadow: none; font-weight: 400; border: 0; outline: 0; letter-spacing: normal; color: #ffffff; ` input.type = 'submit' input.value = '谷歌' input.onclick = () => { window.open(`http://www.google.com/search?q=${kw.value}`) } const box = su.parentNode box.style.width = box.offsetWidth + 60 + 'px' box.appendChild(input) }