diff options
author | Andreas Unterkircher <unki@netshadow.at> | 2008-03-29 12:11:33 +0100 |
---|---|---|
committer | Andreas Unterkircher <unki@netshadow.at> | 2008-03-29 12:11:33 +0100 |
commit | b7a43526958fc12ce7d0e42b8023db52cb25f140 (patch) | |
tree | 1badbdc3ad3e1588faf0c5e0b43738cbb7007fcd /phpfspot.js | |
parent | 38b33998a89dc05f4fc7c90ba6eabb29301f131a (diff) | |
parent | 072aed3d53445a6b09edabf1551706de4c3f1cb1 (diff) |
Merge branch 'master' into nefformat
Diffstat (limited to 'phpfspot.js')
-rw-r--r-- | phpfspot.js | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/phpfspot.js b/phpfspot.js index 89eacba..f9f9703 100644 --- a/phpfspot.js +++ b/phpfspot.js @@ -427,23 +427,32 @@ function WSR_getElementsByClassName(oElm, strTagName, oClassNames){ } -function preloadPhotos(lbImg) { +function preloadPhotos(image_url) { - var d=document; - if(d.images) - if(!d.photos) - d.photos=new Array(); - - var i, j=d.photos.length; + var i; + var timeout = 1000; + var waiting = 100; + var counting; lbImg=WSR_getElementsByClassName(document,"img","thumb"); for(i=0;i<lbImg.length;i++){ - d.photos[j]=new Image; - d.photos[j].src=lbImg[i].src; - j++; + lbImg[i].src=image_url[i]; + // to not bomb the server with requests, give the page some time + // to load the images one by one. if a image exceeds the timeout, + // the next image will be loaded. + if(lbImg[i].complete != undefined && lbImg[i].complete != true) { + counting = 0; + while(lbImg[i].complete != true && counting < timeout) { + window.setTimeout("noop()", waiting); + counting+=waiting; + } + } } } +/* a function that does nothing */ +function noop() {} + function startSlideShow() { if(!sliding) { |