X-Git-Url: https://scm.cri.mines-paristech.fr/git/Portfolio.git/blobdiff_plain/416df04821b815a2df5c4d0e669d395d095227f7..992dde21cc051b895d8e5e98509c27edc4e3e304:/skins/photo_lightbox_viewer.js?ds=inline diff --git a/skins/photo_lightbox_viewer.js b/skins/photo_lightbox_viewer.js index 0b40288..9a57ac2 100644 --- a/skins/photo_lightbox_viewer.js +++ b/skins/photo_lightbox_viewer.js @@ -53,7 +53,7 @@ Lightbox.prototype.windowScrollHandler = function(evt) { this.switchToolBarPositioning(false); } if (window.scrollY > this.lastSlide.firstElementChild.offsetTop - getWindowHeight()) { - console.log('À boire !'); + this.fetchTail(); } }; @@ -325,6 +325,40 @@ Lightbox.prototype._refreshGrid = function(req) { } }; +Lightbox.prototype.fetchTail = function() { + var req = new XMLHttpRequest(); + self = this; + req.onreadystatechange = function() { + switch (req.readyState) { + case 1 : + showProgressImage(); + break; + case 4 : + hideProgressImage(); + if (req.status === 200) { + self._appendTail(req) + } + break; + } + }; + + var url = absolute_url() + + '/portfolio_thumbnails_tail?start:int=' + + String(this.grid.children.length + 1 ) + + '&size:int=10'; + req.open('GET', url, true); + req.send(); +}; + +Lightbox.prototype._appendTail = function(req) { + var doc = req.responseXML.documentElement; + var i; + var slides = this.grid.children; + for (i=0 ; i