rg443

pcwalls.net grid (paging)

Jun 13th, 2013
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var ig="http://rg443.hj.cx/p/?url=";
  2. var pageSize=20,pages=4086,tag="latest_wallpapers",cat="top_view_wallpapers latest_wallpapers top_wallpapers animals-desktop-wallpapers".split(" ");
  3. // tag=cat[3];
  4. var j=1;
  5. if(!cache1)var cache1={};
  6. if (!data1) {var data1=document.createElement("div");document.body.insertAdjacentElement("afterBegin",data1)}; data1.innerHTML="";data1.style.marginLeft="140px";data1.style.cursor="pointer"; data1.style.width="1300px"; data1.style.minHeight="12250";data1.style.overflowY="visible";
  7. if (!next1) {var next1=document.createElement("span");next1.innerText="more..."; var n=next1.style; n.font="16pt Arial";n.color="blue";n.cursor="pointer";n.marginLeft=data1.style.marginLeft; data1.insertAdjacentElement("AfterEnd",next1);}
  8.  
  9. function parse1(){
  10.   var a=this.match(/\w+(?=-t1.jpg)/gim),
  11.   b=a.map(function(v,i){return '<img src="http://127.0.0.'+(i%10+1)+'/wp1/pcwalls.net/thumbs/'+v+'-t2.jpg?resize=320,200" style="width:320px;height:200px;margin:2px;image-rendering:optimizeQuality"/>'});data1.insertAdjacentHTML("beforeEnd",b.join(""));
  12.   }
  13.  
  14. data1.onclick=function(e){
  15.    var e=e.srcElement||e.target;
  16.    if (e.tagName!="IMG") return;
  17.    var w=window.open("about:blank");
  18.    //w.document.body.innerHTML="<p style=\"font:menu\">loading image ...</p>";
  19.    w.document.body.innerHTML='<div style="box-shadow: 10px 10px 5px dimgray;border-radius:10px;image-rendering: optimizeQuality;position:absolute;left:10%;top:10%;width:80%;height:80%;background-repeat:no-repeat;background-position:left top;background-size: cover;background-image:url('+e.src+')"></div>';
  20.    setTimeout(function(){w.location="http://eho.st/"+"http://i1.wp.com/pcwalls.net/download/"+e.src.match(/\w+(?=-t[12].jpg)/)[0]+"-normal.jpg"},300);
  21.    // http://eho.st/ http://imgur.com/upload?url=
  22.    }
  23.  
  24.  
  25. next1.onclick=function(){
  26.    post_imgur(((data1.innerHTML.replace(/(127.0.0.\d+\/wp1)|(i\d+.wp.com)\//gim,"").match(/\w+(?=-t\d.jpg)/gim))||[]).map(function(v){return 'http://pcwalls.net/download/'+v+'-normal.jpg'}),function(){window.hl=this.toString();console.log("imgur: "+ (window.hl.split("\n").length-1))});
  27.    window.scroll(0,0); // data1.offsetTop
  28.    data1.innerHTML="";
  29.    for (var i=j,t=new Date();i<j+pageSize;i++) setTimeout(get_url,(i-j-1)*200,ig+"http://pcwalls.net/"+tag+"/page/"+i,parse1);
  30.    setTimeout(get_url,5000,ig+"http://pcwalls.net/"+tag+"/page/"+i);
  31.    document.title="pcwalls "+ tag + " - " +j;
  32.    j+=pageSize;
  33.    }
  34.  
  35. document.onkeyup=function(e){
  36.    //console.log(e.which , e.keyCode,document.height,window.pageYOffset,window.innerHeight)
  37.    // eof && pgdn
  38.    if (e.keyCode==34 && (document.height-window.pageYOffset-window.innerHeight)==0){next1.onclick();console.log("more");}
  39.    }
  40.  
  41.  
  42. next1.click();
  43.  
  44.  
  45. function get_url(url,callback) {
  46.     if (cache1.hasOwnProperty(url) && callback) {callback.call(cache1[url]);return};
  47.     var r=new XMLHttpRequest();
  48.     r.open("GET",url,true);
  49.     r.onreadystatechange=function(){
  50.        if (this.readyState==4 && this.status==200) {cache1[url]=this.responseText; callback&&callback.call(this.responseText);};
  51.        }
  52.     r.send();      
  53.  
  54. }
  55. /* upload imgur */
  56. function post_imgur(a,callback) {    
  57. var r=new XMLHttpRequest();
  58. r.open("POST","http://176.34.162.148/jabry/imgur1.asp?u=&b=",true);
  59. r.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  60. r.onreadystatechange=function(){if (this.readyState==4 && this.status==200) callback.call(this.responseText); }
  61. r.send("u=" + a.join(","));
  62. }
  63.  
  64. /*
  65. https://www.google.com/searchbyimage?image_url=http%3A%2F%2Fi.eho.st%2Fpjakk4ry.jpg&image_content=&filename=&safe=off&hl=en&bih=397&biw=1600
  66.  
  67. */
Advertisement
Add Comment
Please, Sign In to add comment