GM Script: Google Image Re-Linker
In my attempt to make GreaseMonkey do everything ever related to page rewriting in Firefox, I converted roachfiend’s Google Images Re-linker to a GreaseMonkey script.
I just got his permission to post this, so you can snag it here. It’s purpose is to make links in Google Image Search point directly to the image, instead of loading up a thumbnail in a frame. It works for me but my roommate complained about it not, so feel free to comment if it’s being odd. I can’t promise that I’ll be able to fix it since I’m still just getting my feet wet, but I can certainly try.
PS: Roachfiend writes some really awesome firefox extensions, you should check them out.
March 6th, 2005




On this script, I think the problem may be that you’re dealing with doubly-encoded URLs, but you’re manually replacing %2520 with %20.
Basically any reserved character gets encoded in URIs as %
The reserved chars are : / . ? & and ” “. Maybe more.
But JS has a handy decodeURI function just for this purpose.
Try this:
googLinks[x].href = decodeURI(gmatch[1]);
Worked for me…
March 7th, 2005 at 6:54 am
Thanks Jeremy, I appreciate the help in getting it working properly.
March 7th, 2005 at 9:46 am
This doesn’t work on google’s international sites as it likes to redirect you to your local domain. To fix it change the include line to:
// @include http://images.google.*/*
which will catch all the other domains.
Thanks
March 15th, 2005 at 1:05 am
Honestly, I would have never ever noticed. I’ll fix it for all my friends who aren’t American.
March 15th, 2005 at 1:43 am
It would be nice if a text link to the source website (or the Google split-frame setup, perhaps) could be included.
March 18th, 2005 at 9:40 pm
This is awesome! I’d love it if you had it insert a “[context]” link that linked to the standard Google thing, but of course that would be harder than just changing one attribute on one tag (and perhaps I should just try to do this myself).
March 29th, 2005 at 7:42 am
Good script! I have added the best recommendation scripts for Greasemonkey at http://www.lifehack.org/articles/lifehack/save-time-on-firefox-with-greasemonkey.html
May 28th, 2005 at 1:15 am
quoting ” [context] link that linked to the standard Google thing” you can take a look on the modified script in customizegoogle. It adds a div and it’s based on your (fantastic) script
July 9th, 2005 at 1:57 am
I’ve noticed recently that google image search (along with the web search) have been rewriting the urls on mousedown. I not know exactly what they are trying to do but it annoys me because it breaks this extensions usability. I can click on a thumbnail and it will go to the normal “framed” google image result page and then hit back and click it again and it will work fine going directly to the full size image. Is there a way to get around this? Overwriting the function rwt that seems to do the url rewrite or going through and removing the function if it’s found attached to the link? I dunno.
August 30th, 2005 at 8:11 am
Interesting, I’ll have to take a look at that when I get a chance.
August 30th, 2005 at 10:14 am
Just curious if you ever got a chance to look at what I described earlier. It’s really annoying and I’m not smart enough with jscript to fix it myself. Thanks!
October 26th, 2005 at 6:20 am
I haven’t, actually. I imagine it would be pretty simple to rip the functions that the CustomizeGoogle extension uses. It’s just a matter of time and I’m sadly lacking in that lately.
October 27th, 2005 at 3:28 pm
Well I’ve wasted an hour trying this but it shows that I know nothing about JavaScript. I’ve spent an eternity trying to find out how you can change the onClick attribute of an anchor but I can’t do it. I’ve given up on it for now but if anyone has an idea how to remove or replace the onClick function that rewrites the URI in the google image search, email me.
November 1st, 2005 at 10:37 am
Forgot to include my email address: zan.loy @ gmail DOT com
November 1st, 2005 at 10:38 am
[...] It’s available as both a Firefox extension or Greasemonkey script. I prefer the Greasemonkey script, since if for some reason I do want to see the framed page, I can just disable Greasemonkey in the statusbar and reload the page; disabling the extension is comparatively a bit of a pain. Both downloads work wherever Firefox does. — Adam Pash GM Script: Google Image Re-Linker [patcavit.com via Google Operating System] Google Images Re-Linker Firefox Extension [Roachfiend] [...]
November 1st, 2006 at 9:39 pm
Sweet
January 30th, 2007 at 9:18 am
[...] If you use Firefox, you can install Customize Google extension that, among other feaures, rewrites links to point straight to the images. Or if you have GreaseMonkey installed, you can add the script from here. [...]
August 17th, 2008 at 8:23 pm