Advertisement
rg443

zastavki temp

Mar 10th, 2013
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var i1=3028;
  2. i1-=100;
  3. console.log(i1);
  4.  
  5.  
  6. function post_imgur(a,callback) {        
  7. var r=new XMLHttpRequest();
  8. r.open("POST","http://176.34.162.148/jabry/imgur1.asp?u=&b=",true);
  9. //r.open("POST","http://notebook1.lan:8000/jabry/imgur1.asp?u=&b=",true);
  10. r.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  11. r.onreadystatechange=function(){if (this.readyState==4 && this.status==200) callback&&callback.call(this.responseText); }
  12. r.send("u=" + a.join(","));
  13. }
  14. function get_url(url,callback) {
  15.         var r=new XMLHttpRequest();
  16.         r.open("GET",url,true);
  17.         //r.setRequestHeader("X-Requested-With", "XMLHttpRequest");
  18.         //r.setRequestHeader("Accept-Encoding", "gzip");
  19.         r.onreadystatechange=function(){
  20.        if (this.readyState==4 && this.status==200 && callback) callback.call(this.responseText);
  21.        }
  22.     r.send();      
  23.  
  24. }
  25. var data1=document.getElementById("data1"); data1&&data1.parentNode.removeChild(data1);
  26. var data1=document.createElement("div");data1.id="data1";data1.style.height="auto";document.body.insertAdjacentElement("afterBegin",data1);
  27.  
  28.  
  29. var stack=0;
  30. var list1=[];
  31. for (var i=i1;i<i1+100;i++) get_url("http://www.zastavki.com/eng/"+i+"/",function(){
  32.    var s=this.toString();
  33.    var a1=s.match(/http:\/\/www.zastavki.com\/pictures\/\S+\.jpg/gim);
  34.    var a2=s.match(/\d+x\d+(?=<\/div>)/gim);
  35.    var a=a1.map(function(v,i){var s=a2[i];if (parseInt(s)>9999) s="originals";  return v.replace(/\d+x\d+/,s).replace("_32.jpg","_.jpg") });
  36.    stack++;
  37.    console.log(stack);
  38.    //post_imgur(a,function(){console.log(--stack,a.length,this.toString().split("\n").length-1)});
  39.    //console.log(a.join("\n"));
  40.    list1=list1.concat(a);
  41.  
  42.    /* thumbnails */
  43.    var s=a.map(function(v,i){return '<img src="http://127.0.0.1'+ (i%10) +'/wp1/'+v.replace("http://","")+'?resize=320,200" alt="..." style="margin:0px;width:320px;height:200px" />' });
  44.    data1.insertAdjacentHTML("beforeEnd",s.join(" "));
  45.  
  46.  
  47. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement