Last active
October 27, 2021 01:47
-
-
Save monoglo/a5864f58da1fcebae50cfbcf4ea9a0c6 to your computer and use it in GitHub Desktop.
Baidu to Google Tampermonkey
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Baidu to Google | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description try to take over the world! | |
| // @author rankOfMatrix | |
| // @match *://www.baidu.com/ | |
| // @match *://www.baidu.com/* | |
| // @icon https://www.google.cn/favicon.ico | |
| // @grant none | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| document.title = 'Google'; | |
| var link = document.querySelector("link[rel~='icon']"); | |
| if (!link) { | |
| link = document.createElement('link'); | |
| link.rel = 'icon'; | |
| document.getElementsByTagName('head')[0].appendChild(link); | |
| } | |
| link.href = 'https://www.google.cn/favicon.ico'; | |
| let logo = document.getElementById("s_lg_img") | |
| logo.src = "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" | |
| logo.height = 92 | |
| logo.style.margin = "50px 0 0 0" | |
| let searchbar = document.getElementById("kw") | |
| let form = document.getElementById("form") | |
| form.onsubmit = function() { | |
| window.location.href = "https://www.google.com/search?q=" + searchbar.value | |
| } | |
| let logohref = document.getElementById("s_mp").lastElementChild | |
| logohref.href = "https://www.google.com" | |
| let button = document.getElementById("su") | |
| setTimeout(function() { | |
| button.value = "谷歌一下" | |
| }, 100) | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment