Advertisement
rg443

view_preview (2446375)

May 6th, 2013
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var j= j||2477289;
  2. function grid_preview(start){
  3. if (!start) start=2477289;
  4. for (var a=[],i=start;i>start-450;i--) {a.push('<img src="http://i'+ i%3 + '.wp.com/view.stern.de/de/picture/nsfw/'+i+'/'+i+'.jpg?resize=320,200" style="width:320px;height:200px" onerror="rem3(this)" />'); if (i==1) break;}
  5. window.stop();
  6. document.body.innerHTML=a.join("");
  7. document.body.insertAdjacentHTML("beforeEnd",'<br><a href="#" onclick="grid_preview(j-=450);setTimeout(window.scroll,200,0,0);return false;" style="font:menu;font-size:14pt;color:black;text-decoration:none;">more</a>');
  8.  
  9. document.body.insertAdjacentHTML("beforeEnd",'<a href="#" onclick="grid_preview(j+=450);setTimeout(window.scroll,200,0,0);return false;" style="font:menu;font-size:9pt;color:black;text-decoration:none;margin-left:10px;" title="scroll back"> scroll back </a>');
  10.  
  11. document.body.insertAdjacentHTML("beforeEnd",'<a href="#" onclick="latest();setTimeout(window.scroll,200,0,0);return false;" style="font:menu;font-size:9pt;color:black;text-decoration:none;margin-left:5px;" title="latest photos"> latest </a>');
  12.  
  13. document.title="view - " +start;
  14. /*
  15.    http://view.stern.de/de/picture/nsfw/2446353/2446353.jpg
  16.    http://view.stern.de/de/original/nsfw/2446371/2446371.jpg
  17. */
  18.  
  19. }
  20.  
  21. function latest(callback){
  22.    // usage: latest(grid_preview);
  23.    var r=new XMLHttpRequest();
  24.    r.open("GET","http://query.yahooapis.com/v1/public/yql?q=select * from html where url = 'http://view.stern.de/de/picture/0/'",true);
  25.    r.onload=function(){
  26.       var re=/(\d+)\/\S+.jpg/gim,m=null,latest=-1;
  27.       while(m=re.exec(this.responseText)) (latest<m[1])&&(latest=parseInt(m[1]))
  28.       console.log(latest);
  29.       latest&&(localStorage["view.latest"]=[Math.floor(new Date().getTime()/1000),latest]);
  30.       latest&&(j=latest+450);
  31.       latest&&callback&&callback.call(latest+450);
  32.       latest&&grid_preview(latest);
  33.    }
  34.    r.send();
  35. }
  36.  
  37. function rem1(el){setTimeout(function(){el.parentElement.removeChild(el)},100);}
  38. function rem2(el){el.style.display="none";}
  39. function rem3(el){el.style.visibility="hidden";}
  40.  
  41. grid_preview(j);
  42. // latest(grid_preview);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement