Greasy Fork is available in English.

Replace Google logo with Baidu

Replace Google logo in homepage with Baidu logo

// ==UserScript==
// @name               Replace Google logo with Baidu
// @name:zh-CN         将 Google Logo 替换为百度
// @namespace          http://tampermonkey.net/
// @version            0.2
// @description        Replace Google logo in homepage with Baidu logo
// @description:zh-CN  将 Google 首页的 Logo 替换为相同 Google 配色的百度 Logo
// @author             ReekyStive
// @match              https://www.google.com/
// @match              https://www.google.com.*/
// @match              https://www.google.com/webhp?*
// @match              https://www.google.com.*/webhp?*
// @icon               https://www.google.com/favicon.ico
// @grant              none
// @run-at             document-body
// @license            MIT
// ==/UserScript==

(function() {
    'use strict';

    if (window.location.pathname === '/' || window.location.pathname === '/webhp') {
        const style = document.createElement('style');
        style.innerHTML = ".lnXdpd { display: none; }";
        document.body.appendChild(style);

        const logoSvg = "%3Csvg viewBox='0 0 231 79' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M90.8007 42.3301C98.5507 40.6651 97.4927 31.3931 97.2657 29.3671C96.8837 26.2421 93.2107 20.7851 88.2267 21.2211C81.9517 21.7801 81.0357 30.8441 81.0357 30.8441C80.1857 35.0411 83.0637 43.9991 90.8007 42.3301M105.193 26.7871C109.471 26.7871 112.929 21.8571 112.929 15.7671C112.929 9.67611 109.471 4.75411 105.193 4.75411C100.913 4.75411 97.4457 9.67611 97.4457 15.7671C97.4457 21.8571 100.912 26.7871 105.193 26.7871M123.637 27.5121C129.364 28.2621 133.033 22.1531 133.767 17.5241C134.517 12.9011 130.817 7.52411 126.772 6.60111C122.709 5.66711 117.637 12.1711 117.18 16.4141C116.623 21.6041 117.916 26.7791 123.637 27.5121M146.316 35.2891C146.316 33.0751 144.483 26.4011 137.657 26.4011C130.817 26.4011 129.913 32.6991 129.913 37.1491C129.913 41.3961 130.267 47.3201 138.761 47.1361C147.246 46.9481 146.316 37.5181 146.316 35.2891M137.657 54.7251C137.657 54.7251 128.804 47.8771 123.637 40.4731C116.621 29.5561 106.667 34.0021 103.339 39.5461C100.021 45.1041 94.8627 48.6141 94.1247 49.5461C93.3797 50.4591 83.4327 55.8341 85.6397 65.6491C87.8517 75.4561 95.6087 75.2701 95.6087 75.2701C95.6087 75.2701 101.326 75.8291 107.956 74.3461C114.6 72.8671 120.316 74.7091 120.316 74.7091C120.316 74.7091 135.814 79.9061 140.049 69.9061C144.289 59.9141 137.657 54.7251 137.657 54.7251' fill='%234285f4' /%3E%3Cpath d='M106.568 45.1781L106.568 51.7661L101.2 51.7661C101.2 51.7661 95.8347 52.2111 93.9567 58.2921C93.3017 62.3521 94.5347 64.7431 94.7497 65.2541C94.9667 65.7641 96.7007 68.7341 101.055 69.6061L111.128 69.6061L111.128 45.2501L106.568 45.1781ZM106.487 65.6081L102.429 65.6081C102.429 65.6081 99.6017 65.4611 98.7407 62.2061C98.2967 60.7641 98.8067 59.0981 99.0307 58.4431C99.2357 57.7871 100.185 56.2711 102.142 55.6871L106.486 55.6871L106.487 65.6081L106.487 65.6081Z' fill='%23ffffff' /%3E%3Cpath d='M113.597 52.3571L113.597 65.1811C113.597 65.1811 113.807 68.3721 118.307 69.5351L129.899 69.5351L129.899 52.3551L124.896 52.3551L124.896 65.2521L120.122 65.2521C120.122 65.2521 118.596 65.0301 118.309 63.8041L118.309 52.2811L113.597 52.3571Z' fill='%23ffffff' /%3E%3Cpath d='M185.13 43.9371L185.13 38.5311L149.518 38.5311L149.472 44.0171L164.782 44.0171L163.346 47.2981L150.326 47.2981L150.326 74.4271L181.255 74.4271C184.488 74.4271 184.201 71.1611 184.201 71.1611L184.201 47.2991L171.162 47.2991L172.308 43.9401L185.129 43.9401L185.129 43.9371L185.13 43.9371ZM178.214 68.6351C178.214 68.6351 177.839 69.5361 177.309 69.5361L156.786 69.5361L156.786 63.2081L178.217 63.2081L178.214 68.6351L178.214 68.6351ZM178.179 57.9821L156.783 57.9821L156.783 52.0481L178.179 52.0481L178.179 57.9821L178.179 57.9821Z' fill='%2334a853' /%3E%3Cpath d='M225.823 38.6761L211.85 38.6761L211.85 35.9391L205.297 35.9391L205.297 38.5411L189.269 38.5411L189.269 74.3721L195.036 74.3721L195.036 43.1631L225.823 43.1631C225.823 43.1631 225.823 38.6761 225.823 38.6761ZM222.054 46.0921L222.054 44.0181L216.421 44.0181L216.421 46.0921L204.832 46.0921L204.832 44.0921L199.496 44.0921L199.496 46.0921L195.891 46.0921L195.962 50.1511L199.496 50.1511L199.496 57.7741L218.988 57.7741C221.693 57.7741 222.051 54.9201 222.051 54.9201L222.051 50.1491L226.176 50.1491L226.176 46.0891L222.052 46.0891L222.054 46.0921L222.054 46.0921ZM216.421 52.9221C216.421 52.9221 215.918 53.8461 215.275 53.8461L204.77 53.8461L204.77 50.0711L216.418 50.0711L216.418 52.9241L216.421 52.9241C216.421 52.9241 216.421 52.9221 216.421 52.9221ZM196.678 63.3291L205.651 68.5331C204.94 69.3141 201.876 70.3061 201.876 70.3061L195.894 70.3061L195.894 74.3061L204.016 74.3061C206.44 73.8101 210.926 71.5301 210.926 71.5301C212.782 73.2351 216.351 73.9451 216.351 73.9451L225.609 73.9451L225.609 69.9551L218.63 69.9551C216.749 69.6741 215.06 68.6011 215.06 68.6011L225.611 62.5431L225.611 59.2631L196.681 59.2631L196.681 63.3271L196.678 63.3291L196.678 63.3291ZM215.348 63.2621L210.216 65.9691L205.512 63.2621L215.348 63.2621Z' fill='%23ea4335' /%3E%3Cpath d='M70.2797 44.3811L78.0527 44.3811L78.0527 37.5331L70.2797 37.5331L70.2797 44.3811ZM70.2797 74.2261L78.0527 74.2261L78.0527 47.3641L70.2797 47.3641L70.2797 74.2261Z' fill='%23fbbc05' /%3E%3Cpath d='M57.6407 47.3871L41.0567 47.3441L41.0567 52.9911L55.5987 52.9911C55.5987 52.9911 59.0597 53.8451 59.0597 56.0411L59.0597 58.0301L45.9007 58.0301C45.9007 58.0301 40.7257 58.5081 39.0637 64.6891C38.7777 67.5851 39.1587 69.0071 39.3537 69.5351C39.5407 70.0581 41.0567 73.4731 45.5697 74.3261L66.5227 74.3261L66.5227 55.0831C66.5227 55.0841 65.5247 48.4801 57.6407 47.3871M59.0597 69.0101L48.4697 69.0101C47.0467 68.4361 46.5727 67.4891 46.4727 67.2491C46.3747 67.0161 46.0447 66.1651 46.4287 65.3051C47.2857 63.6471 48.7057 63.2641 48.7057 63.2641L59.0597 63.2641L59.0597 69.0101Z' fill='%23ea4335' /%3E%3Cpath d='M37.3547 64.8051C37.5837 58.2641 31.7157 56.0021 31.7157 56.0021C36.6827 53.4041 36.0517 46.8561 36.0517 46.8561C35.5137 36.8351 23.2697 37.3031 23.2697 37.3031L4.35068 37.3031L4.35068 74.6501L25.7127 74.6501C38.2577 74.6001 37.3547 64.8051 37.3547 64.8051M25.2837 67.7081L25.2837 67.7251L12.4867 67.7251L12.4867 59.6671L25.2207 59.6671L25.6517 59.7541C25.6517 59.7541 28.0747 60.1971 28.9527 62.3761C28.9527 62.3761 29.4607 64.4241 28.3637 65.9451C28.3637 65.9451 27.5567 67.3511 25.2837 67.7081M27.9967 50.3921C27.9967 50.3921 27.1367 51.9721 24.8547 52.3141L12.4867 52.3141L12.4867 44.5851L24.8017 44.5851C24.8017 44.5851 27.4777 44.4621 28.3637 46.5871C28.3637 46.5881 28.8957 48.8461 27.9967 50.3921' fill='%234285f4' /%3E%3C/svg%3E";
        // encoded using https://yoksel.github.io/url-encoder/
        // this logo is copyrighted to Baidu and modified by ReekyStive

        window.onload = () => {
            const logo = document.querySelector('img[alt=Google]');
            logo.src = 'data:image/svg+xml,' + logoSvg;
            logo.removeAttribute('srcset');
            document.body.removeChild(style);
            console.log('Replaced Google Logo!');
        }
    }
})();