Monday, 12 August 2013

Monkeying With Google

Sometimes you wake up and have a great idea with that first morning coffee. Other times you wake up and decide to waste ten minutes on a pointless exercise. This post is about a pointless exercise - changing the logo on the Google homepage.

It was completed using Firefox and Greasemonkey, but should work just as well in Google Chrome, Chromium, and Iron.

First thing is to create a userscript. I called mine "Google Logo Swap", but it can be called anything you want. Create the userscript in a text editor such as Leafpad, Notepad, or Notepad++. The following is all the lines you need:

// ==UserScript==
// @name            Google Logo Swap
// @include         http://www.google.com/
// @include         https://www.google.com/
// ==/UserScript==

var logoImage = document.getElementById('hplogo');
logoImage.src = "http://d3j5vwomefv46c.cloudfront.net/photos/large/799375665.jpg";
logoImage.width="491";
logoImage.height="190";


The image source (logoImage.src (the part in red)) is the URL to the graphic you want to replace the Google logo. Mine links to a twitpic file, but you can link to any image.

Save this as GoogleLogoSwap.user.js, and then drag in to Firefox or Chrome. Your browser will ask if you want to install the script.

That is it.

The file I used is 491 x 190 pixels purely because that is what Google uses for its logo. The text was created with the Catull font which Google uses, and the text colors used are:
  • Blue - #0140CA
  • Red - #DD1812
  • Yellow - #FCCA03
  • Green - #16A61E
The angel with the shotgun came from DeviantArt.


Notes: It is set for Google only, not the other searches (such as images, books, etc.) purely because the others use different dimensions that are not of the same ratio - as an example Google Images uses 276 x 110. Although I am sure this can be achieved with a few more lines of code. Also I am not 100% sure if the DIV container 'hplogo' (meaning Home Page Logo) remains the same name when Google put their interactive logos up for special occasions, although it should as it overwrites the original logo. If I ever decide to update the script I'll post a new version.

2 comments:

  1. 491 pixels by 190 pixels is a custom size. The default is 275 pixels by 95 pixels. Which is not too different from the Images logo. So change the script to read:

    // @include http://www.google.com/*
    // @include https://www.google.com/*

    And:

    logoImage.width="275";
    logoImage.height="95";

    May be some slight distort but not enough to worry about.

    Hope that helps.

    ReplyDelete
    Replies
    1. Thanks for that. Seems 491 x 190 was in use yesterday ... Made the changes and on Google Image Search you can't really notice the ratio problem.

      Delete

Thank you for your comment. Please note that all comments are not moderated and as such are not the responsibility of this blog; or its author.