diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js index 067cd08642..b9039ea9a6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js @@ -60,181 +60,181 @@ function isNum(v,maybenull) { //======================================================================= // Functions for drag-and-drop functionality +if( typeof(YAHOO) === "object"){ + (function() { -(function() { + var Dom = YAHOO.util.Dom; + var Event = YAHOO.util.Event; + var DDM = YAHOO.util.DragDropMgr; -var Dom = YAHOO.util.Dom; -var Event = YAHOO.util.Event; -var DDM = YAHOO.util.DragDropMgr; - -DDApp = { - init: function() { - var uls = document.getElementsByTagName('ul'); - var i,j; - var ddtarget; - for (i=0; i this.lastY) { + this.goingUp = false; + } + this.lastY = y; + }, + + onDragOver: function(e, id) { + + var srcEl = this.getEl(); + var destEl = Dom.get(id); + + // We are only concerned with list items, we ignore the dragover + // notifications for the list. + if (destEl.nodeName.toLowerCase() == "li") { + var orig_p = srcEl.parentNode; + var p = destEl.parentNode; + + if (this.goingUp) { + p.insertBefore(srcEl, destEl); // insert above + } else { + p.insertBefore(srcEl, destEl.nextSibling); // insert below + } - // Check to see if we are over the source element's location. We will - // append to the bottom of the list once we are sure it was a drop in - // the negative space (the area of the list without any list items) - if (!region.intersect(pt)) { - var destEl = Dom.get(id); - var destDD = DDM.getDDById(id); - destEl.appendChild(this.getEl()); - destDD.isEmpty = false; DDM.refreshCache(); } } - }, - - onDrag: function(e) { - - // Keep track of the direction of the drag for use during onDragOver - var y = Event.getPageY(e); - - if (y < this.lastY) { - this.goingUp = true; - } else if (y > this.lastY) { - this.goingUp = false; - } - this.lastY = y; - }, - - onDragOver: function(e, id) { - - var srcEl = this.getEl(); - var destEl = Dom.get(id); - - // We are only concerned with list items, we ignore the dragover - // notifications for the list. - if (destEl.nodeName.toLowerCase() == "li") { - var orig_p = srcEl.parentNode; - var p = destEl.parentNode; - - if (this.goingUp) { - p.insertBefore(srcEl, destEl); // insert above - } else { - p.insertBefore(srcEl, destEl.nextSibling); // insert below - } - - DDM.refreshCache(); - } - } -}); -})(); - + }); + })(); +}