Dotclear

Changeset 1648:2eee4ee2798e


Ignore:
Timestamp:
08/25/13 20:39:43 (10 years ago)
Author:
Lepeltier kévin
Branch:
Ticket #1604
Message:

Ticket #1604
remplacement des div par des ul li
Ajout de draggable dans jQuery ui
Ajout de sortable et draggable version ui il manque la supression
L'avertissement "No widget" est permanent, mais masqué par js ('display none') je suppose que ça va pas le faire avec a11y

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • admin/js/jquery/jquery-ui.custom.js

    r1048 r1648  
    1 /*! jQuery UI - v1.9.2 - 2012-11-29 
     1/*! jQuery UI - v1.10.3 - 2013-08-23 
    22* http://jqueryui.com 
    3 * Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.sortable.js, jquery.ui.accordion.js 
    4 * Copyright (c) 2012 jQuery Foundation and other contributors Licensed MIT */ 
     3* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.sortable.js, jquery.ui.accordion.js 
     4* Copyright 2013 jQuery Foundation and other contributors Licensed MIT */ 
    55 
    66(function( $, undefined ) { 
     
    99     runiqueId = /^ui-id-\d+$/; 
    1010 
    11 // prevent duplicate loading 
    12 // this is only a problem because we proxy existing functions 
    13 // and we don't want to double proxy them 
     11// $.ui might exist from components with no dependencies, e.g., $.ui.position 
    1412$.ui = $.ui || {}; 
    15 if ( $.ui.version ) { 
    16      return; 
    17 } 
    1813 
    1914$.extend( $.ui, { 
    20      version: "1.9.2", 
     15     version: "1.10.3", 
    2116 
    2217     keyCode: { 
     
    4843// plugins 
    4944$.fn.extend({ 
    50      _focus: $.fn.focus, 
    51      focus: function( delay, fn ) { 
    52           return typeof delay === "number" ? 
    53                this.each(function() { 
    54                     var elem = this; 
    55                     setTimeout(function() { 
    56                          $( elem ).focus(); 
    57                          if ( fn ) { 
    58                               fn.call( elem ); 
    59                          } 
    60                     }, delay ); 
    61                }) : 
    62                this._focus.apply( this, arguments ); 
    63      }, 
     45     focus: (function( orig ) { 
     46          return function( delay, fn ) { 
     47               return typeof delay === "number" ? 
     48                    this.each(function() { 
     49                         var elem = this; 
     50                         setTimeout(function() { 
     51                              $( elem ).focus(); 
     52                              if ( fn ) { 
     53                                   fn.call( elem ); 
     54                              } 
     55                         }, delay ); 
     56                    }) : 
     57                    orig.apply( this, arguments ); 
     58          }; 
     59     })( $.fn.focus ), 
    6460 
    6561     scrollParent: function() { 
    6662          var scrollParent; 
    67           if (($.ui.ie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) { 
     63          if (($.ui.ie && (/(static|relative)/).test(this.css("position"))) || (/absolute/).test(this.css("position"))) { 
    6864               scrollParent = this.parents().filter(function() { 
    69                     return (/(relative|absolute|fixed)/).test($.css(this,'position')) && (/(auto|scroll)/).test($.css(this,'overflow')+$.css(this,'overflow-y')+$.css(this,'overflow-x')); 
     65                    return (/(relative|absolute|fixed)/).test($.css(this,"position")) && (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x")); 
    7066               }).eq(0); 
    7167          } else { 
    7268               scrollParent = this.parents().filter(function() { 
    73                     return (/(auto|scroll)/).test($.css(this,'overflow')+$.css(this,'overflow-y')+$.css(this,'overflow-x')); 
     69                    return (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x")); 
    7470               }).eq(0); 
    7571          } 
    7672 
    77           return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent; 
     73          return (/fixed/).test(this.css("position")) || !scrollParent.length ? $(document) : scrollParent; 
    7874     }, 
    7975 
     
    148144function visible( element ) { 
    149145     return $.expr.filters.visible( element ) && 
    150           !$( element ).parents().andSelf().filter(function() { 
     146          !$( element ).parents().addBack().filter(function() { 
    151147               return $.css( this, "visibility" ) === "hidden"; 
    152148          }).length; 
     
    176172}); 
    177173 
    178 // support 
    179 $(function() { 
    180      var body = document.body, 
    181           div = body.appendChild( div = document.createElement( "div" ) ); 
    182  
    183      // access offsetHeight before setting the style to prevent a layout bug 
    184      // in IE 9 which causes the element to continue to take up space even 
    185      // after it is removed from the DOM (#8026) 
    186      div.offsetHeight; 
    187  
    188      $.extend( div.style, { 
    189           minHeight: "100px", 
    190           height: "auto", 
    191           padding: 0, 
    192           borderWidth: 0 
    193      }); 
    194  
    195      $.support.minHeight = div.offsetHeight === 100; 
    196      $.support.selectstart = "onselectstart" in div; 
    197  
    198      // set display to none to avoid a layout bug in IE 
    199      // http://dev.jquery.com/ticket/4014 
    200      body.removeChild( div ).style.display = "none"; 
    201 }); 
    202  
    203174// support: jQuery <1.8 
    204175if ( !$( "<a>" ).outerWidth( 1 ).jquery ) { 
     
    248219} 
    249220 
     221// support: jQuery <1.8 
     222if ( !$.fn.addBack ) { 
     223     $.fn.addBack = function( selector ) { 
     224          return this.add( selector == null ? 
     225               this.prevObject : this.prevObject.filter( selector ) 
     226          ); 
     227     }; 
     228} 
     229 
    250230// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413) 
    251231if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) { 
     
    266246 
    267247// deprecated 
    268  
    269 (function() { 
    270      var uaMatch = /msie ([\w.]+)/.exec( navigator.userAgent.toLowerCase() ) || []; 
    271      $.ui.ie = uaMatch.length ? true : false; 
    272      $.ui.ie6 = parseFloat( uaMatch[ 1 ], 10 ) === 6; 
    273 })(); 
    274  
     248$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); 
     249 
     250$.support.selectstart = "onselectstart" in document.createElement( "div" ); 
    275251$.fn.extend({ 
    276252     disableSelection: function() { 
     
    287263 
    288264$.extend( $.ui, { 
    289      // $.ui.plugin is deprecated.  Use the proxy pattern instead. 
     265     // $.ui.plugin is deprecated. Use $.widget() extensions instead. 
    290266     plugin: { 
    291267          add: function( module, option, set ) { 
     
    312288     }, 
    313289 
    314      contains: $.contains, 
    315  
    316290     // only used by resizable 
    317291     hasScroll: function( el, a ) { 
     
    336310          el[ scroll ] = 0; 
    337311          return has; 
    338      }, 
    339  
    340      // these are odd functions, fix the API or move into individual plugins 
    341      isOverAxis: function( x, reference, size ) { 
    342           //Determines when x coordinate is over "b" element axis 
    343           return ( x > reference ) && ( x < ( reference + size ) ); 
    344      }, 
    345      isOver: function( y, x, top, left, height, width ) { 
    346           //Determines when x, y coordinates is over "b" element 
    347           return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width ); 
    348312     } 
    349313}); 
     
    367331$.widget = function( name, base, prototype ) { 
    368332     var fullName, existingConstructor, constructor, basePrototype, 
     333          // proxiedPrototype allows the provided prototype to remain unmodified 
     334          // so that it can be used as a mixin for multiple widgets (#8876) 
     335          proxiedPrototype = {}, 
    369336          namespace = name.split( "." )[ 0 ]; 
    370337 
     
    413380     basePrototype.options = $.widget.extend( {}, basePrototype.options ); 
    414381     $.each( prototype, function( prop, value ) { 
    415           if ( $.isFunction( value ) ) { 
    416                prototype[ prop ] = (function() { 
    417                     var _super = function() { 
    418                               return base.prototype[ prop ].apply( this, arguments ); 
    419                          }, 
    420                          _superApply = function( args ) { 
    421                               return base.prototype[ prop ].apply( this, args ); 
    422                          }; 
    423                     return function() { 
    424                          var __super = this._super, 
    425                               __superApply = this._superApply, 
    426                               returnValue; 
    427  
    428                          this._super = _super; 
    429                          this._superApply = _superApply; 
    430  
    431                          returnValue = value.apply( this, arguments ); 
    432  
    433                          this._super = __super; 
    434                          this._superApply = __superApply; 
    435  
    436                          return returnValue; 
     382          if ( !$.isFunction( value ) ) { 
     383               proxiedPrototype[ prop ] = value; 
     384               return; 
     385          } 
     386          proxiedPrototype[ prop ] = (function() { 
     387               var _super = function() { 
     388                         return base.prototype[ prop ].apply( this, arguments ); 
     389                    }, 
     390                    _superApply = function( args ) { 
     391                         return base.prototype[ prop ].apply( this, args ); 
    437392                    }; 
    438                })(); 
    439           } 
     393               return function() { 
     394                    var __super = this._super, 
     395                         __superApply = this._superApply, 
     396                         returnValue; 
     397 
     398                    this._super = _super; 
     399                    this._superApply = _superApply; 
     400 
     401                    returnValue = value.apply( this, arguments ); 
     402 
     403                    this._super = __super; 
     404                    this._superApply = __superApply; 
     405 
     406                    return returnValue; 
     407               }; 
     408          })(); 
    440409     }); 
    441410     constructor.prototype = $.widget.extend( basePrototype, { 
     
    444413          // don't prefix for widgets that aren't DOM-based 
    445414          widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix : name 
    446      }, prototype, { 
     415     }, proxiedPrototype, { 
    447416          constructor: constructor, 
    448417          namespace: namespace, 
    449418          widgetName: name, 
    450           // TODO remove widgetBaseClass, see #8155 
    451           widgetBaseClass: fullName, 
    452419          widgetFullName: fullName 
    453420     }); 
     
    575542 
    576543          if ( element !== this ) { 
    577                // 1.9 BC for #7810 
    578                // TODO remove dual storage 
    579                $.data( element, this.widgetName, this ); 
    580544               $.data( element, this.widgetFullName, this ); 
    581545               this._on( true, this.element, { 
     
    844808               element.delay( options.delay ); 
    845809          } 
    846           if ( hasOptions && $.effects && ( $.effects.effect[ effectName ] || $.uiBackCompat !== false && $.effects[ effectName ] ) ) { 
     810          if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { 
    847811               element[ method ]( options ); 
    848812          } else if ( effectName !== method && element[ effectName ] ) { 
     
    860824}); 
    861825 
    862 // DEPRECATED 
    863 if ( $.uiBackCompat !== false ) { 
    864      $.Widget.prototype._getCreateOptions = function() { 
    865           return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ]; 
    866      }; 
    867 } 
    868  
    869826})( jQuery ); 
    870827(function( $, undefined ) { 
    871828 
    872829var mouseHandled = false; 
    873 $( document ).mouseup( function( e ) { 
     830$( document ).mouseup( function() { 
    874831     mouseHandled = false; 
    875832}); 
    876833 
    877834$.widget("ui.mouse", { 
    878      version: "1.9.2", 
     835     version: "1.10.3", 
    879836     options: { 
    880           cancel: 'input,textarea,button,select,option', 
     837          cancel: "input,textarea,button,select,option", 
    881838          distance: 1, 
    882839          delay: 0 
     
    886843 
    887844          this.element 
    888                .bind('mousedown.'+this.widgetName, function(event) { 
     845               .bind("mousedown."+this.widgetName, function(event) { 
    889846                    return that._mouseDown(event); 
    890847               }) 
    891                .bind('click.'+this.widgetName, function(event) { 
    892                     if (true === $.data(event.target, that.widgetName + '.preventClickEvent')) { 
    893                          $.removeData(event.target, that.widgetName + '.preventClickEvent'); 
     848               .bind("click."+this.widgetName, function(event) { 
     849                    if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) { 
     850                         $.removeData(event.target, that.widgetName + ".preventClickEvent"); 
    894851                         event.stopImmediatePropagation(); 
    895852                         return false; 
     
    903860     // other instances of mouse 
    904861     _mouseDestroy: function() { 
    905           this.element.unbind('.'+this.widgetName); 
     862          this.element.unbind("."+this.widgetName); 
    906863          if ( this._mouseMoveDelegate ) { 
    907864               $(document) 
    908                     .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate) 
    909                     .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate); 
     865                    .unbind("mousemove."+this.widgetName, this._mouseMoveDelegate) 
     866                    .unbind("mouseup."+this.widgetName, this._mouseUpDelegate); 
    910867          } 
    911868     }, 
     
    945902 
    946903          // Click event may never have fired (Gecko & Opera) 
    947           if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) { 
    948                $.removeData(event.target, this.widgetName + '.preventClickEvent'); 
     904          if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) { 
     905               $.removeData(event.target, this.widgetName + ".preventClickEvent"); 
    949906          } 
    950907 
     
    957914          }; 
    958915          $(document) 
    959                .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate) 
    960                .bind('mouseup.'+this.widgetName, this._mouseUpDelegate); 
     916               .bind("mousemove."+this.widgetName, this._mouseMoveDelegate) 
     917               .bind("mouseup."+this.widgetName, this._mouseUpDelegate); 
    961918 
    962919          event.preventDefault(); 
     
    968925     _mouseMove: function(event) { 
    969926          // IE mouseup check - mouseup happened when mouse was out of window 
    970           if ($.ui.ie && !(document.documentMode >= 9) && !event.button) { 
     927          if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) { 
    971928               return this._mouseUp(event); 
    972929          } 
     
    988945     _mouseUp: function(event) { 
    989946          $(document) 
    990                .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate) 
    991                .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate); 
     947               .unbind("mousemove."+this.widgetName, this._mouseMoveDelegate) 
     948               .unbind("mouseup."+this.widgetName, this._mouseUpDelegate); 
    992949 
    993950          if (this._mouseStarted) { 
     
    995952 
    996953               if (event.target === this._mouseDownEvent.target) { 
    997                     $.data(event.target, this.widgetName + '.preventClickEvent', true); 
     954                    $.data(event.target, this.widgetName + ".preventClickEvent", true); 
    998955               } 
    999956 
     
    1012969     }, 
    1013970 
    1014      _mouseDelayMet: function(event) { 
     971     _mouseDelayMet: function(/* event */) { 
    1015972          return this.mouseDelayMet; 
    1016973     }, 
    1017974 
    1018975     // These are placeholder methods, to be overriden by extending plugin 
    1019      _mouseStart: function(event) {}, 
    1020      _mouseDrag: function(event) {}, 
    1021      _mouseStop: function(event) {}, 
    1022      _mouseCapture: function(event) { return true; } 
     976     _mouseStart: function(/* event */) {}, 
     977     _mouseDrag: function(/* event */) {}, 
     978     _mouseStop: function(/* event */) {}, 
     979     _mouseCapture: function(/* event */) { return true; } 
    1023980}); 
    1024981 
     
    1026983(function( $, undefined ) { 
    1027984 
     985$.widget("ui.draggable", $.ui.mouse, { 
     986     version: "1.10.3", 
     987     widgetEventPrefix: "drag", 
     988     options: { 
     989          addClasses: true, 
     990          appendTo: "parent", 
     991          axis: false, 
     992          connectToSortable: false, 
     993          containment: false, 
     994          cursor: "auto", 
     995          cursorAt: false, 
     996          grid: false, 
     997          handle: false, 
     998          helper: "original", 
     999          iframeFix: false, 
     1000          opacity: false, 
     1001          refreshPositions: false, 
     1002          revert: false, 
     1003          revertDuration: 500, 
     1004          scope: "default", 
     1005          scroll: true, 
     1006          scrollSensitivity: 20, 
     1007          scrollSpeed: 20, 
     1008          snap: false, 
     1009          snapMode: "both", 
     1010          snapTolerance: 20, 
     1011          stack: false, 
     1012          zIndex: false, 
     1013 
     1014          // callbacks 
     1015          drag: null, 
     1016          start: null, 
     1017          stop: null 
     1018     }, 
     1019     _create: function() { 
     1020 
     1021          if (this.options.helper === "original" && !(/^(?:r|a|f)/).test(this.element.css("position"))) { 
     1022               this.element[0].style.position = "relative"; 
     1023          } 
     1024          if (this.options.addClasses){ 
     1025               this.element.addClass("ui-draggable"); 
     1026          } 
     1027          if (this.options.disabled){ 
     1028               this.element.addClass("ui-draggable-disabled"); 
     1029          } 
     1030 
     1031          this._mouseInit(); 
     1032 
     1033     }, 
     1034 
     1035     _destroy: function() { 
     1036          this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" ); 
     1037          this._mouseDestroy(); 
     1038     }, 
     1039 
     1040     _mouseCapture: function(event) { 
     1041 
     1042          var o = this.options; 
     1043 
     1044          // among others, prevent a drag on a resizable-handle 
     1045          if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) { 
     1046               return false; 
     1047          } 
     1048 
     1049          //Quit if we're not on a valid handle 
     1050          this.handle = this._getHandle(event); 
     1051          if (!this.handle) { 
     1052               return false; 
     1053          } 
     1054 
     1055          $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() { 
     1056               $("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>") 
     1057               .css({ 
     1058                    width: this.offsetWidth+"px", height: this.offsetHeight+"px", 
     1059                    position: "absolute", opacity: "0.001", zIndex: 1000 
     1060               }) 
     1061               .css($(this).offset()) 
     1062               .appendTo("body"); 
     1063          }); 
     1064 
     1065          return true; 
     1066 
     1067     }, 
     1068 
     1069     _mouseStart: function(event) { 
     1070 
     1071          var o = this.options; 
     1072 
     1073          //Create and append the visible helper 
     1074          this.helper = this._createHelper(event); 
     1075 
     1076          this.helper.addClass("ui-draggable-dragging"); 
     1077 
     1078          //Cache the helper size 
     1079          this._cacheHelperProportions(); 
     1080 
     1081          //If ddmanager is used for droppables, set the global draggable 
     1082          if($.ui.ddmanager) { 
     1083               $.ui.ddmanager.current = this; 
     1084          } 
     1085 
     1086          /* 
     1087           * - Position generation - 
     1088           * This block generates everything position related - it's the core of draggables. 
     1089           */ 
     1090 
     1091          //Cache the margins of the original element 
     1092          this._cacheMargins(); 
     1093 
     1094          //Store the helper's css position 
     1095          this.cssPosition = this.helper.css( "position" ); 
     1096          this.scrollParent = this.helper.scrollParent(); 
     1097          this.offsetParent = this.helper.offsetParent(); 
     1098          this.offsetParentCssPosition = this.offsetParent.css( "position" ); 
     1099 
     1100          //The element's absolute position on the page minus margins 
     1101          this.offset = this.positionAbs = this.element.offset(); 
     1102          this.offset = { 
     1103               top: this.offset.top - this.margins.top, 
     1104               left: this.offset.left - this.margins.left 
     1105          }; 
     1106 
     1107          //Reset scroll cache 
     1108          this.offset.scroll = false; 
     1109 
     1110          $.extend(this.offset, { 
     1111               click: { //Where the click happened, relative to the element 
     1112                    left: event.pageX - this.offset.left, 
     1113                    top: event.pageY - this.offset.top 
     1114               }, 
     1115               parent: this._getParentOffset(), 
     1116               relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper 
     1117          }); 
     1118 
     1119          //Generate the original position 
     1120          this.originalPosition = this.position = this._generatePosition(event); 
     1121          this.originalPageX = event.pageX; 
     1122          this.originalPageY = event.pageY; 
     1123 
     1124          //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 
     1125          (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); 
     1126 
     1127          //Set a containment if given in the options 
     1128          this._setContainment(); 
     1129 
     1130          //Trigger event + callbacks 
     1131          if(this._trigger("start", event) === false) { 
     1132               this._clear(); 
     1133               return false; 
     1134          } 
     1135 
     1136          //Recache the helper size 
     1137          this._cacheHelperProportions(); 
     1138 
     1139          //Prepare the droppable offsets 
     1140          if ($.ui.ddmanager && !o.dropBehaviour) { 
     1141               $.ui.ddmanager.prepareOffsets(this, event); 
     1142          } 
     1143 
     1144 
     1145          this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position 
     1146 
     1147          //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003) 
     1148          if ( $.ui.ddmanager ) { 
     1149               $.ui.ddmanager.dragStart(this, event); 
     1150          } 
     1151 
     1152          return true; 
     1153     }, 
     1154 
     1155     _mouseDrag: function(event, noPropagation) { 
     1156          // reset any necessary cached properties (see #5009) 
     1157          if ( this.offsetParentCssPosition === "fixed" ) { 
     1158               this.offset.parent = this._getParentOffset(); 
     1159          } 
     1160 
     1161          //Compute the helpers position 
     1162          this.position = this._generatePosition(event); 
     1163          this.positionAbs = this._convertPositionTo("absolute"); 
     1164 
     1165          //Call plugins and callbacks and use the resulting position if something is returned 
     1166          if (!noPropagation) { 
     1167               var ui = this._uiHash(); 
     1168               if(this._trigger("drag", event, ui) === false) { 
     1169                    this._mouseUp({}); 
     1170                    return false; 
     1171               } 
     1172               this.position = ui.position; 
     1173          } 
     1174 
     1175          if(!this.options.axis || this.options.axis !== "y") { 
     1176               this.helper[0].style.left = this.position.left+"px"; 
     1177          } 
     1178          if(!this.options.axis || this.options.axis !== "x") { 
     1179               this.helper[0].style.top = this.position.top+"px"; 
     1180          } 
     1181          if($.ui.ddmanager) { 
     1182               $.ui.ddmanager.drag(this, event); 
     1183          } 
     1184 
     1185          return false; 
     1186     }, 
     1187 
     1188     _mouseStop: function(event) { 
     1189 
     1190          //If we are using droppables, inform the manager about the drop 
     1191          var that = this, 
     1192               dropped = false; 
     1193          if ($.ui.ddmanager && !this.options.dropBehaviour) { 
     1194               dropped = $.ui.ddmanager.drop(this, event); 
     1195          } 
     1196 
     1197          //if a drop comes from outside (a sortable) 
     1198          if(this.dropped) { 
     1199               dropped = this.dropped; 
     1200               this.dropped = false; 
     1201          } 
     1202 
     1203          //if the original element is no longer in the DOM don't bother to continue (see #8269) 
     1204          if ( this.options.helper === "original" && !$.contains( this.element[ 0 ].ownerDocument, this.element[ 0 ] ) ) { 
     1205               return false; 
     1206          } 
     1207 
     1208          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))) { 
     1209               $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { 
     1210                    if(that._trigger("stop", event) !== false) { 
     1211                         that._clear(); 
     1212                    } 
     1213               }); 
     1214          } else { 
     1215               if(this._trigger("stop", event) !== false) { 
     1216                    this._clear(); 
     1217               } 
     1218          } 
     1219 
     1220          return false; 
     1221     }, 
     1222 
     1223     _mouseUp: function(event) { 
     1224          //Remove frame helpers 
     1225          $("div.ui-draggable-iframeFix").each(function() { 
     1226               this.parentNode.removeChild(this); 
     1227          }); 
     1228 
     1229          //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003) 
     1230          if( $.ui.ddmanager ) { 
     1231               $.ui.ddmanager.dragStop(this, event); 
     1232          } 
     1233 
     1234          return $.ui.mouse.prototype._mouseUp.call(this, event); 
     1235     }, 
     1236 
     1237     cancel: function() { 
     1238 
     1239          if(this.helper.is(".ui-draggable-dragging")) { 
     1240               this._mouseUp({}); 
     1241          } else { 
     1242               this._clear(); 
     1243          } 
     1244 
     1245          return this; 
     1246 
     1247     }, 
     1248 
     1249     _getHandle: function(event) { 
     1250          return this.options.handle ? 
     1251               !!$( event.target ).closest( this.element.find( this.options.handle ) ).length : 
     1252               true; 
     1253     }, 
     1254 
     1255     _createHelper: function(event) { 
     1256 
     1257          var o = this.options, 
     1258               helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper === "clone" ? this.element.clone().removeAttr("id") : this.element); 
     1259 
     1260          if(!helper.parents("body").length) { 
     1261               helper.appendTo((o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo)); 
     1262          } 
     1263 
     1264          if(helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) { 
     1265               helper.css("position", "absolute"); 
     1266          } 
     1267 
     1268          return helper; 
     1269 
     1270     }, 
     1271 
     1272     _adjustOffsetFromHelper: function(obj) { 
     1273          if (typeof obj === "string") { 
     1274               obj = obj.split(" "); 
     1275          } 
     1276          if ($.isArray(obj)) { 
     1277               obj = {left: +obj[0], top: +obj[1] || 0}; 
     1278          } 
     1279          if ("left" in obj) { 
     1280               this.offset.click.left = obj.left + this.margins.left; 
     1281          } 
     1282          if ("right" in obj) { 
     1283               this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 
     1284          } 
     1285          if ("top" in obj) { 
     1286               this.offset.click.top = obj.top + this.margins.top; 
     1287          } 
     1288          if ("bottom" in obj) { 
     1289               this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 
     1290          } 
     1291     }, 
     1292 
     1293     _getParentOffset: function() { 
     1294 
     1295          //Get the offsetParent and cache its position 
     1296          var po = this.offsetParent.offset(); 
     1297 
     1298          // This is a special case where we need to modify a offset calculated on start, since the following happened: 
     1299          // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent 
     1300          // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that 
     1301          //    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag 
     1302          if(this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) { 
     1303               po.left += this.scrollParent.scrollLeft(); 
     1304               po.top += this.scrollParent.scrollTop(); 
     1305          } 
     1306 
     1307          //This needs to be actually done for all browsers, since pageX/pageY includes this information 
     1308          //Ugly IE fix 
     1309          if((this.offsetParent[0] === document.body) || 
     1310               (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) { 
     1311               po = { top: 0, left: 0 }; 
     1312          } 
     1313 
     1314          return { 
     1315               top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), 
     1316               left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) 
     1317          }; 
     1318 
     1319     }, 
     1320 
     1321     _getRelativeOffset: function() { 
     1322 
     1323          if(this.cssPosition === "relative") { 
     1324               var p = this.element.position(); 
     1325               return { 
     1326                    top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), 
     1327                    left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() 
     1328               }; 
     1329          } else { 
     1330               return { top: 0, left: 0 }; 
     1331          } 
     1332 
     1333     }, 
     1334 
     1335     _cacheMargins: function() { 
     1336          this.margins = { 
     1337               left: (parseInt(this.element.css("marginLeft"),10) || 0), 
     1338               top: (parseInt(this.element.css("marginTop"),10) || 0), 
     1339               right: (parseInt(this.element.css("marginRight"),10) || 0), 
     1340               bottom: (parseInt(this.element.css("marginBottom"),10) || 0) 
     1341          }; 
     1342     }, 
     1343 
     1344     _cacheHelperProportions: function() { 
     1345          this.helperProportions = { 
     1346               width: this.helper.outerWidth(), 
     1347               height: this.helper.outerHeight() 
     1348          }; 
     1349     }, 
     1350 
     1351     _setContainment: function() { 
     1352 
     1353          var over, c, ce, 
     1354               o = this.options; 
     1355 
     1356          if ( !o.containment ) { 
     1357               this.containment = null; 
     1358               return; 
     1359          } 
     1360 
     1361          if ( o.containment === "window" ) { 
     1362               this.containment = [ 
     1363                    $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left, 
     1364                    $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top, 
     1365                    $( window ).scrollLeft() + $( window ).width() - this.helperProportions.width - this.margins.left, 
     1366                    $( window ).scrollTop() + ( $( window ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top 
     1367               ]; 
     1368               return; 
     1369          } 
     1370 
     1371          if ( o.containment === "document") { 
     1372               this.containment = [ 
     1373                    0, 
     1374                    0, 
     1375                    $( document ).width() - this.helperProportions.width - this.margins.left, 
     1376                    ( $( document ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top 
     1377               ]; 
     1378               return; 
     1379          } 
     1380 
     1381          if ( o.containment.constructor === Array ) { 
     1382               this.containment = o.containment; 
     1383               return; 
     1384          } 
     1385 
     1386          if ( o.containment === "parent" ) { 
     1387               o.containment = this.helper[ 0 ].parentNode; 
     1388          } 
     1389 
     1390          c = $( o.containment ); 
     1391          ce = c[ 0 ]; 
     1392 
     1393          if( !ce ) { 
     1394               return; 
     1395          } 
     1396 
     1397          over = c.css( "overflow" ) !== "hidden"; 
     1398 
     1399          this.containment = [ 
     1400               ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ), 
     1401               ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ) , 
     1402               ( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - this.helperProportions.width - this.margins.left - this.margins.right, 
     1403               ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - this.helperProportions.height - this.margins.top  - this.margins.bottom 
     1404          ]; 
     1405          this.relative_container = c; 
     1406     }, 
     1407 
     1408     _convertPositionTo: function(d, pos) { 
     1409 
     1410          if(!pos) { 
     1411               pos = this.position; 
     1412          } 
     1413 
     1414          var mod = d === "absolute" ? 1 : -1, 
     1415               scroll = this.cssPosition === "absolute" && !( this.scrollParent[ 0 ] !== document && $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? this.offsetParent : this.scrollParent; 
     1416 
     1417          //Cache the scroll 
     1418          if (!this.offset.scroll) { 
     1419               this.offset.scroll = {top : scroll.scrollTop(), left : scroll.scrollLeft()}; 
     1420          } 
     1421 
     1422          return { 
     1423               top: ( 
     1424                    pos.top   +                                                                               // The absolute mouse position 
     1425                    this.offset.relative.top * mod +                                                // Only for relative positioned nodes: Relative offset from element to offset parent 
     1426                    this.offset.parent.top * mod -                                                  // The offsetParent's offset without borders (offset + border) 
     1427                    ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : this.offset.scroll.top ) * mod ) 
     1428               ), 
     1429               left: ( 
     1430                    pos.left +                                                                                // The absolute mouse position 
     1431                    this.offset.relative.left * mod +                                               // Only for relative positioned nodes: Relative offset from element to offset parent 
     1432                    this.offset.parent.left * mod -                                                 // The offsetParent's offset without borders (offset + border) 
     1433                    ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : this.offset.scroll.left ) * mod ) 
     1434               ) 
     1435          }; 
     1436 
     1437     }, 
     1438 
     1439     _generatePosition: function(event) { 
     1440 
     1441          var containment, co, top, left, 
     1442               o = this.options, 
     1443               scroll = this.cssPosition === "absolute" && !( this.scrollParent[ 0 ] !== document && $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? this.offsetParent : this.scrollParent, 
     1444               pageX = event.pageX, 
     1445               pageY = event.pageY; 
     1446 
     1447          //Cache the scroll 
     1448          if (!this.offset.scroll) { 
     1449               this.offset.scroll = {top : scroll.scrollTop(), left : scroll.scrollLeft()}; 
     1450          } 
     1451 
     1452          /* 
     1453           * - Position constraining - 
     1454           * Constrain the position to a mix of grid, containment. 
     1455           */ 
     1456 
     1457          // If we are not dragging yet, we won't check for options 
     1458          if ( this.originalPosition ) { 
     1459               if ( this.containment ) { 
     1460                    if ( this.relative_container ){ 
     1461                         co = this.relative_container.offset(); 
     1462                         containment = [ 
     1463                              this.containment[ 0 ] + co.left, 
     1464                              this.containment[ 1 ] + co.top, 
     1465                              this.containment[ 2 ] + co.left, 
     1466                              this.containment[ 3 ] + co.top 
     1467                         ]; 
     1468                    } 
     1469                    else { 
     1470                         containment = this.containment; 
     1471                    } 
     1472 
     1473                    if(event.pageX - this.offset.click.left < containment[0]) { 
     1474                         pageX = containment[0] + this.offset.click.left; 
     1475                    } 
     1476                    if(event.pageY - this.offset.click.top < containment[1]) { 
     1477                         pageY = containment[1] + this.offset.click.top; 
     1478                    } 
     1479                    if(event.pageX - this.offset.click.left > containment[2]) { 
     1480                         pageX = containment[2] + this.offset.click.left; 
     1481                    } 
     1482                    if(event.pageY - this.offset.click.top > containment[3]) { 
     1483                         pageY = containment[3] + this.offset.click.top; 
     1484                    } 
     1485               } 
     1486 
     1487               if(o.grid) { 
     1488                    //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950) 
     1489                    top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY; 
     1490                    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; 
     1491 
     1492                    left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX; 
     1493                    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; 
     1494               } 
     1495 
     1496          } 
     1497 
     1498          return { 
     1499               top: ( 
     1500                    pageY -                                                                                   // The absolute mouse position 
     1501                    this.offset.click.top    -                                                           // Click offset (relative to the element) 
     1502                    this.offset.relative.top -                                                           // Only for relative positioned nodes: Relative offset from element to offset parent 
     1503                    this.offset.parent.top +                                                        // The offsetParent's offset without borders (offset + border) 
     1504                    ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : this.offset.scroll.top ) 
     1505               ), 
     1506               left: ( 
     1507                    pageX -                                                                                   // The absolute mouse position 
     1508                    this.offset.click.left -                                                        // Click offset (relative to the element) 
     1509                    this.offset.relative.left -                                                          // Only for relative positioned nodes: Relative offset from element to offset parent 
     1510                    this.offset.parent.left +                                                            // The offsetParent's offset without borders (offset + border) 
     1511                    ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : this.offset.scroll.left ) 
     1512               ) 
     1513          }; 
     1514 
     1515     }, 
     1516 
     1517     _clear: function() { 
     1518          this.helper.removeClass("ui-draggable-dragging"); 
     1519          if(this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) { 
     1520               this.helper.remove(); 
     1521          } 
     1522          this.helper = null; 
     1523          this.cancelHelperRemoval = false; 
     1524     }, 
     1525 
     1526     // From now on bulk stuff - mainly helpers 
     1527 
     1528     _trigger: function(type, event, ui) { 
     1529          ui = ui || this._uiHash(); 
     1530          $.ui.plugin.call(this, type, [event, ui]); 
     1531          //The absolute position has to be recalculated after plugins 
     1532          if(type === "drag") { 
     1533               this.positionAbs = this._convertPositionTo("absolute"); 
     1534          } 
     1535          return $.Widget.prototype._trigger.call(this, type, event, ui); 
     1536     }, 
     1537 
     1538     plugins: {}, 
     1539 
     1540     _uiHash: function() { 
     1541          return { 
     1542               helper: this.helper, 
     1543               position: this.position, 
     1544               originalPosition: this.originalPosition, 
     1545               offset: this.positionAbs 
     1546          }; 
     1547     } 
     1548 
     1549}); 
     1550 
     1551$.ui.plugin.add("draggable", "connectToSortable", { 
     1552     start: function(event, ui) { 
     1553 
     1554          var inst = $(this).data("ui-draggable"), o = inst.options, 
     1555               uiSortable = $.extend({}, ui, { item: inst.element }); 
     1556          inst.sortables = []; 
     1557          $(o.connectToSortable).each(function() { 
     1558               var sortable = $.data(this, "ui-sortable"); 
     1559               if (sortable && !sortable.options.disabled) { 
     1560                    inst.sortables.push({ 
     1561                         instance: sortable, 
     1562                         shouldRevert: sortable.options.revert 
     1563                    }); 
     1564                    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). 
     1565                    sortable._trigger("activate", event, uiSortable); 
     1566               } 
     1567          }); 
     1568 
     1569     }, 
     1570     stop: function(event, ui) { 
     1571 
     1572          //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper 
     1573          var inst = $(this).data("ui-draggable"), 
     1574               uiSortable = $.extend({}, ui, { item: inst.element }); 
     1575 
     1576          $.each(inst.sortables, function() { 
     1577               if(this.instance.isOver) { 
     1578 
     1579                    this.instance.isOver = 0; 
     1580 
     1581                    inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance 
     1582                    this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work) 
     1583 
     1584                    //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: "valid/invalid" 
     1585                    if(this.shouldRevert) { 
     1586                         this.instance.options.revert = this.shouldRevert; 
     1587                    } 
     1588 
     1589                    //Trigger the stop of the sortable 
     1590                    this.instance._mouseStop(event); 
     1591 
     1592                    this.instance.options.helper = this.instance.options._helper; 
     1593 
     1594                    //If the helper has been the original item, restore properties in the sortable 
     1595                    if(inst.options.helper === "original") { 
     1596                         this.instance.currentItem.css({ top: "auto", left: "auto" }); 
     1597                    } 
     1598 
     1599               } else { 
     1600                    this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance 
     1601                    this.instance._trigger("deactivate", event, uiSortable); 
     1602               } 
     1603 
     1604          }); 
     1605 
     1606     }, 
     1607     drag: function(event, ui) { 
     1608 
     1609          var inst = $(this).data("ui-draggable"), that = this; 
     1610 
     1611          $.each(inst.sortables, function() { 
     1612 
     1613               var innermostIntersecting = false, 
     1614                    thisSortable = this; 
     1615 
     1616               //Copy over some variables to allow calling the sortable's native _intersectsWith 
     1617               this.instance.positionAbs = inst.positionAbs; 
     1618               this.instance.helperProportions = inst.helperProportions; 
     1619               this.instance.offset.click = inst.offset.click; 
     1620 
     1621               if(this.instance._intersectsWith(this.instance.containerCache)) { 
     1622                    innermostIntersecting = true; 
     1623                    $.each(inst.sortables, function () { 
     1624                         this.instance.positionAbs = inst.positionAbs; 
     1625                         this.instance.helperProportions = inst.helperProportions; 
     1626                         this.instance.offset.click = inst.offset.click; 
     1627                         if (this !== thisSortable && 
     1628                              this.instance._intersectsWith(this.instance.containerCache) && 
     1629                              $.contains(thisSortable.instance.element[0], this.instance.element[0]) 
     1630                         ) { 
     1631                              innermostIntersecting = false; 
     1632                         } 
     1633                         return innermostIntersecting; 
     1634                    }); 
     1635               } 
     1636 
     1637 
     1638               if(innermostIntersecting) { 
     1639                    //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once 
     1640                    if(!this.instance.isOver) { 
     1641 
     1642                         this.instance.isOver = 1; 
     1643                         //Now we fake the start of dragging for the sortable instance, 
     1644                         //by cloning the list group item, appending it to the sortable and using it as inst.currentItem 
     1645                         //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) 
     1646                         this.instance.currentItem = $(that).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item", true); 
     1647                         this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it 
     1648                         this.instance.options.helper = function() { return ui.helper[0]; }; 
     1649 
     1650                         event.target = this.instance.currentItem[0]; 
     1651                         this.instance._mouseCapture(event, true); 
     1652                         this.instance._mouseStart(event, true, true); 
     1653 
     1654                         //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes 
     1655                         this.instance.offset.click.top = inst.offset.click.top; 
     1656                         this.instance.offset.click.left = inst.offset.click.left; 
     1657                         this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left; 
     1658                         this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top; 
     1659 
     1660                         inst._trigger("toSortable", event); 
     1661                         inst.dropped = this.instance.element; //draggable revert needs that 
     1662                         //hack so receive/update callbacks work (mostly) 
     1663                         inst.currentItem = inst.element; 
     1664                         this.instance.fromOutside = inst; 
     1665 
     1666                    } 
     1667 
     1668                    //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable 
     1669                    if(this.instance.currentItem) { 
     1670                         this.instance._mouseDrag(event); 
     1671                    } 
     1672 
     1673               } else { 
     1674 
     1675                    //If it doesn't intersect with the sortable, and it intersected before, 
     1676                    //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval 
     1677                    if(this.instance.isOver) { 
     1678 
     1679                         this.instance.isOver = 0; 
     1680                         this.instance.cancelHelperRemoval = true; 
     1681 
     1682                         //Prevent reverting on this forced stop 
     1683                         this.instance.options.revert = false; 
     1684 
     1685                         // The out event needs to be triggered independently 
     1686                         this.instance._trigger("out", event, this.instance._uiHash(this.instance)); 
     1687 
     1688                         this.instance._mouseStop(event, true); 
     1689                         this.instance.options.helper = this.instance.options._helper; 
     1690 
     1691                         //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size 
     1692                         this.instance.currentItem.remove(); 
     1693                         if(this.instance.placeholder) { 
     1694                              this.instance.placeholder.remove(); 
     1695                         } 
     1696 
     1697                         inst._trigger("fromSortable", event); 
     1698                         inst.dropped = false; //draggable revert needs that 
     1699                    } 
     1700 
     1701               } 
     1702 
     1703          }); 
     1704 
     1705     } 
     1706}); 
     1707 
     1708$.ui.plugin.add("draggable", "cursor", { 
     1709     start: function() { 
     1710          var t = $("body"), o = $(this).data("ui-draggable").options; 
     1711          if (t.css("cursor")) { 
     1712               o._cursor = t.css("cursor"); 
     1713          } 
     1714          t.css("cursor", o.cursor); 
     1715     }, 
     1716     stop: function() { 
     1717          var o = $(this).data("ui-draggable").options; 
     1718          if (o._cursor) { 
     1719               $("body").css("cursor", o._cursor); 
     1720          } 
     1721     } 
     1722}); 
     1723 
     1724$.ui.plugin.add("draggable", "opacity", { 
     1725     start: function(event, ui) { 
     1726          var t = $(ui.helper), o = $(this).data("ui-draggable").options; 
     1727          if(t.css("opacity")) { 
     1728               o._opacity = t.css("opacity"); 
     1729          } 
     1730          t.css("opacity", o.opacity); 
     1731     }, 
     1732     stop: function(event, ui) { 
     1733          var o = $(this).data("ui-draggable").options; 
     1734          if(o._opacity) { 
     1735               $(ui.helper).css("opacity", o._opacity); 
     1736          } 
     1737     } 
     1738}); 
     1739 
     1740$.ui.plugin.add("draggable", "scroll", { 
     1741     start: function() { 
     1742          var i = $(this).data("ui-draggable"); 
     1743          if(i.scrollParent[0] !== document && i.scrollParent[0].tagName !== "HTML") { 
     1744               i.overflowOffset = i.scrollParent.offset(); 
     1745          } 
     1746     }, 
     1747     drag: function( event ) { 
     1748 
     1749          var i = $(this).data("ui-draggable"), o = i.options, scrolled = false; 
     1750 
     1751          if(i.scrollParent[0] !== document && i.scrollParent[0].tagName !== "HTML") { 
     1752 
     1753               if(!o.axis || o.axis !== "x") { 
     1754                    if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) { 
     1755                         i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed; 
     1756                    } else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity) { 
     1757                         i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed; 
     1758                    } 
     1759               } 
     1760 
     1761               if(!o.axis || o.axis !== "y") { 
     1762                    if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) { 
     1763                         i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed; 
     1764                    } else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity) { 
     1765                         i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed; 
     1766                    } 
     1767               } 
     1768 
     1769          } else { 
     1770 
     1771               if(!o.axis || o.axis !== "x") { 
     1772                    if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) { 
     1773                         scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); 
     1774                    } else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) { 
     1775                         scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); 
     1776                    } 
     1777               } 
     1778 
     1779               if(!o.axis || o.axis !== "y") { 
     1780                    if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) { 
     1781                         scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); 
     1782                    } else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) { 
     1783                         scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); 
     1784                    } 
     1785               } 
     1786 
     1787          } 
     1788 
     1789          if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { 
     1790               $.ui.ddmanager.prepareOffsets(i, event); 
     1791          } 
     1792 
     1793     } 
     1794}); 
     1795 
     1796$.ui.plugin.add("draggable", "snap", { 
     1797     start: function() { 
     1798 
     1799          var i = $(this).data("ui-draggable"), 
     1800               o = i.options; 
     1801 
     1802          i.snapElements = []; 
     1803 
     1804          $(o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap).each(function() { 
     1805               var $t = $(this), 
     1806                    $o = $t.offset(); 
     1807               if(this !== i.element[0]) { 
     1808                    i.snapElements.push({ 
     1809                         item: this, 
     1810                         width: $t.outerWidth(), height: $t.outerHeight(), 
     1811                         top: $o.top, left: $o.left 
     1812                    }); 
     1813               } 
     1814          }); 
     1815 
     1816     }, 
     1817     drag: function(event, ui) { 
     1818 
     1819          var ts, bs, ls, rs, l, r, t, b, i, first, 
     1820               inst = $(this).data("ui-draggable"), 
     1821               o = inst.options, 
     1822               d = o.snapTolerance, 
     1823               x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, 
     1824               y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; 
     1825 
     1826          for (i = inst.snapElements.length - 1; i >= 0; i--){ 
     1827 
     1828               l = inst.snapElements[i].left; 
     1829               r = l + inst.snapElements[i].width; 
     1830               t = inst.snapElements[i].top; 
     1831               b = t + inst.snapElements[i].height; 
     1832 
     1833               if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || !$.contains( inst.snapElements[ i ].item.ownerDocument, inst.snapElements[ i ].item ) ) { 
     1834                    if(inst.snapElements[i].snapping) { 
     1835                         (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); 
     1836                    } 
     1837                    inst.snapElements[i].snapping = false; 
     1838                    continue; 
     1839               } 
     1840 
     1841               if(o.snapMode !== "inner") { 
     1842                    ts = Math.abs(t - y2) <= d; 
     1843                    bs = Math.abs(b - y1) <= d; 
     1844                    ls = Math.abs(l - x2) <= d; 
     1845                    rs = Math.abs(r - x1) <= d; 
     1846                    if(ts) { 
     1847                         ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top; 
     1848                    } 
     1849                    if(bs) { 
     1850                         ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top; 
     1851                    } 
     1852                    if(ls) { 
     1853                         ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left; 
     1854                    } 
     1855                    if(rs) { 
     1856                         ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left; 
     1857                    } 
     1858               } 
     1859 
     1860               first = (ts || bs || ls || rs); 
     1861 
     1862               if(o.snapMode !== "outer") { 
     1863                    ts = Math.abs(t - y1) <= d; 
     1864                    bs = Math.abs(b - y2) <= d; 
     1865                    ls = Math.abs(l - x1) <= d; 
     1866                    rs = Math.abs(r - x2) <= d; 
     1867                    if(ts) { 
     1868                         ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top; 
     1869                    } 
     1870                    if(bs) { 
     1871                         ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top; 
     1872                    } 
     1873                    if(ls) { 
     1874                         ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left; 
     1875                    } 
     1876                    if(rs) { 
     1877                         ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left; 
     1878                    } 
     1879               } 
     1880 
     1881               if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) { 
     1882                    (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); 
     1883               } 
     1884               inst.snapElements[i].snapping = (ts || bs || ls || rs || first); 
     1885 
     1886          } 
     1887 
     1888     } 
     1889}); 
     1890 
     1891$.ui.plugin.add("draggable", "stack", { 
     1892     start: function() { 
     1893          var min, 
     1894               o = this.data("ui-draggable").options, 
     1895               group = $.makeArray($(o.stack)).sort(function(a,b) { 
     1896                    return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0); 
     1897               }); 
     1898 
     1899          if (!group.length) { return; } 
     1900 
     1901          min = parseInt($(group[0]).css("zIndex"), 10) || 0; 
     1902          $(group).each(function(i) { 
     1903               $(this).css("zIndex", min + i); 
     1904          }); 
     1905          this.css("zIndex", (min + group.length)); 
     1906     } 
     1907}); 
     1908 
     1909$.ui.plugin.add("draggable", "zIndex", { 
     1910     start: function(event, ui) { 
     1911          var t = $(ui.helper), o = $(this).data("ui-draggable").options; 
     1912          if(t.css("zIndex")) { 
     1913               o._zIndex = t.css("zIndex"); 
     1914          } 
     1915          t.css("zIndex", o.zIndex); 
     1916     }, 
     1917     stop: function(event, ui) { 
     1918          var o = $(this).data("ui-draggable").options; 
     1919          if(o._zIndex) { 
     1920               $(ui.helper).css("zIndex", o._zIndex); 
     1921          } 
     1922     } 
     1923}); 
     1924 
     1925})(jQuery); 
     1926(function( $, undefined ) { 
     1927 
     1928/*jshint loopfunc: true */ 
     1929 
     1930function isOverAxis( x, reference, size ) { 
     1931     return ( x > reference ) && ( x < ( reference + size ) ); 
     1932} 
     1933 
     1934function isFloating(item) { 
     1935     return (/left|right/).test(item.css("float")) || (/inline|table-cell/).test(item.css("display")); 
     1936} 
     1937 
    10281938$.widget("ui.sortable", $.ui.mouse, { 
    1029      version: "1.9.2", 
     1939     version: "1.10.3", 
    10301940     widgetEventPrefix: "sort", 
    10311941     ready: false, 
     
    10351945          connectWith: false, 
    10361946          containment: false, 
    1037           cursor: 'auto', 
     1947          cursor: "auto", 
    10381948          cursorAt: false, 
    10391949          dropOnEmpty: true, 
     
    10431953          handle: false, 
    10441954          helper: "original", 
    1045           items: '> *', 
     1955          items: "> *", 
    10461956          opacity: false, 
    10471957          placeholder: false, 
     
    10521962          scope: "default", 
    10531963          tolerance: "intersect", 
    1054           zIndex: 1000 
     1964          zIndex: 1000, 
     1965 
     1966          // callbacks 
     1967          activate: null, 
     1968          beforeStop: null, 
     1969          change: null, 
     1970          deactivate: null, 
     1971          out: null, 
     1972          over: null, 
     1973          receive: null, 
     1974          remove: null, 
     1975          sort: null, 
     1976          start: null, 
     1977          stop: null, 
     1978          update: null 
    10551979     }, 
    10561980     _create: function() { 
     
    10641988 
    10651989          //Let's determine if the items are being displayed horizontally 
    1066           this.floating = this.items.length ? o.axis === 'x' || (/left|right/).test(this.items[0].item.css('float')) || (/inline|table-cell/).test(this.items[0].item.css('display')) : false; 
     1990          this.floating = this.items.length ? o.axis === "x" || isFloating(this.items[0].item) : false; 
    10671991 
    10681992          //Let's determine the parent's offset 
     
    10731997 
    10741998          //We're ready to go 
    1075           this.ready = true 
     1999          this.ready = true; 
    10762000 
    10772001     }, 
     
    10822006          this._mouseDestroy(); 
    10832007 
    1084           for ( var i = this.items.length - 1; i >= 0; i-- ) 
     2008          for ( var i = this.items.length - 1; i >= 0; i-- ) { 
    10852009               this.items[i].item.removeData(this.widgetName + "-item"); 
     2010          } 
    10862011 
    10872012          return this; 
     
    11002025 
    11012026     _mouseCapture: function(event, overrideHandle) { 
    1102           var that = this; 
     2027          var currentItem = null, 
     2028               validHandle = false, 
     2029               that = this; 
    11032030 
    11042031          if (this.reverting) { 
     
    11062033          } 
    11072034 
    1108           if(this.options.disabled || this.options.type == 'static') return false; 
     2035          if(this.options.disabled || this.options.type === "static") { 
     2036               return false; 
     2037          } 
    11092038 
    11102039          //We have to refresh the items data once first 
     
    11122041 
    11132042          //Find out if the clicked node (or one of its parents) is a actual item in this.items 
    1114           var currentItem = null, nodes = $(event.target).parents().each(function() { 
    1115                if($.data(this, that.widgetName + '-item') == that) { 
     2043          $(event.target).parents().each(function() { 
     2044               if($.data(this, that.widgetName + "-item") === that) { 
    11162045                    currentItem = $(this); 
    11172046                    return false; 
    11182047               } 
    11192048          }); 
    1120           if($.data(event.target, that.widgetName + '-item') == that) currentItem = $(event.target); 
    1121  
    1122           if(!currentItem) return false; 
     2049          if($.data(event.target, that.widgetName + "-item") === that) { 
     2050               currentItem = $(event.target); 
     2051          } 
     2052 
     2053          if(!currentItem) { 
     2054               return false; 
     2055          } 
    11232056          if(this.options.handle && !overrideHandle) { 
    1124                var validHandle = false; 
    1125  
    1126                $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; }); 
    1127                if(!validHandle) return false; 
     2057               $(this.options.handle, currentItem).find("*").addBack().each(function() { 
     2058                    if(this === event.target) { 
     2059                         validHandle = true; 
     2060                    } 
     2061               }); 
     2062               if(!validHandle) { 
     2063                    return false; 
     2064               } 
    11282065          } 
    11292066 
     
    11362073     _mouseStart: function(event, overrideHandle, noActivation) { 
    11372074 
    1138           var o = this.options; 
     2075          var i, body, 
     2076               o = this.options; 
     2077 
    11392078          this.currentContainer = this; 
    11402079 
     
    11852124          this.originalPageY = event.pageY; 
    11862125 
    1187           //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied 
     2126          //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 
    11882127          (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); 
    11892128 
     
    11922131 
    11932132          //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way 
    1194           if(this.helper[0] != this.currentItem[0]) { 
     2133          if(this.helper[0] !== this.currentItem[0]) { 
    11952134               this.currentItem.hide(); 
    11962135          } 
     
    12002139 
    12012140          //Set a containment if given in the options 
    1202           if(o.containment) 
     2141          if(o.containment) { 
    12032142               this._setContainment(); 
    1204  
    1205           if(o.cursor) { // cursor option 
    1206                if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor"); 
    1207                $('body').css("cursor", o.cursor); 
     2143          } 
     2144 
     2145          if( o.cursor && o.cursor !== "auto" ) { // cursor option 
     2146               body = this.document.find( "body" ); 
     2147 
     2148               // support: IE 
     2149               this.storedCursor = body.css( "cursor" ); 
     2150               body.css( "cursor", o.cursor ); 
     2151 
     2152               this.storedStylesheet = $( "<style>*{ cursor: "+o.cursor+" !important; }</style>" ).appendTo( body ); 
    12082153          } 
    12092154 
    12102155          if(o.opacity) { // opacity option 
    1211                if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity"); 
     2156               if (this.helper.css("opacity")) { 
     2157                    this._storedOpacity = this.helper.css("opacity"); 
     2158               } 
    12122159               this.helper.css("opacity", o.opacity); 
    12132160          } 
    12142161 
    12152162          if(o.zIndex) { // zIndex option 
    1216                if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex"); 
     2163               if (this.helper.css("zIndex")) { 
     2164                    this._storedZIndex = this.helper.css("zIndex"); 
     2165               } 
    12172166               this.helper.css("zIndex", o.zIndex); 
    12182167          } 
    12192168 
    12202169          //Prepare scrolling 
    1221           if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') 
     2170          if(this.scrollParent[0] !== document && this.scrollParent[0].tagName !== "HTML") { 
    12222171               this.overflowOffset = this.scrollParent.offset(); 
     2172          } 
    12232173 
    12242174          //Call callbacks 
     
    12262176 
    12272177          //Recache the helper size 
    1228           if(!this._preserveHelperProportions) 
     2178          if(!this._preserveHelperProportions) { 
    12292179               this._cacheHelperProportions(); 
    1230  
    1231  
    1232           //Post 'activate' events to possible containers 
    1233           if(!noActivation) { 
    1234                 for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, this._uiHash(this)); } 
     2180          } 
     2181 
     2182 
     2183          //Post "activate" events to possible containers 
     2184          if( !noActivation ) { 
     2185               for ( i = this.containers.length - 1; i >= 0; i-- ) { 
     2186                    this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) ); 
     2187               } 
    12352188          } 
    12362189 
    12372190          //Prepare possible droppables 
    1238           if($.ui.ddmanager) 
     2191          if($.ui.ddmanager) { 
    12392192               $.ui.ddmanager.current = this; 
    1240  
    1241           if ($.ui.ddmanager && !o.dropBehaviour) 
     2193          } 
     2194 
     2195          if ($.ui.ddmanager && !o.dropBehaviour) { 
    12422196               $.ui.ddmanager.prepareOffsets(this, event); 
     2197          } 
    12432198 
    12442199          this.dragging = true; 
     
    12512206 
    12522207     _mouseDrag: function(event) { 
     2208          var i, item, itemElement, intersection, 
     2209               o = this.options, 
     2210               scrolled = false; 
    12532211 
    12542212          //Compute the helpers position 
     
    12622220          //Do scrolling 
    12632221          if(this.options.scroll) { 
    1264                var o = this.options, scrolled = false; 
    1265                if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') { 
    1266  
    1267                     if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) 
     2222               if(this.scrollParent[0] !== document && this.scrollParent[0].tagName !== "HTML") { 
     2223 
     2224                    if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) { 
    12682225                         this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed; 
    1269                     else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) 
     2226                    } else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) { 
    12702227                         this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed; 
    1271  
    1272                     if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) 
     2228                    } 
     2229 
     2230                    if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) { 
    12732231                         this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed; 
    1274                     else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) 
     2232                    } else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) { 
    12752233                         this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed; 
     2234                    } 
    12762235 
    12772236               } else { 
    12782237 
    1279                     if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) 
     2238                    if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) { 
    12802239                         scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); 
    1281                     else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) 
     2240                    } else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) { 
    12822241                         scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); 
    1283  
    1284                     if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) 
     2242                    } 
     2243 
     2244                    if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) { 
    12852245                         scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); 
    1286                     else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) 
     2246                    } else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) { 
    12872247                         scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); 
    1288  
    1289                } 
    1290  
    1291                if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) 
     2248                    } 
     2249 
     2250               } 
     2251 
     2252               if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { 
    12922253                    $.ui.ddmanager.prepareOffsets(this, event); 
     2254               } 
    12932255          } 
    12942256 
     
    12972259 
    12982260          //Set the helper position 
    1299           if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; 
    1300           if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; 
     2261          if(!this.options.axis || this.options.axis !== "y") { 
     2262               this.helper[0].style.left = this.position.left+"px"; 
     2263          } 
     2264          if(!this.options.axis || this.options.axis !== "x") { 
     2265               this.helper[0].style.top = this.position.top+"px"; 
     2266          } 
    13012267 
    13022268          //Rearrange 
    1303           for (var i = this.items.length - 1; i >= 0; i--) { 
     2269          for (i = this.items.length - 1; i >= 0; i--) { 
    13042270 
    13052271               //Cache variables and intersection, continue if no intersection 
    1306                var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item); 
    1307                if (!intersection) continue; 
     2272               item = this.items[i]; 
     2273               itemElement = item.item[0]; 
     2274               intersection = this._intersectsWithPointer(item); 
     2275               if (!intersection) { 
     2276                    continue; 
     2277               } 
    13082278 
    13092279               // Only put the placeholder inside the current Container, skip all 
     
    13142284               // Without this moving items in "sub-sortables" can cause the placeholder to jitter 
    13152285               // beetween the outer and inner container. 
    1316                if (item.instance !== this.currentContainer) continue; 
    1317  
    1318                if (itemElement != this.currentItem[0] //cannot intersect with itself 
    1319                     &&   this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before 
    1320                     &&   !$.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked 
    1321                     && (this.options.type == 'semi-dynamic' ? !$.contains(this.element[0], itemElement) : true) 
    1322                     //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container 
     2286               if (item.instance !== this.currentContainer) { 
     2287                    continue; 
     2288               } 
     2289 
     2290               // cannot intersect with itself 
     2291               // no useless actions that have been done before 
     2292               // no action if the item moved is the parent of the item checked 
     2293               if (itemElement !== this.currentItem[0] && 
     2294                    this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement && 
     2295                    !$.contains(this.placeholder[0], itemElement) && 
     2296                    (this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true) 
    13232297               ) { 
    13242298 
    1325                     this.direction = intersection == 1 ? "down" : "up"; 
    1326  
    1327                     if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) { 
     2299                    this.direction = intersection === 1 ? "down" : "up"; 
     2300 
     2301                    if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) { 
    13282302                         this._rearrange(event, item); 
    13292303                    } else { 
     
    13402314 
    13412315          //Interconnect with droppables 
    1342           if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); 
     2316          if($.ui.ddmanager) { 
     2317               $.ui.ddmanager.drag(this, event); 
     2318          } 
    13432319 
    13442320          //Call callbacks 
    1345           this._trigger('sort', event, this._uiHash()); 
     2321          this._trigger("sort", event, this._uiHash()); 
    13462322 
    13472323          this.lastPositionAbs = this.positionAbs; 
     
    13522328     _mouseStop: function(event, noPropagation) { 
    13532329 
    1354           if(!event) return; 
     2330          if(!event) { 
     2331               return; 
     2332          } 
    13552333 
    13562334          //If we are using droppables, inform the manager about the drop 
    1357           if ($.ui.ddmanager && !this.options.dropBehaviour) 
     2335          if ($.ui.ddmanager && !this.options.dropBehaviour) { 
    13582336               $.ui.ddmanager.drop(this, event); 
     2337          } 
    13592338 
    13602339          if(this.options.revert) { 
    1361                var that = this; 
    1362                var cur = this.placeholder.offset(); 
    1363  
     2340               var that = this, 
     2341                    cur = this.placeholder.offset(), 
     2342                    axis = this.options.axis, 
     2343                    animation = {}; 
     2344 
     2345               if ( !axis || axis === "x" ) { 
     2346                    animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === document.body ? 0 : this.offsetParent[0].scrollLeft); 
     2347               } 
     2348               if ( !axis || axis === "y" ) { 
     2349                    animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === document.body ? 0 : this.offsetParent[0].scrollTop); 
     2350               } 
    13642351               this.reverting = true; 
    1365  
    1366                $(this.helper).animate({ 
    1367                     left: cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft), 
    1368                     top: cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) 
    1369                }, parseInt(this.options.revert, 10) || 500, function() { 
     2352               $(this.helper).animate( animation, parseInt(this.options.revert, 10) || 500, function() { 
    13702353                    that._clear(event); 
    13712354               }); 
     
    13842367               this._mouseUp({ target: null }); 
    13852368 
    1386                if(this.options.helper == "original") 
     2369               if(this.options.helper === "original") { 
    13872370                    this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); 
    1388                else 
     2371               } else { 
    13892372                    this.currentItem.show(); 
     2373               } 
    13902374 
    13912375               //Post deactivating events to containers 
     
    14022386          if (this.placeholder) { 
    14032387               //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! 
    1404                if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]); 
    1405                if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove(); 
     2388               if(this.placeholder[0].parentNode) { 
     2389                    this.placeholder[0].parentNode.removeChild(this.placeholder[0]); 
     2390               } 
     2391               if(this.options.helper !== "original" && this.helper && this.helper[0].parentNode) { 
     2392                    this.helper.remove(); 
     2393               } 
    14062394 
    14072395               $.extend(this, { 
     
    14252413     serialize: function(o) { 
    14262414 
    1427           var items = this._getItemsAsjQuery(o && o.connected); 
    1428           var str = []; o = o || {}; 
     2415          var items = this._getItemsAsjQuery(o && o.connected), 
     2416               str = []; 
     2417          o = o || {}; 
    14292418 
    14302419          $(items).each(function() { 
    1431                var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/)); 
    1432                if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2])); 
     2420               var res = ($(o.item || this).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[\-=_](.+)/)); 
     2421               if (res) { 
     2422                    str.push((o.key || res[1]+"[]")+"="+(o.key && o.expression ? res[1] : res[2])); 
     2423               } 
    14332424          }); 
    14342425 
    14352426          if(!str.length && o.key) { 
    1436                str.push(o.key + '='); 
    1437           } 
    1438  
    1439           return str.join('&'); 
     2427               str.push(o.key + "="); 
     2428          } 
     2429 
     2430          return str.join("&"); 
    14402431 
    14412432     }, 
     
    14432434     toArray: function(o) { 
    14442435 
    1445           var items = this._getItemsAsjQuery(o && o.connected); 
    1446           var ret = []; o = o || {}; 
    1447  
    1448           items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); }); 
     2436          var items = this._getItemsAsjQuery(o && o.connected), 
     2437               ret = []; 
     2438 
     2439          o = o || {}; 
     2440 
     2441          items.each(function() { ret.push($(o.item || this).attr(o.attribute || "id") || ""); }); 
    14492442          return ret; 
    14502443 
     
    14572450               x2 = x1 + this.helperProportions.width, 
    14582451               y1 = this.positionAbs.top, 
    1459                y2 = y1 + this.helperProportions.height; 
    1460  
    1461           var l = item.left, 
     2452               y2 = y1 + this.helperProportions.height, 
     2453               l = item.left, 
    14622454               r = l + item.width, 
    14632455               t = item.top, 
    1464                b = t + item.height; 
    1465  
    1466           var dyClick = this.offset.click.top, 
    1467                dxClick = this.offset.click.left; 
    1468  
    1469           var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r; 
    1470  
    1471           if(     this.options.tolerance == "pointer" 
    1472                || this.options.forcePointerForContainers 
    1473                || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height']) 
     2456               b = t + item.height, 
     2457               dyClick = this.offset.click.top, 
     2458               dxClick = this.offset.click.left, 
     2459               isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && ( y1 + dyClick ) < b ), 
     2460               isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && ( x1 + dxClick ) < r ), 
     2461               isOverElement = isOverElementHeight && isOverElementWidth; 
     2462 
     2463          if ( this.options.tolerance === "pointer" || 
     2464               this.options.forcePointerForContainers || 
     2465               (this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"]) 
    14742466          ) { 
    14752467               return isOverElement; 
    14762468          } else { 
    14772469 
    1478                return (l < x1 + (this.helperProportions.width / 2) // Right Half 
    1479                     && x2 - (this.helperProportions.width / 2) < r // Left Half 
    1480                     && t < y1 + (this.helperProportions.height / 2) // Bottom Half 
    1481                     && y2 - (this.helperProportions.height / 2) < b ); // Top Half 
     2470               return (l < x1 + (this.helperProportions.width / 2) && // Right Half 
     2471                    x2 - (this.helperProportions.width / 2) < r && // Left Half 
     2472                    t < y1 + (this.helperProportions.height / 2) && // Bottom Half 
     2473                    y2 - (this.helperProportions.height / 2) < b ); // Top Half 
    14822474 
    14832475          } 
     
    14862478     _intersectsWithPointer: function(item) { 
    14872479 
    1488           var isOverElementHeight = (this.options.axis === 'x') || $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height), 
    1489                isOverElementWidth = (this.options.axis === 'y') || $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width), 
     2480          var isOverElementHeight = (this.options.axis === "x") || isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height), 
     2481               isOverElementWidth = (this.options.axis === "y") || isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width), 
    14902482               isOverElement = isOverElementHeight && isOverElementWidth, 
    14912483               verticalDirection = this._getDragVerticalDirection(), 
    14922484               horizontalDirection = this._getDragHorizontalDirection(); 
    14932485 
    1494           if (!isOverElement) 
     2486          if (!isOverElement) { 
    14952487               return false; 
     2488          } 
    14962489 
    14972490          return this.floating ? 
    1498                ( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 ) 
    1499                : ( verticalDirection && (verticalDirection == "down" ? 2 : 1) ); 
     2491               ( ((horizontalDirection && horizontalDirection === "right") || verticalDirection === "down") ? 2 : 1 ) 
     2492               : ( verticalDirection && (verticalDirection === "down" ? 2 : 1) ); 
    15002493 
    15012494     }, 
     
    15032496     _intersectsWithSides: function(item) { 
    15042497 
    1505           var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height), 
    1506                isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width), 
     2498          var isOverBottomHalf = isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height), 
     2499               isOverRightHalf = isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width), 
    15072500               verticalDirection = this._getDragVerticalDirection(), 
    15082501               horizontalDirection = this._getDragHorizontalDirection(); 
    15092502 
    15102503          if (this.floating && horizontalDirection) { 
    1511                return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf)); 
     2504               return ((horizontalDirection === "right" && isOverRightHalf) || (horizontalDirection === "left" && !isOverRightHalf)); 
    15122505          } else { 
    1513                return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf)); 
     2506               return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || (verticalDirection === "up" && !isOverBottomHalf)); 
    15142507          } 
    15152508 
     
    15182511     _getDragVerticalDirection: function() { 
    15192512          var delta = this.positionAbs.top - this.lastPositionAbs.top; 
    1520           return delta != 0 && (delta > 0 ? "down" : "up"); 
     2513          return delta !== 0 && (delta > 0 ? "down" : "up"); 
    15212514     }, 
    15222515 
    15232516     _getDragHorizontalDirection: function() { 
    15242517          var delta = this.positionAbs.left - this.lastPositionAbs.left; 
    1525           return delta != 0 && (delta > 0 ? "right" : "left"); 
     2518          return delta !== 0 && (delta > 0 ? "right" : "left"); 
    15262519     }, 
    15272520 
     
    15342527     _connectWith: function() { 
    15352528          var options = this.options; 
    1536           return options.connectWith.constructor == String 
    1537                ? [options.connectWith] 
    1538                : options.connectWith; 
     2529          return options.connectWith.constructor === String ? [options.connectWith] : options.connectWith; 
    15392530     }, 
    15402531 
    15412532     _getItemsAsjQuery: function(connected) { 
    15422533 
    1543           var items = []; 
    1544           var queries = []; 
    1545           var connectWith = this._connectWith(); 
     2534          var i, j, cur, inst, 
     2535               items = [], 
     2536               queries = [], 
     2537               connectWith = this._connectWith(); 
    15462538 
    15472539          if(connectWith && connected) { 
    1548                for (var i = connectWith.length - 1; i >= 0; i--){ 
    1549                     var cur = $(connectWith[i]); 
    1550                     for (var j = cur.length - 1; j >= 0; j--){ 
    1551                          var inst = $.data(cur[j], this.widgetName); 
    1552                          if(inst && inst != this && !inst.options.disabled) { 
    1553                               queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]); 
     2540               for (i = connectWith.length - 1; i >= 0; i--){ 
     2541                    cur = $(connectWith[i]); 
     2542                    for ( j = cur.length - 1; j >= 0; j--){ 
     2543                         inst = $.data(cur[j], this.widgetFullName); 
     2544                         if(inst && inst !== this && !inst.options.disabled) { 
     2545                              queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), inst]); 
    15542546                         } 
    1555                     }; 
    1556                }; 
    1557           } 
    1558  
    1559           queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), this]); 
    1560  
    1561           for (var i = queries.length - 1; i >= 0; i--){ 
     2547                    } 
     2548               } 
     2549          } 
     2550 
     2551          queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]); 
     2552 
     2553          for (i = queries.length - 1; i >= 0; i--){ 
    15622554               queries[i][0].each(function() { 
    15632555                    items.push(this); 
    15642556               }); 
    1565           }; 
     2557          } 
    15662558 
    15672559          return $(items); 
     
    15752567          this.items = $.grep(this.items, function (item) { 
    15762568               for (var j=0; j < list.length; j++) { 
    1577                     if(list[j] == item.item[0]) 
     2569                    if(list[j] === item.item[0]) { 
    15782570                         return false; 
    1579                }; 
     2571                    } 
     2572               } 
    15802573               return true; 
    15812574          }); 
     
    15872580          this.items = []; 
    15882581          this.containers = [this]; 
    1589           var items = this.items; 
    1590           var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]]; 
    1591           var connectWith = this._connectWith(); 
     2582 
     2583          var i, j, cur, inst, targetData, _queries, item, queriesLength, 
     2584               items = this.items, 
     2585               queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]], 
     2586               connectWith = this._connectWith(); 
    15922587 
    15932588          if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down 
    1594                for (var i = connectWith.length - 1; i >= 0; i--){ 
    1595                     var cur = $(connectWith[i]); 
    1596                     for (var j = cur.length - 1; j >= 0; j--){ 
    1597                          var inst = $.data(cur[j], this.widgetName); 
    1598                          if(inst && inst != this && !inst.options.disabled) { 
     2589               for (i = connectWith.length - 1; i >= 0; i--){ 
     2590                    cur = $(connectWith[i]); 
     2591                    for (j = cur.length - 1; j >= 0; j--){ 
     2592                         inst = $.data(cur[j], this.widgetFullName); 
     2593                         if(inst && inst !== this && !inst.options.disabled) { 
    15992594                              queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]); 
    16002595                              this.containers.push(inst); 
    16012596                         } 
    1602                     }; 
    1603                }; 
    1604           } 
    1605  
    1606           for (var i = queries.length - 1; i >= 0; i--) { 
    1607                var targetData = queries[i][1]; 
    1608                var _queries = queries[i][0]; 
    1609  
    1610                for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) { 
    1611                     var item = $(_queries[j]); 
    1612  
    1613                     item.data(this.widgetName + '-item', targetData); // Data for target checking (mouse manager) 
     2597                    } 
     2598               } 
     2599          } 
     2600 
     2601          for (i = queries.length - 1; i >= 0; i--) { 
     2602               targetData = queries[i][1]; 
     2603               _queries = queries[i][0]; 
     2604 
     2605               for (j=0, queriesLength = _queries.length; j < queriesLength; j++) { 
     2606                    item = $(_queries[j]); 
     2607 
     2608                    item.data(this.widgetName + "-item", targetData); // Data for target checking (mouse manager) 
    16142609 
    16152610                    items.push({ 
     
    16192614                         left: 0, top: 0 
    16202615                    }); 
    1621                }; 
    1622           }; 
     2616               } 
     2617          } 
    16232618 
    16242619     }, 
     
    16312626          } 
    16322627 
    1633           for (var i = this.items.length - 1; i >= 0; i--){ 
    1634                var item = this.items[i]; 
     2628          var i, item, t, p; 
     2629 
     2630          for (i = this.items.length - 1; i >= 0; i--){ 
     2631               item = this.items[i]; 
    16352632 
    16362633               //We ignore calculating positions of all connected containers when we're not over them 
    1637                if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0]) 
     2634               if(item.instance !== this.currentContainer && this.currentContainer && item.item[0] !== this.currentItem[0]) { 
    16382635                    continue; 
    1639  
    1640                var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item; 
     2636               } 
     2637 
     2638               t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item; 
    16412639 
    16422640               if (!fast) { 
     
    16452643               } 
    16462644 
    1647                var p = t.offset(); 
     2645               p = t.offset(); 
    16482646               item.left = p.left; 
    16492647               item.top = p.top; 
    1650           }; 
     2648          } 
    16512649 
    16522650          if(this.options.custom && this.options.custom.refreshContainers) { 
    16532651               this.options.custom.refreshContainers.call(this); 
    16542652          } else { 
    1655                for (var i = this.containers.length - 1; i >= 0; i--){ 
    1656                     var p = this.containers[i].element.offset(); 
     2653               for (i = this.containers.length - 1; i >= 0; i--){ 
     2654                    p = this.containers[i].element.offset(); 
    16572655                    this.containers[i].containerCache.left = p.left; 
    16582656                    this.containers[i].containerCache.top = p.top; 
    16592657                    this.containers[i].containerCache.width = this.containers[i].element.outerWidth(); 
    16602658                    this.containers[i].containerCache.height = this.containers[i].element.outerHeight(); 
    1661                }; 
     2659               } 
    16622660          } 
    16632661 
     
    16672665     _createPlaceholder: function(that) { 
    16682666          that = that || this; 
    1669           var o = that.options; 
    1670  
    1671           if(!o.placeholder || o.placeholder.constructor == String) { 
    1672                var className = o.placeholder; 
     2667          var className, 
     2668               o = that.options; 
     2669 
     2670          if(!o.placeholder || o.placeholder.constructor === String) { 
     2671               className = o.placeholder; 
    16732672               o.placeholder = { 
    16742673                    element: function() { 
    16752674 
    1676                          var el = $(document.createElement(that.currentItem[0].nodeName)) 
    1677                               .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder") 
    1678                               .removeClass("ui-sortable-helper")[0]; 
    1679  
    1680                          if(!className) 
    1681                               el.style.visibility = "hidden"; 
    1682  
    1683                          return el; 
     2675                         var nodeName = that.currentItem[0].nodeName.toLowerCase(), 
     2676                              element = $( "<" + nodeName + ">", that.document[0] ) 
     2677                                   .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder") 
     2678                                   .removeClass("ui-sortable-helper"); 
     2679 
     2680                         if ( nodeName === "tr" ) { 
     2681                              that.currentItem.children().each(function() { 
     2682                                   $( "<td>&#160;</td>", that.document[0] ) 
     2683                                        .attr( "colspan", $( this ).attr( "colspan" ) || 1 ) 
     2684                                        .appendTo( element ); 
     2685                              }); 
     2686                         } else if ( nodeName === "img" ) { 
     2687                              element.attr( "src", that.currentItem.attr( "src" ) ); 
     2688                         } 
     2689 
     2690                         if ( !className ) { 
     2691                              element.css( "visibility", "hidden" ); 
     2692                         } 
     2693 
     2694                         return element; 
    16842695                    }, 
    16852696                    update: function(container, p) { 
     
    16872698                         // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that 
    16882699                         // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified 
    1689                          if(className && !o.forcePlaceholderSize) return; 
     2700                         if(className && !o.forcePlaceholderSize) { 
     2701                              return; 
     2702                         } 
    16902703 
    16912704                         //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item 
    1692                          if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css('paddingTop')||0, 10) - parseInt(that.currentItem.css('paddingBottom')||0, 10)); }; 
    1693                          if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css('paddingLeft')||0, 10) - parseInt(that.currentItem.css('paddingRight')||0, 10)); }; 
     2705                         if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10)); } 
     2706                         if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10)); } 
    16942707                    } 
    16952708               }; 
     
    17082721 
    17092722     _contactContainers: function(event) { 
     2723          var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, base, cur, nearBottom, floating, 
     2724               innermostContainer = null, 
     2725               innermostIndex = null; 
    17102726 
    17112727          // get innermost container that intersects with item 
    1712           var innermostContainer = null, innermostIndex = null; 
    1713  
    1714  
    1715           for (var i = this.containers.length - 1; i >= 0; i--){ 
     2728          for (i = this.containers.length - 1; i >= 0; i--) { 
    17162729 
    17172730               // never consider a container that's located within the item itself 
    1718                if($.contains(this.currentItem[0], this.containers[i].element[0])) 
     2731               if($.contains(this.currentItem[0], this.containers[i].element[0])) { 
    17192732                    continue; 
     2733               } 
    17202734 
    17212735               if(this._intersectsWith(this.containers[i].containerCache)) { 
    17222736 
    17232737                    // if we've already found a container and it's more "inner" than this, then continue 
    1724                     if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) 
     2738                    if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) { 
    17252739                         continue; 
     2740                    } 
    17262741 
    17272742                    innermostContainer = this.containers[i]; 
     
    17392754 
    17402755          // if no intersecting containers found, return 
    1741           if(!innermostContainer) return; 
     2756          if(!innermostContainer) { 
     2757               return; 
     2758          } 
    17422759 
    17432760          // move the item into the container if it's not there already 
    17442761          if(this.containers.length === 1) { 
    1745                this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); 
    1746                this.containers[innermostIndex].containerCache.over = 1; 
     2762               if (!this.containers[innermostIndex].containerCache.over) { 
     2763                    this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); 
     2764                    this.containers[innermostIndex].containerCache.over = 1; 
     2765               } 
    17472766          } else { 
    17482767 
    17492768               //When entering a new container, we will find the item with the least distance and append our item near it 
    1750                var dist = 10000; var itemWithLeastDistance = null; 
    1751                var posProperty = this.containers[innermostIndex].floating ? 'left' : 'top'; 
    1752                var sizeProperty = this.containers[innermostIndex].floating ? 'width' : 'height'; 
    1753                var base = this.positionAbs[posProperty] + this.offset.click[posProperty]; 
    1754                for (var j = this.items.length - 1; j >= 0; j--) { 
    1755                     if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue; 
    1756                     if(this.items[j].item[0] == this.currentItem[0]) continue; 
    1757                     var cur = this.items[j].item.offset()[posProperty]; 
    1758                     var nearBottom = false; 
     2769               dist = 10000; 
     2770               itemWithLeastDistance = null; 
     2771               floating = innermostContainer.floating || isFloating(this.currentItem); 
     2772               posProperty = floating ? "left" : "top"; 
     2773               sizeProperty = floating ? "width" : "height"; 
     2774               base = this.positionAbs[posProperty] + this.offset.click[posProperty]; 
     2775               for (j = this.items.length - 1; j >= 0; j--) { 
     2776                    if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) { 
     2777                         continue; 
     2778                    } 
     2779                    if(this.items[j].item[0] === this.currentItem[0]) { 
     2780                         continue; 
     2781                    } 
     2782                    if (floating && !isOverAxis(this.positionAbs.top + this.offset.click.top, this.items[j].top, this.items[j].height)) { 
     2783                         continue; 
     2784                    } 
     2785                    cur = this.items[j].item.offset()[posProperty]; 
     2786                    nearBottom = false; 
    17592787                    if(Math.abs(cur - base) > Math.abs(cur + this.items[j][sizeProperty] - base)){ 
    17602788                         nearBottom = true; 
     
    17682796               } 
    17692797 
    1770                if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled 
     2798               //Check if dropOnEmpty is enabled 
     2799               if(!itemWithLeastDistance && !this.options.dropOnEmpty) { 
    17712800                    return; 
    1772  
    1773                this.currentContainer = this.containers[innermostIndex]; 
     2801               } 
     2802 
     2803               if(this.currentContainer === this.containers[innermostIndex]) { 
     2804                    return; 
     2805               } 
     2806 
    17742807               itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true); 
    17752808               this._trigger("change", event, this._uiHash()); 
    17762809               this.containers[innermostIndex]._trigger("change", event, this._uiHash(this)); 
     2810               this.currentContainer = this.containers[innermostIndex]; 
    17772811 
    17782812               //Update the placeholder 
     
    17882822     _createHelper: function(event) { 
    17892823 
    1790           var o = this.options; 
    1791           var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem); 
    1792  
    1793           if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already 
    1794                $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]); 
    1795  
    1796           if(helper[0] == this.currentItem[0]) 
     2824          var o = this.options, 
     2825               helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper === "clone" ? this.currentItem.clone() : this.currentItem); 
     2826 
     2827          //Add the helper to the DOM if that didn't happen already 
     2828          if(!helper.parents("body").length) { 
     2829               $(o.appendTo !== "parent" ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]); 
     2830          } 
     2831 
     2832          if(helper[0] === this.currentItem[0]) { 
    17972833               this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") }; 
    1798  
    1799           if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width()); 
    1800           if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height()); 
     2834          } 
     2835 
     2836          if(!helper[0].style.width || o.forceHelperSize) { 
     2837               helper.width(this.currentItem.width()); 
     2838          } 
     2839          if(!helper[0].style.height || o.forceHelperSize) { 
     2840               helper.height(this.currentItem.height()); 
     2841          } 
    18012842 
    18022843          return helper; 
     
    18052846 
    18062847     _adjustOffsetFromHelper: function(obj) { 
    1807           if (typeof obj == 'string') { 
    1808                obj = obj.split(' '); 
     2848          if (typeof obj === "string") { 
     2849               obj = obj.split(" "); 
    18092850          } 
    18102851          if ($.isArray(obj)) { 
    18112852               obj = {left: +obj[0], top: +obj[1] || 0}; 
    18122853          } 
    1813           if ('left' in obj) { 
     2854          if ("left" in obj) { 
    18142855               this.offset.click.left = obj.left + this.margins.left; 
    18152856          } 
    1816           if ('right' in obj) { 
     2857          if ("right" in obj) { 
    18172858               this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 
    18182859          } 
    1819           if ('top' in obj) { 
     2860          if ("top" in obj) { 
    18202861               this.offset.click.top = obj.top + this.margins.top; 
    18212862          } 
    1822           if ('bottom' in obj) { 
     2863          if ("bottom" in obj) { 
    18232864               this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 
    18242865          } 
     
    18362877          // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that 
    18372878          //    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag 
    1838           if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) { 
     2879          if(this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) { 
    18392880               po.left += this.scrollParent.scrollLeft(); 
    18402881               po.top += this.scrollParent.scrollTop(); 
    18412882          } 
    18422883 
    1843           if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information 
    1844           || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.ui.ie)) //Ugly IE fix 
     2884          // This needs to be actually done for all browsers, since pageX/pageY includes this information 
     2885          // with an ugly IE fix 
     2886          if( this.offsetParent[0] === document.body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) { 
    18452887               po = { top: 0, left: 0 }; 
     2888          } 
    18462889 
    18472890          return { 
     
    18542897     _getRelativeOffset: function() { 
    18552898 
    1856           if(this.cssPosition == "relative") { 
     2899          if(this.cssPosition === "relative") { 
    18572900               var p = this.currentItem.position(); 
    18582901               return { 
     
    18822925     _setContainment: function() { 
    18832926 
    1884           var o = this.options; 
    1885           if(o.containment == 'parent') o.containment = this.helper[0].parentNode; 
    1886           if(o.containment == 'document' || o.containment == 'window') this.containment = [ 
    1887                0 - this.offset.relative.left - this.offset.parent.left, 
    1888                0 - this.offset.relative.top - this.offset.parent.top, 
    1889                $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, 
    1890                ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top 
    1891           ]; 
     2927          var ce, co, over, 
     2928               o = this.options; 
     2929          if(o.containment === "parent") { 
     2930               o.containment = this.helper[0].parentNode; 
     2931          } 
     2932          if(o.containment === "document" || o.containment === "window") { 
     2933               this.containment = [ 
     2934                    0 - this.offset.relative.left - this.offset.parent.left, 
     2935                    0 - this.offset.relative.top - this.offset.parent.top, 
     2936                    $(o.containment === "document" ? document : window).width() - this.helperProportions.width - this.margins.left, 
     2937                    ($(o.containment === "document" ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top 
     2938               ]; 
     2939          } 
    18922940 
    18932941          if(!(/^(document|window|parent)$/).test(o.containment)) { 
    1894                var ce = $(o.containment)[0]; 
    1895                var co = $(o.containment).offset(); 
    1896                var over = ($(ce).css("overflow") != 'hidden'); 
     2942               ce = $(o.containment)[0]; 
     2943               co = $(o.containment).offset(); 
     2944               over = ($(ce).css("overflow") !== "hidden"); 
    18972945 
    18982946               this.containment = [ 
     
    19082956     _convertPositionTo: function(d, pos) { 
    19092957 
    1910           if(!pos) pos = this.position; 
    1911           var mod = d == "absolute" ? 1 : -1; 
    1912           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); 
     2958          if(!pos) { 
     2959               pos = this.position; 
     2960          } 
     2961          var mod = d === "absolute" ? 1 : -1, 
     2962               scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, 
     2963               scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); 
    19132964 
    19142965          return { 
    19152966               top: ( 
    1916                     pos.top                                                                                   // The absolute mouse position 
    1917                     + this.offset.relative.top * mod                                                // Only for relative positioned nodes: Relative offset from element to offset parent 
    1918                     + this.offset.parent.top * mod                                                       // The offsetParent's offset without borders (offset + border) 
    1919                     - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) 
     2967                    pos.top   +                                                                               // The absolute mouse position 
     2968                    this.offset.relative.top * mod +                                                // Only for relative positioned nodes: Relative offset from element to offset parent 
     2969                    this.offset.parent.top * mod -                                                       // The offsetParent's offset without borders (offset + border) 
     2970                    ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) 
    19202971               ), 
    19212972               left: ( 
    1922                     pos.left                                                                             // The absolute mouse position 
    1923                     + this.offset.relative.left * mod                                               // Only for relative positioned nodes: Relative offset from element to offset parent 
    1924                     + this.offset.parent.left * mod                                                      // The offsetParent's offset without borders (offset + border) 
    1925                     - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) 
     2973                    pos.left +                                                                                // The absolute mouse position 
     2974                    this.offset.relative.left * mod +                                               // Only for relative positioned nodes: Relative offset from element to offset parent 
     2975                    this.offset.parent.left * mod -                                                 // The offsetParent's offset without borders (offset + border) 
     2976                    ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) 
    19262977               ) 
    19272978          }; 
     
    19312982     _generatePosition: function(event) { 
    19322983 
    1933           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); 
     2984          var top, left, 
     2985               o = this.options, 
     2986               pageX = event.pageX, 
     2987               pageY = event.pageY, 
     2988               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); 
    19342989 
    19352990          // This is another very weird special case that only happens for relative elements: 
     
    19372992          // 2. and the scroll parent is the document or similar to the offset parent 
    19382993          // we have to refresh the relative offset during the scroll so there are no jumps 
    1939           if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) { 
     2994          if(this.cssPosition === "relative" && !(this.scrollParent[0] !== document && this.scrollParent[0] !== this.offsetParent[0])) { 
    19402995               this.offset.relative = this._getRelativeOffset(); 
    19412996          } 
    1942  
    1943           var pageX = event.pageX; 
    1944           var pageY = event.pageY; 
    19452997 
    19462998          /* 
     
    19523004 
    19533005               if(this.containment) { 
    1954                     if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left; 
    1955                     if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top; 
    1956                     if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left; 
    1957                     if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top; 
     3006                    if(event.pageX - this.offset.click.left < this.containment[0]) { 
     3007                         pageX = this.containment[0] + this.offset.click.left; 
     3008                    } 
     3009                    if(event.pageY - this.offset.click.top < this.containment[1]) { 
     3010                         pageY = this.containment[1] + this.offset.click.top; 
     3011                    } 
     3012                    if(event.pageX - this.offset.click.left > this.containment[2]) { 
     3013                         pageX = this.containment[2] + this.offset.click.left; 
     3014                    } 
     3015                    if(event.pageY - this.offset.click.top > this.containment[3]) { 
     3016                         pageY = this.containment[3] + this.offset.click.top; 
     3017                    } 
    19583018               } 
    19593019 
    19603020               if(o.grid) { 
    1961                     var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1]; 
    1962                     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; 
    1963  
    1964                     var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0]; 
    1965                     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; 
     3021                    top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1]; 
     3022                    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; 
     3023 
     3024                    left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0]; 
     3025                    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; 
    19663026               } 
    19673027 
     
    19703030          return { 
    19713031               top: ( 
    1972                     pageY                                                                                // The absolute mouse position 
    1973                     - this.offset.click.top                                                              // Click offset (relative to the element) 
    1974                     - this.offset.relative.top                                                           // Only for relative positioned nodes: Relative offset from element to offset parent 
    1975                     - this.offset.parent.top                                                        // The offsetParent's offset without borders (offset + border) 
    1976                     + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) 
     3032                    pageY -                                                                              // The absolute mouse position 
     3033                    this.offset.click.top -                                                              // Click offset (relative to the element) 
     3034                    this.offset.relative.top -                                                      // Only for relative positioned nodes: Relative offset from element to offset parent 
     3035                    this.offset.parent.top +                                                        // The offsetParent's offset without borders (offset + border) 
     3036                    ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) 
    19773037               ), 
    19783038               left: ( 
    1979                     pageX                                                                                // The absolute mouse position 
    1980                     - this.offset.click.left                                                        // Click offset (relative to the element) 
    1981                     - this.offset.relative.left                                                          // Only for relative positioned nodes: Relative offset from element to offset parent 
    1982                     - this.offset.parent.left                                                            // The offsetParent's offset without borders (offset + border) 
    1983                     + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) 
     3039                    pageX -                                                                              // The absolute mouse position 
     3040                    this.offset.click.left -                                                        // Click offset (relative to the element) 
     3041                    this.offset.relative.left     -                                                      // Only for relative positioned nodes: Relative offset from element to offset parent 
     3042                    this.offset.parent.left +                                                            // The offsetParent's offset without borders (offset + border) 
     3043                    ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) 
    19843044               ) 
    19853045          }; 
     
    19893049     _rearrange: function(event, i, a, hardRefresh) { 
    19903050 
    1991           a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling)); 
     3051          a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction === "down" ? i.item[0] : i.item[0].nextSibling)); 
    19923052 
    19933053          //Various things done here to improve the performance: 
     
    20003060 
    20013061          this._delay(function() { 
    2002                if(counter == this.counter) this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove 
     3062               if(counter === this.counter) { 
     3063                    this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove 
     3064               } 
    20033065          }); 
    20043066 
     
    20103072          // We delay all events that have to be triggered to after the point where the placeholder has been removed and 
    20113073          // everything else normalized again 
    2012           var delayedTriggers = []; 
     3074          var i, 
     3075               delayedTriggers = []; 
    20133076 
    20143077          // We first have to update the dom position of the actual currentItem 
    20153078          // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088) 
    2016           if(!this._noFinalSort && this.currentItem.parent().length) this.placeholder.before(this.currentItem); 
     3079          if(!this._noFinalSort && this.currentItem.parent().length) { 
     3080               this.placeholder.before(this.currentItem); 
     3081          } 
    20173082          this._noFinalSort = null; 
    20183083 
    2019           if(this.helper[0] == this.currentItem[0]) { 
    2020                for(var i in this._storedCSS) { 
    2021                     if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = ''; 
     3084          if(this.helper[0] === this.currentItem[0]) { 
     3085               for(i in this._storedCSS) { 
     3086                    if(this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") { 
     3087                         this._storedCSS[i] = ""; 
     3088                    } 
    20223089               } 
    20233090               this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); 
     
    20263093          } 
    20273094 
    2028           if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); }); 
    2029           if((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !noPropagation) delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed 
     3095          if(this.fromOutside && !noPropagation) { 
     3096               delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); }); 
     3097          } 
     3098          if((this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) { 
     3099               delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed 
     3100          } 
    20303101 
    20313102          // Check if the items Container has Changed and trigger appropriate 
     
    20413112 
    20423113          //Post events to containers 
    2043           for (var i = this.containers.length - 1; i >= 0; i--){ 
    2044                if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); };  }).call(this, this.containers[i])); 
     3114          for (i = this.containers.length - 1; i >= 0; i--){ 
     3115               if(!noPropagation) { 
     3116                    delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); };  }).call(this, this.containers[i])); 
     3117               } 
    20453118               if(this.containers[i].containerCache.over) { 
    20463119                    delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); };  }).call(this, this.containers[i])); 
     
    20503123 
    20513124          //Do what was originally in plugins 
    2052           if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor 
    2053           if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset opacity 
    2054           if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index 
     3125          if ( this.storedCursor ) { 
     3126               this.document.find( "body" ).css( "cursor", this.storedCursor ); 
     3127               this.storedStylesheet.remove(); 
     3128          } 
     3129          if(this._storedOpacity) { 
     3130               this.helper.css("opacity", this._storedOpacity); 
     3131          } 
     3132          if(this._storedZIndex) { 
     3133               this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex); 
     3134          } 
    20553135 
    20563136          this.dragging = false; 
     
    20583138               if(!noPropagation) { 
    20593139                    this._trigger("beforeStop", event, this._uiHash()); 
    2060                     for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events 
     3140                    for (i=0; i < delayedTriggers.length; i++) { 
     3141                         delayedTriggers[i].call(this, event); 
     3142                    } //Trigger all delayed events 
    20613143                    this._trigger("stop", event, this._uiHash()); 
    20623144               } 
     
    20663148          } 
    20673149 
    2068           if(!noPropagation) this._trigger("beforeStop", event, this._uiHash()); 
     3150          if(!noPropagation) { 
     3151               this._trigger("beforeStop", event, this._uiHash()); 
     3152          } 
    20693153 
    20703154          //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! 
    20713155          this.placeholder[0].parentNode.removeChild(this.placeholder[0]); 
    20723156 
    2073           if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null; 
     3157          if(this.helper[0] !== this.currentItem[0]) { 
     3158               this.helper.remove(); 
     3159          } 
     3160          this.helper = null; 
    20743161 
    20753162          if(!noPropagation) { 
    2076                for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events 
     3163               for (i=0; i < delayedTriggers.length; i++) { 
     3164                    delayedTriggers[i].call(this, event); 
     3165               } //Trigger all delayed events 
    20773166               this._trigger("stop", event, this._uiHash()); 
    20783167          } 
     
    21173206 
    21183207$.widget( "ui.accordion", { 
    2119      version: "1.9.2", 
     3208     version: "1.10.3", 
    21203209     options: { 
    21213210          active: 0, 
     
    21363225 
    21373226     _create: function() { 
    2138           var accordionId = this.accordionId = "ui-accordion-" + 
    2139                     (this.element.attr( "id" ) || ++uid), 
    2140                options = this.options; 
    2141  
     3227          var options = this.options; 
    21423228          this.prevShow = this.prevHide = $(); 
    2143           this.element.addClass( "ui-accordion ui-widget ui-helper-reset" ); 
    2144  
    2145           this.headers = this.element.find( options.header ) 
    2146                .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" ); 
    2147           this._hoverable( this.headers ); 
    2148           this._focusable( this.headers ); 
    2149  
    2150           this.headers.next() 
    2151                .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" ) 
    2152                .hide(); 
     3229          this.element.addClass( "ui-accordion ui-widget ui-helper-reset" ) 
     3230               // ARIA 
     3231               .attr( "role", "tablist" ); 
    21533232 
    21543233          // don't allow collapsible: false and active: false / null 
     
    21563235               options.active = 0; 
    21573236          } 
     3237 
     3238          this._processPanels(); 
    21583239          // handle negative values 
    21593240          if ( options.active < 0 ) { 
    21603241               options.active += this.headers.length; 
    21613242          } 
    2162           this.active = this._findActive( options.active ) 
    2163                .addClass( "ui-accordion-header-active ui-state-active" ) 
    2164                .toggleClass( "ui-corner-all ui-corner-top" ); 
    2165           this.active.next() 
    2166                .addClass( "ui-accordion-content-active" ) 
    2167                .show(); 
    2168  
    2169           this._createIcons(); 
    2170           this.refresh(); 
    2171  
    2172           // ARIA 
    2173           this.element.attr( "role", "tablist" ); 
    2174  
    2175           this.headers 
    2176                .attr( "role", "tab" ) 
    2177                .each(function( i ) { 
    2178                     var header = $( this ), 
    2179                          headerId = header.attr( "id" ), 
    2180                          panel = header.next(), 
    2181                          panelId = panel.attr( "id" ); 
    2182                     if ( !headerId ) { 
    2183                          headerId = accordionId + "-header-" + i; 
    2184                          header.attr( "id", headerId ); 
    2185                     } 
    2186                     if ( !panelId ) { 
    2187                          panelId = accordionId + "-panel-" + i; 
    2188                          panel.attr( "id", panelId ); 
    2189                     } 
    2190                     header.attr( "aria-controls", panelId ); 
    2191                     panel.attr( "aria-labelledby", headerId ); 
    2192                }) 
    2193                .next() 
    2194                     .attr( "role", "tabpanel" ); 
    2195  
    2196           this.headers 
    2197                .not( this.active ) 
    2198                .attr({ 
    2199                     "aria-selected": "false", 
    2200                     tabIndex: -1 
    2201                }) 
    2202                .next() 
    2203                     .attr({ 
    2204                          "aria-expanded": "false", 
    2205                          "aria-hidden": "true" 
    2206                     }) 
    2207                     .hide(); 
    2208  
    2209           // make sure at least one header is in the tab order 
    2210           if ( !this.active.length ) { 
    2211                this.headers.eq( 0 ).attr( "tabIndex", 0 ); 
    2212           } else { 
    2213                this.active.attr({ 
    2214                     "aria-selected": "true", 
    2215                     tabIndex: 0 
    2216                }) 
    2217                .next() 
    2218                     .attr({ 
    2219                          "aria-expanded": "true", 
    2220                          "aria-hidden": "false" 
    2221                     }); 
    2222           } 
    2223  
    2224           this._on( this.headers, { keydown: "_keydown" }); 
    2225           this._on( this.headers.next(), { keydown: "_panelKeyDown" }); 
    2226           this._setupEvents( options.event ); 
     3243          this._refresh(); 
    22273244     }, 
    22283245 
     
    22303247          return { 
    22313248               header: this.active, 
     3249               panel: !this.active.length ? $() : this.active.next(), 
    22323250               content: !this.active.length ? $() : this.active.next() 
    22333251          }; 
     
    23313349 
    23323350     _keydown: function( event ) { 
     3351          /*jshint maxcomplexity:15*/ 
    23333352          if ( event.altKey || event.ctrlKey ) { 
    23343353               return; 
     
    23763395 
    23773396     refresh: function() { 
    2378           var maxHeight, overflow, 
    2379                heightStyle = this.options.heightStyle, 
    2380                parent = this.element.parent(); 
    2381  
     3397          var options = this.options; 
     3398          this._processPanels(); 
     3399 
     3400          // was collapsed or no panel 
     3401          if ( ( options.active === false && options.collapsible === true ) || !this.headers.length ) { 
     3402               options.active = false; 
     3403               this.active = $(); 
     3404          // active false only when collapsible is true 
     3405          } else if ( options.active === false ) { 
     3406               this._activate( 0 ); 
     3407          // was active, but active panel is gone 
     3408          } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { 
     3409               // all remaining panel are disabled 
     3410               if ( this.headers.length === this.headers.find(".ui-state-disabled").length ) { 
     3411                    options.active = false; 
     3412                    this.active = $(); 
     3413               // activate previous panel 
     3414               } else { 
     3415                    this._activate( Math.max( 0, options.active - 1 ) ); 
     3416               } 
     3417          // was active, active panel still exists 
     3418          } else { 
     3419               // make sure active index is correct 
     3420               options.active = this.headers.index( this.active ); 
     3421          } 
     3422 
     3423          this._destroyIcons(); 
     3424 
     3425          this._refresh(); 
     3426     }, 
     3427 
     3428     _processPanels: function() { 
     3429          this.headers = this.element.find( this.options.header ) 
     3430               .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" ); 
     3431 
     3432          this.headers.next() 
     3433               .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" ) 
     3434               .filter(":not(.ui-accordion-content-active)") 
     3435               .hide(); 
     3436     }, 
     3437 
     3438     _refresh: function() { 
     3439          var maxHeight, 
     3440               options = this.options, 
     3441               heightStyle = options.heightStyle, 
     3442               parent = this.element.parent(), 
     3443               accordionId = this.accordionId = "ui-accordion-" + 
     3444                    (this.element.attr( "id" ) || ++uid); 
     3445 
     3446          this.active = this._findActive( options.active ) 
     3447               .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" ) 
     3448               .removeClass( "ui-corner-all" ); 
     3449          this.active.next() 
     3450               .addClass( "ui-accordion-content-active" ) 
     3451               .show(); 
     3452 
     3453          this.headers 
     3454               .attr( "role", "tab" ) 
     3455               .each(function( i ) { 
     3456                    var header = $( this ), 
     3457                         headerId = header.attr( "id" ), 
     3458                         panel = header.next(), 
     3459                         panelId = panel.attr( "id" ); 
     3460                    if ( !headerId ) { 
     3461                         headerId = accordionId + "-header-" + i; 
     3462                         header.attr( "id", headerId ); 
     3463                    } 
     3464                    if ( !panelId ) { 
     3465                         panelId = accordionId + "-panel-" + i; 
     3466                         panel.attr( "id", panelId ); 
     3467                    } 
     3468                    header.attr( "aria-controls", panelId ); 
     3469                    panel.attr( "aria-labelledby", headerId ); 
     3470               }) 
     3471               .next() 
     3472                    .attr( "role", "tabpanel" ); 
     3473 
     3474          this.headers 
     3475               .not( this.active ) 
     3476               .attr({ 
     3477                    "aria-selected": "false", 
     3478                    tabIndex: -1 
     3479               }) 
     3480               .next() 
     3481                    .attr({ 
     3482                         "aria-expanded": "false", 
     3483                         "aria-hidden": "true" 
     3484                    }) 
     3485                    .hide(); 
     3486 
     3487          // make sure at least one header is in the tab order 
     3488          if ( !this.active.length ) { 
     3489               this.headers.eq( 0 ).attr( "tabIndex", 0 ); 
     3490          } else { 
     3491               this.active.attr({ 
     3492                    "aria-selected": "true", 
     3493                    tabIndex: 0 
     3494               }) 
     3495               .next() 
     3496                    .attr({ 
     3497                         "aria-expanded": "true", 
     3498                         "aria-hidden": "false" 
     3499                    }); 
     3500          } 
     3501 
     3502          this._createIcons(); 
     3503 
     3504          this._setupEvents( options.event ); 
    23823505 
    23833506          if ( heightStyle === "fill" ) { 
    2384                // IE 6 treats height like minHeight, so we need to turn off overflow 
    2385                // in order to get a reliable height 
    2386                // we use the minHeight support test because we assume that only 
    2387                // browsers that don't support minHeight will treat height as minHeight 
    2388                if ( !$.support.minHeight ) { 
    2389                     overflow = parent.css( "overflow" ); 
    2390                     parent.css( "overflow", "hidden"); 
    2391                } 
    23923507               maxHeight = parent.height(); 
    23933508               this.element.siblings( ":visible" ).each(function() { 
     
    24003515                    maxHeight -= elem.outerHeight( true ); 
    24013516               }); 
    2402                if ( overflow ) { 
    2403                     parent.css( "overflow", overflow ); 
    2404                } 
    24053517 
    24063518               this.headers.each(function() { 
     
    24473559 
    24483560     _setupEvents: function( event ) { 
    2449           var events = {}; 
    2450           if ( !event ) { 
    2451                return; 
    2452           } 
    2453           $.each( event.split(" "), function( index, eventName ) { 
    2454                events[ eventName ] = "_eventHandler"; 
    2455           }); 
     3561          var events = { 
     3562               keydown: "_keydown" 
     3563          }; 
     3564          if ( event ) { 
     3565               $.each( event.split(" "), function( index, eventName ) { 
     3566                    events[ eventName ] = "_eventHandler"; 
     3567               }); 
     3568          } 
     3569 
     3570          this._off( this.headers.add( this.headers.next() ) ); 
    24563571          this._on( this.headers, events ); 
     3572          this._on( this.headers.next(), { keydown: "_panelKeyDown" }); 
     3573          this._hoverable( this.headers ); 
     3574          this._focusable( this.headers ); 
    24573575     }, 
    24583576 
     
    26333751}); 
    26343752 
    2635  
    2636  
    2637 // DEPRECATED 
    2638 if ( $.uiBackCompat !== false ) { 
    2639      // navigation options 
    2640      (function( $, prototype ) { 
    2641           $.extend( prototype.options, { 
    2642                navigation: false, 
    2643                navigationFilter: function() { 
    2644                     return this.href.toLowerCase() === location.href.toLowerCase(); 
    2645                } 
    2646           }); 
    2647  
    2648           var _create = prototype._create; 
    2649           prototype._create = function() { 
    2650                if ( this.options.navigation ) { 
    2651                     var that = this, 
    2652                          headers = this.element.find( this.options.header ), 
    2653                          content = headers.next(), 
    2654                          current = headers.add( content ) 
    2655                               .find( "a" ) 
    2656                               .filter( this.options.navigationFilter ) 
    2657                               [ 0 ]; 
    2658                     if ( current ) { 
    2659                          headers.add( content ).each( function( index ) { 
    2660                               if ( $.contains( this, current ) ) { 
    2661                                    that.options.active = Math.floor( index / 2 ); 
    2662                                    return false; 
    2663                               } 
    2664                          }); 
    2665                     } 
    2666                } 
    2667                _create.call( this ); 
    2668           }; 
    2669      }( jQuery, jQuery.ui.accordion.prototype ) ); 
    2670  
    2671      // height options 
    2672      (function( $, prototype ) { 
    2673           $.extend( prototype.options, { 
    2674                heightStyle: null, // remove default so we fall back to old values 
    2675                autoHeight: true, // use heightStyle: "auto" 
    2676                clearStyle: false, // use heightStyle: "content" 
    2677                fillSpace: false // use heightStyle: "fill" 
    2678           }); 
    2679  
    2680           var _create = prototype._create, 
    2681                _setOption = prototype._setOption; 
    2682  
    2683           $.extend( prototype, { 
    2684                _create: function() { 
    2685                     this.options.heightStyle = this.options.heightStyle || 
    2686                          this._mergeHeightStyle(); 
    2687  
    2688                     _create.call( this ); 
    2689                }, 
    2690  
    2691                _setOption: function( key ) { 
    2692                     if ( key === "autoHeight" || key === "clearStyle" || key === "fillSpace" ) { 
    2693                          this.options.heightStyle = this._mergeHeightStyle(); 
    2694                     } 
    2695                     _setOption.apply( this, arguments ); 
    2696                }, 
    2697  
    2698                _mergeHeightStyle: function() { 
    2699                     var options = this.options; 
    2700  
    2701                     if ( options.fillSpace ) { 
    2702                          return "fill"; 
    2703                     } 
    2704  
    2705                     if ( options.clearStyle ) { 
    2706                          return "content"; 
    2707                     } 
    2708  
    2709                     if ( options.autoHeight ) { 
    2710                          return "auto"; 
    2711                     } 
    2712                } 
    2713           }); 
    2714      }( jQuery, jQuery.ui.accordion.prototype ) ); 
    2715  
    2716      // icon options 
    2717      (function( $, prototype ) { 
    2718           $.extend( prototype.options.icons, { 
    2719                activeHeader: null, // remove default so we fall back to old values 
    2720                headerSelected: "ui-icon-triangle-1-s" 
    2721           }); 
    2722  
    2723           var _createIcons = prototype._createIcons; 
    2724           prototype._createIcons = function() { 
    2725                if ( this.options.icons ) { 
    2726                     this.options.icons.activeHeader = this.options.icons.activeHeader || 
    2727                          this.options.icons.headerSelected; 
    2728                } 
    2729                _createIcons.call( this ); 
    2730           }; 
    2731      }( jQuery, jQuery.ui.accordion.prototype ) ); 
    2732  
    2733      // expanded active option, activate method 
    2734      (function( $, prototype ) { 
    2735           prototype.activate = prototype._activate; 
    2736  
    2737           var _findActive = prototype._findActive; 
    2738           prototype._findActive = function( index ) { 
    2739                if ( index === -1 ) { 
    2740                     index = false; 
    2741                } 
    2742                if ( index && typeof index !== "number" ) { 
    2743                     index = this.headers.index( this.headers.filter( index ) ); 
    2744                     if ( index === -1 ) { 
    2745                          index = false; 
    2746                     } 
    2747                } 
    2748                return _findActive.call( this, index ); 
    2749           }; 
    2750      }( jQuery, jQuery.ui.accordion.prototype ) ); 
    2751  
    2752      // resize method 
    2753      jQuery.ui.accordion.prototype.resize = jQuery.ui.accordion.prototype.refresh; 
    2754  
    2755      // change events 
    2756      (function( $, prototype ) { 
    2757           $.extend( prototype.options, { 
    2758                change: null, 
    2759                changestart: null 
    2760           }); 
    2761  
    2762           var _trigger = prototype._trigger; 
    2763           prototype._trigger = function( type, event, data ) { 
    2764                var ret = _trigger.apply( this, arguments ); 
    2765                if ( !ret ) { 
    2766                     return false; 
    2767                } 
    2768  
    2769                if ( type === "beforeActivate" ) { 
    2770                     ret = _trigger.call( this, "changestart", event, { 
    2771                          oldHeader: data.oldHeader, 
    2772                          oldContent: data.oldPanel, 
    2773                          newHeader: data.newHeader, 
    2774                          newContent: data.newPanel 
    2775                     }); 
    2776                } else if ( type === "activate" ) { 
    2777                     ret = _trigger.call( this, "change", event, { 
    2778                          oldHeader: data.oldHeader, 
    2779                          oldContent: data.oldPanel, 
    2780                          newHeader: data.newHeader, 
    2781                          newContent: data.newPanel 
    2782                     }); 
    2783                } 
    2784                return ret; 
    2785           }; 
    2786      }( jQuery, jQuery.ui.accordion.prototype ) ); 
    2787  
    2788      // animated option 
    2789      // NOTE: this only provides support for "slide", "bounceslide", and easings 
    2790      // not the full $.ui.accordion.animations API 
    2791      (function( $, prototype ) { 
    2792           $.extend( prototype.options, { 
    2793                animate: null, 
    2794                animated: "slide" 
    2795           }); 
    2796  
    2797           var _create = prototype._create; 
    2798           prototype._create = function() { 
    2799                var options = this.options; 
    2800                if ( options.animate === null ) { 
    2801                     if ( !options.animated ) { 
    2802                          options.animate = false; 
    2803                     } else if ( options.animated === "slide" ) { 
    2804                          options.animate = 300; 
    2805                     } else if ( options.animated === "bounceslide" ) { 
    2806                          options.animate = { 
    2807                               duration: 200, 
    2808                               down: { 
    2809                                    easing: "easeOutBounce", 
    2810                                    duration: 1000 
    2811                               } 
    2812                          }; 
    2813                     } else { 
    2814                          options.animate = options.animated; 
    2815                     } 
    2816                } 
    2817  
    2818                _create.call( this ); 
    2819           }; 
    2820      }( jQuery, jQuery.ui.accordion.prototype ) ); 
    2821 } 
    2822  
    28233753})( jQuery ); 
  • plugins/widgets/dragdrop.js

    r0 r1648  
    1 ToolMan._coordinatesFactory.inside = function(item,container) { 
    2      var iTL = this.topLeftOffset(item); 
    3      var iBR = this.bottomRightOffset(item); 
    4      var cTL = this.topLeftOffset(container); 
    5      var cBR = this.bottomRightOffset(container); 
     1$(function() { 
    62      
    7      return (iTL.x >= cTL.x && iTL.x <= cBR.x && iTL.y >= cTL.y && iTL.y <= cBR.y) 
    8      || (iBR.x >= cTL.x && iBR.x <= cBR.x && iBR.y >= cTL.y && iBR.y <= cBR.y); 
    9 } 
    10  
    11 ToolMan._dragdropFactory = { 
    12      firstContainer: null, 
    13      lastContainer: null, 
     3     // clean 
     4     $('.js-remove').remove(); 
     5     $('.js-hide').hide(); 
     6     $('.widgetSettings').hide(); 
    147      
    15      makeDragable: function(item) { 
    16           var group = ToolMan.drag().createSimpleGroup(item); 
    17           group.register('dragstart',this._onDragStart); 
    18           group.register('dragmove', this._onDragMove); 
    19           group.register('dragend', this._onDragEnd); 
    20            
    21           item.isOutside = false; 
    22           item.started = false; 
    23            
    24           return group; 
    25      }, 
     8     // move 
     9     $( ".connected" ).sortable({ 
     10          axis: "y", 
     11          connectWith: ".connected", 
     12          cursor: "move", 
     13          stop: function( event, ui ) { 
     14               $('.connected').each(function(){ 
     15                    if( $(this).find('li').length == 0 ) { 
     16                         $(this).parents('.widgets').find('.empty-widgets').show(); 
     17                    } else { 
     18                         $(this).parents('.widgets').find('.empty-widgets').hide(); 
     19                    } 
     20               }); 
     21          }//, 
     22          //change: function( event, ui ) { 
     23               //ui.helper.css('height', $('#dndnav .widget-name').css('height')); 
     24          //} 
     25     }); 
    2626      
    27      makeListContainer: function(list,name) { 
    28           // each container becomes a linked list node 
    29           if (this.firstContainer == null) { 
    30                this.firstContainer = this.lastContainer = list; 
    31                list.previousContainer = null; 
    32                list.nextContainer = null; 
    33           } else { 
    34                list.previousContainer = this.lastContainer; 
    35                list.nextContainer = null; 
    36                this.lastContainer.nextContainer = list; 
    37                this.lastContainer = list; 
    38           } 
    39            
    40           var helpers = ToolMan.helpers(); 
    41           var coordinates = ToolMan.coordinates(); 
    42            
    43           //var children = list.childNodes; 
    44           var items = new Array(); 
    45           for (var i=0; i<list.childNodes.length; i++) { 
    46                if (list.childNodes[i].nodeType == 1 && 
    47                list.childNodes[i].nodeName.toLowerCase() == name.toLowerCase()) { 
    48                     items.push(list.childNodes[i]); 
    49                } 
    50           } 
    51            
    52           // these functions are called when an item is draged over 
    53           // a container or out of a container bounds.  onDragOut 
    54           // is also called when the drag ends with an item having 
    55           // been added to the container 
    56           list.onDragOver = new Function(); 
    57           list.onDragOut = new Function(); 
    58           list.onDragEnd = new Function(); 
    59            
    60           if (list.factory == undefined) { 
    61                list.factory = false; 
    62           } 
    63            
    64           var This = this; 
    65           helpers.map(items, function(item) { 
    66                var dragGroup = This.makeDragable(item); 
    67                dragGroup.setThreshold(4); 
    68           }); 
    69           for (var i = 2, n = arguments.length; i < n; i++) { 
    70                helpers.map(items, arguments[i]); 
    71           } 
    72      }, 
     27     // add 
     28     $( "#widgets > li" ).draggable({ 
     29          connectToSortable: ".connected", 
     30          helper: "clone", 
     31          revert: "invalid", 
     32          cursor: "move", 
     33          start: function( event, ui ) { 
     34               ui.helper.css({'width': $('#widgets > li').css('width')}); 
     35               //ui.helper.css({'min-height': $('#dndnav .widget-name').css('height')}); 
     36               //ui.helper.find('.form-note').hide(); 
     37               //ui.helper.find('.widget-name').css({'min-height': $('#dndnav .widget-name').css('height')}); 
     38          }/*, 
     39          stop: function( event, ui ) { 
     40               $('.empty-widgets').css('display', 'none'); 
     41          }*/ 
     42     }); 
    7343      
    74      _onDragStart: function(dragEvent) { 
    75           var container = ToolMan._dragdropFactory.firstContainer; 
    76           var item = dragEvent.group.element; 
    77           var coordinates = ToolMan.coordinates(); 
    78            
    79           // Factory is a sort of assembly pieces, we want to keep them 
    80           if (item.parentNode.factory) { 
    81                var origin = item.cloneNode(true); 
    82                item.parentNode.insertBefore(origin,item.nextSibling); 
    83                ToolMan._dragdropFactory.makeDragable(origin); 
    84           } 
    85            
    86           while (container != null) { 
    87                container.topLeft = coordinates.topLeftOffset(container); 
    88                container.bottomRight = coordinates.bottomRightOffset(container); 
    89                container = container.nextContainer; 
    90           } 
    91            
    92           // item starts out over current parent 
    93           item.started = true; 
    94           item.parentNode.onDragOver(); 
    95      }, 
     44     $( "#widgets, .connected" ).disableSelection(); 
    9645      
    97      _onDragMove: function(dragEvent) { 
    98           var helpers = ToolMan.helpers(); 
    99           var coordinates = ToolMan.coordinates(); 
    100            
    101           var item = dragEvent.group.element; 
    102           var xmouse = dragEvent.transformedMouseOffset; 
    103           var moveTo = null; 
    104            
    105           // Check if we are nowhere 
    106           if (item.isOutside) { 
    107                var container = ToolMan._dragdropFactory.firstContainer; 
    108                while (container != null) { 
    109                     if (coordinates.inside(item,container) && !container.factory) { 
    110                          container.onDragOver(); 
    111                          item.isOutside = false; 
    112                           
    113                          // since isOutside was true, the current parent is a 
    114                          // temporary clone of some previous container node and 
    115                          // it needs to be removed from the document 
    116                          var tempParent = item.parentNode; 
    117                          tempParent.removeChild(item); 
    118                          container.appendChild(item); 
    119                          //tempParent.parentNode.removeChild(tempParent); 
    120                           
    121                          break; 
    122                     } 
    123                     container = container.nextContainer; 
    124                } 
    125                 
    126                if (this.isOutside) { 
    127                     return; 
    128                } 
    129           } 
    130           // Outside the parent node 
    131           else if (!coordinates.inside(item,item.parentNode)) { 
    132                item.parentNode.onDragOut(); 
    133                item.isOutside = true; 
    134                var container = ToolMan._dragdropFactory.firstContainer; 
    135                while (container != null) { 
    136                     if (coordinates.inside(item,container) && !container.factory) { 
    137                          container.onDragOver(); 
    138                          item.isOutside = false; 
    139                          container.appendChild(item); 
    140                          break; 
    141                     } 
    142                     container = container.nextContainer; 
    143                } 
    144                // if we're not in any container now, make a temporary clone of 
    145                // the previous container node and add it to the document 
    146                if (this.isOutside) { 
    147                     var tempParent = item.parentNode.cloneNode(false); 
    148                     item.parentNode.removeChild(item); 
    149                     tempParent.appendChild(item); 
    150                     document.body.appendChild(tempParent); 
    151                     return; 
    152                } 
    153           } 
    154            
    155           // if we get here, we're inside some container bounds, so we do 
    156           // everything the original dragsort script did to swap us into the 
    157           // correct position 
    158            
    159           if (item.parentNode.factory) { 
    160                return; 
    161           } 
    162            
    163           var moveTo = null 
    164            
    165           var previous = helpers.previousItem(item, item.nodeName) 
    166           while (previous != null) { 
    167                var bottomRight = coordinates.bottomRightOffset(previous) 
    168                if (xmouse.y <= bottomRight.y && xmouse.x <= bottomRight.x) { 
    169                     moveTo = previous 
    170                } 
    171                previous = helpers.previousItem(previous, item.nodeName) 
    172           } 
    173           if (moveTo != null) { 
    174                helpers.moveBefore(item, moveTo) 
    175                return 
    176           } 
    177            
    178           var next = helpers.nextItem(item, item.nodeName) 
    179           while (next != null) { 
    180                var topLeft = coordinates.topLeftOffset(next) 
    181                if (topLeft.y <= xmouse.y && topLeft.x <= xmouse.x) { 
    182                     moveTo = next 
    183                } 
    184                next = helpers.nextItem(next, item.nodeName) 
    185           } 
    186           if (moveTo != null) { 
    187                helpers.moveBefore(item, helpers.nextItem(moveTo, item.nodeName)) 
    188                return 
    189           } 
    190      }, 
    191       
    192      _onDragEnd: function(dragEvent) { 
    193           var item = dragEvent.group.element; 
    194            
    195           if (!item.started) { 
    196                return; 
    197           } 
    198            
    199           if (item.isOutside || item.parentNode.factory) { 
    200                item.parentNode.removeChild(item); 
    201                return; 
    202           } 
    203            
    204           item.parentNode.onDragEnd.call(item); 
    205           ToolMan.coordinates().create(0, 0).reposition(dragEvent.group.element); 
    206      } 
    207 }; 
    208  
    209 ToolMan.dragdrop = function() { 
    210      return ToolMan._dragdropFactory; 
    211 }; 
     46}); 
  • plugins/widgets/index.php

    r1518 r1648  
    165165  <?php echo file_get_contents(dirname(__FILE__).'/style.css'); ?> 
    166166  </style> 
    167   <script type="text/javascript" src="js/tool-man/core.js"></script> 
    168   <script type="text/javascript" src="js/tool-man/events.js"></script> 
    169   <script type="text/javascript" src="js/tool-man/css.js"></script> 
    170   <script type="text/javascript" src="js/tool-man/coordinates.js"></script> 
    171   <script type="text/javascript" src="js/tool-man/drag.js"></script> 
     167     <script type="text/javascript" src="js/jquery/jquery-ui.custom.js"></script> 
     168  <script type="text/javascript" src="index.php?pf=widgets/widgets.js"></script> 
    172169  <?php  
    173170     $core->auth->user_prefs->addWorkspace('accessibility');  
     
    177174  <script type="text/javascript" src="index.php?pf=widgets/dragdrop.js"></script> 
    178175  <?php endif; ?> 
    179   <script type="text/javascript" src="index.php?pf=widgets/widgets.js"></script> 
    180176  <script type="text/javascript"> 
    181177  //<![CDATA[ 
     
    199195'<h3>'.__('Available widgets').'</h3>'. 
    200196'<p>'.__('Move widgets from this list to one of the sidebars.').'</p>'. 
    201 '<div id="widgets">'; 
     197'<ul id="widgets">'; 
    202198 
    203199$j = 0; 
    204200foreach ($__widgets->elements(true) as $w) { 
    205201     echo 
    206      '<div>'.form::hidden(array('w[void][0][id]'),html::escapeHTML($w->id())). 
     202     '<li>'.form::hidden(array('w[void][0][id]'),html::escapeHTML($w->id())). 
    207203     '<p class="widget-name">'.form::field(array('w[void][0][order]'),2,3,0,'hideControl').' '. 
    208204     $w->name().($w->desc() != '' ? ' <span class="form-note">'.__($w->desc()).'</span>' : '').'</p>'. 
     
    210206     form::combo(array('addw['.$w->id().']'),$append_combo).'</p>'. 
    211207     '<div class="widgetSettings">'.$w->formSettings('w[void][0]',$j).'</div>'. 
    212      '</div>'; 
     208     '</li>'; 
    213209     $j++; 
    214210} 
    215211 
    216212echo 
    217 '</div>'. 
    218 '<p><input type="submit" class="js-remove" name="append" value="'.__('Add widgets to sidebars').'" />'. 
    219 $core->formNonce().'</p>'. 
     213'</ul>'. 
     214$core->formNonce(). 
     215'<p class="js-remove"><input type="submit" name="append" value="'.__('Add widgets to sidebars').'" /></p>'. 
    220216'</form>'; 
    221217 
     
    316312function sidebarWidgets($id,$title,$widgets,$pr,$default_widgets,&$j) 
    317313{ 
    318      $res = '<h3>'.$title.'</h3><div id="'.$id.'">'; 
     314     $res = '<h3>'.$title.'</h3>'; 
    319315      
    320316     if (!($widgets instanceof dcWidgets)) 
     
    325321     if ($widgets->isEmpty()) { 
    326322          $res .= '<p class="empty-widgets">'.__('No widget.').'</p>'; 
    327      } 
     323     } else { 
     324          $res .= '<p class="empty-widgets" style="display: none;">'.__('No widget.').'</p>'; 
     325     } 
     326      
     327     $res .= '<ul id="'.$id.'" class="connected">'; 
    328328      
    329329     $i = 0; 
     
    333333           
    334334          $res .= 
    335           '<div>'.form::hidden(array($iname.'[id]'),html::escapeHTML($w->id())). 
     335          '<li>'.form::hidden(array($iname.'[id]'),html::escapeHTML($w->id())). 
    336336          '<p class="widget-name">'.form::field(array($iname.'[order]'),2,3,(string) $i,'js-hide','',0,'title="'.__('order').'"').' '. 
    337337          $w->name().($w->desc() != '' ? ' <!-- <span class="form-note">'.__($w->desc()).'</span> -->' : '').'</p>'. 
     
    340340          '</label></p>'. 
    341341          '<div class="widgetSettings">'.$w->formSettings($iname,$j).'</div>'. 
    342           '</div>'; 
     342          '</li>'; 
    343343           
    344344          $i++; 
     
    346346     } 
    347347      
    348      $res .= '</div>'; 
     348     $res .= '</ul>'; 
    349349      
    350350     return $res; 
  • plugins/widgets/style.css

    r1526 r1648  
    66     margin: 0 1% 0 0; 
    77} 
    8 #widgets > div { 
     8#widgets > li { 
    99     border: 1px solid #ccc; 
    1010     margin-bottom: .5em; 
     
    1212     min-height: 3em; 
    1313     padding: 0 0 4px 0; 
     14     list-style: none; 
    1415} 
    1516#widgets .widget-name, #widgets .js-remove { 
     
    4142     padding: 1em 0; 
    4243} 
    43 #dndnav > div, #dndextra > div, #dndcustom > div { 
     44#dndnav > li, #dndextra > li, #dndcustom > li { 
    4445     padding: O; 
    4546     border: 1px solid #999; 
    4647     margin-bottom: 1em; 
     48     list-style: none; 
    4749} 
     50#dndnav .form-note, #dndextra .form-note, #dndcustom .form-note { 
     51     display: none; 
     52} 
     53 
    4854 
    4955.widget-name { 
  • plugins/widgets/widgets.js

    r665 r1648  
    1 var dragdrop = ToolMan.dragdrop(); 
    2 $(function() { 
     1dotclear.postExpander = function(line) { 
     2     var title = $(line).find('.widget-name'); 
     3      
     4     var img = document.createElement('img'); 
     5     img.src = dotclear.img_plus_src; 
     6     img.alt = dotclear.img_plus_alt; 
     7     img.className = 'expand'; 
     8     $(img).css('cursor','pointer'); 
     9     img.line = line; 
     10     img.onclick = function() { dotclear.viewPostContent(this.line); }; 
     11      
     12     title.prepend(img); 
     13}; 
     14 
     15dotclear.viewPostContent = function(line,action) { 
     16     var action = action || 'toogle'; 
     17     var img = $(line).find('.expand'); 
     18     var isopen = img.attr('alt') == dotclear.img_plus_alt; 
     19      
     20     if( action == 'close' || ( action == 'toogle' && !isopen ) ) { 
     21          $(line).find('.widgetSettings').hide(); 
     22          img.attr('src', dotclear.img_plus_src); 
     23          img.attr('alt', dotclear.img_plus_alt); 
     24     } else if ( action == 'open' || ( action == 'toogle' && isopen ) ) { 
     25          $(line).find('.widgetSettings').show(); 
     26          img.attr('src', dotclear.img_minus_src); 
     27          img.attr('alt', dotclear.img_minus_alt); 
     28     } 
     29      
     30}; 
     31 
     32$(function() {  
    333     $('input[name="wreset"]').click(function() { 
    434          return window.confirm(dotclear.msg.confirm_widgets_reset); 
    535     }); 
     36      
     37     $('#dndnav > li, #dndextra > li, #dndcustom > li').each(function() { 
     38          dotclear.postExpander(this); 
     39          dotclear.viewPostContent(this, 'close'); 
     40     }); 
     41      
    642}); 
    7  
    8 $(function() { 
    9      var widgets = document.getElementById('widgets'); 
     43      
     44     /*var widgets = document.getElementById('widgets'); 
    1045     var w_nav = document.getElementById('dndnav'); 
    1146     var w_ext = document.getElementById('dndextra'); 
    1247     var w_custom = document.getElementById('dndcustom'); 
    1348      
    14      w_nav.className = 'hideControls'; 
    15      w_ext.className = 'hideControls'; 
    16      w_custom.className = 'hideControls'; 
     49     $('#dndnav').addClass('hideControls'); 
     50     $('#dndextra').addClass('hideControls'); 
     51     $('#dndcustom').addClass('hideControls'); 
    1752      
    1853     removeElements(document.getElementById('listWidgets'),'input'); 
     
    2863     configControls(w_ext); 
    2964     configControls(w_custom); 
    30       
    31      dragdrop.makeListContainer(widgets,'div',setHandle); 
    32      if (!document.all) { widgets.factory = true; } 
    33      dragdrop.makeListContainer(w_nav,'div',setHandle); 
    34      w_nav.onDragEnd = navDragEnd; 
    35      dragdrop.makeListContainer(w_ext,'div',setHandle); 
    36      w_ext.onDragEnd = extraDragEnd; 
    37      dragdrop.makeListContainer(w_custom,'div',setHandle); 
    38      w_custom.onDragEnd = customDragEnd; 
    3965      
    4066     // Helper to remove some elements 
     
    166192          } 
    167193     } 
    168       
    169      function setHandle(item) { 
    170           //var handle = item.getElementsByTagName('h4').item(0); 
    171           var handle = $('p.widget-name',item).get(0); 
    172           $(handle).addClass('handler'); 
    173           item.toolManDragGroup.setHandle(handle); 
    174      } 
    175194}); 
    176195 
     
    225244          }); 
    226245     }); 
    227 } 
     246}*/ 
Note: See TracChangeset for help on using the changeset viewer.

Sites map