Google Full Image

By Jeffrey Palm Last update Apr 22, 2009 — Installed 598 times. Daily Installs: 1, 3, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 3, 0, 1, 1, 2, 0, 0, 0, 2, 4, 0, 1, 1, 0, 1
// ==UserScript==
// @name          FullImage
// @namespace     http://jeffpalm.com/fullimage
// @description   Provides links to the full image on Google's image search
// @include       http://images.google.com/images*
// ==/UserScript==

/*
 * Copyright 2009 Jeffrey Palm.
 */

var TESTING = false;

/** http://javascript.internet.com/snippets/insertafter.html */
function insertAfter(parent, node, referenceNode) {
  parent.insertBefore(node, referenceNode.nextSibling);
}

function main() {
  var as = document.getElementsByTagName('a');
  for (var i=0; i<as.length; i++) {
    var a = as[i];
    if (res = a.href.match(/\?imgurl=([^&]+)&/)) {
      var link = res[1];
      var par = a.parentNode;
      var newLink = document.createElement('A');
      newLink.style.color = '#770000';
      newLink.style.fontSize = '.8em';
      newLink.innerHTML = 'full image';
      newLink.href = link;
      insertAfter(par,newLink,a);
      insertAfter(par,document.createElement('BR'),a);
    }
  }
}

try {main();} catch (e) {if (TESTING) alert(e);}