Created
July 7, 2014 06:01
-
-
Save windows98SE/203069b7d22edbbd910b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var anytechPageRank={cache:{data:{},getElement:function(a){var b=this.data;if(b[a]){return b[a].value}return undefined},isSet:function(a){var b=this.data;if(b[a]){if(new Date().getTime()>b[a].time){delete b[a]}else{return true}}return false},setElement:function(a,b){this.data[a]={value:b,time:new Date().getTime()+(typeof b=="undefined"?1000:3600*1000)}}},byteToHex:function(a){return a<16?"0"+a.toString(16):a.toString(16)},intToHex:function(a){return this.byteToHex(a>>>24)+this.byteToHex(a>>>16&255)+this.byteToHex(a>>>8&255)+this.byteToHex(a&255)},hash:function(a){var c=16909125;var d="Mining PageRank is AGAINST GOOGLE'S TERMS OF SERVICE. Yes, I'm talking to you, scammer.";for(var b=0;b<a.length;b++){c^=d.charCodeAt(b%d.length)^a.charCodeAt(b);c=c>>>23|c<<9}return this.intToHex(c)},getGoogleURL:function(b){b=this.prepareURL(b);var c=/^https:\/\/[^\/]*[\/]?/i.exec(b);if(c){b=c[0]}var a="http://toolbarqueries.google.com/tbr?";a+="client=navclient-auto";a+="&ch=8"+this.hash(b);a+="&features=Rank";a+="&q=info:"+encodeURIComponent(b);return a},getRankFromString:function(a){var b;b=/^.+?:.+?:(.+?)\n?$/.exec(a);return(b=/^.+?:.+?:(.+?)\n?$/.exec(a))?b[1]:""},createHttpRequest:function(){if(window.XMLHttpRequest){return new XMLHttpRequest()}return new ActiveXObject("Microsoft.XMLHTTP")},executeWithTimeout:function(b,a){setTimeout(b,a)},getRankForURL:function(a,c){var b=this.createHttpRequest();b.open("GET",this.getGoogleURL(a),true);b.onreadystatechange=function(){if(b.readyState==4){if(b.status==200){c(anytechPageRank.getRankFromString(b.responseText))}else{c(undefined)}}};b.send(null)},prepareURL:function(a){return a},getNormalURL:function(a){if(!a){return a}if(a.indexOf(":")<0){return"http://"+a}if(!this.isApplicableURL(a)){return null}var b=a.indexOf("#");return b>=0?a.substring(0,b):a},isApplicableURL:function(a){if(a.indexOf(":")<0){return/^[^\/]+\.[^\/]+/.test(a)}return/^https?:\/\/[^\/]+\.[^\/]+/i.test(a)},getRank:function(b,d,c,a){b=this.getNormalURL(b);if(!b){c(null);return}if(this.cache.isSet(b)){c(this.cache.getElement(b));return}d();if(a){this.executeWithTimeout(function(){anytechPageRank.getRankForURL(b,function(e){anytechPageRank.cache.setElement(b,e);c(e)})},a)}else{this.getRankForURL(b,function(e){anytechPageRank.cache.setElement(b,e);c(e)})}},GUI:{BACKGROUND_DELAY:100,delay:0,fillTable:function(h,d,g){var b=d.countTabs();var l=h.rows;if(l.length==2&&l[1].cells[0].colSpan==2){h.deleteRow(1)}while(l.length>b+1){h.deleteRow(l.length-1)}if(b==0){var f=h.insertRow(1).insertCell(0);f.colSpan=2;f.appendChild(this.getDocument(g).createTextNode(d.getEmptyText()))}this.delay=this.BACKGROUND_DELAY;for(var e=0;e<b;e++){var k;if(l.length>e+1){k=l[e+1];for(var c=k.cells.length-1;c>=0;c--){this.removeAllChildren(k.cells[c])}}else{k=h.insertRow(e+1);k.insertCell(0);k.insertCell(1);if(e%2){k.className="odd"}}var a=d.getInfo(e);k.cells[0].appendChild(this.createURLArea(a.url,a.tabid,g));this.fillRow(k,a.url,g)}},createURLArea:function(b,a,c){var d=this.getDocument(c).createElement("div");d.title=b;d.appendChild(this.getDocument(c).createTextNode(b));if(c.activate){d.onclick=function(){anytechPageRank.GUI.activate(a)}}return d},getDocument:function(a){return a.content?a.content:document},fillRow:function(f,c,d){var a=f.cells[1];var e=anytechPageRank;var b=e.GUI;e.getRank(c,function(){a.appendChild(b.getDocument(d).createTextNode("..."));b.delay+=b.BACKGROUND_DELAY},function(h){b.removeAllChildren(a);if(typeof h=="undefined"){var g=b.getDocument(d).createElement("a");g.href="javascript:void(0)";g.appendChild(b.getDocument(d).createTextNode(b.rankToText(h)));g.onclick=function(){b.openLink(e.getGoogleURL(c))};a.appendChild(g)}else{a.appendChild(b.getDocument(d).createTextNode(b.rankToText(h)))}},b.delay)},activate:function(a){alert("activate function is not defined")},rankToText:function(a){alert("rankToText function is not defined")},openLink:function(a){alert("openLink function is not defined")},removeAllChildren:function(b){var a=b.childNodes;while(a.length>0){b.removeChild(a[0])}}}}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment