Advertisement
rg443

10 sec slideshow (document images)

Jan 28th, 2013
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. document.body.insertAdjacentHTML("beforeend",'<div id="slide1" style="width:100%;height:100%;background-color:#222;background-repeat:no-repeat;background-position:center center;background-size:contain;"></div>');document.body.style.margin="0px";document.body.style.overflowY="hidden";var slide1=document.getElementById("slide1");window.scroll(0,slide1.offsetTop);
  2.  
  3. var a=data1.innerHTML.match(/http.*?jpg/gim);
  4. setInterval(function(){slide1.style.backgroundImage="url('" + a[~~((a.length-1)*Math.random())]+ "')"},10000)
  5.  
  6.  
  7. setInterval(function() {
  8. var r=new XMLHttpRequest();
  9. r.open("GET","http://photos1.servepics.com/jabry/fsv.asp?q=t0&p="+ ((i++ % 50)+1));
  10. r.onreadystatechange=function(){if (this.readyState==4 && this.status==200) {
  11.    var b=this.responseText.match(/http.*?jpg/gim);
  12.    b.forEach(function(v){ if (a.indexOf(v)==-1) a.push(v)});
  13.    console.log(i,a.length);
  14.    } }
  15. r.send();
  16. },120000);
  17.  
  18.  
  19.  
  20.  
  21. /* maintenance stuff */
  22. a=a.map(function(v){var x=(v+"").match(/http:[^"]*?\.jpg/im); return x&&x[0]||null });a.forEach(function(v,i,a){if (v=="") a.splice(i,1); });a=a.unique();a.sort();
  23.  
  24. post_imgur(a.map(function(v){return (v+"").replace("http://notebook1.lan/vc/","http://view.stern.de/de/original/")}))
  25.  
  26.  
  27. function () {
  28.         var arr = this, newArr = [], obj = {};
  29.         for(var i = 0, len = arr.length; i < len; i++){
  30.             if (obj[arr[i]]) {
  31.                         continue;
  32.                 }
  33.                 obj[arr[i]] = 1;
  34.                 newArr.push(arr[i]);
  35.         }
  36.         return newArr;
  37.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement