View Single Post
Old 07-31-2004, 05:19 AM   #154
rayg
Nameless Being
 
pure javascript bookmarklet

this is completely done with javascript requiring no backend php or cgi. it also seems to be platform independent. props go to here for the original javascript. it doesn't handle urls with parameters (like the url of this page in the thread), but i haven't seen any of the other implementations handle these correctly, either (they chop off the parameters). just prepend 'javascript' + ':'.
Code:
function%20zeroFill(a,b){var%20z=2147483648;if(z&a){a=(a>>1);a&=(~z);a|=0x40000000;a=(a>>(b-1));}else{a=(a>>b);}return%20a;}function%20mix(a,b,c){a-=b;a-=c;a^=(zeroFill(c,13));b-=c;b-=a;b^=(a<<8);c-=a;c-=b;c^=(zeroFill(b,13));a-=b;a-=c;a^=(zeroFill(c,12));b-=c;b-=a;b^=(a<<16);c-=a;c-=b;c^=(zeroFill(b,5));a-=b;a-=c;a^=(zeroFill(c,3));b-=c;b-=a;b^=(a<<10);c-=a;c-=b;c^=(zeroFill(b,15));return%20Array(a,b,c);}function%20GoogleCH(url){var%20length=url.length;a=b=0x9E3779B9;c=0xE6359A60;k=0;len=length;while(len>=12){a+=(url[k+0]+(url[k+1]<<8)+(url[k+2]<<16)+(url[k+3]<<24));b+=(url[k+4]+(url[k+5]<<8)+(url[k+6]<<16)+(url[k+7]<<24));c+=(url[k+8]+(url[k+9]<<8)+(url[k+10]<<16)+(url[k+11]<<24));mixvar=mix(a,b,c);a=mixvar[0];b=mixvar[1];c=mixvar[2];k+=12;len-=12;}c+=length;switch(len){case%2011:c+=(url[k+10]<<24);case%2010:c+=(url[k+9]<<16);case%209:c+=(url[k+8]<<8);case%208:b+=(url[k+7]<<24);case%207:b+=(url[k+6]<<16);case%206:b+=(url[k+5]<<8);case%205:b+=(url[k+4]);case%204:a+=(url[k+3]<<24);case%203:a+=(url[k+2]<<16);case%202:a+=(url[k+1]<<8);case%201:a+=(url[k+0]);}mixvar=mix(a,b,c);return%20mixvar[2];}function%20strord(string){var%20result=new%20Array();for(i=0;i<string.length;i++){result[i]=string.charCodeAt(i);}return%20result;}var%20ch=GoogleCH(strord('info:'+location.href));location.href='http://google.com/search?client=navclient-auto&ch=6'+ch+'&features=Rank&q=info:'+location.href
  Reply With Quote