Skip to content

Instantly share code, notes, and snippets.

@monoglo
Last active October 27, 2021 01:47
Show Gist options
  • Save monoglo/a5864f58da1fcebae50cfbcf4ea9a0c6 to your computer and use it in GitHub Desktop.
Save monoglo/a5864f58da1fcebae50cfbcf4ea9a0c6 to your computer and use it in GitHub Desktop.
Baidu to Google Tampermonkey
// ==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