X-Git-Url: https://scm.cri.mines-paristech.fr/git/Portfolio.git/blobdiff_plain/b5ab6830421b7147eac005470f50d0cb44080daf..56cf98937c95ed6aee58b464aa389ee3a90c9413:/skins/photo_lightbox_viewer.js?ds=sidebyside diff --git a/skins/photo_lightbox_viewer.js b/skins/photo_lightbox_viewer.js index f4c4498..3438151 100644 --- a/skins/photo_lightbox_viewer.js +++ b/skins/photo_lightbox_viewer.js @@ -482,10 +482,10 @@ Lightbox.prototype.onDragStart = function(evt) { Lightbox.prototype.onDragOver = function(evt) { var target = getTargetedObject(evt); - if (!target) {return;} - while(target.className !== 'slide') { + while(target && target.className !== 'slide') { target = target.parentNode; } + if (!target) {return;} target = target.parentNode; if (target !== this.dragged) { target.classList.add('dragover'); @@ -500,8 +500,10 @@ Lightbox.prototype.onDragEnd = function(evt) { if (this.lastDropTarget) { this.lastDropTarget.classList.remove('dragover'); var i, slide; + this.pendingMovedSlides = []; for(i=this.draggedSelection.length -1 ; i>=0 ; i--) { slide = this.draggedSelection[i].cloneNode(true); + this.pendingMovedSlides.push(slide); this.grid.insertBefore(slide, this.lastDropTarget.nextSibling); slide.style.opacity = 1; slide.style.width = ''; @@ -522,10 +524,7 @@ Lightbox.prototype.moveSelectedPhotos = function() { break; case 4 : hideProgressImage(); - if (req.status === 200) { - console.log(req.responseText); - // self._refreshGrid(req); - } + self._moveSelectedPhotos(req) break; } }; @@ -542,7 +541,34 @@ Lightbox.prototype.moveSelectedPhotos = function() { req.send(query); }; -Lightbox.prototype.moveSelectedPhoto = function() { +Lightbox.prototype._moveSelectedPhotos = function(req) { + var i, slide, cb; + if (req.status === 200) { + var doc = req.responseXML.documentElement; + if (doc.nodeName === 'ok') { + for(i=0 ; i