Diffstat (limited to 'frontend/gamma/js/MochiKit/Sortable.js') (more/less context) (show whitespace changes)
-rw-r--r-- | frontend/gamma/js/MochiKit/Sortable.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/frontend/gamma/js/MochiKit/Sortable.js b/frontend/gamma/js/MochiKit/Sortable.js index 863b506..ca9db21 100644 --- a/frontend/gamma/js/MochiKit/Sortable.js +++ b/frontend/gamma/js/MochiKit/Sortable.js @@ -1,33 +1,33 @@ /*** Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) Mochi-ized By Thomas Herve (_firstname_@nimail.org) See scriptaculous.js for full license. ***/ -MochiKit.Base._module('Sortable', '1.5', ['Base', 'Iter', 'DOM', 'Position', 'DragAndDrop']); +MochiKit.Base.module(MochiKit, 'Sortable', '1.5', ['Base', 'Iter', 'DOM', 'Position', 'DragAndDrop']); MochiKit.Base.update(MochiKit.Sortable, { __export__: false, /*** Manage sortables. Mainly use the create function to add a sortable. ***/ sortables: {}, _findRootElement: function (element) { while (element.tagName.toUpperCase() != "BODY") { if (element.id && MochiKit.Sortable.sortables[element.id]) { return element; } element = element.parentNode; } }, _createElementId: function(element) { if (element.id == null || element.id == "") { var d = MochiKit.DOM; var id; @@ -158,57 +158,57 @@ MochiKit.Base.update(MochiKit.Sortable, { options_for_draggable.reverteffect = options.reverteffect; } else if (options.ghosting) { options_for_draggable.reverteffect = function (innerelement) { innerelement.style.top = 0; innerelement.style.left = 0; }; } if (options.endeffect) { options_for_draggable.endeffect = options.endeffect; } if (options.zindex) { options_for_draggable.zindex = options.zindex; } // build options for the droppables var options_for_droppable = { overlap: options.overlap, containment: options.containment, hoverclass: options.hoverclass, onhover: self.onHover, tree: options.tree, accept: options.accept - } + }; var options_for_tree = { onhover: self.onEmptyHover, overlap: options.overlap, containment: options.containment, hoverclass: options.hoverclass, accept: options.accept - } + }; // fix for gecko engine MochiKit.DOM.removeEmptyTextNodes(element); options.draggables = []; options.droppables = []; // drop on empty handling if (options.dropOnEmpty || options.tree) { new MochiKit.DragAndDrop.Droppable(element, options_for_tree); options.droppables.push(element); } MochiKit.Base.map(function (e) { // handles are per-draggable var handle = options.handle ? MochiKit.DOM.getFirstElementByTagAndClassName(null, options.handle, e) : e; options.draggables.push( new MochiKit.DragAndDrop.Draggable(e, MochiKit.Base.update(options_for_draggable, {handle: handle}))); new MochiKit.DragAndDrop.Droppable(e, options_for_droppable); if (options.tree) { e.treeNode = element; @@ -409,94 +409,94 @@ MochiKit.Base.update(MochiKit.Sortable, { self._marker.style.top = (offsets.y + dropon.clientHeight) + 'px'; } } MochiKit.Style.showElement(self._marker); }, _tree: function (element, options, parent) { var self = MochiKit.Sortable; var children = self.findElements(element, options) || []; for (var i = 0; i < children.length; ++i) { var match = children[i].id.match(options.format); if (!match) { continue; } var child = { id: encodeURIComponent(match ? match[1] : null), element: element, parent: parent, children: [], position: parent.children.length, container: self._findChildrenElement(children[i], options.treeTag.toUpperCase()) - } + }; /* Get the element containing the children and recurse over it */ if (child.container) { - self._tree(child.container, options, child) + self._tree(child.container, options, child); } parent.children.push (child); } return parent; }, /* Finds the first element of the given tag type within a parent element. Used for finding the first LI[ST] within a L[IST]I[TEM].*/ _findChildrenElement: function (element, containerTag) { if (element && element.hasChildNodes) { containerTag = containerTag.toUpperCase(); for (var i = 0; i < element.childNodes.length; ++i) { if (element.childNodes[i].tagName.toUpperCase() == containerTag) { return element.childNodes[i]; } } } return null; }, /** @id MochiKit.Sortable.tree */ tree: function (element, options) { element = MochiKit.DOM.getElement(element); var sortableOptions = MochiKit.Sortable.options(element); options = MochiKit.Base.update({ tag: sortableOptions.tag, treeTag: sortableOptions.treeTag, only: sortableOptions.only, name: element.id, format: sortableOptions.format }, options || {}); var root = { id: null, parent: null, children: new Array, container: element, position: 0 - } + }; return MochiKit.Sortable._tree(element, options, root); }, /** * Specifies the sequence for the Sortable. * @param {Node} element Element to use as the Sortable. * @param {Object} newSequence New sequence to use. * @param {Object} options Options to use fro the Sortable. */ setSequence: function (element, newSequence, options) { var self = MochiKit.Sortable; var b = MochiKit.Base; element = MochiKit.DOM.getElement(element); options = b.update(self.options(element), options || {}); var nodeMap = {}; b.map(function (n) { var m = n.id.match(options.format); if (m) { nodeMap[m[1]] = [n, n.parentNode]; } n.parentNode.removeChild(n); }, self.findElements(element, options)); |