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.

Revisions

  1. monoglo revised this gist Oct 23, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions baidu2google.js
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@
    // @author rankOfMatrix
    // @match *://www.baidu.com/
    // @match *://www.baidu.com/*
    // @icon https://www.google.com/s2/favicons?domain=google.com
    // @icon https://www.google.cn/favicon.ico
    // @grant none
    // ==/UserScript==

    @@ -20,7 +20,7 @@
    link.rel = 'icon';
    document.getElementsByTagName('head')[0].appendChild(link);
    }
    link.href = 'https://www.google.com/s2/favicons?domain=google.com';
    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"
  2. monoglo created this gist Oct 23, 2021.
    45 changes: 45 additions & 0 deletions baidu2google.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,45 @@
    // ==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.com/s2/favicons?domain=google.com
    // @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.com/s2/favicons?domain=google.com';

    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)
    })();