+if (browser.isGecko) {
+ Lightbox.prototype.disableDefaultDragging = function(element) {
+ if (!element) {
+ element = this.grid;
+ }
+ var i, j, name, elements;
+ var elementsNames = ['a', 'img'];
+ for (i=0 ; i < elementsNames.length ; i++) {
+ name = elementsNames[i];
+ elements = element.getElementsByTagName(name);
+ for (j=0 ; j < elements.length ; j++) {
+ elements[j].draggable=false;
+ }
+ }
+ };
+}
+else {
+ Lightbox.prototype.disableDefaultDragging = function() {};
+}
+
+Lightbox.prototype.getSelectedSlides = function() {
+ var i, e, slide;
+ var slides = [];
+ for (i=0 ; i<this.form.elements.length ; i++) {
+ e = this.form.elements[i];
+ if (e.type === 'checkbox' && e.checked) {
+ slide = e.parentNode.parentNode;
+ slides.push(slide);
+ }
+ }
+ return slides;
+};
+
+Lightbox.prototype.onDragStart = function(evt) {
+ var target = getTargetedObject(evt);
+ this.dragged = target;
+ this.draggedSelection = this.getSelectedSlides();
+ this.draggedSelection.push(target);
+ evt.dataTransfer.setData('text', '');
+
+ var i, slide;
+ for(i=0 ; i<this.draggedSelection.length ; i++) {
+ slide = this.draggedSelection[i];
+ slide.style.opacity = 0;
+ slide.style.width = 0;
+ }
+};
+
+Lightbox.prototype.onDragOver = function(evt) {
+ var target = getTargetedObject(evt);
+ while(target.className !== 'slide') {
+ target = target.parentNode;
+ }
+ target = target.parentNode;
+ if (target !== this.dragged) {
+ target.classList.add('dragover');
+ }
+ if (this.previousDragOver && this.previousDragOver !== target) {
+ this.previousDragOver.classList.remove('dragover');
+ }
+ this.previousDragOver = target;
+};
+
+Lightbox.prototype.onDragEnd = function(evt) {
+ if (this.previousDragOver) {
+ this.previousDragOver.classList.remove('dragover');
+ }
+ var i, slide;
+ for(i=0 ; i<this.draggedSelection.length ; i++) {
+ slide = this.draggedSelection[i];
+ slide.style.opacity = 1;
+ slide.style.width = '';
+ }
+ this.draggedSelection = this.previousDragOver = this.dragged = undefined;
+};
+