Googleanonymous

By Ajnasz Last update Sep 29, 2007 — Installed 1,759 times. Daily Installs: 2, 1, 2, 1, 0, 0, 0, 0, 1, 0, 1, 3, 2, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 3, 0, 1, 0, 0
// ==UserScript==
// @name           Googleanonymous
// @author         Ajnasz
// @namespace      http://ajnasz.hu/googleanonymous
// @description    Add an anonymizer (http://anonym.to) link to the google results
// @include        *.google.*/search*
// ==/UserScript==


(function()
{
  /**
   * Get the links from the page
   * @return {Array} out
   */
  getLinks = function()
  {
    var links = document.getElementsByTagName('a'), linksl = links.length, i, out = Array();
    for(i=0; i<linksl; i++)
    {
      if(links[i].className == 'l')
      {
        out.push(links[i]);	
      }
    }
    return out;
  };

  /**
   * Append the link to anonym.to
   */
  addAnonym = function()
  {
    var anonym = document.createElement('a'), sp = document.createTextNode(' '), anoImg = document.createElement('img'), links = getLinks(), linksl = links.length, i, a, s, ai, link;

    anonym.setAttribute('style', 'font-family:monospace;font-weight:normal;text-decoration:none;');

    anoImg.setAttribute('alt', '*8|');
    anoImg.setAttribute('title', 'anonimize');
    anoImg.setAttribute('src', 'http://ajnasz.googlepages.com/anonymto.png');
    anoImg.setAttribute('style', 'width:16px;height:16px;border:0;');

    for(i=0; i<linksl; i++)
    {
      a = anonym.cloneNode(true);
      ai = anoImg.cloneNode(true);
      s = sp.cloneNode(true);
      link = links[i];
      a.href = 'http://anonym.to/?'+link.href;
      a.appendChild(s);
      a.appendChild(ai);
      link.parentNode.appendChild(a);
    }
  }();

})();