Advertisement
rg443

autoload pages (photo sight)

Jan 13th, 2013
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* fetch url */
  2. function get_url(url,callback) {
  3.         var r=new XMLHttpRequest();
  4.         r.open("GET",url,true);
  5.         r.onreadystatechange=function(){
  6.        if (this.readyState==4 && this.status==200) callback.call(this.responseText);
  7.        }
  8.     r.send();      
  9.  
  10. }
  11. Array.prototype.unique = function(){
  12. return this.filter(function(s, i, a){ return i == a.lastIndexOf(s); });
  13. }
  14.  
  15. function save1(s){
  16. window[tag+"."+page]=s;//this.toString();
  17. console.log("rcvd:" + page);
  18. document.getElementById("data1").insertAdjacentHTML('beforeend',window[tag+"."+page].match(/<div id="data1">([\s\S]*?)<\/div>/im)[1]);
  19. location.hash=page;
  20. page++;
  21. if (page <=50) get_url("?q="+tag+"&p="+page,function(){save1(this.toString())});
  22. //
  23. }
  24. // get_url("?q="+tag+"&p="+page,function(){save1(this.toString())});
  25.  
  26. tag="c87";page=2; get_url("?q="+tag+"&p="+page,function(){save1(this.toString())});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement