PageRenderTime 60ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/MvcMusicStore/Scripts/jquery-ui-1.8.11.js

#
JavaScript | 2022 lines | 1460 code | 332 blank | 230 comment | 487 complexity | 6c225a6b87e0619fc81082709456c8a9 MD5 | raw file
  1. /*!
  2. * Note: While Microsoft is not the author of this file, Microsoft is
  3. * offering you a license subject to the terms of the Microsoft Software
  4. * License Terms for Microsoft ASP.NET Model View Controller 3.
  5. * Microsoft reserves all other rights. The notices below are provided
  6. * for informational purposes only and are not the license terms under
  7. * which Microsoft distributed this file.
  8. *
  9. * jQuery UI 1.8.11
  10. *
  11. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  12. *
  13. * http://docs.jquery.com/UI
  14. */
  15. (function( $, undefined ) {
  16. // prevent duplicate loading
  17. // this is only a problem because we proxy existing functions
  18. // and we don't want to double proxy them
  19. $.ui = $.ui || {};
  20. if ( $.ui.version ) {
  21. return;
  22. }
  23. $.extend( $.ui, {
  24. version: "1.8.11",
  25. keyCode: {
  26. ALT: 18,
  27. BACKSPACE: 8,
  28. CAPS_LOCK: 20,
  29. COMMA: 188,
  30. COMMAND: 91,
  31. COMMAND_LEFT: 91, // COMMAND
  32. COMMAND_RIGHT: 93,
  33. CONTROL: 17,
  34. DELETE: 46,
  35. DOWN: 40,
  36. END: 35,
  37. ENTER: 13,
  38. ESCAPE: 27,
  39. HOME: 36,
  40. INSERT: 45,
  41. LEFT: 37,
  42. MENU: 93, // COMMAND_RIGHT
  43. NUMPAD_ADD: 107,
  44. NUMPAD_DECIMAL: 110,
  45. NUMPAD_DIVIDE: 111,
  46. NUMPAD_ENTER: 108,
  47. NUMPAD_MULTIPLY: 106,
  48. NUMPAD_SUBTRACT: 109,
  49. PAGE_DOWN: 34,
  50. PAGE_UP: 33,
  51. PERIOD: 190,
  52. RIGHT: 39,
  53. SHIFT: 16,
  54. SPACE: 32,
  55. TAB: 9,
  56. UP: 38,
  57. WINDOWS: 91 // COMMAND
  58. }
  59. });
  60. // plugins
  61. $.fn.extend({
  62. _focus: $.fn.focus,
  63. focus: function( delay, fn ) {
  64. return typeof delay === "number" ?
  65. this.each(function() {
  66. var elem = this;
  67. setTimeout(function() {
  68. $( elem ).focus();
  69. if ( fn ) {
  70. fn.call( elem );
  71. }
  72. }, delay );
  73. }) :
  74. this._focus.apply( this, arguments );
  75. },
  76. scrollParent: function() {
  77. var scrollParent;
  78. if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
  79. scrollParent = this.parents().filter(function() {
  80. return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
  81. }).eq(0);
  82. } else {
  83. scrollParent = this.parents().filter(function() {
  84. return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
  85. }).eq(0);
  86. }
  87. return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
  88. },
  89. zIndex: function( zIndex ) {
  90. if ( zIndex !== undefined ) {
  91. return this.css( "zIndex", zIndex );
  92. }
  93. if ( this.length ) {
  94. var elem = $( this[ 0 ] ), position, value;
  95. while ( elem.length && elem[ 0 ] !== document ) {
  96. // Ignore z-index if position is set to a value where z-index is ignored by the browser
  97. // This makes behavior of this function consistent across browsers
  98. // WebKit always returns auto if the element is positioned
  99. position = elem.css( "position" );
  100. if ( position === "absolute" || position === "relative" || position === "fixed" ) {
  101. // IE returns 0 when zIndex is not specified
  102. // other browsers return a string
  103. // we ignore the case of nested elements with an explicit value of 0
  104. // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
  105. value = parseInt( elem.css( "zIndex" ), 10 );
  106. if ( !isNaN( value ) && value !== 0 ) {
  107. return value;
  108. }
  109. }
  110. elem = elem.parent();
  111. }
  112. }
  113. return 0;
  114. },
  115. disableSelection: function() {
  116. return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
  117. ".ui-disableSelection", function( event ) {
  118. event.preventDefault();
  119. });
  120. },
  121. enableSelection: function() {
  122. return this.unbind( ".ui-disableSelection" );
  123. }
  124. });
  125. $.each( [ "Width", "Height" ], function( i, name ) {
  126. var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
  127. type = name.toLowerCase(),
  128. orig = {
  129. innerWidth: $.fn.innerWidth,
  130. innerHeight: $.fn.innerHeight,
  131. outerWidth: $.fn.outerWidth,
  132. outerHeight: $.fn.outerHeight
  133. };
  134. function reduce( elem, size, border, margin ) {
  135. $.each( side, function() {
  136. size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0;
  137. if ( border ) {
  138. size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0;
  139. }
  140. if ( margin ) {
  141. size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0;
  142. }
  143. });
  144. return size;
  145. }
  146. $.fn[ "inner" + name ] = function( size ) {
  147. if ( size === undefined ) {
  148. return orig[ "inner" + name ].call( this );
  149. }
  150. return this.each(function() {
  151. $( this ).css( type, reduce( this, size ) + "px" );
  152. });
  153. };
  154. $.fn[ "outer" + name] = function( size, margin ) {
  155. if ( typeof size !== "number" ) {
  156. return orig[ "outer" + name ].call( this, size );
  157. }
  158. return this.each(function() {
  159. $( this).css( type, reduce( this, size, true, margin ) + "px" );
  160. });
  161. };
  162. });
  163. // selectors
  164. function visible( element ) {
  165. return !$( element ).parents().andSelf().filter(function() {
  166. return $.curCSS( this, "visibility" ) === "hidden" ||
  167. $.expr.filters.hidden( this );
  168. }).length;
  169. }
  170. $.extend( $.expr[ ":" ], {
  171. data: function( elem, i, match ) {
  172. return !!$.data( elem, match[ 3 ] );
  173. },
  174. focusable: function( element ) {
  175. var nodeName = element.nodeName.toLowerCase(),
  176. tabIndex = $.attr( element, "tabindex" );
  177. if ( "area" === nodeName ) {
  178. var map = element.parentNode,
  179. mapName = map.name,
  180. img;
  181. if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
  182. return false;
  183. }
  184. img = $( "img[usemap=#" + mapName + "]" )[0];
  185. return !!img && visible( img );
  186. }
  187. return ( /input|select|textarea|button|object/.test( nodeName )
  188. ? !element.disabled
  189. : "a" == nodeName
  190. ? element.href || !isNaN( tabIndex )
  191. : !isNaN( tabIndex ))
  192. // the element and all of its ancestors must be visible
  193. && visible( element );
  194. },
  195. tabbable: function( element ) {
  196. var tabIndex = $.attr( element, "tabindex" );
  197. return ( isNaN( tabIndex ) || tabIndex >= 0 ) && $( element ).is( ":focusable" );
  198. }
  199. });
  200. // support
  201. $(function() {
  202. var body = document.body,
  203. div = body.appendChild( div = document.createElement( "div" ) );
  204. $.extend( div.style, {
  205. minHeight: "100px",
  206. height: "auto",
  207. padding: 0,
  208. borderWidth: 0
  209. });
  210. $.support.minHeight = div.offsetHeight === 100;
  211. $.support.selectstart = "onselectstart" in div;
  212. // set display to none to avoid a layout bug in IE
  213. // http://dev.jquery.com/ticket/4014
  214. body.removeChild( div ).style.display = "none";
  215. });
  216. // deprecated
  217. $.extend( $.ui, {
  218. // $.ui.plugin is deprecated. Use the proxy pattern instead.
  219. plugin: {
  220. add: function( module, option, set ) {
  221. var proto = $.ui[ module ].prototype;
  222. for ( var i in set ) {
  223. proto.plugins[ i ] = proto.plugins[ i ] || [];
  224. proto.plugins[ i ].push( [ option, set[ i ] ] );
  225. }
  226. },
  227. call: function( instance, name, args ) {
  228. var set = instance.plugins[ name ];
  229. if ( !set || !instance.element[ 0 ].parentNode ) {
  230. return;
  231. }
  232. for ( var i = 0; i < set.length; i++ ) {
  233. if ( instance.options[ set[ i ][ 0 ] ] ) {
  234. set[ i ][ 1 ].apply( instance.element, args );
  235. }
  236. }
  237. }
  238. },
  239. // will be deprecated when we switch to jQuery 1.4 - use jQuery.contains()
  240. contains: function( a, b ) {
  241. return document.compareDocumentPosition ?
  242. a.compareDocumentPosition( b ) & 16 :
  243. a !== b && a.contains( b );
  244. },
  245. // only used by resizable
  246. hasScroll: function( el, a ) {
  247. //If overflow is hidden, the element might have extra content, but the user wants to hide it
  248. if ( $( el ).css( "overflow" ) === "hidden") {
  249. return false;
  250. }
  251. var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
  252. has = false;
  253. if ( el[ scroll ] > 0 ) {
  254. return true;
  255. }
  256. // TODO: determine which cases actually cause this to happen
  257. // if the element doesn't have the scroll set, see if it's possible to
  258. // set the scroll
  259. el[ scroll ] = 1;
  260. has = ( el[ scroll ] > 0 );
  261. el[ scroll ] = 0;
  262. return has;
  263. },
  264. // these are odd functions, fix the API or move into individual plugins
  265. isOverAxis: function( x, reference, size ) {
  266. //Determines when x coordinate is over "b" element axis
  267. return ( x > reference ) && ( x < ( reference + size ) );
  268. },
  269. isOver: function( y, x, top, left, height, width ) {
  270. //Determines when x, y coordinates is over "b" element
  271. return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
  272. }
  273. });
  274. })( jQuery );
  275. /*!
  276. * Note: While Microsoft is not the author of this file, Microsoft is
  277. * offering you a license subject to the terms of the Microsoft Software
  278. * License Terms for Microsoft ASP.NET Model View Controller 3.
  279. * Microsoft reserves all other rights. The notices below are provided
  280. * for informational purposes only and are not the license terms under
  281. * which Microsoft distributed this file.
  282. *
  283. * jQuery UI Widget 1.8.11
  284. *
  285. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  286. *
  287. * http://docs.jquery.com/UI/Widget
  288. */
  289. (function( $, undefined ) {
  290. // jQuery 1.4+
  291. if ( $.cleanData ) {
  292. var _cleanData = $.cleanData;
  293. $.cleanData = function( elems ) {
  294. for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
  295. $( elem ).triggerHandler( "remove" );
  296. }
  297. _cleanData( elems );
  298. };
  299. } else {
  300. var _remove = $.fn.remove;
  301. $.fn.remove = function( selector, keepData ) {
  302. return this.each(function() {
  303. if ( !keepData ) {
  304. if ( !selector || $.filter( selector, [ this ] ).length ) {
  305. $( "*", this ).add( [ this ] ).each(function() {
  306. $( this ).triggerHandler( "remove" );
  307. });
  308. }
  309. }
  310. return _remove.call( $(this), selector, keepData );
  311. });
  312. };
  313. }
  314. $.widget = function( name, base, prototype ) {
  315. var namespace = name.split( "." )[ 0 ],
  316. fullName;
  317. name = name.split( "." )[ 1 ];
  318. fullName = namespace + "-" + name;
  319. if ( !prototype ) {
  320. prototype = base;
  321. base = $.Widget;
  322. }
  323. // create selector for plugin
  324. $.expr[ ":" ][ fullName ] = function( elem ) {
  325. return !!$.data( elem, name );
  326. };
  327. $[ namespace ] = $[ namespace ] || {};
  328. $[ namespace ][ name ] = function( options, element ) {
  329. // allow instantiation without initializing for simple inheritance
  330. if ( arguments.length ) {
  331. this._createWidget( options, element );
  332. }
  333. };
  334. var basePrototype = new base();
  335. // we need to make the options hash a property directly on the new instance
  336. // otherwise we'll modify the options hash on the prototype that we're
  337. // inheriting from
  338. // $.each( basePrototype, function( key, val ) {
  339. // if ( $.isPlainObject(val) ) {
  340. // basePrototype[ key ] = $.extend( {}, val );
  341. // }
  342. // });
  343. basePrototype.options = $.extend( true, {}, basePrototype.options );
  344. $[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
  345. namespace: namespace,
  346. widgetName: name,
  347. widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
  348. widgetBaseClass: fullName
  349. }, prototype );
  350. $.widget.bridge( name, $[ namespace ][ name ] );
  351. };
  352. $.widget.bridge = function( name, object ) {
  353. $.fn[ name ] = function( options ) {
  354. var isMethodCall = typeof options === "string",
  355. args = Array.prototype.slice.call( arguments, 1 ),
  356. returnValue = this;
  357. // allow multiple hashes to be passed on init
  358. options = !isMethodCall && args.length ?
  359. $.extend.apply( null, [ true, options ].concat(args) ) :
  360. options;
  361. // prevent calls to internal methods
  362. if ( isMethodCall && options.charAt( 0 ) === "_" ) {
  363. return returnValue;
  364. }
  365. if ( isMethodCall ) {
  366. this.each(function() {
  367. var instance = $.data( this, name ),
  368. methodValue = instance && $.isFunction( instance[options] ) ?
  369. instance[ options ].apply( instance, args ) :
  370. instance;
  371. // TODO: add this back in 1.9 and use $.error() (see #5972)
  372. // if ( !instance ) {
  373. // throw "cannot call methods on " + name + " prior to initialization; " +
  374. // "attempted to call method '" + options + "'";
  375. // }
  376. // if ( !$.isFunction( instance[options] ) ) {
  377. // throw "no such method '" + options + "' for " + name + " widget instance";
  378. // }
  379. // var methodValue = instance[ options ].apply( instance, args );
  380. if ( methodValue !== instance && methodValue !== undefined ) {
  381. returnValue = methodValue;
  382. return false;
  383. }
  384. });
  385. } else {
  386. this.each(function() {
  387. var instance = $.data( this, name );
  388. if ( instance ) {
  389. instance.option( options || {} )._init();
  390. } else {
  391. $.data( this, name, new object( options, this ) );
  392. }
  393. });
  394. }
  395. return returnValue;
  396. };
  397. };
  398. $.Widget = function( options, element ) {
  399. // allow instantiation without initializing for simple inheritance
  400. if ( arguments.length ) {
  401. this._createWidget( options, element );
  402. }
  403. };
  404. $.Widget.prototype = {
  405. widgetName: "widget",
  406. widgetEventPrefix: "",
  407. options: {
  408. disabled: false
  409. },
  410. _createWidget: function( options, element ) {
  411. // $.widget.bridge stores the plugin instance, but we do it anyway
  412. // so that it's stored even before the _create function runs
  413. $.data( element, this.widgetName, this );
  414. this.element = $( element );
  415. this.options = $.extend( true, {},
  416. this.options,
  417. this._getCreateOptions(),
  418. options );
  419. var self = this;
  420. this.element.bind( "remove." + this.widgetName, function() {
  421. self.destroy();
  422. });
  423. this._create();
  424. this._trigger( "create" );
  425. this._init();
  426. },
  427. _getCreateOptions: function() {
  428. return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
  429. },
  430. _create: function() {},
  431. _init: function() {},
  432. destroy: function() {
  433. this.element
  434. .unbind( "." + this.widgetName )
  435. .removeData( this.widgetName );
  436. this.widget()
  437. .unbind( "." + this.widgetName )
  438. .removeAttr( "aria-disabled" )
  439. .removeClass(
  440. this.widgetBaseClass + "-disabled " +
  441. "ui-state-disabled" );
  442. },
  443. widget: function() {
  444. return this.element;
  445. },
  446. option: function( key, value ) {
  447. var options = key;
  448. if ( arguments.length === 0 ) {
  449. // don't return a reference to the internal hash
  450. return $.extend( {}, this.options );
  451. }
  452. if (typeof key === "string" ) {
  453. if ( value === undefined ) {
  454. return this.options[ key ];
  455. }
  456. options = {};
  457. options[ key ] = value;
  458. }
  459. this._setOptions( options );
  460. return this;
  461. },
  462. _setOptions: function( options ) {
  463. var self = this;
  464. $.each( options, function( key, value ) {
  465. self._setOption( key, value );
  466. });
  467. return this;
  468. },
  469. _setOption: function( key, value ) {
  470. this.options[ key ] = value;
  471. if ( key === "disabled" ) {
  472. this.widget()
  473. [ value ? "addClass" : "removeClass"](
  474. this.widgetBaseClass + "-disabled" + " " +
  475. "ui-state-disabled" )
  476. .attr( "aria-disabled", value );
  477. }
  478. return this;
  479. },
  480. enable: function() {
  481. return this._setOption( "disabled", false );
  482. },
  483. disable: function() {
  484. return this._setOption( "disabled", true );
  485. },
  486. _trigger: function( type, event, data ) {
  487. var callback = this.options[ type ];
  488. event = $.Event( event );
  489. event.type = ( type === this.widgetEventPrefix ?
  490. type :
  491. this.widgetEventPrefix + type ).toLowerCase();
  492. data = data || {};
  493. // copy original event properties over to the new event
  494. // this would happen if we could call $.event.fix instead of $.Event
  495. // but we don't have a way to force an event to be fixed multiple times
  496. if ( event.originalEvent ) {
  497. for ( var i = $.event.props.length, prop; i; ) {
  498. prop = $.event.props[ --i ];
  499. event[ prop ] = event.originalEvent[ prop ];
  500. }
  501. }
  502. this.element.trigger( event, data );
  503. return !( $.isFunction(callback) &&
  504. callback.call( this.element[0], event, data ) === false ||
  505. event.isDefaultPrevented() );
  506. }
  507. };
  508. })( jQuery );
  509. /*!
  510. * Note: While Microsoft is not the author of this file, Microsoft is
  511. * offering you a license subject to the terms of the Microsoft Software
  512. * License Terms for Microsoft ASP.NET Model View Controller 3.
  513. * Microsoft reserves all other rights. The notices below are provided
  514. * for informational purposes only and are not the license terms under
  515. * which Microsoft distributed this file.
  516. *
  517. * jQuery UI Mouse 1.8.11
  518. *
  519. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  520. *
  521. * http://docs.jquery.com/UI/Mouse
  522. *
  523. * Depends:
  524. * jquery.ui.widget.js
  525. */
  526. (function( $, undefined ) {
  527. $.widget("ui.mouse", {
  528. options: {
  529. cancel: ':input,option',
  530. distance: 1,
  531. delay: 0
  532. },
  533. _mouseInit: function() {
  534. var self = this;
  535. this.element
  536. .bind('mousedown.'+this.widgetName, function(event) {
  537. return self._mouseDown(event);
  538. })
  539. .bind('click.'+this.widgetName, function(event) {
  540. if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) {
  541. $.removeData(event.target, self.widgetName + '.preventClickEvent');
  542. event.stopImmediatePropagation();
  543. return false;
  544. }
  545. });
  546. this.started = false;
  547. },
  548. // TODO: make sure destroying one instance of mouse doesn't mess with
  549. // other instances of mouse
  550. _mouseDestroy: function() {
  551. this.element.unbind('.'+this.widgetName);
  552. },
  553. _mouseDown: function(event) {
  554. // don't let more than one widget handle mouseStart
  555. // TODO: figure out why we have to use originalEvent
  556. event.originalEvent = event.originalEvent || {};
  557. if (event.originalEvent.mouseHandled) { return; }
  558. // we may have missed mouseup (out of window)
  559. (this._mouseStarted && this._mouseUp(event));
  560. this._mouseDownEvent = event;
  561. var self = this,
  562. btnIsLeft = (event.which == 1),
  563. elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false);
  564. if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
  565. return true;
  566. }
  567. this.mouseDelayMet = !this.options.delay;
  568. if (!this.mouseDelayMet) {
  569. this._mouseDelayTimer = setTimeout(function() {
  570. self.mouseDelayMet = true;
  571. }, this.options.delay);
  572. }
  573. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  574. this._mouseStarted = (this._mouseStart(event) !== false);
  575. if (!this._mouseStarted) {
  576. event.preventDefault();
  577. return true;
  578. }
  579. }
  580. // Click event may never have fired (Gecko & Opera)
  581. if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) {
  582. $.removeData(event.target, this.widgetName + '.preventClickEvent');
  583. }
  584. // these delegates are required to keep context
  585. this._mouseMoveDelegate = function(event) {
  586. return self._mouseMove(event);
  587. };
  588. this._mouseUpDelegate = function(event) {
  589. return self._mouseUp(event);
  590. };
  591. $(document)
  592. .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
  593. .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
  594. event.preventDefault();
  595. event.originalEvent.mouseHandled = true;
  596. return true;
  597. },
  598. _mouseMove: function(event) {
  599. // IE mouseup check - mouseup happened when mouse was out of window
  600. if ($.browser.msie && !(document.documentMode >= 9) && !event.button) {
  601. return this._mouseUp(event);
  602. }
  603. if (this._mouseStarted) {
  604. this._mouseDrag(event);
  605. return event.preventDefault();
  606. }
  607. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  608. this._mouseStarted =
  609. (this._mouseStart(this._mouseDownEvent, event) !== false);
  610. (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
  611. }
  612. return !this._mouseStarted;
  613. },
  614. _mouseUp: function(event) {
  615. $(document)
  616. .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
  617. .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
  618. if (this._mouseStarted) {
  619. this._mouseStarted = false;
  620. if (event.target == this._mouseDownEvent.target) {
  621. $.data(event.target, this.widgetName + '.preventClickEvent', true);
  622. }
  623. this._mouseStop(event);
  624. }
  625. return false;
  626. },
  627. _mouseDistanceMet: function(event) {
  628. return (Math.max(
  629. Math.abs(this._mouseDownEvent.pageX - event.pageX),
  630. Math.abs(this._mouseDownEvent.pageY - event.pageY)
  631. ) >= this.options.distance
  632. );
  633. },
  634. _mouseDelayMet: function(event) {
  635. return this.mouseDelayMet;
  636. },
  637. // These are placeholder methods, to be overriden by extending plugin
  638. _mouseStart: function(event) {},
  639. _mouseDrag: function(event) {},
  640. _mouseStop: function(event) {},
  641. _mouseCapture: function(event) { return true; }
  642. });
  643. })(jQuery);
  644. /*
  645. * Note: While Microsoft is not the author of this file, Microsoft is
  646. * offering you a license subject to the terms of the Microsoft Software
  647. * License Terms for Microsoft ASP.NET Model View Controller 3.
  648. * Microsoft reserves all other rights. The notices below are provided
  649. * for informational purposes only and are not the license terms under
  650. * which Microsoft distributed this file.
  651. *
  652. * jQuery UI Position 1.8.11
  653. *
  654. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  655. *
  656. * http://docs.jquery.com/UI/Position
  657. */
  658. (function( $, undefined ) {
  659. $.ui = $.ui || {};
  660. var horizontalPositions = /left|center|right/,
  661. verticalPositions = /top|center|bottom/,
  662. center = "center",
  663. _position = $.fn.position,
  664. _offset = $.fn.offset;
  665. $.fn.position = function( options ) {
  666. if ( !options || !options.of ) {
  667. return _position.apply( this, arguments );
  668. }
  669. // make a copy, we don't want to modify arguments
  670. options = $.extend( {}, options );
  671. var target = $( options.of ),
  672. targetElem = target[0],
  673. collision = ( options.collision || "flip" ).split( " " ),
  674. offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ],
  675. targetWidth,
  676. targetHeight,
  677. basePosition;
  678. if ( targetElem.nodeType === 9 ) {
  679. targetWidth = target.width();
  680. targetHeight = target.height();
  681. basePosition = { top: 0, left: 0 };
  682. // TODO: use $.isWindow() in 1.9
  683. } else if ( targetElem.setTimeout ) {
  684. targetWidth = target.width();
  685. targetHeight = target.height();
  686. basePosition = { top: target.scrollTop(), left: target.scrollLeft() };
  687. } else if ( targetElem.preventDefault ) {
  688. // force left top to allow flipping
  689. options.at = "left top";
  690. targetWidth = targetHeight = 0;
  691. basePosition = { top: options.of.pageY, left: options.of.pageX };
  692. } else {
  693. targetWidth = target.outerWidth();
  694. targetHeight = target.outerHeight();
  695. basePosition = target.offset();
  696. }
  697. // force my and at to have valid horizontal and veritcal positions
  698. // if a value is missing or invalid, it will be converted to center
  699. $.each( [ "my", "at" ], function() {
  700. var pos = ( options[this] || "" ).split( " " );
  701. if ( pos.length === 1) {
  702. pos = horizontalPositions.test( pos[0] ) ?
  703. pos.concat( [center] ) :
  704. verticalPositions.test( pos[0] ) ?
  705. [ center ].concat( pos ) :
  706. [ center, center ];
  707. }
  708. pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : center;
  709. pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : center;
  710. options[ this ] = pos;
  711. });
  712. // normalize collision option
  713. if ( collision.length === 1 ) {
  714. collision[ 1 ] = collision[ 0 ];
  715. }
  716. // normalize offset option
  717. offset[ 0 ] = parseInt( offset[0], 10 ) || 0;
  718. if ( offset.length === 1 ) {
  719. offset[ 1 ] = offset[ 0 ];
  720. }
  721. offset[ 1 ] = parseInt( offset[1], 10 ) || 0;
  722. if ( options.at[0] === "right" ) {
  723. basePosition.left += targetWidth;
  724. } else if ( options.at[0] === center ) {
  725. basePosition.left += targetWidth / 2;
  726. }
  727. if ( options.at[1] === "bottom" ) {
  728. basePosition.top += targetHeight;
  729. } else if ( options.at[1] === center ) {
  730. basePosition.top += targetHeight / 2;
  731. }
  732. basePosition.left += offset[ 0 ];
  733. basePosition.top += offset[ 1 ];
  734. return this.each(function() {
  735. var elem = $( this ),
  736. elemWidth = elem.outerWidth(),
  737. elemHeight = elem.outerHeight(),
  738. marginLeft = parseInt( $.curCSS( this, "marginLeft", true ) ) || 0,
  739. marginTop = parseInt( $.curCSS( this, "marginTop", true ) ) || 0,
  740. collisionWidth = elemWidth + marginLeft +
  741. ( parseInt( $.curCSS( this, "marginRight", true ) ) || 0 ),
  742. collisionHeight = elemHeight + marginTop +
  743. ( parseInt( $.curCSS( this, "marginBottom", true ) ) || 0 ),
  744. position = $.extend( {}, basePosition ),
  745. collisionPosition;
  746. if ( options.my[0] === "right" ) {
  747. position.left -= elemWidth;
  748. } else if ( options.my[0] === center ) {
  749. position.left -= elemWidth / 2;
  750. }
  751. if ( options.my[1] === "bottom" ) {
  752. position.top -= elemHeight;
  753. } else if ( options.my[1] === center ) {
  754. position.top -= elemHeight / 2;
  755. }
  756. // prevent fractions (see #5280)
  757. position.left = Math.round( position.left );
  758. position.top = Math.round( position.top );
  759. collisionPosition = {
  760. left: position.left - marginLeft,
  761. top: position.top - marginTop
  762. };
  763. $.each( [ "left", "top" ], function( i, dir ) {
  764. if ( $.ui.position[ collision[i] ] ) {
  765. $.ui.position[ collision[i] ][ dir ]( position, {
  766. targetWidth: targetWidth,
  767. targetHeight: targetHeight,
  768. elemWidth: elemWidth,
  769. elemHeight: elemHeight,
  770. collisionPosition: collisionPosition,
  771. collisionWidth: collisionWidth,
  772. collisionHeight: collisionHeight,
  773. offset: offset,
  774. my: options.my,
  775. at: options.at
  776. });
  777. }
  778. });
  779. if ( $.fn.bgiframe ) {
  780. elem.bgiframe();
  781. }
  782. elem.offset( $.extend( position, { using: options.using } ) );
  783. });
  784. };
  785. $.ui.position = {
  786. fit: {
  787. left: function( position, data ) {
  788. var win = $( window ),
  789. over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft();
  790. position.left = over > 0 ? position.left - over : Math.max( position.left - data.collisionPosition.left, position.left );
  791. },
  792. top: function( position, data ) {
  793. var win = $( window ),
  794. over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop();
  795. position.top = over > 0 ? position.top - over : Math.max( position.top - data.collisionPosition.top, position.top );
  796. }
  797. },
  798. flip: {
  799. left: function( position, data ) {
  800. if ( data.at[0] === center ) {
  801. return;
  802. }
  803. var win = $( window ),
  804. over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(),
  805. myOffset = data.my[ 0 ] === "left" ?
  806. -data.elemWidth :
  807. data.my[ 0 ] === "right" ?
  808. data.elemWidth :
  809. 0,
  810. atOffset = data.at[ 0 ] === "left" ?
  811. data.targetWidth :
  812. -data.targetWidth,
  813. offset = -2 * data.offset[ 0 ];
  814. position.left += data.collisionPosition.left < 0 ?
  815. myOffset + atOffset + offset :
  816. over > 0 ?
  817. myOffset + atOffset + offset :
  818. 0;
  819. },
  820. top: function( position, data ) {
  821. if ( data.at[1] === center ) {
  822. return;
  823. }
  824. var win = $( window ),
  825. over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(),
  826. myOffset = data.my[ 1 ] === "top" ?
  827. -data.elemHeight :
  828. data.my[ 1 ] === "bottom" ?
  829. data.elemHeight :
  830. 0,
  831. atOffset = data.at[ 1 ] === "top" ?
  832. data.targetHeight :
  833. -data.targetHeight,
  834. offset = -2 * data.offset[ 1 ];
  835. position.top += data.collisionPosition.top < 0 ?
  836. myOffset + atOffset + offset :
  837. over > 0 ?
  838. myOffset + atOffset + offset :
  839. 0;
  840. }
  841. }
  842. };
  843. // offset setter from jQuery 1.4
  844. if ( !$.offset.setOffset ) {
  845. $.offset.setOffset = function( elem, options ) {
  846. // set position first, in-case top/left are set even on static elem
  847. if ( /static/.test( $.curCSS( elem, "position" ) ) ) {
  848. elem.style.position = "relative";
  849. }
  850. var curElem = $( elem ),
  851. curOffset = curElem.offset(),
  852. curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0,
  853. curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0,
  854. props = {
  855. top: (options.top - curOffset.top) + curTop,
  856. left: (options.left - curOffset.left) + curLeft
  857. };
  858. if ( 'using' in options ) {
  859. options.using.call( elem, props );
  860. } else {
  861. curElem.css( props );
  862. }
  863. };
  864. $.fn.offset = function( options ) {
  865. var elem = this[ 0 ];
  866. if ( !elem || !elem.ownerDocument ) { return null; }
  867. if ( options ) {
  868. return this.each(function() {
  869. $.offset.setOffset( this, options );
  870. });
  871. }
  872. return _offset.call( this );
  873. };
  874. }
  875. }( jQuery ));
  876. /*
  877. * Note: While Microsoft is not the author of this file, Microsoft is
  878. * offering you a license subject to the terms of the Microsoft Software
  879. * License Terms for Microsoft ASP.NET Model View Controller 3.
  880. * Microsoft reserves all other rights. The notices below are provided
  881. * for informational purposes only and are not the license terms under
  882. * which Microsoft distributed this file.
  883. *
  884. * jQuery UI Draggable 1.8.11
  885. *
  886. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  887. *
  888. * http://docs.jquery.com/UI/Draggables
  889. *
  890. * Depends:
  891. * jquery.ui.core.js
  892. * jquery.ui.mouse.js
  893. * jquery.ui.widget.js
  894. */
  895. (function( $, undefined ) {
  896. $.widget("ui.draggable", $.ui.mouse, {
  897. widgetEventPrefix: "drag",
  898. options: {
  899. addClasses: true,
  900. appendTo: "parent",
  901. axis: false,
  902. connectToSortable: false,
  903. containment: false,
  904. cursor: "auto",
  905. cursorAt: false,
  906. grid: false,
  907. handle: false,
  908. helper: "original",
  909. iframeFix: false,
  910. opacity: false,
  911. refreshPositions: false,
  912. revert: false,
  913. revertDuration: 500,
  914. scope: "default",
  915. scroll: true,
  916. scrollSensitivity: 20,
  917. scrollSpeed: 20,
  918. snap: false,
  919. snapMode: "both",
  920. snapTolerance: 20,
  921. stack: false,
  922. zIndex: false
  923. },
  924. _create: function() {
  925. if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
  926. this.element[0].style.position = 'relative';
  927. (this.options.addClasses && this.element.addClass("ui-draggable"));
  928. (this.options.disabled && this.element.addClass("ui-draggable-disabled"));
  929. this._mouseInit();
  930. },
  931. destroy: function() {
  932. if(!this.element.data('draggable')) return;
  933. this.element
  934. .removeData("draggable")
  935. .unbind(".draggable")
  936. .removeClass("ui-draggable"
  937. + " ui-draggable-dragging"
  938. + " ui-draggable-disabled");
  939. this._mouseDestroy();
  940. return this;
  941. },
  942. _mouseCapture: function(event) {
  943. var o = this.options;
  944. // among others, prevent a drag on a resizable-handle
  945. if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle'))
  946. return false;
  947. //Quit if we're not on a valid handle
  948. this.handle = this._getHandle(event);
  949. if (!this.handle)
  950. return false;
  951. return true;
  952. },
  953. _mouseStart: function(event) {
  954. var o = this.options;
  955. //Create and append the visible helper
  956. this.helper = this._createHelper(event);
  957. //Cache the helper size
  958. this._cacheHelperProportions();
  959. //If ddmanager is used for droppables, set the global draggable
  960. if($.ui.ddmanager)
  961. $.ui.ddmanager.current = this;
  962. /*
  963. * - Position generation -
  964. * This block generates everything position related - it's the core of draggables.
  965. */
  966. //Cache the margins of the original element
  967. this._cacheMargins();
  968. //Store the helper's css position
  969. this.cssPosition = this.helper.css("position");
  970. this.scrollParent = this.helper.scrollParent();
  971. //The element's absolute position on the page minus margins
  972. this.offset = this.positionAbs = this.element.offset();
  973. this.offset = {
  974. top: this.offset.top - this.margins.top,
  975. left: this.offset.left - this.margins.left
  976. };
  977. $.extend(this.offset, {
  978. click: { //Where the click happened, relative to the element
  979. left: event.pageX - this.offset.left,
  980. top: event.pageY - this.offset.top
  981. },
  982. parent: this._getParentOffset(),
  983. relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
  984. });
  985. //Generate the original position
  986. this.originalPosition = this.position = this._generatePosition(event);
  987. this.originalPageX = event.pageX;
  988. this.originalPageY = event.pageY;
  989. //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
  990. (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
  991. //Set a containment if given in the options
  992. if(o.containment)
  993. this._setContainment();
  994. //Trigger event + callbacks
  995. if(this._trigger("start", event) === false) {
  996. this._clear();
  997. return false;
  998. }
  999. //Recache the helper size
  1000. this._cacheHelperProportions();
  1001. //Prepare the droppable offsets
  1002. if ($.ui.ddmanager && !o.dropBehaviour)
  1003. $.ui.ddmanager.prepareOffsets(this, event);
  1004. this.helper.addClass("ui-draggable-dragging");
  1005. this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
  1006. return true;
  1007. },
  1008. _mouseDrag: function(event, noPropagation) {
  1009. //Compute the helpers position
  1010. this.position = this._generatePosition(event);
  1011. this.positionAbs = this._convertPositionTo("absolute");
  1012. //Call plugins and callbacks and use the resulting position if something is returned
  1013. if (!noPropagation) {
  1014. var ui = this._uiHash();
  1015. if(this._trigger('drag', event, ui) === false) {
  1016. this._mouseUp({});
  1017. return false;
  1018. }
  1019. this.position = ui.position;
  1020. }
  1021. if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
  1022. if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
  1023. if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
  1024. return false;
  1025. },
  1026. _mouseStop: function(event) {
  1027. //If we are using droppables, inform the manager about the drop
  1028. var dropped = false;
  1029. if ($.ui.ddmanager && !this.options.dropBehaviour)
  1030. dropped = $.ui.ddmanager.drop(this, event);
  1031. //if a drop comes from outside (a sortable)
  1032. if(this.dropped) {
  1033. dropped = this.dropped;
  1034. this.dropped = false;
  1035. }
  1036. //if the original element is removed, don't bother to continue if helper is set to "original"
  1037. if((!this.element[0] || !this.element[0].parentNode) && this.options.helper == "original")
  1038. return false;
  1039. 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))) {
  1040. var self = this;
  1041. $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
  1042. if(self._trigger("stop", event) !== false) {
  1043. self._clear();
  1044. }
  1045. });
  1046. } else {
  1047. if(this._trigger("stop", event) !== false) {
  1048. this._clear();
  1049. }
  1050. }
  1051. return false;
  1052. },
  1053. cancel: function() {
  1054. if(this.helper.is(".ui-draggable-dragging")) {
  1055. this._mouseUp({});
  1056. } else {
  1057. this._clear();
  1058. }
  1059. return this;
  1060. },
  1061. _getHandle: function(event) {
  1062. var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
  1063. $(this.options.handle, this.element)
  1064. .find("*")
  1065. .andSelf()
  1066. .each(function() {
  1067. if(this == event.target) handle = true;
  1068. });
  1069. return handle;
  1070. },
  1071. _createHelper: function(event) {
  1072. var o = this.options;
  1073. var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone() : this.element);
  1074. if(!helper.parents('body').length)
  1075. helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
  1076. if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position")))
  1077. helper.css("position", "absolute");
  1078. return helper;
  1079. },
  1080. _adjustOffsetFromHelper: function(obj) {
  1081. if (typeof obj == 'string') {
  1082. obj = obj.split(' ');
  1083. }
  1084. if ($.isArray(obj)) {
  1085. obj = {left: +obj[0], top: +obj[1] || 0};
  1086. }
  1087. if ('left' in obj) {
  1088. this.offset.click.left = obj.left + this.margins.left;
  1089. }
  1090. if ('right' in obj) {
  1091. this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  1092. }
  1093. if ('top' in obj) {
  1094. this.offset.click.top = obj.top + this.margins.top;
  1095. }
  1096. if ('bottom' in obj) {
  1097. this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  1098. }
  1099. },
  1100. _getParentOffset: function() {
  1101. //Get the offsetParent and cache its position
  1102. this.offsetParent = this.helper.offsetParent();
  1103. var po = this.offsetParent.offset();
  1104. // This is a special case where we need to modify a offset calculated on start, since the following happened:
  1105. // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
  1106. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
  1107. // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
  1108. if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
  1109. po.left += this.scrollParent.scrollLeft();
  1110. po.top += this.scrollParent.scrollTop();
  1111. }
  1112. if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
  1113. || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
  1114. po = { top: 0, left: 0 };
  1115. return {
  1116. top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
  1117. left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
  1118. };
  1119. },
  1120. _getRelativeOffset: function() {
  1121. if(this.cssPosition == "relative") {
  1122. var p = this.element.position();
  1123. return {
  1124. top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
  1125. left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
  1126. };
  1127. } else {
  1128. return { top: 0, left: 0 };
  1129. }
  1130. },
  1131. _cacheMargins: function() {
  1132. this.margins = {
  1133. left: (parseInt(this.element.css("marginLeft"),10) || 0),
  1134. top: (parseInt(this.element.css("marginTop"),10) || 0),
  1135. right: (parseInt(this.element.css("marginRight"),10) || 0),
  1136. bottom: (parseInt(this.element.css("marginBottom"),10) || 0)
  1137. };
  1138. },
  1139. _cacheHelperProportions: function() {
  1140. this.helperProportions = {
  1141. width: this.helper.outerWidth(),
  1142. height: this.helper.outerHeight()
  1143. };
  1144. },
  1145. _setContainment: function() {
  1146. var o = this.options;
  1147. if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
  1148. if(o.containment == 'document' || o.containment == 'window') this.containment = [
  1149. (o.containment == 'document' ? 0 : $(window).scrollLeft()) - this.offset.relative.left - this.offset.parent.left,
  1150. (o.containment == 'document' ? 0 : $(window).scrollTop()) - this.offset.relative.top - this.offset.parent.top,
  1151. (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
  1152. (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
  1153. ];
  1154. if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
  1155. var ce = $(o.containment)[0]; if(!ce) return;
  1156. var co = $(o.containment).offset();
  1157. var over = ($(ce).css("overflow") != 'hidden');
  1158. this.containment = [
  1159. co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0),
  1160. co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0),
  1161. co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right,
  1162. co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top - this.margins.bottom
  1163. ];
  1164. } else if(o.containment.constructor == Array) {
  1165. this.containment = o.containment;
  1166. }
  1167. },
  1168. _convertPositionTo: function(d, pos) {
  1169. if(!pos) pos = this.position;
  1170. var mod = d == "absolute" ? 1 : -1;
  1171. var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
  1172. return {
  1173. top: (
  1174. pos.top // The absolute mouse position
  1175. + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
  1176. + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
  1177. - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
  1178. ),
  1179. left: (
  1180. pos.left // The absolute mouse position
  1181. + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
  1182. + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
  1183. - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
  1184. )
  1185. };
  1186. },
  1187. _generatePosition: function(event) {
  1188. var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
  1189. var pageX = event.pageX;
  1190. var pageY = event.pageY;
  1191. /*
  1192. * - Position constraining -
  1193. * Constrain the position to a mix of grid, containment.
  1194. */
  1195. if(this.originalPosition) { //If we are not dragging yet, we won't check for options
  1196. if(this.containment) {
  1197. if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
  1198. if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
  1199. if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
  1200. if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
  1201. }
  1202. if(o.grid) {
  1203. var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
  1204. 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;
  1205. var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
  1206. 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;
  1207. }
  1208. }
  1209. return {
  1210. top: (
  1211. pageY // The absolute mouse position
  1212. - this.offset.click.top // Click offset (relative to the element)
  1213. - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
  1214. - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
  1215. + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
  1216. ),
  1217. left: (
  1218. pageX // The absolute mouse position
  1219. - this.offset.click.left // Click offset (relative to the element)
  1220. - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
  1221. - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
  1222. + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
  1223. )
  1224. };
  1225. },
  1226. _clear: function() {
  1227. this.helper.removeClass("ui-draggable-dragging");
  1228. if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove();
  1229. //if($.ui.ddmanager) $.ui.ddmanager.current = null;
  1230. this.helper = null;
  1231. this.cancelHelperRemoval = false;
  1232. },
  1233. // From now on bulk stuff - mainly helpers
  1234. _trigger: function(type, event, ui) {
  1235. ui = ui || this._uiHash();
  1236. $.ui.plugin.call(this, type, [event, ui]);
  1237. if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
  1238. return $.Widget.prototype._trigger.call(this, type, event, ui);
  1239. },
  1240. plugins: {},
  1241. _uiHash: function(event) {
  1242. return {
  1243. helper: this.helper,
  1244. position: this.position,
  1245. originalPosition: this.originalPosition,
  1246. offset: this.positionAbs
  1247. };
  1248. }
  1249. });
  1250. $.extend($.ui.draggable, {
  1251. version: "1.8.11"
  1252. });
  1253. $.ui.plugin.add("draggable", "connectToSortable", {
  1254. start: function(event, ui) {
  1255. var inst = $(this).data("draggable"), o = inst.options,
  1256. uiSortable = $.extend({}, ui, { item: inst.element });
  1257. inst.sortables = [];
  1258. $(o.connectToSortable).each(function() {
  1259. var sortable = $.data(this, 'sortable');
  1260. if (sortable && !sortable.options.disabled) {
  1261. inst.sortables.push({
  1262. instance: sortable,
  1263. shouldRevert: sortable.options.revert
  1264. });
  1265. 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).
  1266. sortable._trigger("activate", event, uiSortable);
  1267. }
  1268. });
  1269. },
  1270. stop: function(event, ui) {
  1271. //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
  1272. var inst = $(this).data("draggable"),
  1273. uiSortable = $.extend({}, ui, { item: inst.element });
  1274. $.each(inst.sortables, function() {
  1275. if(this.instance.isOver) {
  1276. this.instance.isOver = 0;
  1277. inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
  1278. this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
  1279. //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid'
  1280. if(this.shouldRevert) this.instance.options.revert = true;
  1281. //Trigger the stop of the sortable
  1282. this.instance._mouseStop(event);
  1283. this.instance.options.helper = this.instance.options._helper;
  1284. //If the helper has been the original item, restore properties in the sortable
  1285. if(inst.options.helper == 'original')
  1286. this.instance.currentItem.css({ top: 'auto', left: 'auto' });
  1287. } else {
  1288. this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
  1289. this.instance._trigger("deactivate", event, uiSortable);
  1290. }
  1291. });
  1292. },
  1293. drag: function(event, ui) {
  1294. var inst = $(this).data("draggable"), self = this;
  1295. var checkPos = function(o) {
  1296. var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
  1297. var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left;
  1298. var itemHeight = o.height, itemWidth = o.width;
  1299. var itemTop = o.top, itemLeft = o.left;
  1300. return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth);
  1301. };
  1302. $.each(inst.sortables, function(i) {
  1303. //Copy over some variables to allow calling the sortable's native _intersectsWith
  1304. this.instance.positionAbs = inst.positionAbs;
  1305. this.instance.helperProportions = inst.helperProportions;
  1306. this.instance.offset.click = inst.offset.click;
  1307. if(this.instance._intersectsWith(this.instance.containerCache)) {
  1308. //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
  1309. if(!this.instance.isOver) {
  1310. this.instance.isOver = 1;
  1311. //Now we fake the start of dragging for the sortable instance,
  1312. //by cloning the list group item, appending it to the sortable and using it as inst.currentItem
  1313. //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)
  1314. this.instance.currentItem = $(self).clone().appendTo(this.instance.element).data("sortable-item", true);
  1315. this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
  1316. this.instance.options.helper = function() { return ui.helper[0]; };
  1317. event.target = this.instance.currentItem[0];
  1318. this.instance._mouseCapture(event, true);
  1319. this.instance._mouseStart(event, true, true);
  1320. //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
  1321. this.instance.offset.click.top = inst.offset.click.top;
  1322. this.instance.offset.click.left = inst.offset.click.left;
  1323. this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
  1324. this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
  1325. inst._trigger("toSortable", event);
  1326. inst.dropped = this.instance.element; //draggable revert needs that
  1327. //hack so receive/update callbacks work (mostly)
  1328. inst.currentItem = inst.element;
  1329. this.instance.fromOutside = inst;
  1330. }
  1331. //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
  1332. if(this.instance.currentItem) this.instance._mouseDrag(event);
  1333. } else {
  1334. //If it doesn't intersect with the sortable, and it intersected before,
  1335. //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
  1336. if(this.instance.isOver) {
  1337. this.instance.isOver = 0;
  1338. this.instance.cancelHelperRemoval = true;
  1339. //Prevent reverting on this forced stop
  1340. this.instance.options.revert = false;
  1341. // The out event needs to be triggered independently
  1342. this.instance._trigger('out', event, this.instance._uiHash(this.instance));
  1343. this.instance._mouseStop(event, true);
  1344. this.instance.options.helper = this.instance.options._helper;
  1345. //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
  1346. this.instance.currentItem.remove();
  1347. if(this.instance.placeholder) this.instance.placeholder.remove();
  1348. inst._trigger("fromSortable", event);
  1349. inst.dropped = false; //draggable revert needs that
  1350. }
  1351. };
  1352. });
  1353. }
  1354. });
  1355. $.ui.plugin.add("draggable", "cursor", {
  1356. start: function(event, ui) {
  1357. var t = $('body'), o = $(this).data('draggable').options;
  1358. if (t.css("cursor")) o._cursor = t.css("cursor");
  1359. t.css("cursor", o.cursor);
  1360. },
  1361. stop: function(event, ui) {
  1362. var o = $(this).data('draggable').options;
  1363. if (o._cursor) $('body').css("cursor", o._cursor);
  1364. }
  1365. });
  1366. $.ui.plugin.add("draggable", "iframeFix", {
  1367. start: function(event, ui) {
  1368. var o = $(this).data('draggable').options;
  1369. $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
  1370. $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
  1371. .css({
  1372. width: this.offsetWidth+"px", height: this.offsetHeight+"px",
  1373. position: "absolute", opacity: "0.001", zIndex: 1000
  1374. })
  1375. .css($(this).offset())
  1376. .appendTo("body");
  1377. });
  1378. },
  1379. stop: function(event, ui) {
  1380. $("div.ui-draggable-iframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers
  1381. }
  1382. });
  1383. $.ui.plugin.add("draggable", "opacity", {
  1384. start: function(event, ui) {
  1385. var t = $(ui.helper), o = $(this).data('draggable').options;
  1386. if(t.css("opacity")) o._opacity = t.css("opacity");
  1387. t.css('opacity', o.opacity);
  1388. },
  1389. stop: function(event, ui) {
  1390. var o = $(this).data('draggable').options;
  1391. if(o._opacity) $(ui.helper).css('opacity', o._opacity);
  1392. }
  1393. });
  1394. $.ui.plugin.add("draggable", "scroll", {
  1395. start: function(event, ui) {
  1396. var i = $(this).data("draggable");
  1397. if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();
  1398. },
  1399. drag: function(event, ui) {
  1400. var i = $(this).data("draggable"), o = i.options, scrolled = false;
  1401. if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {
  1402. if(!o.axis || o.axis != 'x') {
  1403. if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
  1404. i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
  1405. else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity)
  1406. i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
  1407. }
  1408. if(!o.axis || o.axis != 'y') {
  1409. if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
  1410. i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
  1411. else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity)
  1412. i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
  1413. }
  1414. } else {
  1415. if(!o.axis || o.axis != 'x') {
  1416. if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
  1417. scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
  1418. else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
  1419. scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
  1420. }
  1421. if(!o.axis || o.axis != 'y') {
  1422. if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
  1423. scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
  1424. else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
  1425. scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
  1426. }
  1427. }
  1428. if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
  1429. $.ui.ddmanager.prepareOffsets(i, event);
  1430. }
  1431. });
  1432. $.ui.plugin.add("draggable", "snap", {
  1433. start: function(event, ui) {
  1434. var i = $(this).data("draggable"), o = i.options;
  1435. i.snapElements = [];
  1436. $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() {
  1437. var $t = $(this); var $o = $t.offset();
  1438. if(this != i.element[0]) i.snapElements.push({
  1439. item: this,
  1440. width: $t.outerWidth(), height: $t.outerHeight(),
  1441. top: $o.top, left: $o.left
  1442. });
  1443. });
  1444. },
  1445. drag: function(event, ui) {
  1446. var inst = $(this).data("draggable"), o = inst.options;
  1447. var d = o.snapTolerance;
  1448. var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
  1449. y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
  1450. for (var i = inst.snapElements.length - 1; i >= 0; i--){
  1451. var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width,
  1452. t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;
  1453. //Yes, I know, this is insane ;)
  1454. if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) {
  1455. if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
  1456. inst.snapElements[i].snapping = false;
  1457. continue;
  1458. }
  1459. if(o.snapMode != 'inner') {
  1460. var ts = Math.abs(t - y2) <= d;
  1461. var bs = Math.abs(b - y1) <= d;
  1462. var ls = Math.abs(l - x2) <= d;
  1463. var rs = Math.abs(r - x1) <= d;
  1464. if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
  1465. if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
  1466. if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
  1467. if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
  1468. }
  1469. var first = (ts || bs || ls || rs);
  1470. if(o.snapMode != 'outer') {
  1471. var ts = Math.abs(t - y1) <= d;
  1472. var bs = Math.abs(b - y2) <= d;
  1473. var ls = Math.abs(l - x1) <= d;
  1474. var rs = Math.abs(r - x2) <= d;
  1475. if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
  1476. if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
  1477. if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
  1478. if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
  1479. }
  1480. if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
  1481. (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
  1482. inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
  1483. };
  1484. }
  1485. });
  1486. $.ui.plugin.add("draggable", "stack", {
  1487. start: function(event, ui) {
  1488. var o = $(this).data("draggable").options;
  1489. var group = $.makeArray($(o.stack)).sort(function(a,b) {
  1490. return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
  1491. });
  1492. if (!group.length) { return; }
  1493. var min = parseInt(group[0].style.zIndex) || 0;
  1494. $(group).each(function(i) {
  1495. this.style.zIndex = min + i;
  1496. });
  1497. this[0].style.zIndex = min + group.length;
  1498. }
  1499. });
  1500. $.ui.plugin.add("draggable", "zIndex", {
  1501. start: function(event, ui) {
  1502. var t = $(ui.helper), o = $(this).data("draggable").options;
  1503. if(t.css("zIndex")) o._zIndex = t.css("zIndex");
  1504. t.css('zIndex', o.zIndex);
  1505. },
  1506. stop: function(event, ui) {
  1507. var o = $(this).data("draggable").options;
  1508. if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex);
  1509. }
  1510. });
  1511. })(jQuery);
  1512. /*
  1513. * Note: While Microsoft is not the author of this file, Microsoft is
  1514. * offering you a license subject to the terms of the Microsoft Software
  1515. * License Terms for Microsoft ASP.NET Model View Controller 3.
  1516. * Microsoft reserves all other rights. The notices below are provided
  1517. * for informational purposes only and are not the license terms under
  1518. * which Microsoft distributed this file.
  1519. *
  1520. * jQuery UI Droppable 1.8.11
  1521. *
  1522. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  1523. *
  1524. * http://docs.jquery.com/UI/Droppables
  1525. *
  1526. * Depends:
  1527. * jquery.ui.core.js
  1528. * jquery.ui.widget.js
  1529. * jquery.ui.mouse.js
  1530. * jquery.ui.draggable.js
  1531. */
  1532. (function( $, undefined ) {
  1533. $.widget("ui.droppable", {
  1534. widgetEventPrefix: "drop",
  1535. options: {
  1536. accept: '*',
  1537. activeClass: false,
  1538. addClasses: true,
  1539. greedy: false,
  1540. hoverClass: false,
  1541. scope: 'default',
  1542. tolerance: 'intersect'
  1543. },
  1544. _create: function() {
  1545. var o = this.options, accept = o.accept;
  1546. this.isover = 0; this.isout = 1;
  1547. this.accept = $.isFunction(accept) ? accept : function(d) {
  1548. return d.is(accept);
  1549. };
  1550. //Store the droppable's proportions
  1551. this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
  1552. // Add the reference and positions to the manager
  1553. $.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || [];
  1554. $.ui.ddmanager.droppables[o.scope].push(this);
  1555. (o.addClasses && this.element.addClass("ui-droppable"));
  1556. },
  1557. destroy: function() {
  1558. var drop = $.ui.ddmanager.droppables[this.options.scope];
  1559. for ( var i = 0; i < drop.length; i++ )
  1560. if ( drop[i] == this )
  1561. drop.splice(i, 1);
  1562. this.element
  1563. .removeClass("ui-droppable ui-droppable-disabled")
  1564. .removeData("droppable")
  1565. .unbind(".droppable");
  1566. return this;
  1567. },
  1568. _setOption: function(key, value) {
  1569. if(key == 'accept') {
  1570. this.accept = $.isFunction(value) ? value : function(d) {
  1571. return d.is(value);
  1572. };
  1573. }
  1574. $.Widget.prototype._setOption.apply(this, arguments);
  1575. },
  1576. _activate: function(event) {
  1577. var draggable = $.ui.ddmanager.current;
  1578. if(this.options.activeClass) this.element.addClass(this.options.activeClass);
  1579. (draggable && this._trigger('activate', event, this.ui(draggable)));
  1580. },
  1581. _deactivate: function(event) {
  1582. var draggable = $.ui.ddmanager.current;
  1583. if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
  1584. (draggable && this._trigger('deactivate', event, this.ui(draggable)));
  1585. },
  1586. _over: function(event) {
  1587. var draggable = $.ui.ddmanager.current;
  1588. if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
  1589. if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
  1590. if(this.options.hoverClass) this.element.addClass(this.options.hoverClass);
  1591. this._trigger('over', event, this.ui(draggable));
  1592. }
  1593. },
  1594. _out: function(event) {
  1595. var draggable = $.ui.ddmanager.current;
  1596. if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
  1597. if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
  1598. if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
  1599. this._trigger('out', event, this.ui(draggable));
  1600. }
  1601. },
  1602. _drop: function(event,custom) {
  1603. var draggable = custom || $.ui.ddmanager.current;
  1604. if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
  1605. var childrenIntersection = false;
  1606. this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
  1607. var inst = $.data(this, 'droppable');
  1608. if(
  1609. inst.options.greedy
  1610. && !inst.options.disabled
  1611. && inst.options.scope == draggable.options.scope
  1612. && inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element))
  1613. && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)
  1614. ) { childrenIntersection = true; return false; }
  1615. });
  1616. if(childrenIntersection) return false;
  1617. if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
  1618. if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
  1619. if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
  1620. this._trigger('drop', event, this.ui(draggable));
  1621. return this.element;
  1622. }
  1623. return false;
  1624. },
  1625. ui: function(c) {
  1626. return {
  1627. draggable: (c.currentItem || c.element),
  1628. helper: c.helper,
  1629. position: c.position,
  1630. offset: c.positionAbs
  1631. };
  1632. }
  1633. });
  1634. $.extend($.ui.droppable, {
  1635. version: "1.8.11"
  1636. });
  1637. $.ui.intersect = function(draggable, droppable, toleranceMode) {
  1638. if (!droppable.offset) return false;
  1639. var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
  1640. y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
  1641. var l = droppable.offset.left, r = l + droppable.proportions.width,
  1642. t = droppable.offset.top, b = t + droppable.proportions.height;
  1643. switch (toleranceMode) {
  1644. case 'fit':
  1645. return (l <= x1 && x2 <= r
  1646. && t <= y1 && y2 <= b);
  1647. break;
  1648. case 'intersect':
  1649. return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
  1650. && x2 - (draggable.helperProportions.width / 2) < r // Left Half
  1651. && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
  1652. && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
  1653. break;
  1654. case 'pointer':
  1655. var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
  1656. draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),
  1657. isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
  1658. return isOver;
  1659. break;
  1660. case 'touch':
  1661. return (
  1662. (y1 >= t && y1 <= b) || // Top edge touching
  1663. (y2 >= t && y2 <= b) || // Bottom edge touching
  1664. (y1 < t && y2 > b) // Surrounded vertically
  1665. ) && (
  1666. (x1 >= l && x1 <= r) || // Left edge touching
  1667. (x2 >= l && x2 <= r) || // Right edge touching
  1668. (x1 < l && x2 > r) // Surrounded horizontally
  1669. );
  1670. break;
  1671. default:
  1672. return false;
  1673. break;
  1674. }
  1675. };
  1676. /*
  1677. This manager tracks offsets of draggables and droppables
  1678. */
  1679. $.ui.ddmanager = {
  1680. current: null,
  1681. droppables: { 'default': [] },
  1682. prepareOffsets: function(t, event) {
  1683. var m = $.ui.ddmanager.droppables[t.options.scope] || [];
  1684. var type = event ? event.type : null; // workaround for #2317
  1685. var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
  1686. droppablesLoop: for (var i = 0; i < m.length; i++) {
  1687. if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted
  1688. for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item
  1689. m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
  1690. if(type == "mousedown") m[i]