   1. // ==UserScript==  
   2. // @name        TDNAM PageRank Checker  
   3. // @author  Craze3  
   4. // @email   craze3@gmail.com  
   5. // @namespace   http://www.scaredy.com  
   6. // @description Adds a pagerank/backlink display next to every domain listed on tdnam.com.  
   7. // @include     http://tdnam.com/*  
   8. // @include     http://*.tdnam.com/*  
   9. //  
  10. // @include     https://tdnam.com/*  
  11. // @include     https://*.tdnam.com/*  
  12. // ==/UserScript==  
  13.   
  14. //URL API Used to create the pagerank check image (for reference):  
  15. //http://www.top-google-pagerank.com/pagerank.php?action=image&url=http://www.URL-HERE.com  
  16. //..and the one for backlinks:  
  17. //http://www.express-submit.de/backlink-neu/backlink.cgi?http://www.URL-HERE.com  
  18.   
  19. //Trim function, removes whitespace  
  20. function trim(s){  
  21.     if((s==null)||(typeof(s)!='string')||!s.length)return'';return s.replace(/^\s+/,'').replace(/\s+$/,'')}  
  22.   
  23. //Loop through all domains listed and add pagerank image  
  24. var result = document.evaluate( "//td[@class='sItem']/a[@style] | //td[@class='sItemA']/a[@style]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null );  
  25.   
  26. if(result.snapshotLength < 1)    return;  
  27. for ( var i = 0; i < result.snapshotLength; i++ )  
  28. {  
  29.     thisElement = result.snapshotItem(i);  
  30.     thisText = trim(thisElement.title);  
  31.     if(!thisText)   thisText = trim(thisElement.text);  
  32.     thisText = thisText.replace("View details for ", "");  
  33.   
  34.     newElement = document.createElement('div');  
  35.     newElement.innerHTML = '<img src="http://www.linktrend.com/pr?uri=http://' + thisText + '" />';  
  36.     thisElement.parentNode.insertBefore(newElement, thisElement.nextSibling);  
  37. }  

