I was working on a small module that requires to show member's website's page rank. However, I didn't find any suitable web service that can provide me the exact solution that i wanted.
So, I had to do some small hack on an existing third party page rank service. http://www.mypagerank.net provides such service which i was able to make edits on. They provides a javascript link that actually does all their works. Its as follows:
<script src="http://www.mypagerank.net/services/pagerankbutton/servicepr_js.php"></script>
Problem is this show some texts/textbox/button to enter url and click to retrieve the resultant page rank, which wasn't my expectation. The main clue i got here is that, this doesn't require any captcha entry to verify myself, so trying to automate worth a try.
So, i added some JavaScript code snippet(actually jquery) those are as follows:
var int_id;
$(document).ready(function(){
if($("#surl").length){
$("#surl").val("url; ?>");
$("input[type='button'][value='Check PR']").click();
int_id = setInterval(show_pr,2000);
}
});
function show_pr(){
var images = $("img[align='absmiddle']");
if(images.length>0){
images.css('display','none');
images.eq(0).css('display','block');
clearInterval(int_id);
}
}
Notice the "url; ?>" portion, here will be the dynamic url we need page rank of. This code will remove the required action to enter url and click the button and also show only the first result instead of all that the script provides. So, this might help you if you require such customization and want to show page rank.
Subscribe to:
Post Comments (Atom)










0 comments:
Post a Comment