// PageRank Beautifier
// version 0.1 - 2009-03-09
// Copyright 2009 (C) Otto de Voogd - http://www.7is7.com/
//
// This script is released under the terms of the GNU General Public License
// (GNU-GPL) version 3 of the licence:
// http://www.gnu.org/copyleft/gpl.html
//
// The purpose of this script is to beautify the response received from
// Google when requesting PageRank information about a site with the
// PageRank bookmarklet, which can be found at:
// http://www.7is7.com/software/bookmarklets/
//
// PangeRank request returns a value like Rank_1:1:4 (for pagerank 4)
// Google itself returns Rank_1:2:10 and unranked pages return nothing.
//
// ==UserScript==
// @name        PageRank Beautifier
// @namespace   http://www.7is7.com/
// @description Transform a PageRank response into a Google styled PageRank bar
// @include     http://www.google.com/search*client=navclient*features=Rank*
// ==/UserScript==

var iH=document.body.innerHTML;
var pr,disp_pr;
if (iH.lastIndexOf(':')!=-1) {
	pr=parseInt(iH.substring(iH.lastIndexOf(':')+1));
	disp_pr=pr+'/10';
} else {
	pr=0;
	disp_pr='n/a';
}
document.title='PageRank: '+disp_pr;
var html='<div style="text-align:center;"><p>PageRank: '+disp_pr+'</p><p><img src="/images/pos.gif" width="'+ (pr*15) +'" height="17" border=0 alt=""><img src="/images/neg.gif" width="'+((10-pr)*15)+'" height="17" border=0 alt=""></p></div>';
document.body.innerHTML = html;

// That's All Folks!
