]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - resources/lib/jquery.ui/jquery.ui.draggable.js
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / resources / lib / jquery.ui / jquery.ui.draggable.js
similarity index 77%
rename from resources/jquery.ui/jquery.ui.draggable.js
rename to resources/lib/jquery.ui/jquery.ui.draggable.js
index b4c1070dfa765056fb0578a401dcee77e402e47b..723dbd4915cea7a4ff1e6c7e34df6e37c4c022e8 100644 (file)
@@ -1,20 +1,22 @@
-/*
- * jQuery UI Draggable 1.8.2
+/*!
+ * jQuery UI Draggable 1.9.2
+ * http://jqueryui.com
  *
- * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright 2012 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
  *
- * http://docs.jquery.com/UI/Draggables
+ * http://api.jqueryui.com/draggable/
  *
  * Depends:
  *     jquery.ui.core.js
  *     jquery.ui.mouse.js
  *     jquery.ui.widget.js
  */
-(function($) {
+(function( $, undefined ) {
 
 $.widget("ui.draggable", $.ui.mouse, {
+       version: "1.9.2",
        widgetEventPrefix: "drag",
        options: {
                addClasses: true,
@@ -54,17 +56,9 @@ $.widget("ui.draggable", $.ui.mouse, {
 
        },
 
-       destroy: function() {
-               if(!this.element.data('draggable')) return;
-               this.element
-                       .removeData("draggable")
-                       .unbind(".draggable")
-                       .removeClass("ui-draggable"
-                               + " ui-draggable-dragging"
-                               + " ui-draggable-disabled");
+       _destroy: function() {
+               this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" );
                this._mouseDestroy();
-
-               return this;
        },
 
        _mouseCapture: function(event) {
@@ -80,6 +74,16 @@ $.widget("ui.draggable", $.ui.mouse, {
                if (!this.handle)
                        return false;
 
+               $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
+                       $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
+                       .css({
+                               width: this.offsetWidth+"px", height: this.offsetHeight+"px",
+                               position: "absolute", opacity: "0.001", zIndex: 1000
+                       })
+                       .css($(this).offset())
+                       .appendTo("body");
+               });
+
                return true;
 
        },
@@ -91,6 +95,8 @@ $.widget("ui.draggable", $.ui.mouse, {
                //Create and append the visible helper
                this.helper = this._createHelper(event);
 
+               this.helper.addClass("ui-draggable-dragging");
+
                //Cache the helper size
                this._cacheHelperProportions();
 
@@ -127,9 +133,13 @@ $.widget("ui.draggable", $.ui.mouse, {
                });
 
                //Generate the original position
-               this.originalPosition = this.position = this._generatePosition(event);
                this.originalPageX = event.pageX;
                this.originalPageY = event.pageY;
+               this.originalPosition = this.position = this._generatePosition(event);
+               // These lines where moved up to fix an issue with with draggable, revert and grid
+               // See: https://bugs.jqueryui.com/ticket/4696 and https://gerrit.wikimedia.org/r/#/c/333224
+               // this.originalPageX = event.pageX;
+               // this.originalPageY = event.pageY;
 
                //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
                (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
@@ -151,8 +161,12 @@ $.widget("ui.draggable", $.ui.mouse, {
                if ($.ui.ddmanager && !o.dropBehaviour)
                        $.ui.ddmanager.prepareOffsets(this, event);
 
-               this.helper.addClass("ui-draggable-dragging");
+
                this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
+
+               //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
+               if ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event);
+
                return true;
        },
 
@@ -191,16 +205,22 @@ $.widget("ui.draggable", $.ui.mouse, {
                        dropped = this.dropped;
                        this.dropped = false;
                }
-               
-               //if the original element is removed, don't bother to continue
-               if(!this.element[0] || !this.element[0].parentNode)
+
+               //if the original element is no longer in the DOM don't bother to continue (see #8269)
+               var element = this.element[0], elementInDom = false;
+               while ( element && (element = element.parentNode) ) {
+                       if (element == document ) {
+                               elementInDom = true;
+                       }
+               }
+               if ( !elementInDom && this.options.helper === "original" )
                        return false;
 
                if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
-                       var self = this;
+                       var that = this;
                        $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
-                               if(self._trigger("stop", event) !== false) {
-                                       self._clear();
+                               if(that._trigger("stop", event) !== false) {
+                                       that._clear();
                                }
                        });
                } else {
@@ -211,17 +231,29 @@ $.widget("ui.draggable", $.ui.mouse, {
 
                return false;
        },
-       
+
+       _mouseUp: function(event) {
+               //Remove frame helpers
+               $("div.ui-draggable-iframeFix").each(function() {
+                       this.parentNode.removeChild(this);
+               });
+
+               //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
+               if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event);
+
+               return $.ui.mouse.prototype._mouseUp.call(this, event);
+       },
+
        cancel: function() {
-               
+
                if(this.helper.is(".ui-draggable-dragging")) {
                        this._mouseUp({});
                } else {
                        this._clear();
                }
-               
+
                return this;
-               
+
        },
 
        _getHandle: function(event) {
@@ -241,7 +273,7 @@ $.widget("ui.draggable", $.ui.mouse, {
        _createHelper: function(event) {
 
                var o = this.options;
-               var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone() : this.element);
+               var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') : this.element);
 
                if(!helper.parents('body').length)
                        helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
@@ -284,13 +316,13 @@ $.widget("ui.draggable", $.ui.mouse, {
                // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
                // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
                //    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
-               if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
+               if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
                        po.left += this.scrollParent.scrollLeft();
                        po.top += this.scrollParent.scrollTop();
                }
 
                if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
-               || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
+               || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.ui.ie)) //Ugly IE fix
                        po = { top: 0, left: 0 };
 
                return {
@@ -317,7 +349,9 @@ $.widget("ui.draggable", $.ui.mouse, {
        _cacheMargins: function() {
                this.margins = {
                        left: (parseInt(this.element.css("marginLeft"),10) || 0),
-                       top: (parseInt(this.element.css("marginTop"),10) || 0)
+                       top: (parseInt(this.element.css("marginTop"),10) || 0),
+                       right: (parseInt(this.element.css("marginRight"),10) || 0),
+                       bottom: (parseInt(this.element.css("marginBottom"),10) || 0)
                };
        },
 
@@ -333,23 +367,26 @@ $.widget("ui.draggable", $.ui.mouse, {
                var o = this.options;
                if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
                if(o.containment == 'document' || o.containment == 'window') this.containment = [
-                       0 - this.offset.relative.left - this.offset.parent.left,
-                       0 - this.offset.relative.top - this.offset.parent.top,
-                       $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
-                       ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
+                       o.containment == 'document' ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
+                       o.containment == 'document' ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top,
+                       (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
+                       (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
                ];
 
                if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
-                       var ce = $(o.containment)[0]; if(!ce) return;
-                       var co = $(o.containment).offset();
+                       var c = $(o.containment);
+                       var ce = c[0]; if(!ce) return;
+                       var co = c.offset();
                        var over = ($(ce).css("overflow") != 'hidden');
 
                        this.containment = [
-                               co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
-                               co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
-                               co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
-                               co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
+                               (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0),
+                               (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0),
+                               (over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right,
+                               (over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top  - this.margins.bottom
                        ];
+                       this.relative_container = c;
+
                } else if(o.containment.constructor == Array) {
                        this.containment = o.containment;
                }
@@ -360,20 +397,20 @@ $.widget("ui.draggable", $.ui.mouse, {
 
                if(!pos) pos = this.position;
                var mod = d == "absolute" ? 1 : -1;
-               var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+               var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
 
                return {
                        top: (
                                pos.top                                                                                                                                 // The absolute mouse position
                                + this.offset.relative.top * mod                                                                                // Only for relative positioned nodes: Relative offset from element to offset parent
                                + this.offset.parent.top * mod                                                                                  // The offsetParent's offset without borders (offset + border)
-                               - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
+                               - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
                        ),
                        left: (
                                pos.left                                                                                                                                // The absolute mouse position
                                + this.offset.relative.left * mod                                                                               // Only for relative positioned nodes: Relative offset from element to offset parent
                                + this.offset.parent.left * mod                                                                                 // The offsetParent's offset without borders (offset + border)
-                               - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
+                               - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
                        )
                };
 
@@ -381,7 +418,7 @@ $.widget("ui.draggable", $.ui.mouse, {
 
        _generatePosition: function(event) {
 
-               var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+               var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
                var pageX = event.pageX;
                var pageY = event.pageY;
 
@@ -391,20 +428,32 @@ $.widget("ui.draggable", $.ui.mouse, {
                 */
 
                if(this.originalPosition) { //If we are not dragging yet, we won't check for options
-
+                       var containment;
                        if(this.containment) {
-                               if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
-                               if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
-                               if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
-                               if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
+                       if (this.relative_container){
+                               var co = this.relative_container.offset();
+                               containment = [ this.containment[0] + co.left,
+                                       this.containment[1] + co.top,
+                                       this.containment[2] + co.left,
+                                       this.containment[3] + co.top ];
+                       }
+                       else {
+                               containment = this.containment;
+                       }
+
+                               if(event.pageX - this.offset.click.left < containment[0]) pageX = containment[0] + this.offset.click.left;
+                               if(event.pageY - this.offset.click.top < containment[1]) pageY = containment[1] + this.offset.click.top;
+                               if(event.pageX - this.offset.click.left > containment[2]) pageX = containment[2] + this.offset.click.left;
+                               if(event.pageY - this.offset.click.top > containment[3]) pageY = containment[3] + this.offset.click.top;
                        }
 
                        if(o.grid) {
-                               var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
-                               pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
+                               //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
+                               var top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
+                               pageY = containment ? (!(top - this.offset.click.top < containment[1] || top - this.offset.click.top > containment[3]) ? top : (!(top - this.offset.click.top < containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
 
-                               var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
-                               pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
+                               var left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
+                               pageX = containment ? (!(left - this.offset.click.left < containment[0] || left - this.offset.click.left > containment[2]) ? left : (!(left - this.offset.click.left < containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
                        }
 
                }
@@ -415,14 +464,14 @@ $.widget("ui.draggable", $.ui.mouse, {
                                - this.offset.click.top                                                                                                 // Click offset (relative to the element)
                                - this.offset.relative.top                                                                                              // Only for relative positioned nodes: Relative offset from element to offset parent
                                - this.offset.parent.top                                                                                                // The offsetParent's offset without borders (offset + border)
-                               + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
+                               + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
                        ),
                        left: (
                                pageX                                                                                                                           // The absolute mouse position
                                - this.offset.click.left                                                                                                // Click offset (relative to the element)
                                - this.offset.relative.left                                                                                             // Only for relative positioned nodes: Relative offset from element to offset parent
                                - this.offset.parent.left                                                                                               // The offsetParent's offset without borders (offset + border)
-                               + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
+                               + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
                        )
                };
 
@@ -458,10 +507,6 @@ $.widget("ui.draggable", $.ui.mouse, {
 
 });
 
-$.extend($.ui.draggable, {
-       version: "1.8.2"
-});
-
 $.ui.plugin.add("draggable", "connectToSortable", {
        start: function(event, ui) {
 
@@ -475,7 +520,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
                                        instance: sortable,
                                        shouldRevert: sortable.options.revert
                                });
-                               sortable._refreshItems();       //Do a one-time refresh at start to refresh the containerCache
+                               sortable.refreshPositions();    // Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page).
                                sortable._trigger("activate", event, uiSortable);
                        }
                });
@@ -517,7 +562,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
        },
        drag: function(event, ui) {
 
-               var inst = $(this).data("draggable"), self = this;
+               var inst = $(this).data("draggable"), that = this;
 
                var checkPos = function(o) {
                        var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
@@ -529,14 +574,30 @@ $.ui.plugin.add("draggable", "connectToSortable", {
                };
 
                $.each(inst.sortables, function(i) {
-                       
+
+                       var innermostIntersecting = false;
+                       var thisSortable = this;
                        //Copy over some variables to allow calling the sortable's native _intersectsWith
                        this.instance.positionAbs = inst.positionAbs;
                        this.instance.helperProportions = inst.helperProportions;
                        this.instance.offset.click = inst.offset.click;
-                       
+
                        if(this.instance._intersectsWith(this.instance.containerCache)) {
+                               innermostIntersecting = true;
+                               $.each(inst.sortables, function () {
+                                       this.instance.positionAbs = inst.positionAbs;
+                                       this.instance.helperProportions = inst.helperProportions;
+                                       this.instance.offset.click = inst.offset.click;
+                                       if  (this != thisSortable
+                                               && this.instance._intersectsWith(this.instance.containerCache)
+                                               && $.ui.contains(thisSortable.instance.element[0], this.instance.element[0]))
+                                               innermostIntersecting = false;
+                                               return innermostIntersecting;
+                               });
+                       }
+
 
+                       if(innermostIntersecting) {
                                //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
                                if(!this.instance.isOver) {
 
@@ -544,7 +605,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
                                        //Now we fake the start of dragging for the sortable instance,
                                        //by cloning the list group item, appending it to the sortable and using it as inst.currentItem
                                        //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
-                                       this.instance.currentItem = $(self).clone().appendTo(this.instance.element).data("sortable-item", true);
+                                       this.instance.currentItem = $(that).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true);
                                        this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
                                        this.instance.options.helper = function() { return ui.helper[0]; };
 
@@ -577,13 +638,13 @@ $.ui.plugin.add("draggable", "connectToSortable", {
 
                                        this.instance.isOver = 0;
                                        this.instance.cancelHelperRemoval = true;
-                                       
+
                                        //Prevent reverting on this forced stop
                                        this.instance.options.revert = false;
-                                       
+
                                        // The out event needs to be triggered independently
                                        this.instance._trigger('out', event, this.instance._uiHash(this.instance));
-                                       
+
                                        this.instance._mouseStop(event, true);
                                        this.instance.options.helper = this.instance.options._helper;
 
@@ -614,24 +675,6 @@ $.ui.plugin.add("draggable", "cursor", {
        }
 });
 
-$.ui.plugin.add("draggable", "iframeFix", {
-       start: function(event, ui) {
-               var o = $(this).data('draggable').options;
-               $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
-                       $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
-                       .css({
-                               width: this.offsetWidth+"px", height: this.offsetHeight+"px",
-                               position: "absolute", opacity: "0.001", zIndex: 1000
-                       })
-                       .css($(this).offset())
-                       .appendTo("body");
-               });
-       },
-       stop: function(event, ui) {
-               $("div.ui-draggable-iframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers
-       }
-});
-
 $.ui.plugin.add("draggable", "opacity", {
        start: function(event, ui) {
                var t = $(ui.helper), o = $(this).data('draggable').options;
@@ -771,7 +814,7 @@ $.ui.plugin.add("draggable", "stack", {
                        return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
                });
                if (!group.length) { return; }
-               
+
                var min = parseInt(group[0].style.zIndex) || 0;
                $(group).each(function(i) {
                        this.style.zIndex = min + i;