X-Git-Url: https://scm.cri.mines-paristech.fr/git/Portfolio.git/blobdiff_plain/3940d117b095679f682c973f0bdc83e877b214e6..42f8aecd3f2b63a3929bb3a0baf420c6bd47b05f:/skins/photo_lightbox_viewer.js?ds=sidebyside diff --git a/skins/photo_lightbox_viewer.js b/skins/photo_lightbox_viewer.js index d659ac1..bb27a67 100644 --- a/skins/photo_lightbox_viewer.js +++ b/skins/photo_lightbox_viewer.js @@ -11,20 +11,21 @@ var Lightbox; var reSelected = /.*selected.*/; -Lightbox = function(grid, toolbar, complete) { +Lightbox = function(grid, toolbar, complete, container_type) { var self = this; this.grid = grid; - this.lastSlide = this.grid.children[this.grid.children.length-1]; + this._buildSlidesIndex(); // set this.slides and this.lastSlide; this.fetchingDisabled = false; this.complete = complete; - console.log('complete:', complete) + this.container_type = container_type; this.toolbar = toolbar; if (toolbar) { this.toolbarFixed = false; addListener(window, 'scroll', function(evt){self.windowScrollToolbarlHandler(evt);}); } addListener(window, 'scroll', function(evt){self.windowScrollGridHandler(evt);}); - addListener(window, 'load', function(evt){ self.windowScrollGridHandler();}); + // addListener(window, 'load', function(evt){ self.windowScrollGridHandler();}); + registerStartupFunction(function(){ self.windowScrollGridHandler();}); this.lastCBChecked = undefined; this.form = undefined; var parent = this.grid.parentNode; @@ -47,13 +48,25 @@ Lightbox = function(grid, toolbar, complete) { } }; +Lightbox.prototype._buildSlidesIndex = function() { + this.slides = []; + var node, i; + for (i=0 ; i this.lastSlide.firstElementChild.offsetTop - getWindowHeight()) { + getWindowScrollY() > + (this.lastSlide.firstElementChild || this.lastSlide.children[0]).offsetTop + - getWindowHeight()) { this.fetchingDisabled = true; this.fetchTail(); } @@ -185,6 +200,9 @@ Lightbox.prototype.onResponseLoad = function(req) { this.fm.submitButton = undefined; this.refreshGrid(); break; + default : + this.fm.loadResponse(req); + break; } }; @@ -247,7 +265,7 @@ Lightbox.prototype.deleteSelection = function() { }; Lightbox.prototype._removeSelection = function() { - var i, e, slide; + var i, e; var toRemove = []; for (i=0 ; i