Skip to content

Instantly share code, notes, and snippets.

@arvgta
Last active December 13, 2015 19:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arvgta/4961833 to your computer and use it in GitHub Desktop.
Save arvgta/4961833 to your computer and use it in GitHub Desktop.
Display a PageRank Bar on your pages that updates itself - also works in an Ajax environment!
(function($){
$.fn.PageRank_Bar=function(style){
$this = $(this);
if(!style) style = 9; //default style
$(function () { //on DOMready
$.ajax({
url: 'http://4nf.org/php/gPR.php?u=' + location,
success: function(pr) {
if(!pr) pr = 0;
$this.html(
'<a href="http://www.page-rank-lookup.com/" title="Check PageRank">' +
'<img src="http://www.page-rank-lookup.com/i/style' + style +
'/pr' + pr + '.gif" border="0" alt="PageRank: ' + pr + '/10" />' +
'</a>'
);
},
error: function(xhr, ajaxOptions, thrownError) {alert(thrownError);
}
});
}); //end on DOMready
return $this;
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment