Google Logo Restorer

Restores the previous Google logo and favicon

< 腳本Google Logo Restorer的回應

提問/評論

§
發表於:2015-09-15

Nice implementation

The goals were set to be an All-In-One script for rolling back the detestable new logo wherever it lays.

Nice implementation. While Google kept their logos on-line, it is indeed wiser to use base64.
'Main' logo:
https://www.google.com/images/srpr/logo9w.png
Last favicon:
http://www.google.com/images/google_favicon_128.png

Haven't QAed your script, but as in mine, you should deal with no short-cut icon case (when looking on a picture in image search for example).

Knowbody作者
§
發表於:2015-09-15
編輯:2015-09-15

I'm not sure what the "no short-cut icon case" is. I tried it with google image searches and it seemed to work for me.

I created a new nav_logo image in photoshop using this one as a template: http://www.google.com/images/nav_logo231.png And then resizing/placing the good logo in exactly the same places as the new flat ones, so that it's a direct replacement and I don't have to fuck around with resizing/shifting it in the userscript.

If I use this one: http://www.google.com/images/nav_logo117.png the main logo on the search page doesn't line up exactly.

I also resized the logo on the main page to be exactly the same size as the new one too.

And I converted them to base64 using this: http://www.base64-image.de/step-1.php

Knowbody作者
§
發表於:2015-09-16
編輯:2015-09-16

OK, I think I know what you mean with the "no short-cut icon case" On certain pages where the header doesn't include the favicon (it's being loaded another way), it isn't finding anything to change. So here is some new code that adds a favicon to the header if it doesn't already have one:

var favIconNotReplaced = true;
var headLinks = document.head.getElementsByTagName('link');
for (var i in headLinks) {
    if (headLinks[i].rel == 'shortcut icon') {
        headLinks[i].href = favIconBlueCapitalG;
        favIconNotReplaced = false;
        break;
    }
}
if (favIconNotReplaced) {
    var favIcon = document.createElement('link');
    favIcon.setAttribute('rel', 'shortcut icon');
    favIcon.setAttribute('href', favIconBlueCapitalG);
    document.head.insertBefore(favIcon, document.head.firstChild);
}

The only issue with this is that the favicon isn't immediately replaced, and so the ugly one can be seen briefly before it gets replaced.

I'd like to know what other method is actually being used to load the favicon though.

§
發表於:2015-09-16
編輯:2015-09-16

The fall-back for no favicon declared in the head is looking for it on the base path.

That meaning taking it from here:
http://www.google.com/favicon.ico

This is browser work in the background, as a feature though not declared in HTML assumed to be better.

Knowbody作者
§
發表於:2015-09-16
編輯:2015-09-16

Looks like the only way to change that would be to redirect the HTTP request to http://www.google.com/favicon.ico.

I doubt that could be done in a userscript.

發表回覆

登入以回復