Advertisement
rg443

listofcarbrands.com (paging)

Jun 16th, 2013
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* listofcarbrands grid view (paging) */
  2. var ig="http://rg443.bugs3.com/p/?url=";
  3. var ig="http://rg443.hj.cx/p/?url=";
  4. document.head.insertAdjacentHTML("beforeEnd","<style> \
  5. img.b{width:160px;height:160px;margin:2px;background-color:whitesmoke;image-rendering:optimizeQuality;border-radius:7px;zoom:1.33} \
  6. img.s{width:90px;height:90px;margin:2px;background-color:whitesmoke;image-rendering:optimizeQuality;zoom:1.0}   \
  7. img.t{width:320px;height:200px;margin:2px;image-rendering:optimizeQuality;border-radius:7px;} \
  8. </style>");
  9. document.head.insertAdjacentHTML('AfterBegin',
  10. '<link rel="shortcut icon" href="http://www.listofcarbrands.com/wp-content/themes/w-minfolio-1/favicon.ico" /> \
  11. <title>HD Car Wallpapers</title>');
  12.  
  13. var cache1=cache1||{};
  14.  
  15. var x={j:1,pageSize:20,page:670,title:"HD Car Wallpapers",title1:"listofcarbrands",url:"http://www.listofcarbrands.com/page/$i/"};
  16.  
  17. /* init */
  18. document.body.innerHTML="<div id=\"navtop\" style=\"font:menu\"></div><div id=\"data1\" style=\"font:menu;min-height:12240px;overflow-y:visible;\"></div><div id=\"navbot\" style=\"font:menu\"></div>"
  19. x.data1=document.getElementById("data1");
  20.  
  21.  
  22. /*
  23. <img src="http://www.listofcarbrands.com/wp-content/themes/w-minfolio-1/timthumb.php?src=http://www.listofcarbrands.com/wp-content/uploads/2013/04/2013-Dodge-SRT-Viper-GTS-R-SRT-Viper-GTS.jpg&h=200&w=300&zc=1" alt="2013 Dodge SRT Viper GTS-R &#8211; SRT Viper GTS" width="300" height="200" />
  24. */
  25.  
  26.  
  27. x.next=function(){
  28.    for (var i=x.j;i<x.j+x.pageSize;i++) setTimeout(get_url,(i-x.j-1)*200,ig+x.url.replace("$i",i),parse1);
  29.    setTimeout(get_url,5000,ig+x.url.replace("$i",i)); // prefetch
  30.    document.title=x.title1 +" - " + x.j;
  31.    x.j+=x.pageSize;
  32.    window.scroll(0,0);
  33.    window.stop&&window.stop();
  34.    x.data1.innerHTML="";
  35.    
  36.    function parse1(){
  37.        var a = (this.match(/http:\/\/www.listofcarbrands.com\/wp-content\/uploads\/\S+.jpg/gim)||[]).map(function(v){return v.replace(/-\d+x\d+(?=\.jpg)/,"")});
  38.        b=a.map(function(v,i){return '<img src="http://127.0.0.'+(i%10+1)+'/wp1/'+v.substring(7)+'?resize=320,200" class="t" alt=""/>'});
  39.        x.data1.insertAdjacentHTML("beforeend",b.join(""));
  40.        }
  41.     }
  42.  
  43. x.prev=function(){
  44.     x.j-=x.pageSize*2; if(x.j<=1) x.j=1; x.next();
  45.     }
  46.  
  47. x.preview=function(e){
  48.    var e=e.srcElement||e.target;
  49.    if (e.tagName!="IMG") return;
  50.    console.log(e.src);
  51.    }
  52.    
  53.    
  54.  
  55. document.onclick=x.preview;
  56. document.onkeyup=function(e){
  57.    // console.log(e.which , e.keyCode,document.height,window.pageYOffset,window.innerHeight)
  58.    if (e.keyCode==34 && (document.height-window.pageYOffset-window.innerHeight)==0)x.next(); /* pgdn */
  59.    if (e.keyCode==33 && window.pageYOffset==0)x.prev(); /* pgup */
  60.    }
  61.  
  62.  
  63. function get_url(url,callback) {
  64.     if (cache1.hasOwnProperty(url) && callback) {callback.call(cache1[url]);return};
  65.     var r=new XMLHttpRequest();
  66.     r.open("GET",url,true);
  67.     r.onreadystatechange=function(){
  68.        if (this.readyState==4 && this.status==200) {cache1[url]=this.responseText; callback&&callback.call(this.responseText);};
  69.        }
  70.     r.send();      
  71.  
  72. }
  73. /* upload imgur */
  74. function post_imgur(a,callback) {    
  75. var r=new XMLHttpRequest();
  76. r.open("POST","http://176.34.162.148/jabry/imgur1.asp?u=&b=",true);
  77. r.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  78. r.onreadystatechange=function(){if (this.readyState==4 && this.status==200) callback.call(this.responseText); }
  79. r.send("u=" + a.join(","));
  80. }
  81.    
  82.    
  83.    
  84.    
  85.  
  86. x.next();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement