jqueryui.slider|posistion|button

patations of jquery ui includes slider/posistion/buttons

Tento skript by neměl být instalován přímo. Jedná se o knihovnu, kterou by měly jiné skripty využívat pomocí meta příkazu // @require https://update.greatest.deepsurf.us/scripts/388324/723370/jqueryuislider%7Cposistion%7Cbutton.js

  1. // ==UserScript==
  2. // @name jqueryui.slider|posistion|button
  3. // @version 1.12.1
  4. // @namespace tsharp.js
  5. // @description patations of jquery ui includes slider/posistion/buttons
  6. // @author jimbo
  7. // @license GPLv3
  8. // @match *
  9. // @require https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.4.1.min.js
  10. // ==/UserScript==
  11.  
  12. /*! jQuery UI - v1.12.1 - 2019-08-09
  13. * http://jqueryui.com
  14. * Includes: widget.js, position.js, data.js, form-reset-mixin.js, keycode.js, labels.js, scroll-parent.js, unique-id.js, widgets/sortable.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/mouse.js, widgets/slider.js, widgets/tooltip.js, effect.js, effects/effect-scale.js, effects/effect-size.js
  15. * Copyright jQuery Foundation and other contributors; Licensed MIT */
  16.  
  17. (function( factory ) {
  18. if ( typeof define === "function" && define.amd ) {
  19.  
  20. // AMD. Register as an anonymous module.
  21. define([ "jquery" ], factory );
  22. } else {
  23.  
  24. // Browser globals
  25. factory( jQuery );
  26. }
  27. }(function( $ ) {
  28.  
  29. $.ui = $.ui || {};
  30.  
  31. var version = $.ui.version = "1.12.1";
  32.  
  33.  
  34. /*!
  35. * jQuery UI Widget 1.12.1
  36. * http://jqueryui.com
  37. *
  38. * Copyright jQuery Foundation and other contributors
  39. * Released under the MIT license.
  40. * http://jquery.org/license
  41. */
  42.  
  43. //>>label: Widget
  44. //>>group: Core
  45. //>>description: Provides a factory for creating stateful widgets with a common API.
  46. //>>docs: http://api.jqueryui.com/jQuery.widget/
  47. //>>demos: http://jqueryui.com/widget/
  48.  
  49.  
  50.  
  51. var widgetUuid = 0;
  52. var widgetSlice = Array.prototype.slice;
  53.  
  54. $.cleanData = ( function( orig ) {
  55. return function( elems ) {
  56. var events, elem, i;
  57. for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {
  58. try {
  59.  
  60. // Only trigger remove when necessary to save time
  61. events = $._data( elem, "events" );
  62. if ( events && events.remove ) {
  63. $( elem ).triggerHandler( "remove" );
  64. }
  65.  
  66. // Http://bugs.jquery.com/ticket/8235
  67. } catch ( e ) {}
  68. }
  69. orig( elems );
  70. };
  71. } )( $.cleanData );
  72.  
  73. $.widget = function( name, base, prototype ) {
  74. var existingConstructor, constructor, basePrototype;
  75.  
  76. // ProxiedPrototype allows the provided prototype to remain unmodified
  77. // so that it can be used as a mixin for multiple widgets (#8876)
  78. var proxiedPrototype = {};
  79.  
  80. var namespace = name.split( "." )[ 0 ];
  81. name = name.split( "." )[ 1 ];
  82. var fullName = namespace + "-" + name;
  83.  
  84. if ( !prototype ) {
  85. prototype = base;
  86. base = $.Widget;
  87. }
  88.  
  89. if ( $.isArray( prototype ) ) {
  90. prototype = $.extend.apply( null, [ {} ].concat( prototype ) );
  91. }
  92.  
  93. // Create selector for plugin
  94. $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
  95. return !!$.data( elem, fullName );
  96. };
  97.  
  98. $[ namespace ] = $[ namespace ] || {};
  99. existingConstructor = $[ namespace ][ name ];
  100. constructor = $[ namespace ][ name ] = function( options, element ) {
  101.  
  102. // Allow instantiation without "new" keyword
  103. if ( !this._createWidget ) {
  104. return new constructor( options, element );
  105. }
  106.  
  107. // Allow instantiation without initializing for simple inheritance
  108. // must use "new" keyword (the code above always passes args)
  109. if ( arguments.length ) {
  110. this._createWidget( options, element );
  111. }
  112. };
  113.  
  114. // Extend with the existing constructor to carry over any static properties
  115. $.extend( constructor, existingConstructor, {
  116. version: prototype.version,
  117.  
  118. // Copy the object used to create the prototype in case we need to
  119. // redefine the widget later
  120. _proto: $.extend( {}, prototype ),
  121.  
  122. // Track widgets that inherit from this widget in case this widget is
  123. // redefined after a widget inherits from it
  124. _childConstructors: []
  125. } );
  126.  
  127. basePrototype = new base();
  128.  
  129. // We need to make the options hash a property directly on the new instance
  130. // otherwise we'll modify the options hash on the prototype that we're
  131. // inheriting from
  132. basePrototype.options = $.widget.extend( {}, basePrototype.options );
  133. $.each( prototype, function( prop, value ) {
  134. if ( !$.isFunction( value ) ) {
  135. proxiedPrototype[ prop ] = value;
  136. return;
  137. }
  138. proxiedPrototype[ prop ] = ( function() {
  139. function _super() {
  140. return base.prototype[ prop ].apply( this, arguments );
  141. }
  142.  
  143. function _superApply( args ) {
  144. return base.prototype[ prop ].apply( this, args );
  145. }
  146.  
  147. return function() {
  148. var __super = this._super;
  149. var __superApply = this._superApply;
  150. var returnValue;
  151.  
  152. this._super = _super;
  153. this._superApply = _superApply;
  154.  
  155. returnValue = value.apply( this, arguments );
  156.  
  157. this._super = __super;
  158. this._superApply = __superApply;
  159.  
  160. return returnValue;
  161. };
  162. } )();
  163. } );
  164. constructor.prototype = $.widget.extend( basePrototype, {
  165.  
  166. // TODO: remove support for widgetEventPrefix
  167. // always use the name + a colon as the prefix, e.g., draggable:start
  168. // don't prefix for widgets that aren't DOM-based
  169. widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name
  170. }, proxiedPrototype, {
  171. constructor: constructor,
  172. namespace: namespace,
  173. widgetName: name,
  174. widgetFullName: fullName
  175. } );
  176.  
  177. // If this widget is being redefined then we need to find all widgets that
  178. // are inheriting from it and redefine all of them so that they inherit from
  179. // the new version of this widget. We're essentially trying to replace one
  180. // level in the prototype chain.
  181. if ( existingConstructor ) {
  182. $.each( existingConstructor._childConstructors, function( i, child ) {
  183. var childPrototype = child.prototype;
  184.  
  185. // Redefine the child widget using the same prototype that was
  186. // originally used, but inherit from the new version of the base
  187. $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor,
  188. child._proto );
  189. } );
  190.  
  191. // Remove the list of existing child constructors from the old constructor
  192. // so the old child constructors can be garbage collected
  193. delete existingConstructor._childConstructors;
  194. } else {
  195. base._childConstructors.push( constructor );
  196. }
  197.  
  198. $.widget.bridge( name, constructor );
  199.  
  200. return constructor;
  201. };
  202.  
  203. $.widget.extend = function( target ) {
  204. var input = widgetSlice.call( arguments, 1 );
  205. var inputIndex = 0;
  206. var inputLength = input.length;
  207. var key;
  208. var value;
  209.  
  210. for ( ; inputIndex < inputLength; inputIndex++ ) {
  211. for ( key in input[ inputIndex ] ) {
  212. value = input[ inputIndex ][ key ];
  213. if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
  214.  
  215. // Clone objects
  216. if ( $.isPlainObject( value ) ) {
  217. target[ key ] = $.isPlainObject( target[ key ] ) ?
  218. $.widget.extend( {}, target[ key ], value ) :
  219.  
  220. // Don't extend strings, arrays, etc. with objects
  221. $.widget.extend( {}, value );
  222.  
  223. // Copy everything else by reference
  224. } else {
  225. target[ key ] = value;
  226. }
  227. }
  228. }
  229. }
  230. return target;
  231. };
  232.  
  233. $.widget.bridge = function( name, object ) {
  234. var fullName = object.prototype.widgetFullName || name;
  235. $.fn[ name ] = function( options ) {
  236. var isMethodCall = typeof options === "string";
  237. var args = widgetSlice.call( arguments, 1 );
  238. var returnValue = this;
  239.  
  240. if ( isMethodCall ) {
  241.  
  242. // If this is an empty collection, we need to have the instance method
  243. // return undefined instead of the jQuery instance
  244. if ( !this.length && options === "instance" ) {
  245. returnValue = undefined;
  246. } else {
  247. this.each( function() {
  248. var methodValue;
  249. var instance = $.data( this, fullName );
  250.  
  251. if ( options === "instance" ) {
  252. returnValue = instance;
  253. return false;
  254. }
  255.  
  256. if ( !instance ) {
  257. return $.error( "cannot call methods on " + name +
  258. " prior to initialization; " +
  259. "attempted to call method '" + options + "'" );
  260. }
  261.  
  262. if ( !$.isFunction( instance[ options ] ) || options.charAt( 0 ) === "_" ) {
  263. return $.error( "no such method '" + options + "' for " + name +
  264. " widget instance" );
  265. }
  266.  
  267. methodValue = instance[ options ].apply( instance, args );
  268.  
  269. if ( methodValue !== instance && methodValue !== undefined ) {
  270. returnValue = methodValue && methodValue.jquery ?
  271. returnValue.pushStack( methodValue.get() ) :
  272. methodValue;
  273. return false;
  274. }
  275. } );
  276. }
  277. } else {
  278.  
  279. // Allow multiple hashes to be passed on init
  280. if ( args.length ) {
  281. options = $.widget.extend.apply( null, [ options ].concat( args ) );
  282. }
  283.  
  284. this.each( function() {
  285. var instance = $.data( this, fullName );
  286. if ( instance ) {
  287. instance.option( options || {} );
  288. if ( instance._init ) {
  289. instance._init();
  290. }
  291. } else {
  292. $.data( this, fullName, new object( options, this ) );
  293. }
  294. } );
  295. }
  296.  
  297. return returnValue;
  298. };
  299. };
  300.  
  301. $.Widget = function( /* options, element */ ) {};
  302. $.Widget._childConstructors = [];
  303.  
  304. $.Widget.prototype = {
  305. widgetName: "widget",
  306. widgetEventPrefix: "",
  307. defaultElement: "<div>",
  308.  
  309. options: {
  310. classes: {},
  311. disabled: false,
  312.  
  313. // Callbacks
  314. create: null
  315. },
  316.  
  317. _createWidget: function( options, element ) {
  318. element = $( element || this.defaultElement || this )[ 0 ];
  319. this.element = $( element );
  320. this.uuid = widgetUuid++;
  321. this.eventNamespace = "." + this.widgetName + this.uuid;
  322.  
  323. this.bindings = $();
  324. this.hoverable = $();
  325. this.focusable = $();
  326. this.classesElementLookup = {};
  327.  
  328. if ( element !== this ) {
  329. $.data( element, this.widgetFullName, this );
  330. this._on( true, this.element, {
  331. remove: function( event ) {
  332. if ( event.target === element ) {
  333. this.destroy();
  334. }
  335. }
  336. } );
  337. this.document = $( element.style ?
  338.  
  339. // Element within the document
  340. element.ownerDocument :
  341.  
  342. // Element is window or document
  343. element.document || element );
  344. this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow );
  345. }
  346.  
  347. this.options = $.widget.extend( {},
  348. this.options,
  349. this._getCreateOptions(),
  350. options );
  351.  
  352. this._create();
  353.  
  354. if ( this.options.disabled ) {
  355. this._setOptionDisabled( this.options.disabled );
  356. }
  357.  
  358. this._trigger( "create", null, this._getCreateEventData() );
  359. this._init();
  360. },
  361.  
  362. _getCreateOptions: function() {
  363. return {};
  364. },
  365.  
  366. _getCreateEventData: $.noop,
  367.  
  368. _create: $.noop,
  369.  
  370. _init: $.noop,
  371.  
  372. destroy: function() {
  373. var that = this;
  374.  
  375. this._destroy();
  376. $.each( this.classesElementLookup, function( key, value ) {
  377. that._removeClass( value, key );
  378. } );
  379.  
  380. // We can probably remove the unbind calls in 2.0
  381. // all event bindings should go through this._on()
  382. this.element
  383. .off( this.eventNamespace )
  384. .removeData( this.widgetFullName );
  385. this.widget()
  386. .off( this.eventNamespace )
  387. .removeAttr( "aria-disabled" );
  388.  
  389. // Clean up events and states
  390. this.bindings.off( this.eventNamespace );
  391. },
  392.  
  393. _destroy: $.noop,
  394.  
  395. widget: function() {
  396. return this.element;
  397. },
  398.  
  399. option: function( key, value ) {
  400. var options = key;
  401. var parts;
  402. var curOption;
  403. var i;
  404.  
  405. if ( arguments.length === 0 ) {
  406.  
  407. // Don't return a reference to the internal hash
  408. return $.widget.extend( {}, this.options );
  409. }
  410.  
  411. if ( typeof key === "string" ) {
  412.  
  413. // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
  414. options = {};
  415. parts = key.split( "." );
  416. key = parts.shift();
  417. if ( parts.length ) {
  418. curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
  419. for ( i = 0; i < parts.length - 1; i++ ) {
  420. curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
  421. curOption = curOption[ parts[ i ] ];
  422. }
  423. key = parts.pop();
  424. if ( arguments.length === 1 ) {
  425. return curOption[ key ] === undefined ? null : curOption[ key ];
  426. }
  427. curOption[ key ] = value;
  428. } else {
  429. if ( arguments.length === 1 ) {
  430. return this.options[ key ] === undefined ? null : this.options[ key ];
  431. }
  432. options[ key ] = value;
  433. }
  434. }
  435.  
  436. this._setOptions( options );
  437.  
  438. return this;
  439. },
  440.  
  441. _setOptions: function( options ) {
  442. var key;
  443.  
  444. for ( key in options ) {
  445. this._setOption( key, options[ key ] );
  446. }
  447.  
  448. return this;
  449. },
  450.  
  451. _setOption: function( key, value ) {
  452. if ( key === "classes" ) {
  453. this._setOptionClasses( value );
  454. }
  455.  
  456. this.options[ key ] = value;
  457.  
  458. if ( key === "disabled" ) {
  459. this._setOptionDisabled( value );
  460. }
  461.  
  462. return this;
  463. },
  464.  
  465. _setOptionClasses: function( value ) {
  466. var classKey, elements, currentElements;
  467.  
  468. for ( classKey in value ) {
  469. currentElements = this.classesElementLookup[ classKey ];
  470. if ( value[ classKey ] === this.options.classes[ classKey ] ||
  471. !currentElements ||
  472. !currentElements.length ) {
  473. continue;
  474. }
  475.  
  476. // We are doing this to create a new jQuery object because the _removeClass() call
  477. // on the next line is going to destroy the reference to the current elements being
  478. // tracked. We need to save a copy of this collection so that we can add the new classes
  479. // below.
  480. elements = $( currentElements.get() );
  481. this._removeClass( currentElements, classKey );
  482.  
  483. // We don't use _addClass() here, because that uses this.options.classes
  484. // for generating the string of classes. We want to use the value passed in from
  485. // _setOption(), this is the new value of the classes option which was passed to
  486. // _setOption(). We pass this value directly to _classes().
  487. elements.addClass( this._classes( {
  488. element: elements,
  489. keys: classKey,
  490. classes: value,
  491. add: true
  492. } ) );
  493. }
  494. },
  495.  
  496. _setOptionDisabled: function( value ) {
  497. this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value );
  498.  
  499. // If the widget is becoming disabled, then nothing is interactive
  500. if ( value ) {
  501. this._removeClass( this.hoverable, null, "ui-state-hover" );
  502. this._removeClass( this.focusable, null, "ui-state-focus" );
  503. }
  504. },
  505.  
  506. enable: function() {
  507. return this._setOptions( { disabled: false } );
  508. },
  509.  
  510. disable: function() {
  511. return this._setOptions( { disabled: true } );
  512. },
  513.  
  514. _classes: function( options ) {
  515. var full = [];
  516. var that = this;
  517.  
  518. options = $.extend( {
  519. element: this.element,
  520. classes: this.options.classes || {}
  521. }, options );
  522.  
  523. function processClassString( classes, checkOption ) {
  524. var current, i;
  525. for ( i = 0; i < classes.length; i++ ) {
  526. current = that.classesElementLookup[ classes[ i ] ] || $();
  527. if ( options.add ) {
  528. current = $( $.unique( current.get().concat( options.element.get() ) ) );
  529. } else {
  530. current = $( current.not( options.element ).get() );
  531. }
  532. that.classesElementLookup[ classes[ i ] ] = current;
  533. full.push( classes[ i ] );
  534. if ( checkOption && options.classes[ classes[ i ] ] ) {
  535. full.push( options.classes[ classes[ i ] ] );
  536. }
  537. }
  538. }
  539.  
  540. this._on( options.element, {
  541. "remove": "_untrackClassesElement"
  542. } );
  543.  
  544. if ( options.keys ) {
  545. processClassString( options.keys.match( /\S+/g ) || [], true );
  546. }
  547. if ( options.extra ) {
  548. processClassString( options.extra.match( /\S+/g ) || [] );
  549. }
  550.  
  551. return full.join( " " );
  552. },
  553.  
  554. _untrackClassesElement: function( event ) {
  555. var that = this;
  556. $.each( that.classesElementLookup, function( key, value ) {
  557. if ( $.inArray( event.target, value ) !== -1 ) {
  558. that.classesElementLookup[ key ] = $( value.not( event.target ).get() );
  559. }
  560. } );
  561. },
  562.  
  563. _removeClass: function( element, keys, extra ) {
  564. return this._toggleClass( element, keys, extra, false );
  565. },
  566.  
  567. _addClass: function( element, keys, extra ) {
  568. return this._toggleClass( element, keys, extra, true );
  569. },
  570.  
  571. _toggleClass: function( element, keys, extra, add ) {
  572. add = ( typeof add === "boolean" ) ? add : extra;
  573. var shift = ( typeof element === "string" || element === null ),
  574. options = {
  575. extra: shift ? keys : extra,
  576. keys: shift ? element : keys,
  577. element: shift ? this.element : element,
  578. add: add
  579. };
  580. options.element.toggleClass( this._classes( options ), add );
  581. return this;
  582. },
  583.  
  584. _on: function( suppressDisabledCheck, element, handlers ) {
  585. var delegateElement;
  586. var instance = this;
  587.  
  588. // No suppressDisabledCheck flag, shuffle arguments
  589. if ( typeof suppressDisabledCheck !== "boolean" ) {
  590. handlers = element;
  591. element = suppressDisabledCheck;
  592. suppressDisabledCheck = false;
  593. }
  594.  
  595. // No element argument, shuffle and use this.element
  596. if ( !handlers ) {
  597. handlers = element;
  598. element = this.element;
  599. delegateElement = this.widget();
  600. } else {
  601. element = delegateElement = $( element );
  602. this.bindings = this.bindings.add( element );
  603. }
  604.  
  605. $.each( handlers, function( event, handler ) {
  606. function handlerProxy() {
  607.  
  608. // Allow widgets to customize the disabled handling
  609. // - disabled as an array instead of boolean
  610. // - disabled class as method for disabling individual parts
  611. if ( !suppressDisabledCheck &&
  612. ( instance.options.disabled === true ||
  613. $( this ).hasClass( "ui-state-disabled" ) ) ) {
  614. return;
  615. }
  616. return ( typeof handler === "string" ? instance[ handler ] : handler )
  617. .apply( instance, arguments );
  618. }
  619.  
  620. // Copy the guid so direct unbinding works
  621. if ( typeof handler !== "string" ) {
  622. handlerProxy.guid = handler.guid =
  623. handler.guid || handlerProxy.guid || $.guid++;
  624. }
  625.  
  626. var match = event.match( /^([\w:-]*)\s*(.*)$/ );
  627. var eventName = match[ 1 ] + instance.eventNamespace;
  628. var selector = match[ 2 ];
  629.  
  630. if ( selector ) {
  631. delegateElement.on( eventName, selector, handlerProxy );
  632. } else {
  633. element.on( eventName, handlerProxy );
  634. }
  635. } );
  636. },
  637.  
  638. _off: function( element, eventName ) {
  639. eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) +
  640. this.eventNamespace;
  641. element.off( eventName ).off( eventName );
  642.  
  643. // Clear the stack to avoid memory leaks (#10056)
  644. this.bindings = $( this.bindings.not( element ).get() );
  645. this.focusable = $( this.focusable.not( element ).get() );
  646. this.hoverable = $( this.hoverable.not( element ).get() );
  647. },
  648.  
  649. _delay: function( handler, delay ) {
  650. function handlerProxy() {
  651. return ( typeof handler === "string" ? instance[ handler ] : handler )
  652. .apply( instance, arguments );
  653. }
  654. var instance = this;
  655. return setTimeout( handlerProxy, delay || 0 );
  656. },
  657.  
  658. _hoverable: function( element ) {
  659. this.hoverable = this.hoverable.add( element );
  660. this._on( element, {
  661. mouseenter: function( event ) {
  662. this._addClass( $( event.currentTarget ), null, "ui-state-hover" );
  663. },
  664. mouseleave: function( event ) {
  665. this._removeClass( $( event.currentTarget ), null, "ui-state-hover" );
  666. }
  667. } );
  668. },
  669.  
  670. _focusable: function( element ) {
  671. this.focusable = this.focusable.add( element );
  672. this._on( element, {
  673. focusin: function( event ) {
  674. this._addClass( $( event.currentTarget ), null, "ui-state-focus" );
  675. },
  676. focusout: function( event ) {
  677. this._removeClass( $( event.currentTarget ), null, "ui-state-focus" );
  678. }
  679. } );
  680. },
  681.  
  682. _trigger: function( type, event, data ) {
  683. var prop, orig;
  684. var callback = this.options[ type ];
  685.  
  686. data = data || {};
  687. event = $.Event( event );
  688. event.type = ( type === this.widgetEventPrefix ?
  689. type :
  690. this.widgetEventPrefix + type ).toLowerCase();
  691.  
  692. // The original event may come from any element
  693. // so we need to reset the target on the new event
  694. event.target = this.element[ 0 ];
  695.  
  696. // Copy original event properties over to the new event
  697. orig = event.originalEvent;
  698. if ( orig ) {
  699. for ( prop in orig ) {
  700. if ( !( prop in event ) ) {
  701. event[ prop ] = orig[ prop ];
  702. }
  703. }
  704. }
  705.  
  706. this.element.trigger( event, data );
  707. return !( $.isFunction( callback ) &&
  708. callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false ||
  709. event.isDefaultPrevented() );
  710. }
  711. };
  712.  
  713. $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
  714. $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
  715. if ( typeof options === "string" ) {
  716. options = { effect: options };
  717. }
  718.  
  719. var hasOptions;
  720. var effectName = !options ?
  721. method :
  722. options === true || typeof options === "number" ?
  723. defaultEffect :
  724. options.effect || defaultEffect;
  725.  
  726. options = options || {};
  727. if ( typeof options === "number" ) {
  728. options = { duration: options };
  729. }
  730.  
  731. hasOptions = !$.isEmptyObject( options );
  732. options.complete = callback;
  733.  
  734. if ( options.delay ) {
  735. element.delay( options.delay );
  736. }
  737.  
  738. if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
  739. element[ method ]( options );
  740. } else if ( effectName !== method && element[ effectName ] ) {
  741. element[ effectName ]( options.duration, options.easing, callback );
  742. } else {
  743. element.queue( function( next ) {
  744. $( this )[ method ]();
  745. if ( callback ) {
  746. callback.call( element[ 0 ] );
  747. }
  748. next();
  749. } );
  750. }
  751. };
  752. } );
  753.  
  754. var widget = $.widget;
  755.  
  756.  
  757. /*!
  758. * jQuery UI Position 1.12.1
  759. * http://jqueryui.com
  760. *
  761. * Copyright jQuery Foundation and other contributors
  762. * Released under the MIT license.
  763. * http://jquery.org/license
  764. *
  765. * http://api.jqueryui.com/position/
  766. */
  767.  
  768. //>>label: Position
  769. //>>group: Core
  770. //>>description: Positions elements relative to other elements.
  771. //>>docs: http://api.jqueryui.com/position/
  772. //>>demos: http://jqueryui.com/position/
  773.  
  774.  
  775. ( function() {
  776. var cachedScrollbarWidth,
  777. max = Math.max,
  778. abs = Math.abs,
  779. rhorizontal = /left|center|right/,
  780. rvertical = /top|center|bottom/,
  781. roffset = /[\+\-]\d+(\.[\d]+)?%?/,
  782. rposition = /^\w+/,
  783. rpercent = /%$/,
  784. _position = $.fn.position;
  785.  
  786. function getOffsets( offsets, width, height ) {
  787. return [
  788. parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
  789. parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
  790. ];
  791. }
  792.  
  793. function parseCss( element, property ) {
  794. return parseInt( $.css( element, property ), 10 ) || 0;
  795. }
  796.  
  797. function getDimensions( elem ) {
  798. var raw = elem[ 0 ];
  799. if ( raw.nodeType === 9 ) {
  800. return {
  801. width: elem.width(),
  802. height: elem.height(),
  803. offset: { top: 0, left: 0 }
  804. };
  805. }
  806. if ( $.isWindow( raw ) ) {
  807. return {
  808. width: elem.width(),
  809. height: elem.height(),
  810. offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
  811. };
  812. }
  813. if ( raw.preventDefault ) {
  814. return {
  815. width: 0,
  816. height: 0,
  817. offset: { top: raw.pageY, left: raw.pageX }
  818. };
  819. }
  820. return {
  821. width: elem.outerWidth(),
  822. height: elem.outerHeight(),
  823. offset: elem.offset()
  824. };
  825. }
  826.  
  827. $.position = {
  828. scrollbarWidth: function() {
  829. if ( cachedScrollbarWidth !== undefined ) {
  830. return cachedScrollbarWidth;
  831. }
  832. var w1, w2,
  833. div = $( "<div " +
  834. "style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'>" +
  835. "<div style='height:100px;width:auto;'></div></div>" ),
  836. innerDiv = div.children()[ 0 ];
  837.  
  838. $( "body" ).append( div );
  839. w1 = innerDiv.offsetWidth;
  840. div.css( "overflow", "scroll" );
  841.  
  842. w2 = innerDiv.offsetWidth;
  843.  
  844. if ( w1 === w2 ) {
  845. w2 = div[ 0 ].clientWidth;
  846. }
  847.  
  848. div.remove();
  849.  
  850. return ( cachedScrollbarWidth = w1 - w2 );
  851. },
  852. getScrollInfo: function( within ) {
  853. var overflowX = within.isWindow || within.isDocument ? "" :
  854. within.element.css( "overflow-x" ),
  855. overflowY = within.isWindow || within.isDocument ? "" :
  856. within.element.css( "overflow-y" ),
  857. hasOverflowX = overflowX === "scroll" ||
  858. ( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ),
  859. hasOverflowY = overflowY === "scroll" ||
  860. ( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight );
  861. return {
  862. width: hasOverflowY ? $.position.scrollbarWidth() : 0,
  863. height: hasOverflowX ? $.position.scrollbarWidth() : 0
  864. };
  865. },
  866. getWithinInfo: function( element ) {
  867. var withinElement = $( element || window ),
  868. isWindow = $.isWindow( withinElement[ 0 ] ),
  869. isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9,
  870. hasOffset = !isWindow && !isDocument;
  871. return {
  872. element: withinElement,
  873. isWindow: isWindow,
  874. isDocument: isDocument,
  875. offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 },
  876. scrollLeft: withinElement.scrollLeft(),
  877. scrollTop: withinElement.scrollTop(),
  878. width: withinElement.outerWidth(),
  879. height: withinElement.outerHeight()
  880. };
  881. }
  882. };
  883.  
  884. $.fn.position = function( options ) {
  885. if ( !options || !options.of ) {
  886. return _position.apply( this, arguments );
  887. }
  888.  
  889. // Make a copy, we don't want to modify arguments
  890. options = $.extend( {}, options );
  891.  
  892. var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
  893. target = $( options.of ),
  894. within = $.position.getWithinInfo( options.within ),
  895. scrollInfo = $.position.getScrollInfo( within ),
  896. collision = ( options.collision || "flip" ).split( " " ),
  897. offsets = {};
  898.  
  899. dimensions = getDimensions( target );
  900. if ( target[ 0 ].preventDefault ) {
  901.  
  902. // Force left top to allow flipping
  903. options.at = "left top";
  904. }
  905. targetWidth = dimensions.width;
  906. targetHeight = dimensions.height;
  907. targetOffset = dimensions.offset;
  908.  
  909. // Clone to reuse original targetOffset later
  910. basePosition = $.extend( {}, targetOffset );
  911.  
  912. // Force my and at to have valid horizontal and vertical positions
  913. // if a value is missing or invalid, it will be converted to center
  914. $.each( [ "my", "at" ], function() {
  915. var pos = ( options[ this ] || "" ).split( " " ),
  916. horizontalOffset,
  917. verticalOffset;
  918.  
  919. if ( pos.length === 1 ) {
  920. pos = rhorizontal.test( pos[ 0 ] ) ?
  921. pos.concat( [ "center" ] ) :
  922. rvertical.test( pos[ 0 ] ) ?
  923. [ "center" ].concat( pos ) :
  924. [ "center", "center" ];
  925. }
  926. pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
  927. pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
  928.  
  929. // Calculate offsets
  930. horizontalOffset = roffset.exec( pos[ 0 ] );
  931. verticalOffset = roffset.exec( pos[ 1 ] );
  932. offsets[ this ] = [
  933. horizontalOffset ? horizontalOffset[ 0 ] : 0,
  934. verticalOffset ? verticalOffset[ 0 ] : 0
  935. ];
  936.  
  937. // Reduce to just the positions without the offsets
  938. options[ this ] = [
  939. rposition.exec( pos[ 0 ] )[ 0 ],
  940. rposition.exec( pos[ 1 ] )[ 0 ]
  941. ];
  942. } );
  943.  
  944. // Normalize collision option
  945. if ( collision.length === 1 ) {
  946. collision[ 1 ] = collision[ 0 ];
  947. }
  948.  
  949. if ( options.at[ 0 ] === "right" ) {
  950. basePosition.left += targetWidth;
  951. } else if ( options.at[ 0 ] === "center" ) {
  952. basePosition.left += targetWidth / 2;
  953. }
  954.  
  955. if ( options.at[ 1 ] === "bottom" ) {
  956. basePosition.top += targetHeight;
  957. } else if ( options.at[ 1 ] === "center" ) {
  958. basePosition.top += targetHeight / 2;
  959. }
  960.  
  961. atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
  962. basePosition.left += atOffset[ 0 ];
  963. basePosition.top += atOffset[ 1 ];
  964.  
  965. return this.each( function() {
  966. var collisionPosition, using,
  967. elem = $( this ),
  968. elemWidth = elem.outerWidth(),
  969. elemHeight = elem.outerHeight(),
  970. marginLeft = parseCss( this, "marginLeft" ),
  971. marginTop = parseCss( this, "marginTop" ),
  972. collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) +
  973. scrollInfo.width,
  974. collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) +
  975. scrollInfo.height,
  976. position = $.extend( {}, basePosition ),
  977. myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
  978.  
  979. if ( options.my[ 0 ] === "right" ) {
  980. position.left -= elemWidth;
  981. } else if ( options.my[ 0 ] === "center" ) {
  982. position.left -= elemWidth / 2;
  983. }
  984.  
  985. if ( options.my[ 1 ] === "bottom" ) {
  986. position.top -= elemHeight;
  987. } else if ( options.my[ 1 ] === "center" ) {
  988. position.top -= elemHeight / 2;
  989. }
  990.  
  991. position.left += myOffset[ 0 ];
  992. position.top += myOffset[ 1 ];
  993.  
  994. collisionPosition = {
  995. marginLeft: marginLeft,
  996. marginTop: marginTop
  997. };
  998.  
  999. $.each( [ "left", "top" ], function( i, dir ) {
  1000. if ( $.ui.position[ collision[ i ] ] ) {
  1001. $.ui.position[ collision[ i ] ][ dir ]( position, {
  1002. targetWidth: targetWidth,
  1003. targetHeight: targetHeight,
  1004. elemWidth: elemWidth,
  1005. elemHeight: elemHeight,
  1006. collisionPosition: collisionPosition,
  1007. collisionWidth: collisionWidth,
  1008. collisionHeight: collisionHeight,
  1009. offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
  1010. my: options.my,
  1011. at: options.at,
  1012. within: within,
  1013. elem: elem
  1014. } );
  1015. }
  1016. } );
  1017.  
  1018. if ( options.using ) {
  1019.  
  1020. // Adds feedback as second argument to using callback, if present
  1021. using = function( props ) {
  1022. var left = targetOffset.left - position.left,
  1023. right = left + targetWidth - elemWidth,
  1024. top = targetOffset.top - position.top,
  1025. bottom = top + targetHeight - elemHeight,
  1026. feedback = {
  1027. target: {
  1028. element: target,
  1029. left: targetOffset.left,
  1030. top: targetOffset.top,
  1031. width: targetWidth,
  1032. height: targetHeight
  1033. },
  1034. element: {
  1035. element: elem,
  1036. left: position.left,
  1037. top: position.top,
  1038. width: elemWidth,
  1039. height: elemHeight
  1040. },
  1041. horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
  1042. vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
  1043. };
  1044. if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
  1045. feedback.horizontal = "center";
  1046. }
  1047. if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
  1048. feedback.vertical = "middle";
  1049. }
  1050. if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
  1051. feedback.important = "horizontal";
  1052. } else {
  1053. feedback.important = "vertical";
  1054. }
  1055. options.using.call( this, props, feedback );
  1056. };
  1057. }
  1058.  
  1059. elem.offset( $.extend( position, { using: using } ) );
  1060. } );
  1061. };
  1062.  
  1063. $.ui.position = {
  1064. fit: {
  1065. left: function( position, data ) {
  1066. var within = data.within,
  1067. withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
  1068. outerWidth = within.width,
  1069. collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  1070. overLeft = withinOffset - collisionPosLeft,
  1071. overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
  1072. newOverRight;
  1073.  
  1074. // Element is wider than within
  1075. if ( data.collisionWidth > outerWidth ) {
  1076.  
  1077. // Element is initially over the left side of within
  1078. if ( overLeft > 0 && overRight <= 0 ) {
  1079. newOverRight = position.left + overLeft + data.collisionWidth - outerWidth -
  1080. withinOffset;
  1081. position.left += overLeft - newOverRight;
  1082.  
  1083. // Element is initially over right side of within
  1084. } else if ( overRight > 0 && overLeft <= 0 ) {
  1085. position.left = withinOffset;
  1086.  
  1087. // Element is initially over both left and right sides of within
  1088. } else {
  1089. if ( overLeft > overRight ) {
  1090. position.left = withinOffset + outerWidth - data.collisionWidth;
  1091. } else {
  1092. position.left = withinOffset;
  1093. }
  1094. }
  1095.  
  1096. // Too far left -> align with left edge
  1097. } else if ( overLeft > 0 ) {
  1098. position.left += overLeft;
  1099.  
  1100. // Too far right -> align with right edge
  1101. } else if ( overRight > 0 ) {
  1102. position.left -= overRight;
  1103.  
  1104. // Adjust based on position and margin
  1105. } else {
  1106. position.left = max( position.left - collisionPosLeft, position.left );
  1107. }
  1108. },
  1109. top: function( position, data ) {
  1110. var within = data.within,
  1111. withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
  1112. outerHeight = data.within.height,
  1113. collisionPosTop = position.top - data.collisionPosition.marginTop,
  1114. overTop = withinOffset - collisionPosTop,
  1115. overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
  1116. newOverBottom;
  1117.  
  1118. // Element is taller than within
  1119. if ( data.collisionHeight > outerHeight ) {
  1120.  
  1121. // Element is initially over the top of within
  1122. if ( overTop > 0 && overBottom <= 0 ) {
  1123. newOverBottom = position.top + overTop + data.collisionHeight - outerHeight -
  1124. withinOffset;
  1125. position.top += overTop - newOverBottom;
  1126.  
  1127. // Element is initially over bottom of within
  1128. } else if ( overBottom > 0 && overTop <= 0 ) {
  1129. position.top = withinOffset;
  1130.  
  1131. // Element is initially over both top and bottom of within
  1132. } else {
  1133. if ( overTop > overBottom ) {
  1134. position.top = withinOffset + outerHeight - data.collisionHeight;
  1135. } else {
  1136. position.top = withinOffset;
  1137. }
  1138. }
  1139.  
  1140. // Too far up -> align with top
  1141. } else if ( overTop > 0 ) {
  1142. position.top += overTop;
  1143.  
  1144. // Too far down -> align with bottom edge
  1145. } else if ( overBottom > 0 ) {
  1146. position.top -= overBottom;
  1147.  
  1148. // Adjust based on position and margin
  1149. } else {
  1150. position.top = max( position.top - collisionPosTop, position.top );
  1151. }
  1152. }
  1153. },
  1154. flip: {
  1155. left: function( position, data ) {
  1156. var within = data.within,
  1157. withinOffset = within.offset.left + within.scrollLeft,
  1158. outerWidth = within.width,
  1159. offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
  1160. collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  1161. overLeft = collisionPosLeft - offsetLeft,
  1162. overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
  1163. myOffset = data.my[ 0 ] === "left" ?
  1164. -data.elemWidth :
  1165. data.my[ 0 ] === "right" ?
  1166. data.elemWidth :
  1167. 0,
  1168. atOffset = data.at[ 0 ] === "left" ?
  1169. data.targetWidth :
  1170. data.at[ 0 ] === "right" ?
  1171. -data.targetWidth :
  1172. 0,
  1173. offset = -2 * data.offset[ 0 ],
  1174. newOverRight,
  1175. newOverLeft;
  1176.  
  1177. if ( overLeft < 0 ) {
  1178. newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth -
  1179. outerWidth - withinOffset;
  1180. if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
  1181. position.left += myOffset + atOffset + offset;
  1182. }
  1183. } else if ( overRight > 0 ) {
  1184. newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset +
  1185. atOffset + offset - offsetLeft;
  1186. if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
  1187. position.left += myOffset + atOffset + offset;
  1188. }
  1189. }
  1190. },
  1191. top: function( position, data ) {
  1192. var within = data.within,
  1193. withinOffset = within.offset.top + within.scrollTop,
  1194. outerHeight = within.height,
  1195. offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
  1196. collisionPosTop = position.top - data.collisionPosition.marginTop,
  1197. overTop = collisionPosTop - offsetTop,
  1198. overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
  1199. top = data.my[ 1 ] === "top",
  1200. myOffset = top ?
  1201. -data.elemHeight :
  1202. data.my[ 1 ] === "bottom" ?
  1203. data.elemHeight :
  1204. 0,
  1205. atOffset = data.at[ 1 ] === "top" ?
  1206. data.targetHeight :
  1207. data.at[ 1 ] === "bottom" ?
  1208. -data.targetHeight :
  1209. 0,
  1210. offset = -2 * data.offset[ 1 ],
  1211. newOverTop,
  1212. newOverBottom;
  1213. if ( overTop < 0 ) {
  1214. newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight -
  1215. outerHeight - withinOffset;
  1216. if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
  1217. position.top += myOffset + atOffset + offset;
  1218. }
  1219. } else if ( overBottom > 0 ) {
  1220. newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset +
  1221. offset - offsetTop;
  1222. if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {
  1223. position.top += myOffset + atOffset + offset;
  1224. }
  1225. }
  1226. }
  1227. },
  1228. flipfit: {
  1229. left: function() {
  1230. $.ui.position.flip.left.apply( this, arguments );
  1231. $.ui.position.fit.left.apply( this, arguments );
  1232. },
  1233. top: function() {
  1234. $.ui.position.flip.top.apply( this, arguments );
  1235. $.ui.position.fit.top.apply( this, arguments );
  1236. }
  1237. }
  1238. };
  1239.  
  1240. } )();
  1241.  
  1242. var position = $.ui.position;
  1243.  
  1244.  
  1245. /*!
  1246. * jQuery UI :data 1.12.1
  1247. * http://jqueryui.com
  1248. *
  1249. * Copyright jQuery Foundation and other contributors
  1250. * Released under the MIT license.
  1251. * http://jquery.org/license
  1252. */
  1253.  
  1254. //>>label: :data Selector
  1255. //>>group: Core
  1256. //>>description: Selects elements which have data stored under the specified key.
  1257. //>>docs: http://api.jqueryui.com/data-selector/
  1258.  
  1259.  
  1260. var data = $.extend( $.expr[ ":" ], {
  1261. data: $.expr.createPseudo ?
  1262. $.expr.createPseudo( function( dataName ) {
  1263. return function( elem ) {
  1264. return !!$.data( elem, dataName );
  1265. };
  1266. } ) :
  1267.  
  1268. // Support: jQuery <1.8
  1269. function( elem, i, match ) {
  1270. return !!$.data( elem, match[ 3 ] );
  1271. }
  1272. } );
  1273.  
  1274.  
  1275.  
  1276. // Support: IE8 Only
  1277. // IE8 does not support the form attribute and when it is supplied. It overwrites the form prop
  1278. // with a string, so we need to find the proper form.
  1279. var form = $.fn.form = function() {
  1280. return typeof this[ 0 ].form === "string" ? this.closest( "form" ) : $( this[ 0 ].form );
  1281. };
  1282.  
  1283.  
  1284. /*!
  1285. * jQuery UI Form Reset Mixin 1.12.1
  1286. * http://jqueryui.com
  1287. *
  1288. * Copyright jQuery Foundation and other contributors
  1289. * Released under the MIT license.
  1290. * http://jquery.org/license
  1291. */
  1292.  
  1293. //>>label: Form Reset Mixin
  1294. //>>group: Core
  1295. //>>description: Refresh input widgets when their form is reset
  1296. //>>docs: http://api.jqueryui.com/form-reset-mixin/
  1297.  
  1298.  
  1299.  
  1300. var formResetMixin = $.ui.formResetMixin = {
  1301. _formResetHandler: function() {
  1302. var form = $( this );
  1303.  
  1304. // Wait for the form reset to actually happen before refreshing
  1305. setTimeout( function() {
  1306. var instances = form.data( "ui-form-reset-instances" );
  1307. $.each( instances, function() {
  1308. this.refresh();
  1309. } );
  1310. } );
  1311. },
  1312.  
  1313. _bindFormResetHandler: function() {
  1314. this.form = this.element.form();
  1315. if ( !this.form.length ) {
  1316. return;
  1317. }
  1318.  
  1319. var instances = this.form.data( "ui-form-reset-instances" ) || [];
  1320. if ( !instances.length ) {
  1321.  
  1322. // We don't use _on() here because we use a single event handler per form
  1323. this.form.on( "reset.ui-form-reset", this._formResetHandler );
  1324. }
  1325. instances.push( this );
  1326. this.form.data( "ui-form-reset-instances", instances );
  1327. },
  1328.  
  1329. _unbindFormResetHandler: function() {
  1330. if ( !this.form.length ) {
  1331. return;
  1332. }
  1333.  
  1334. var instances = this.form.data( "ui-form-reset-instances" );
  1335. instances.splice( $.inArray( this, instances ), 1 );
  1336. if ( instances.length ) {
  1337. this.form.data( "ui-form-reset-instances", instances );
  1338. } else {
  1339. this.form
  1340. .removeData( "ui-form-reset-instances" )
  1341. .off( "reset.ui-form-reset" );
  1342. }
  1343. }
  1344. };
  1345.  
  1346.  
  1347. /*!
  1348. * jQuery UI Keycode 1.12.1
  1349. * http://jqueryui.com
  1350. *
  1351. * Copyright jQuery Foundation and other contributors
  1352. * Released under the MIT license.
  1353. * http://jquery.org/license
  1354. */
  1355.  
  1356. //>>label: Keycode
  1357. //>>group: Core
  1358. //>>description: Provide keycodes as keynames
  1359. //>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/
  1360.  
  1361.  
  1362. var keycode = $.ui.keyCode = {
  1363. BACKSPACE: 8,
  1364. COMMA: 188,
  1365. DELETE: 46,
  1366. DOWN: 40,
  1367. END: 35,
  1368. ENTER: 13,
  1369. ESCAPE: 27,
  1370. HOME: 36,
  1371. LEFT: 37,
  1372. PAGE_DOWN: 34,
  1373. PAGE_UP: 33,
  1374. PERIOD: 190,
  1375. RIGHT: 39,
  1376. SPACE: 32,
  1377. TAB: 9,
  1378. UP: 38
  1379. };
  1380.  
  1381.  
  1382.  
  1383.  
  1384. // Internal use only
  1385. var escapeSelector = $.ui.escapeSelector = ( function() {
  1386. var selectorEscape = /([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;
  1387. return function( selector ) {
  1388. return selector.replace( selectorEscape, "\\$1" );
  1389. };
  1390. } )();
  1391.  
  1392.  
  1393. /*!
  1394. * jQuery UI Labels 1.12.1
  1395. * http://jqueryui.com
  1396. *
  1397. * Copyright jQuery Foundation and other contributors
  1398. * Released under the MIT license.
  1399. * http://jquery.org/license
  1400. */
  1401.  
  1402. //>>label: labels
  1403. //>>group: Core
  1404. //>>description: Find all the labels associated with a given input
  1405. //>>docs: http://api.jqueryui.com/labels/
  1406.  
  1407.  
  1408.  
  1409. var labels = $.fn.labels = function() {
  1410. var ancestor, selector, id, labels, ancestors;
  1411.  
  1412. // Check control.labels first
  1413. if ( this[ 0 ].labels && this[ 0 ].labels.length ) {
  1414. return this.pushStack( this[ 0 ].labels );
  1415. }
  1416.  
  1417. // Support: IE <= 11, FF <= 37, Android <= 2.3 only
  1418. // Above browsers do not support control.labels. Everything below is to support them
  1419. // as well as document fragments. control.labels does not work on document fragments
  1420. labels = this.eq( 0 ).parents( "label" );
  1421.  
  1422. // Look for the label based on the id
  1423. id = this.attr( "id" );
  1424. if ( id ) {
  1425.  
  1426. // We don't search against the document in case the element
  1427. // is disconnected from the DOM
  1428. ancestor = this.eq( 0 ).parents().last();
  1429.  
  1430. // Get a full set of top level ancestors
  1431. ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() );
  1432.  
  1433. // Create a selector for the label based on the id
  1434. selector = "label[for='" + $.ui.escapeSelector( id ) + "']";
  1435.  
  1436. labels = labels.add( ancestors.find( selector ).addBack( selector ) );
  1437.  
  1438. }
  1439.  
  1440. // Return whatever we have found for labels
  1441. return this.pushStack( labels );
  1442. };
  1443.  
  1444.  
  1445. /*!
  1446. * jQuery UI Scroll Parent 1.12.1
  1447. * http://jqueryui.com
  1448. *
  1449. * Copyright jQuery Foundation and other contributors
  1450. * Released under the MIT license.
  1451. * http://jquery.org/license
  1452. */
  1453.  
  1454. //>>label: scrollParent
  1455. //>>group: Core
  1456. //>>description: Get the closest ancestor element that is scrollable.
  1457. //>>docs: http://api.jqueryui.com/scrollParent/
  1458.  
  1459.  
  1460.  
  1461. var scrollParent = $.fn.scrollParent = function( includeHidden ) {
  1462. var position = this.css( "position" ),
  1463. excludeStaticParent = position === "absolute",
  1464. overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
  1465. scrollParent = this.parents().filter( function() {
  1466. var parent = $( this );
  1467. if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
  1468. return false;
  1469. }
  1470. return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) +
  1471. parent.css( "overflow-x" ) );
  1472. } ).eq( 0 );
  1473.  
  1474. return position === "fixed" || !scrollParent.length ?
  1475. $( this[ 0 ].ownerDocument || document ) :
  1476. scrollParent;
  1477. };
  1478.  
  1479.  
  1480. /*!
  1481. * jQuery UI Unique ID 1.12.1
  1482. * http://jqueryui.com
  1483. *
  1484. * Copyright jQuery Foundation and other contributors
  1485. * Released under the MIT license.
  1486. * http://jquery.org/license
  1487. */
  1488.  
  1489. //>>label: uniqueId
  1490. //>>group: Core
  1491. //>>description: Functions to generate and remove uniqueId's
  1492. //>>docs: http://api.jqueryui.com/uniqueId/
  1493.  
  1494.  
  1495.  
  1496. var uniqueId = $.fn.extend( {
  1497. uniqueId: ( function() {
  1498. var uuid = 0;
  1499.  
  1500. return function() {
  1501. return this.each( function() {
  1502. if ( !this.id ) {
  1503. this.id = "ui-id-" + ( ++uuid );
  1504. }
  1505. } );
  1506. };
  1507. } )(),
  1508.  
  1509. removeUniqueId: function() {
  1510. return this.each( function() {
  1511. if ( /^ui-id-\d+$/.test( this.id ) ) {
  1512. $( this ).removeAttr( "id" );
  1513. }
  1514. } );
  1515. }
  1516. } );
  1517.  
  1518.  
  1519.  
  1520.  
  1521. // This file is deprecated
  1522. var ie = $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
  1523.  
  1524. /*!
  1525. * jQuery UI Mouse 1.12.1
  1526. * http://jqueryui.com
  1527. *
  1528. * Copyright jQuery Foundation and other contributors
  1529. * Released under the MIT license.
  1530. * http://jquery.org/license
  1531. */
  1532.  
  1533. //>>label: Mouse
  1534. //>>group: Widgets
  1535. //>>description: Abstracts mouse-based interactions to assist in creating certain widgets.
  1536. //>>docs: http://api.jqueryui.com/mouse/
  1537.  
  1538.  
  1539.  
  1540. var mouseHandled = false;
  1541. $( document ).on( "mouseup", function() {
  1542. mouseHandled = false;
  1543. } );
  1544.  
  1545. var widgetsMouse = $.widget( "ui.mouse", {
  1546. version: "1.12.1",
  1547. options: {
  1548. cancel: "input, textarea, button, select, option",
  1549. distance: 1,
  1550. delay: 0
  1551. },
  1552. _mouseInit: function() {
  1553. var that = this;
  1554.  
  1555. this.element
  1556. .on( "mousedown." + this.widgetName, function( event ) {
  1557. return that._mouseDown( event );
  1558. } )
  1559. .on( "click." + this.widgetName, function( event ) {
  1560. if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) {
  1561. $.removeData( event.target, that.widgetName + ".preventClickEvent" );
  1562. event.stopImmediatePropagation();
  1563. return false;
  1564. }
  1565. } );
  1566.  
  1567. this.started = false;
  1568. },
  1569.  
  1570. // TODO: make sure destroying one instance of mouse doesn't mess with
  1571. // other instances of mouse
  1572. _mouseDestroy: function() {
  1573. this.element.off( "." + this.widgetName );
  1574. if ( this._mouseMoveDelegate ) {
  1575. this.document
  1576. .off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  1577. .off( "mouseup." + this.widgetName, this._mouseUpDelegate );
  1578. }
  1579. },
  1580.  
  1581. _mouseDown: function( event ) {
  1582.  
  1583. // don't let more than one widget handle mouseStart
  1584. if ( mouseHandled ) {
  1585. return;
  1586. }
  1587.  
  1588. this._mouseMoved = false;
  1589.  
  1590. // We may have missed mouseup (out of window)
  1591. ( this._mouseStarted && this._mouseUp( event ) );
  1592.  
  1593. this._mouseDownEvent = event;
  1594.  
  1595. var that = this,
  1596. btnIsLeft = ( event.which === 1 ),
  1597.  
  1598. // event.target.nodeName works around a bug in IE 8 with
  1599. // disabled inputs (#7620)
  1600. elIsCancel = ( typeof this.options.cancel === "string" && event.target.nodeName ?
  1601. $( event.target ).closest( this.options.cancel ).length : false );
  1602. if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) {
  1603. return true;
  1604. }
  1605.  
  1606. this.mouseDelayMet = !this.options.delay;
  1607. if ( !this.mouseDelayMet ) {
  1608. this._mouseDelayTimer = setTimeout( function() {
  1609. that.mouseDelayMet = true;
  1610. }, this.options.delay );
  1611. }
  1612.  
  1613. if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
  1614. this._mouseStarted = ( this._mouseStart( event ) !== false );
  1615. if ( !this._mouseStarted ) {
  1616. event.preventDefault();
  1617. return true;
  1618. }
  1619. }
  1620.  
  1621. // Click event may never have fired (Gecko & Opera)
  1622. if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) {
  1623. $.removeData( event.target, this.widgetName + ".preventClickEvent" );
  1624. }
  1625.  
  1626. // These delegates are required to keep context
  1627. this._mouseMoveDelegate = function( event ) {
  1628. return that._mouseMove( event );
  1629. };
  1630. this._mouseUpDelegate = function( event ) {
  1631. return that._mouseUp( event );
  1632. };
  1633.  
  1634. this.document
  1635. .on( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  1636. .on( "mouseup." + this.widgetName, this._mouseUpDelegate );
  1637.  
  1638. event.preventDefault();
  1639.  
  1640. mouseHandled = true;
  1641. return true;
  1642. },
  1643.  
  1644. _mouseMove: function( event ) {
  1645.  
  1646. // Only check for mouseups outside the document if you've moved inside the document
  1647. // at least once. This prevents the firing of mouseup in the case of IE<9, which will
  1648. // fire a mousemove event if content is placed under the cursor. See #7778
  1649. // Support: IE <9
  1650. if ( this._mouseMoved ) {
  1651.  
  1652. // IE mouseup check - mouseup happened when mouse was out of window
  1653. if ( $.ui.ie && ( !document.documentMode || document.documentMode < 9 ) &&
  1654. !event.button ) {
  1655. return this._mouseUp( event );
  1656.  
  1657. // Iframe mouseup check - mouseup occurred in another document
  1658. } else if ( !event.which ) {
  1659.  
  1660. // Support: Safari <=8 - 9
  1661. // Safari sets which to 0 if you press any of the following keys
  1662. // during a drag (#14461)
  1663. if ( event.originalEvent.altKey || event.originalEvent.ctrlKey ||
  1664. event.originalEvent.metaKey || event.originalEvent.shiftKey ) {
  1665. this.ignoreMissingWhich = true;
  1666. } else if ( !this.ignoreMissingWhich ) {
  1667. return this._mouseUp( event );
  1668. }
  1669. }
  1670. }
  1671.  
  1672. if ( event.which || event.button ) {
  1673. this._mouseMoved = true;
  1674. }
  1675.  
  1676. if ( this._mouseStarted ) {
  1677. this._mouseDrag( event );
  1678. return event.preventDefault();
  1679. }
  1680.  
  1681. if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
  1682. this._mouseStarted =
  1683. ( this._mouseStart( this._mouseDownEvent, event ) !== false );
  1684. ( this._mouseStarted ? this._mouseDrag( event ) : this._mouseUp( event ) );
  1685. }
  1686.  
  1687. return !this._mouseStarted;
  1688. },
  1689.  
  1690. _mouseUp: function( event ) {
  1691. this.document
  1692. .off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  1693. .off( "mouseup." + this.widgetName, this._mouseUpDelegate );
  1694.  
  1695. if ( this._mouseStarted ) {
  1696. this._mouseStarted = false;
  1697.  
  1698. if ( event.target === this._mouseDownEvent.target ) {
  1699. $.data( event.target, this.widgetName + ".preventClickEvent", true );
  1700. }
  1701.  
  1702. this._mouseStop( event );
  1703. }
  1704.  
  1705. if ( this._mouseDelayTimer ) {
  1706. clearTimeout( this._mouseDelayTimer );
  1707. delete this._mouseDelayTimer;
  1708. }
  1709.  
  1710. this.ignoreMissingWhich = false;
  1711. mouseHandled = false;
  1712. event.preventDefault();
  1713. },
  1714.  
  1715. _mouseDistanceMet: function( event ) {
  1716. return ( Math.max(
  1717. Math.abs( this._mouseDownEvent.pageX - event.pageX ),
  1718. Math.abs( this._mouseDownEvent.pageY - event.pageY )
  1719. ) >= this.options.distance
  1720. );
  1721. },
  1722.  
  1723. _mouseDelayMet: function( /* event */ ) {
  1724. return this.mouseDelayMet;
  1725. },
  1726.  
  1727. // These are placeholder methods, to be overriden by extending plugin
  1728. _mouseStart: function( /* event */ ) {},
  1729. _mouseDrag: function( /* event */ ) {},
  1730. _mouseStop: function( /* event */ ) {},
  1731. _mouseCapture: function( /* event */ ) { return true; }
  1732. } );
  1733.  
  1734.  
  1735. /*!
  1736. * jQuery UI Sortable 1.12.1
  1737. * http://jqueryui.com
  1738. *
  1739. * Copyright jQuery Foundation and other contributors
  1740. * Released under the MIT license.
  1741. * http://jquery.org/license
  1742. */
  1743.  
  1744. //>>label: Sortable
  1745. //>>group: Interactions
  1746. //>>description: Enables items in a list to be sorted using the mouse.
  1747. //>>docs: http://api.jqueryui.com/sortable/
  1748. //>>demos: http://jqueryui.com/sortable/
  1749. //>>css.structure: ../../themes/base/sortable.css
  1750.  
  1751.  
  1752.  
  1753. var widgetsSortable = $.widget( "ui.sortable", $.ui.mouse, {
  1754. version: "1.12.1",
  1755. widgetEventPrefix: "sort",
  1756. ready: false,
  1757. options: {
  1758. appendTo: "parent",
  1759. axis: false,
  1760. connectWith: false,
  1761. containment: false,
  1762. cursor: "auto",
  1763. cursorAt: false,
  1764. dropOnEmpty: true,
  1765. forcePlaceholderSize: false,
  1766. forceHelperSize: false,
  1767. grid: false,
  1768. handle: false,
  1769. helper: "original",
  1770. items: "> *",
  1771. opacity: false,
  1772. placeholder: false,
  1773. revert: false,
  1774. scroll: true,
  1775. scrollSensitivity: 20,
  1776. scrollSpeed: 20,
  1777. scope: "default",
  1778. tolerance: "intersect",
  1779. zIndex: 1000,
  1780.  
  1781. // Callbacks
  1782. activate: null,
  1783. beforeStop: null,
  1784. change: null,
  1785. deactivate: null,
  1786. out: null,
  1787. over: null,
  1788. receive: null,
  1789. remove: null,
  1790. sort: null,
  1791. start: null,
  1792. stop: null,
  1793. update: null
  1794. },
  1795.  
  1796. _isOverAxis: function( x, reference, size ) {
  1797. return ( x >= reference ) && ( x < ( reference + size ) );
  1798. },
  1799.  
  1800. _isFloating: function( item ) {
  1801. return ( /left|right/ ).test( item.css( "float" ) ) ||
  1802. ( /inline|table-cell/ ).test( item.css( "display" ) );
  1803. },
  1804.  
  1805. _create: function() {
  1806. this.containerCache = {};
  1807. this._addClass( "ui-sortable" );
  1808.  
  1809. //Get the items
  1810. this.refresh();
  1811.  
  1812. //Let's determine the parent's offset
  1813. this.offset = this.element.offset();
  1814.  
  1815. //Initialize mouse events for interaction
  1816. this._mouseInit();
  1817.  
  1818. this._setHandleClassName();
  1819.  
  1820. //We're ready to go
  1821. this.ready = true;
  1822.  
  1823. },
  1824.  
  1825. _setOption: function( key, value ) {
  1826. this._super( key, value );
  1827.  
  1828. if ( key === "handle" ) {
  1829. this._setHandleClassName();
  1830. }
  1831. },
  1832.  
  1833. _setHandleClassName: function() {
  1834. var that = this;
  1835. this._removeClass( this.element.find( ".ui-sortable-handle" ), "ui-sortable-handle" );
  1836. $.each( this.items, function() {
  1837. that._addClass(
  1838. this.instance.options.handle ?
  1839. this.item.find( this.instance.options.handle ) :
  1840. this.item,
  1841. "ui-sortable-handle"
  1842. );
  1843. } );
  1844. },
  1845.  
  1846. _destroy: function() {
  1847. this._mouseDestroy();
  1848.  
  1849. for ( var i = this.items.length - 1; i >= 0; i-- ) {
  1850. this.items[ i ].item.removeData( this.widgetName + "-item" );
  1851. }
  1852.  
  1853. return this;
  1854. },
  1855.  
  1856. _mouseCapture: function( event, overrideHandle ) {
  1857. var currentItem = null,
  1858. validHandle = false,
  1859. that = this;
  1860.  
  1861. if ( this.reverting ) {
  1862. return false;
  1863. }
  1864.  
  1865. if ( this.options.disabled || this.options.type === "static" ) {
  1866. return false;
  1867. }
  1868.  
  1869. //We have to refresh the items data once first
  1870. this._refreshItems( event );
  1871.  
  1872. //Find out if the clicked node (or one of its parents) is a actual item in this.items
  1873. $( event.target ).parents().each( function() {
  1874. if ( $.data( this, that.widgetName + "-item" ) === that ) {
  1875. currentItem = $( this );
  1876. return false;
  1877. }
  1878. } );
  1879. if ( $.data( event.target, that.widgetName + "-item" ) === that ) {
  1880. currentItem = $( event.target );
  1881. }
  1882.  
  1883. if ( !currentItem ) {
  1884. return false;
  1885. }
  1886. if ( this.options.handle && !overrideHandle ) {
  1887. $( this.options.handle, currentItem ).find( "*" ).addBack().each( function() {
  1888. if ( this === event.target ) {
  1889. validHandle = true;
  1890. }
  1891. } );
  1892. if ( !validHandle ) {
  1893. return false;
  1894. }
  1895. }
  1896.  
  1897. this.currentItem = currentItem;
  1898. this._removeCurrentsFromItems();
  1899. return true;
  1900.  
  1901. },
  1902.  
  1903. _mouseStart: function( event, overrideHandle, noActivation ) {
  1904.  
  1905. var i, body,
  1906. o = this.options;
  1907.  
  1908. this.currentContainer = this;
  1909.  
  1910. //We only need to call refreshPositions, because the refreshItems call has been moved to
  1911. // mouseCapture
  1912. this.refreshPositions();
  1913.  
  1914. //Create and append the visible helper
  1915. this.helper = this._createHelper( event );
  1916.  
  1917. //Cache the helper size
  1918. this._cacheHelperProportions();
  1919.  
  1920. /*
  1921. * - Position generation -
  1922. * This block generates everything position related - it's the core of draggables.
  1923. */
  1924.  
  1925. //Cache the margins of the original element
  1926. this._cacheMargins();
  1927.  
  1928. //Get the next scrolling parent
  1929. this.scrollParent = this.helper.scrollParent();
  1930.  
  1931. //The element's absolute position on the page minus margins
  1932. this.offset = this.currentItem.offset();
  1933. this.offset = {
  1934. top: this.offset.top - this.margins.top,
  1935. left: this.offset.left - this.margins.left
  1936. };
  1937.  
  1938. $.extend( this.offset, {
  1939. click: { //Where the click happened, relative to the element
  1940. left: event.pageX - this.offset.left,
  1941. top: event.pageY - this.offset.top
  1942. },
  1943. parent: this._getParentOffset(),
  1944.  
  1945. // This is a relative to absolute position minus the actual position calculation -
  1946. // only used for relative positioned helper
  1947. relative: this._getRelativeOffset()
  1948. } );
  1949.  
  1950. // Only after we got the offset, we can change the helper's position to absolute
  1951. // TODO: Still need to figure out a way to make relative sorting possible
  1952. this.helper.css( "position", "absolute" );
  1953. this.cssPosition = this.helper.css( "position" );
  1954.  
  1955. //Generate the original position
  1956. this.originalPosition = this._generatePosition( event );
  1957. this.originalPageX = event.pageX;
  1958. this.originalPageY = event.pageY;
  1959.  
  1960. //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
  1961. ( o.cursorAt && this._adjustOffsetFromHelper( o.cursorAt ) );
  1962.  
  1963. //Cache the former DOM position
  1964. this.domPosition = {
  1965. prev: this.currentItem.prev()[ 0 ],
  1966. parent: this.currentItem.parent()[ 0 ]
  1967. };
  1968.  
  1969. // If the helper is not the original, hide the original so it's not playing any role during
  1970. // the drag, won't cause anything bad this way
  1971. if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
  1972. this.currentItem.hide();
  1973. }
  1974.  
  1975. //Create the placeholder
  1976. this._createPlaceholder();
  1977.  
  1978. //Set a containment if given in the options
  1979. if ( o.containment ) {
  1980. this._setContainment();
  1981. }
  1982.  
  1983. if ( o.cursor && o.cursor !== "auto" ) { // cursor option
  1984. body = this.document.find( "body" );
  1985.  
  1986. // Support: IE
  1987. this.storedCursor = body.css( "cursor" );
  1988. body.css( "cursor", o.cursor );
  1989.  
  1990. this.storedStylesheet =
  1991. $( "<style>*{ cursor: " + o.cursor + " !important; }</style>" ).appendTo( body );
  1992. }
  1993.  
  1994. if ( o.opacity ) { // opacity option
  1995. if ( this.helper.css( "opacity" ) ) {
  1996. this._storedOpacity = this.helper.css( "opacity" );
  1997. }
  1998. this.helper.css( "opacity", o.opacity );
  1999. }
  2000.  
  2001. if ( o.zIndex ) { // zIndex option
  2002. if ( this.helper.css( "zIndex" ) ) {
  2003. this._storedZIndex = this.helper.css( "zIndex" );
  2004. }
  2005. this.helper.css( "zIndex", o.zIndex );
  2006. }
  2007.  
  2008. //Prepare scrolling
  2009. if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  2010. this.scrollParent[ 0 ].tagName !== "HTML" ) {
  2011. this.overflowOffset = this.scrollParent.offset();
  2012. }
  2013.  
  2014. //Call callbacks
  2015. this._trigger( "start", event, this._uiHash() );
  2016.  
  2017. //Recache the helper size
  2018. if ( !this._preserveHelperProportions ) {
  2019. this._cacheHelperProportions();
  2020. }
  2021.  
  2022. //Post "activate" events to possible containers
  2023. if ( !noActivation ) {
  2024. for ( i = this.containers.length - 1; i >= 0; i-- ) {
  2025. this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
  2026. }
  2027. }
  2028.  
  2029. //Prepare possible droppables
  2030. if ( $.ui.ddmanager ) {
  2031. $.ui.ddmanager.current = this;
  2032. }
  2033.  
  2034. if ( $.ui.ddmanager && !o.dropBehaviour ) {
  2035. $.ui.ddmanager.prepareOffsets( this, event );
  2036. }
  2037.  
  2038. this.dragging = true;
  2039.  
  2040. this._addClass( this.helper, "ui-sortable-helper" );
  2041.  
  2042. // Execute the drag once - this causes the helper not to be visiblebefore getting its
  2043. // correct position
  2044. this._mouseDrag( event );
  2045. return true;
  2046.  
  2047. },
  2048.  
  2049. _mouseDrag: function( event ) {
  2050. var i, item, itemElement, intersection,
  2051. o = this.options,
  2052. scrolled = false;
  2053.  
  2054. //Compute the helpers position
  2055. this.position = this._generatePosition( event );
  2056. this.positionAbs = this._convertPositionTo( "absolute" );
  2057.  
  2058. if ( !this.lastPositionAbs ) {
  2059. this.lastPositionAbs = this.positionAbs;
  2060. }
  2061.  
  2062. //Do scrolling
  2063. if ( this.options.scroll ) {
  2064. if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  2065. this.scrollParent[ 0 ].tagName !== "HTML" ) {
  2066.  
  2067. if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) -
  2068. event.pageY < o.scrollSensitivity ) {
  2069. this.scrollParent[ 0 ].scrollTop =
  2070. scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed;
  2071. } else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) {
  2072. this.scrollParent[ 0 ].scrollTop =
  2073. scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed;
  2074. }
  2075.  
  2076. if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) -
  2077. event.pageX < o.scrollSensitivity ) {
  2078. this.scrollParent[ 0 ].scrollLeft = scrolled =
  2079. this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed;
  2080. } else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) {
  2081. this.scrollParent[ 0 ].scrollLeft = scrolled =
  2082. this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed;
  2083. }
  2084.  
  2085. } else {
  2086.  
  2087. if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) {
  2088. scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed );
  2089. } else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) <
  2090. o.scrollSensitivity ) {
  2091. scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed );
  2092. }
  2093.  
  2094. if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) {
  2095. scrolled = this.document.scrollLeft(
  2096. this.document.scrollLeft() - o.scrollSpeed
  2097. );
  2098. } else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) <
  2099. o.scrollSensitivity ) {
  2100. scrolled = this.document.scrollLeft(
  2101. this.document.scrollLeft() + o.scrollSpeed
  2102. );
  2103. }
  2104.  
  2105. }
  2106.  
  2107. if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) {
  2108. $.ui.ddmanager.prepareOffsets( this, event );
  2109. }
  2110. }
  2111.  
  2112. //Regenerate the absolute position used for position checks
  2113. this.positionAbs = this._convertPositionTo( "absolute" );
  2114.  
  2115. //Set the helper position
  2116. if ( !this.options.axis || this.options.axis !== "y" ) {
  2117. this.helper[ 0 ].style.left = this.position.left + "px";
  2118. }
  2119. if ( !this.options.axis || this.options.axis !== "x" ) {
  2120. this.helper[ 0 ].style.top = this.position.top + "px";
  2121. }
  2122.  
  2123. //Rearrange
  2124. for ( i = this.items.length - 1; i >= 0; i-- ) {
  2125.  
  2126. //Cache variables and intersection, continue if no intersection
  2127. item = this.items[ i ];
  2128. itemElement = item.item[ 0 ];
  2129. intersection = this._intersectsWithPointer( item );
  2130. if ( !intersection ) {
  2131. continue;
  2132. }
  2133.  
  2134. // Only put the placeholder inside the current Container, skip all
  2135. // items from other containers. This works because when moving
  2136. // an item from one container to another the
  2137. // currentContainer is switched before the placeholder is moved.
  2138. //
  2139. // Without this, moving items in "sub-sortables" can cause
  2140. // the placeholder to jitter between the outer and inner container.
  2141. if ( item.instance !== this.currentContainer ) {
  2142. continue;
  2143. }
  2144.  
  2145. // Cannot intersect with itself
  2146. // no useless actions that have been done before
  2147. // no action if the item moved is the parent of the item checked
  2148. if ( itemElement !== this.currentItem[ 0 ] &&
  2149. this.placeholder[ intersection === 1 ? "next" : "prev" ]()[ 0 ] !== itemElement &&
  2150. !$.contains( this.placeholder[ 0 ], itemElement ) &&
  2151. ( this.options.type === "semi-dynamic" ?
  2152. !$.contains( this.element[ 0 ], itemElement ) :
  2153. true
  2154. )
  2155. ) {
  2156.  
  2157. this.direction = intersection === 1 ? "down" : "up";
  2158.  
  2159. if ( this.options.tolerance === "pointer" || this._intersectsWithSides( item ) ) {
  2160. this._rearrange( event, item );
  2161. } else {
  2162. break;
  2163. }
  2164.  
  2165. this._trigger( "change", event, this._uiHash() );
  2166. break;
  2167. }
  2168. }
  2169.  
  2170. //Post events to containers
  2171. this._contactContainers( event );
  2172.  
  2173. //Interconnect with droppables
  2174. if ( $.ui.ddmanager ) {
  2175. $.ui.ddmanager.drag( this, event );
  2176. }
  2177.  
  2178. //Call callbacks
  2179. this._trigger( "sort", event, this._uiHash() );
  2180.  
  2181. this.lastPositionAbs = this.positionAbs;
  2182. return false;
  2183.  
  2184. },
  2185.  
  2186. _mouseStop: function( event, noPropagation ) {
  2187.  
  2188. if ( !event ) {
  2189. return;
  2190. }
  2191.  
  2192. //If we are using droppables, inform the manager about the drop
  2193. if ( $.ui.ddmanager && !this.options.dropBehaviour ) {
  2194. $.ui.ddmanager.drop( this, event );
  2195. }
  2196.  
  2197. if ( this.options.revert ) {
  2198. var that = this,
  2199. cur = this.placeholder.offset(),
  2200. axis = this.options.axis,
  2201. animation = {};
  2202.  
  2203. if ( !axis || axis === "x" ) {
  2204. animation.left = cur.left - this.offset.parent.left - this.margins.left +
  2205. ( this.offsetParent[ 0 ] === this.document[ 0 ].body ?
  2206. 0 :
  2207. this.offsetParent[ 0 ].scrollLeft
  2208. );
  2209. }
  2210. if ( !axis || axis === "y" ) {
  2211. animation.top = cur.top - this.offset.parent.top - this.margins.top +
  2212. ( this.offsetParent[ 0 ] === this.document[ 0 ].body ?
  2213. 0 :
  2214. this.offsetParent[ 0 ].scrollTop
  2215. );
  2216. }
  2217. this.reverting = true;
  2218. $( this.helper ).animate(
  2219. animation,
  2220. parseInt( this.options.revert, 10 ) || 500,
  2221. function() {
  2222. that._clear( event );
  2223. }
  2224. );
  2225. } else {
  2226. this._clear( event, noPropagation );
  2227. }
  2228.  
  2229. return false;
  2230.  
  2231. },
  2232.  
  2233. cancel: function() {
  2234.  
  2235. if ( this.dragging ) {
  2236.  
  2237. this._mouseUp( new $.Event( "mouseup", { target: null } ) );
  2238.  
  2239. if ( this.options.helper === "original" ) {
  2240. this.currentItem.css( this._storedCSS );
  2241. this._removeClass( this.currentItem, "ui-sortable-helper" );
  2242. } else {
  2243. this.currentItem.show();
  2244. }
  2245.  
  2246. //Post deactivating events to containers
  2247. for ( var i = this.containers.length - 1; i >= 0; i-- ) {
  2248. this.containers[ i ]._trigger( "deactivate", null, this._uiHash( this ) );
  2249. if ( this.containers[ i ].containerCache.over ) {
  2250. this.containers[ i ]._trigger( "out", null, this._uiHash( this ) );
  2251. this.containers[ i ].containerCache.over = 0;
  2252. }
  2253. }
  2254.  
  2255. }
  2256.  
  2257. if ( this.placeholder ) {
  2258.  
  2259. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
  2260. // it unbinds ALL events from the original node!
  2261. if ( this.placeholder[ 0 ].parentNode ) {
  2262. this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] );
  2263. }
  2264. if ( this.options.helper !== "original" && this.helper &&
  2265. this.helper[ 0 ].parentNode ) {
  2266. this.helper.remove();
  2267. }
  2268.  
  2269. $.extend( this, {
  2270. helper: null,
  2271. dragging: false,
  2272. reverting: false,
  2273. _noFinalSort: null
  2274. } );
  2275.  
  2276. if ( this.domPosition.prev ) {
  2277. $( this.domPosition.prev ).after( this.currentItem );
  2278. } else {
  2279. $( this.domPosition.parent ).prepend( this.currentItem );
  2280. }
  2281. }
  2282.  
  2283. return this;
  2284.  
  2285. },
  2286.  
  2287. serialize: function( o ) {
  2288.  
  2289. var items = this._getItemsAsjQuery( o && o.connected ),
  2290. str = [];
  2291. o = o || {};
  2292.  
  2293. $( items ).each( function() {
  2294. var res = ( $( o.item || this ).attr( o.attribute || "id" ) || "" )
  2295. .match( o.expression || ( /(.+)[\-=_](.+)/ ) );
  2296. if ( res ) {
  2297. str.push(
  2298. ( o.key || res[ 1 ] + "[]" ) +
  2299. "=" + ( o.key && o.expression ? res[ 1 ] : res[ 2 ] ) );
  2300. }
  2301. } );
  2302.  
  2303. if ( !str.length && o.key ) {
  2304. str.push( o.key + "=" );
  2305. }
  2306.  
  2307. return str.join( "&" );
  2308.  
  2309. },
  2310.  
  2311. toArray: function( o ) {
  2312.  
  2313. var items = this._getItemsAsjQuery( o && o.connected ),
  2314. ret = [];
  2315.  
  2316. o = o || {};
  2317.  
  2318. items.each( function() {
  2319. ret.push( $( o.item || this ).attr( o.attribute || "id" ) || "" );
  2320. } );
  2321. return ret;
  2322.  
  2323. },
  2324.  
  2325. /* Be careful with the following core functions */
  2326. _intersectsWith: function( item ) {
  2327.  
  2328. var x1 = this.positionAbs.left,
  2329. x2 = x1 + this.helperProportions.width,
  2330. y1 = this.positionAbs.top,
  2331. y2 = y1 + this.helperProportions.height,
  2332. l = item.left,
  2333. r = l + item.width,
  2334. t = item.top,
  2335. b = t + item.height,
  2336. dyClick = this.offset.click.top,
  2337. dxClick = this.offset.click.left,
  2338. isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t &&
  2339. ( y1 + dyClick ) < b ),
  2340. isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l &&
  2341. ( x1 + dxClick ) < r ),
  2342. isOverElement = isOverElementHeight && isOverElementWidth;
  2343.  
  2344. if ( this.options.tolerance === "pointer" ||
  2345. this.options.forcePointerForContainers ||
  2346. ( this.options.tolerance !== "pointer" &&
  2347. this.helperProportions[ this.floating ? "width" : "height" ] >
  2348. item[ this.floating ? "width" : "height" ] )
  2349. ) {
  2350. return isOverElement;
  2351. } else {
  2352.  
  2353. return ( l < x1 + ( this.helperProportions.width / 2 ) && // Right Half
  2354. x2 - ( this.helperProportions.width / 2 ) < r && // Left Half
  2355. t < y1 + ( this.helperProportions.height / 2 ) && // Bottom Half
  2356. y2 - ( this.helperProportions.height / 2 ) < b ); // Top Half
  2357.  
  2358. }
  2359. },
  2360.  
  2361. _intersectsWithPointer: function( item ) {
  2362. var verticalDirection, horizontalDirection,
  2363. isOverElementHeight = ( this.options.axis === "x" ) ||
  2364. this._isOverAxis(
  2365. this.positionAbs.top + this.offset.click.top, item.top, item.height ),
  2366. isOverElementWidth = ( this.options.axis === "y" ) ||
  2367. this._isOverAxis(
  2368. this.positionAbs.left + this.offset.click.left, item.left, item.width ),
  2369. isOverElement = isOverElementHeight && isOverElementWidth;
  2370.  
  2371. if ( !isOverElement ) {
  2372. return false;
  2373. }
  2374.  
  2375. verticalDirection = this._getDragVerticalDirection();
  2376. horizontalDirection = this._getDragHorizontalDirection();
  2377.  
  2378. return this.floating ?
  2379. ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 )
  2380. : ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) );
  2381.  
  2382. },
  2383.  
  2384. _intersectsWithSides: function( item ) {
  2385.  
  2386. var isOverBottomHalf = this._isOverAxis( this.positionAbs.top +
  2387. this.offset.click.top, item.top + ( item.height / 2 ), item.height ),
  2388. isOverRightHalf = this._isOverAxis( this.positionAbs.left +
  2389. this.offset.click.left, item.left + ( item.width / 2 ), item.width ),
  2390. verticalDirection = this._getDragVerticalDirection(),
  2391. horizontalDirection = this._getDragHorizontalDirection();
  2392.  
  2393. if ( this.floating && horizontalDirection ) {
  2394. return ( ( horizontalDirection === "right" && isOverRightHalf ) ||
  2395. ( horizontalDirection === "left" && !isOverRightHalf ) );
  2396. } else {
  2397. return verticalDirection && ( ( verticalDirection === "down" && isOverBottomHalf ) ||
  2398. ( verticalDirection === "up" && !isOverBottomHalf ) );
  2399. }
  2400.  
  2401. },
  2402.  
  2403. _getDragVerticalDirection: function() {
  2404. var delta = this.positionAbs.top - this.lastPositionAbs.top;
  2405. return delta !== 0 && ( delta > 0 ? "down" : "up" );
  2406. },
  2407.  
  2408. _getDragHorizontalDirection: function() {
  2409. var delta = this.positionAbs.left - this.lastPositionAbs.left;
  2410. return delta !== 0 && ( delta > 0 ? "right" : "left" );
  2411. },
  2412.  
  2413. refresh: function( event ) {
  2414. this._refreshItems( event );
  2415. this._setHandleClassName();
  2416. this.refreshPositions();
  2417. return this;
  2418. },
  2419.  
  2420. _connectWith: function() {
  2421. var options = this.options;
  2422. return options.connectWith.constructor === String ?
  2423. [ options.connectWith ] :
  2424. options.connectWith;
  2425. },
  2426.  
  2427. _getItemsAsjQuery: function( connected ) {
  2428.  
  2429. var i, j, cur, inst,
  2430. items = [],
  2431. queries = [],
  2432. connectWith = this._connectWith();
  2433.  
  2434. if ( connectWith && connected ) {
  2435. for ( i = connectWith.length - 1; i >= 0; i-- ) {
  2436. cur = $( connectWith[ i ], this.document[ 0 ] );
  2437. for ( j = cur.length - 1; j >= 0; j-- ) {
  2438. inst = $.data( cur[ j ], this.widgetFullName );
  2439. if ( inst && inst !== this && !inst.options.disabled ) {
  2440. queries.push( [ $.isFunction( inst.options.items ) ?
  2441. inst.options.items.call( inst.element ) :
  2442. $( inst.options.items, inst.element )
  2443. .not( ".ui-sortable-helper" )
  2444. .not( ".ui-sortable-placeholder" ), inst ] );
  2445. }
  2446. }
  2447. }
  2448. }
  2449.  
  2450. queries.push( [ $.isFunction( this.options.items ) ?
  2451. this.options.items
  2452. .call( this.element, null, { options: this.options, item: this.currentItem } ) :
  2453. $( this.options.items, this.element )
  2454. .not( ".ui-sortable-helper" )
  2455. .not( ".ui-sortable-placeholder" ), this ] );
  2456.  
  2457. function addItems() {
  2458. items.push( this );
  2459. }
  2460. for ( i = queries.length - 1; i >= 0; i-- ) {
  2461. queries[ i ][ 0 ].each( addItems );
  2462. }
  2463.  
  2464. return $( items );
  2465.  
  2466. },
  2467.  
  2468. _removeCurrentsFromItems: function() {
  2469.  
  2470. var list = this.currentItem.find( ":data(" + this.widgetName + "-item)" );
  2471.  
  2472. this.items = $.grep( this.items, function( item ) {
  2473. for ( var j = 0; j < list.length; j++ ) {
  2474. if ( list[ j ] === item.item[ 0 ] ) {
  2475. return false;
  2476. }
  2477. }
  2478. return true;
  2479. } );
  2480.  
  2481. },
  2482.  
  2483. _refreshItems: function( event ) {
  2484.  
  2485. this.items = [];
  2486. this.containers = [ this ];
  2487.  
  2488. var i, j, cur, inst, targetData, _queries, item, queriesLength,
  2489. items = this.items,
  2490. queries = [ [ $.isFunction( this.options.items ) ?
  2491. this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) :
  2492. $( this.options.items, this.element ), this ] ],
  2493. connectWith = this._connectWith();
  2494.  
  2495. //Shouldn't be run the first time through due to massive slow-down
  2496. if ( connectWith && this.ready ) {
  2497. for ( i = connectWith.length - 1; i >= 0; i-- ) {
  2498. cur = $( connectWith[ i ], this.document[ 0 ] );
  2499. for ( j = cur.length - 1; j >= 0; j-- ) {
  2500. inst = $.data( cur[ j ], this.widgetFullName );
  2501. if ( inst && inst !== this && !inst.options.disabled ) {
  2502. queries.push( [ $.isFunction( inst.options.items ) ?
  2503. inst.options.items
  2504. .call( inst.element[ 0 ], event, { item: this.currentItem } ) :
  2505. $( inst.options.items, inst.element ), inst ] );
  2506. this.containers.push( inst );
  2507. }
  2508. }
  2509. }
  2510. }
  2511.  
  2512. for ( i = queries.length - 1; i >= 0; i-- ) {
  2513. targetData = queries[ i ][ 1 ];
  2514. _queries = queries[ i ][ 0 ];
  2515.  
  2516. for ( j = 0, queriesLength = _queries.length; j < queriesLength; j++ ) {
  2517. item = $( _queries[ j ] );
  2518.  
  2519. // Data for target checking (mouse manager)
  2520. item.data( this.widgetName + "-item", targetData );
  2521.  
  2522. items.push( {
  2523. item: item,
  2524. instance: targetData,
  2525. width: 0, height: 0,
  2526. left: 0, top: 0
  2527. } );
  2528. }
  2529. }
  2530.  
  2531. },
  2532.  
  2533. refreshPositions: function( fast ) {
  2534.  
  2535. // Determine whether items are being displayed horizontally
  2536. this.floating = this.items.length ?
  2537. this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
  2538. false;
  2539.  
  2540. //This has to be redone because due to the item being moved out/into the offsetParent,
  2541. // the offsetParent's position will change
  2542. if ( this.offsetParent && this.helper ) {
  2543. this.offset.parent = this._getParentOffset();
  2544. }
  2545.  
  2546. var i, item, t, p;
  2547.  
  2548. for ( i = this.items.length - 1; i >= 0; i-- ) {
  2549. item = this.items[ i ];
  2550.  
  2551. //We ignore calculating positions of all connected containers when we're not over them
  2552. if ( item.instance !== this.currentContainer && this.currentContainer &&
  2553. item.item[ 0 ] !== this.currentItem[ 0 ] ) {
  2554. continue;
  2555. }
  2556.  
  2557. t = this.options.toleranceElement ?
  2558. $( this.options.toleranceElement, item.item ) :
  2559. item.item;
  2560.  
  2561. if ( !fast ) {
  2562. item.width = t.outerWidth();
  2563. item.height = t.outerHeight();
  2564. }
  2565.  
  2566. p = t.offset();
  2567. item.left = p.left;
  2568. item.top = p.top;
  2569. }
  2570.  
  2571. if ( this.options.custom && this.options.custom.refreshContainers ) {
  2572. this.options.custom.refreshContainers.call( this );
  2573. } else {
  2574. for ( i = this.containers.length - 1; i >= 0; i-- ) {
  2575. p = this.containers[ i ].element.offset();
  2576. this.containers[ i ].containerCache.left = p.left;
  2577. this.containers[ i ].containerCache.top = p.top;
  2578. this.containers[ i ].containerCache.width =
  2579. this.containers[ i ].element.outerWidth();
  2580. this.containers[ i ].containerCache.height =
  2581. this.containers[ i ].element.outerHeight();
  2582. }
  2583. }
  2584.  
  2585. return this;
  2586. },
  2587.  
  2588. _createPlaceholder: function( that ) {
  2589. that = that || this;
  2590. var className,
  2591. o = that.options;
  2592.  
  2593. if ( !o.placeholder || o.placeholder.constructor === String ) {
  2594. className = o.placeholder;
  2595. o.placeholder = {
  2596. element: function() {
  2597.  
  2598. var nodeName = that.currentItem[ 0 ].nodeName.toLowerCase(),
  2599. element = $( "<" + nodeName + ">", that.document[ 0 ] );
  2600.  
  2601. that._addClass( element, "ui-sortable-placeholder",
  2602. className || that.currentItem[ 0 ].className )
  2603. ._removeClass( element, "ui-sortable-helper" );
  2604.  
  2605. if ( nodeName === "tbody" ) {
  2606. that._createTrPlaceholder(
  2607. that.currentItem.find( "tr" ).eq( 0 ),
  2608. $( "<tr>", that.document[ 0 ] ).appendTo( element )
  2609. );
  2610. } else if ( nodeName === "tr" ) {
  2611. that._createTrPlaceholder( that.currentItem, element );
  2612. } else if ( nodeName === "img" ) {
  2613. element.attr( "src", that.currentItem.attr( "src" ) );
  2614. }
  2615.  
  2616. if ( !className ) {
  2617. element.css( "visibility", "hidden" );
  2618. }
  2619.  
  2620. return element;
  2621. },
  2622. update: function( container, p ) {
  2623.  
  2624. // 1. If a className is set as 'placeholder option, we don't force sizes -
  2625. // the class is responsible for that
  2626. // 2. The option 'forcePlaceholderSize can be enabled to force it even if a
  2627. // class name is specified
  2628. if ( className && !o.forcePlaceholderSize ) {
  2629. return;
  2630. }
  2631.  
  2632. //If the element doesn't have a actual height by itself (without styles coming
  2633. // from a stylesheet), it receives the inline height from the dragged item
  2634. if ( !p.height() ) {
  2635. p.height(
  2636. that.currentItem.innerHeight() -
  2637. parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) -
  2638. parseInt( that.currentItem.css( "paddingBottom" ) || 0, 10 ) );
  2639. }
  2640. if ( !p.width() ) {
  2641. p.width(
  2642. that.currentItem.innerWidth() -
  2643. parseInt( that.currentItem.css( "paddingLeft" ) || 0, 10 ) -
  2644. parseInt( that.currentItem.css( "paddingRight" ) || 0, 10 ) );
  2645. }
  2646. }
  2647. };
  2648. }
  2649.  
  2650. //Create the placeholder
  2651. that.placeholder = $( o.placeholder.element.call( that.element, that.currentItem ) );
  2652.  
  2653. //Append it after the actual current item
  2654. that.currentItem.after( that.placeholder );
  2655.  
  2656. //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
  2657. o.placeholder.update( that, that.placeholder );
  2658.  
  2659. },
  2660.  
  2661. _createTrPlaceholder: function( sourceTr, targetTr ) {
  2662. var that = this;
  2663.  
  2664. sourceTr.children().each( function() {
  2665. $( "<td>&#160;</td>", that.document[ 0 ] )
  2666. .attr( "colspan", $( this ).attr( "colspan" ) || 1 )
  2667. .appendTo( targetTr );
  2668. } );
  2669. },
  2670.  
  2671. _contactContainers: function( event ) {
  2672. var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom,
  2673. floating, axis,
  2674. innermostContainer = null,
  2675. innermostIndex = null;
  2676.  
  2677. // Get innermost container that intersects with item
  2678. for ( i = this.containers.length - 1; i >= 0; i-- ) {
  2679.  
  2680. // Never consider a container that's located within the item itself
  2681. if ( $.contains( this.currentItem[ 0 ], this.containers[ i ].element[ 0 ] ) ) {
  2682. continue;
  2683. }
  2684.  
  2685. if ( this._intersectsWith( this.containers[ i ].containerCache ) ) {
  2686.  
  2687. // If we've already found a container and it's more "inner" than this, then continue
  2688. if ( innermostContainer &&
  2689. $.contains(
  2690. this.containers[ i ].element[ 0 ],
  2691. innermostContainer.element[ 0 ] ) ) {
  2692. continue;
  2693. }
  2694.  
  2695. innermostContainer = this.containers[ i ];
  2696. innermostIndex = i;
  2697.  
  2698. } else {
  2699.  
  2700. // container doesn't intersect. trigger "out" event if necessary
  2701. if ( this.containers[ i ].containerCache.over ) {
  2702. this.containers[ i ]._trigger( "out", event, this._uiHash( this ) );
  2703. this.containers[ i ].containerCache.over = 0;
  2704. }
  2705. }
  2706.  
  2707. }
  2708.  
  2709. // If no intersecting containers found, return
  2710. if ( !innermostContainer ) {
  2711. return;
  2712. }
  2713.  
  2714. // Move the item into the container if it's not there already
  2715. if ( this.containers.length === 1 ) {
  2716. if ( !this.containers[ innermostIndex ].containerCache.over ) {
  2717. this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );
  2718. this.containers[ innermostIndex ].containerCache.over = 1;
  2719. }
  2720. } else {
  2721.  
  2722. // When entering a new container, we will find the item with the least distance and
  2723. // append our item near it
  2724. dist = 10000;
  2725. itemWithLeastDistance = null;
  2726. floating = innermostContainer.floating || this._isFloating( this.currentItem );
  2727. posProperty = floating ? "left" : "top";
  2728. sizeProperty = floating ? "width" : "height";
  2729. axis = floating ? "pageX" : "pageY";
  2730.  
  2731. for ( j = this.items.length - 1; j >= 0; j-- ) {
  2732. if ( !$.contains(
  2733. this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ] )
  2734. ) {
  2735. continue;
  2736. }
  2737. if ( this.items[ j ].item[ 0 ] === this.currentItem[ 0 ] ) {
  2738. continue;
  2739. }
  2740.  
  2741. cur = this.items[ j ].item.offset()[ posProperty ];
  2742. nearBottom = false;
  2743. if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) {
  2744. nearBottom = true;
  2745. }
  2746.  
  2747. if ( Math.abs( event[ axis ] - cur ) < dist ) {
  2748. dist = Math.abs( event[ axis ] - cur );
  2749. itemWithLeastDistance = this.items[ j ];
  2750. this.direction = nearBottom ? "up" : "down";
  2751. }
  2752. }
  2753.  
  2754. //Check if dropOnEmpty is enabled
  2755. if ( !itemWithLeastDistance && !this.options.dropOnEmpty ) {
  2756. return;
  2757. }
  2758.  
  2759. if ( this.currentContainer === this.containers[ innermostIndex ] ) {
  2760. if ( !this.currentContainer.containerCache.over ) {
  2761. this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() );
  2762. this.currentContainer.containerCache.over = 1;
  2763. }
  2764. return;
  2765. }
  2766.  
  2767. itemWithLeastDistance ?
  2768. this._rearrange( event, itemWithLeastDistance, null, true ) :
  2769. this._rearrange( event, null, this.containers[ innermostIndex ].element, true );
  2770. this._trigger( "change", event, this._uiHash() );
  2771. this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) );
  2772. this.currentContainer = this.containers[ innermostIndex ];
  2773.  
  2774. //Update the placeholder
  2775. this.options.placeholder.update( this.currentContainer, this.placeholder );
  2776.  
  2777. this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );
  2778. this.containers[ innermostIndex ].containerCache.over = 1;
  2779. }
  2780.  
  2781. },
  2782.  
  2783. _createHelper: function( event ) {
  2784.  
  2785. var o = this.options,
  2786. helper = $.isFunction( o.helper ) ?
  2787. $( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) :
  2788. ( o.helper === "clone" ? this.currentItem.clone() : this.currentItem );
  2789.  
  2790. //Add the helper to the DOM if that didn't happen already
  2791. if ( !helper.parents( "body" ).length ) {
  2792. $( o.appendTo !== "parent" ?
  2793. o.appendTo :
  2794. this.currentItem[ 0 ].parentNode )[ 0 ].appendChild( helper[ 0 ] );
  2795. }
  2796.  
  2797. if ( helper[ 0 ] === this.currentItem[ 0 ] ) {
  2798. this._storedCSS = {
  2799. width: this.currentItem[ 0 ].style.width,
  2800. height: this.currentItem[ 0 ].style.height,
  2801. position: this.currentItem.css( "position" ),
  2802. top: this.currentItem.css( "top" ),
  2803. left: this.currentItem.css( "left" )
  2804. };
  2805. }
  2806.  
  2807. if ( !helper[ 0 ].style.width || o.forceHelperSize ) {
  2808. helper.width( this.currentItem.width() );
  2809. }
  2810. if ( !helper[ 0 ].style.height || o.forceHelperSize ) {
  2811. helper.height( this.currentItem.height() );
  2812. }
  2813.  
  2814. return helper;
  2815.  
  2816. },
  2817.  
  2818. _adjustOffsetFromHelper: function( obj ) {
  2819. if ( typeof obj === "string" ) {
  2820. obj = obj.split( " " );
  2821. }
  2822. if ( $.isArray( obj ) ) {
  2823. obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };
  2824. }
  2825. if ( "left" in obj ) {
  2826. this.offset.click.left = obj.left + this.margins.left;
  2827. }
  2828. if ( "right" in obj ) {
  2829. this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  2830. }
  2831. if ( "top" in obj ) {
  2832. this.offset.click.top = obj.top + this.margins.top;
  2833. }
  2834. if ( "bottom" in obj ) {
  2835. this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  2836. }
  2837. },
  2838.  
  2839. _getParentOffset: function() {
  2840.  
  2841. //Get the offsetParent and cache its position
  2842. this.offsetParent = this.helper.offsetParent();
  2843. var po = this.offsetParent.offset();
  2844.  
  2845. // This is a special case where we need to modify a offset calculated on start, since the
  2846. // following happened:
  2847. // 1. The position of the helper is absolute, so it's position is calculated based on the
  2848. // next positioned parent
  2849. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
  2850. // the document, which means that the scroll is included in the initial calculation of the
  2851. // offset of the parent, and never recalculated upon drag
  2852. if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  2853. $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) {
  2854. po.left += this.scrollParent.scrollLeft();
  2855. po.top += this.scrollParent.scrollTop();
  2856. }
  2857.  
  2858. // This needs to be actually done for all browsers, since pageX/pageY includes this
  2859. // information with an ugly IE fix
  2860. if ( this.offsetParent[ 0 ] === this.document[ 0 ].body ||
  2861. ( this.offsetParent[ 0 ].tagName &&
  2862. this.offsetParent[ 0 ].tagName.toLowerCase() === "html" && $.ui.ie ) ) {
  2863. po = { top: 0, left: 0 };
  2864. }
  2865.  
  2866. return {
  2867. top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ),
  2868. left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 )
  2869. };
  2870.  
  2871. },
  2872.  
  2873. _getRelativeOffset: function() {
  2874.  
  2875. if ( this.cssPosition === "relative" ) {
  2876. var p = this.currentItem.position();
  2877. return {
  2878. top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) +
  2879. this.scrollParent.scrollTop(),
  2880. left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) +
  2881. this.scrollParent.scrollLeft()
  2882. };
  2883. } else {
  2884. return { top: 0, left: 0 };
  2885. }
  2886.  
  2887. },
  2888.  
  2889. _cacheMargins: function() {
  2890. this.margins = {
  2891. left: ( parseInt( this.currentItem.css( "marginLeft" ), 10 ) || 0 ),
  2892. top: ( parseInt( this.currentItem.css( "marginTop" ), 10 ) || 0 )
  2893. };
  2894. },
  2895.  
  2896. _cacheHelperProportions: function() {
  2897. this.helperProportions = {
  2898. width: this.helper.outerWidth(),
  2899. height: this.helper.outerHeight()
  2900. };
  2901. },
  2902.  
  2903. _setContainment: function() {
  2904.  
  2905. var ce, co, over,
  2906. o = this.options;
  2907. if ( o.containment === "parent" ) {
  2908. o.containment = this.helper[ 0 ].parentNode;
  2909. }
  2910. if ( o.containment === "document" || o.containment === "window" ) {
  2911. this.containment = [
  2912. 0 - this.offset.relative.left - this.offset.parent.left,
  2913. 0 - this.offset.relative.top - this.offset.parent.top,
  2914. o.containment === "document" ?
  2915. this.document.width() :
  2916. this.window.width() - this.helperProportions.width - this.margins.left,
  2917. ( o.containment === "document" ?
  2918. ( this.document.height() || document.body.parentNode.scrollHeight ) :
  2919. this.window.height() || this.document[ 0 ].body.parentNode.scrollHeight
  2920. ) - this.helperProportions.height - this.margins.top
  2921. ];
  2922. }
  2923.  
  2924. if ( !( /^(document|window|parent)$/ ).test( o.containment ) ) {
  2925. ce = $( o.containment )[ 0 ];
  2926. co = $( o.containment ).offset();
  2927. over = ( $( ce ).css( "overflow" ) !== "hidden" );
  2928.  
  2929. this.containment = [
  2930. co.left + ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) +
  2931. ( parseInt( $( ce ).css( "paddingLeft" ), 10 ) || 0 ) - this.margins.left,
  2932. co.top + ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) +
  2933. ( parseInt( $( ce ).css( "paddingTop" ), 10 ) || 0 ) - this.margins.top,
  2934. co.left + ( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
  2935. ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) -
  2936. ( parseInt( $( ce ).css( "paddingRight" ), 10 ) || 0 ) -
  2937. this.helperProportions.width - this.margins.left,
  2938. co.top + ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
  2939. ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) -
  2940. ( parseInt( $( ce ).css( "paddingBottom" ), 10 ) || 0 ) -
  2941. this.helperProportions.height - this.margins.top
  2942. ];
  2943. }
  2944.  
  2945. },
  2946.  
  2947. _convertPositionTo: function( d, pos ) {
  2948.  
  2949. if ( !pos ) {
  2950. pos = this.position;
  2951. }
  2952. var mod = d === "absolute" ? 1 : -1,
  2953. scroll = this.cssPosition === "absolute" &&
  2954. !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  2955. $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ?
  2956. this.offsetParent :
  2957. this.scrollParent,
  2958. scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );
  2959.  
  2960. return {
  2961. top: (
  2962.  
  2963. // The absolute mouse position
  2964. pos.top +
  2965.  
  2966. // Only for relative positioned nodes: Relative offset from element to offset parent
  2967. this.offset.relative.top * mod +
  2968.  
  2969. // The offsetParent's offset without borders (offset + border)
  2970. this.offset.parent.top * mod -
  2971. ( ( this.cssPosition === "fixed" ?
  2972. -this.scrollParent.scrollTop() :
  2973. ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod )
  2974. ),
  2975. left: (
  2976.  
  2977. // The absolute mouse position
  2978. pos.left +
  2979.  
  2980. // Only for relative positioned nodes: Relative offset from element to offset parent
  2981. this.offset.relative.left * mod +
  2982.  
  2983. // The offsetParent's offset without borders (offset + border)
  2984. this.offset.parent.left * mod -
  2985. ( ( this.cssPosition === "fixed" ?
  2986. -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
  2987. scroll.scrollLeft() ) * mod )
  2988. )
  2989. };
  2990.  
  2991. },
  2992.  
  2993. _generatePosition: function( event ) {
  2994.  
  2995. var top, left,
  2996. o = this.options,
  2997. pageX = event.pageX,
  2998. pageY = event.pageY,
  2999. scroll = this.cssPosition === "absolute" &&
  3000. !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  3001. $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ?
  3002. this.offsetParent :
  3003. this.scrollParent,
  3004. scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );
  3005.  
  3006. // This is another very weird special case that only happens for relative elements:
  3007. // 1. If the css position is relative
  3008. // 2. and the scroll parent is the document or similar to the offset parent
  3009. // we have to refresh the relative offset during the scroll so there are no jumps
  3010. if ( this.cssPosition === "relative" && !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  3011. this.scrollParent[ 0 ] !== this.offsetParent[ 0 ] ) ) {
  3012. this.offset.relative = this._getRelativeOffset();
  3013. }
  3014.  
  3015. /*
  3016. * - Position constraining -
  3017. * Constrain the position to a mix of grid, containment.
  3018. */
  3019.  
  3020. if ( this.originalPosition ) { //If we are not dragging yet, we won't check for options
  3021.  
  3022. if ( this.containment ) {
  3023. if ( event.pageX - this.offset.click.left < this.containment[ 0 ] ) {
  3024. pageX = this.containment[ 0 ] + this.offset.click.left;
  3025. }
  3026. if ( event.pageY - this.offset.click.top < this.containment[ 1 ] ) {
  3027. pageY = this.containment[ 1 ] + this.offset.click.top;
  3028. }
  3029. if ( event.pageX - this.offset.click.left > this.containment[ 2 ] ) {
  3030. pageX = this.containment[ 2 ] + this.offset.click.left;
  3031. }
  3032. if ( event.pageY - this.offset.click.top > this.containment[ 3 ] ) {
  3033. pageY = this.containment[ 3 ] + this.offset.click.top;
  3034. }
  3035. }
  3036.  
  3037. if ( o.grid ) {
  3038. top = this.originalPageY + Math.round( ( pageY - this.originalPageY ) /
  3039. o.grid[ 1 ] ) * o.grid[ 1 ];
  3040. pageY = this.containment ?
  3041. ( ( top - this.offset.click.top >= this.containment[ 1 ] &&
  3042. top - this.offset.click.top <= this.containment[ 3 ] ) ?
  3043. top :
  3044. ( ( top - this.offset.click.top >= this.containment[ 1 ] ) ?
  3045. top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) :
  3046. top;
  3047.  
  3048. left = this.originalPageX + Math.round( ( pageX - this.originalPageX ) /
  3049. o.grid[ 0 ] ) * o.grid[ 0 ];
  3050. pageX = this.containment ?
  3051. ( ( left - this.offset.click.left >= this.containment[ 0 ] &&
  3052. left - this.offset.click.left <= this.containment[ 2 ] ) ?
  3053. left :
  3054. ( ( left - this.offset.click.left >= this.containment[ 0 ] ) ?
  3055. left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) :
  3056. left;
  3057. }
  3058.  
  3059. }
  3060.  
  3061. return {
  3062. top: (
  3063.  
  3064. // The absolute mouse position
  3065. pageY -
  3066.  
  3067. // Click offset (relative to the element)
  3068. this.offset.click.top -
  3069.  
  3070. // Only for relative positioned nodes: Relative offset from element to offset parent
  3071. this.offset.relative.top -
  3072.  
  3073. // The offsetParent's offset without borders (offset + border)
  3074. this.offset.parent.top +
  3075. ( ( this.cssPosition === "fixed" ?
  3076. -this.scrollParent.scrollTop() :
  3077. ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) )
  3078. ),
  3079. left: (
  3080.  
  3081. // The absolute mouse position
  3082. pageX -
  3083.  
  3084. // Click offset (relative to the element)
  3085. this.offset.click.left -
  3086.  
  3087. // Only for relative positioned nodes: Relative offset from element to offset parent
  3088. this.offset.relative.left -
  3089.  
  3090. // The offsetParent's offset without borders (offset + border)
  3091. this.offset.parent.left +
  3092. ( ( this.cssPosition === "fixed" ?
  3093. -this.scrollParent.scrollLeft() :
  3094. scrollIsRootNode ? 0 : scroll.scrollLeft() ) )
  3095. )
  3096. };
  3097.  
  3098. },
  3099.  
  3100. _rearrange: function( event, i, a, hardRefresh ) {
  3101.  
  3102. a ? a[ 0 ].appendChild( this.placeholder[ 0 ] ) :
  3103. i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ],
  3104. ( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) );
  3105.  
  3106. //Various things done here to improve the performance:
  3107. // 1. we create a setTimeout, that calls refreshPositions
  3108. // 2. on the instance, we have a counter variable, that get's higher after every append
  3109. // 3. on the local scope, we copy the counter variable, and check in the timeout,
  3110. // if it's still the same
  3111. // 4. this lets only the last addition to the timeout stack through
  3112. this.counter = this.counter ? ++this.counter : 1;
  3113. var counter = this.counter;
  3114.  
  3115. this._delay( function() {
  3116. if ( counter === this.counter ) {
  3117.  
  3118. //Precompute after each DOM insertion, NOT on mousemove
  3119. this.refreshPositions( !hardRefresh );
  3120. }
  3121. } );
  3122.  
  3123. },
  3124.  
  3125. _clear: function( event, noPropagation ) {
  3126.  
  3127. this.reverting = false;
  3128.  
  3129. // We delay all events that have to be triggered to after the point where the placeholder
  3130. // has been removed and everything else normalized again
  3131. var i,
  3132. delayedTriggers = [];
  3133.  
  3134. // We first have to update the dom position of the actual currentItem
  3135. // Note: don't do it if the current item is already removed (by a user), or it gets
  3136. // reappended (see #4088)
  3137. if ( !this._noFinalSort && this.currentItem.parent().length ) {
  3138. this.placeholder.before( this.currentItem );
  3139. }
  3140. this._noFinalSort = null;
  3141.  
  3142. if ( this.helper[ 0 ] === this.currentItem[ 0 ] ) {
  3143. for ( i in this._storedCSS ) {
  3144. if ( this._storedCSS[ i ] === "auto" || this._storedCSS[ i ] === "static" ) {
  3145. this._storedCSS[ i ] = "";
  3146. }
  3147. }
  3148. this.currentItem.css( this._storedCSS );
  3149. this._removeClass( this.currentItem, "ui-sortable-helper" );
  3150. } else {
  3151. this.currentItem.show();
  3152. }
  3153.  
  3154. if ( this.fromOutside && !noPropagation ) {
  3155. delayedTriggers.push( function( event ) {
  3156. this._trigger( "receive", event, this._uiHash( this.fromOutside ) );
  3157. } );
  3158. }
  3159. if ( ( this.fromOutside ||
  3160. this.domPosition.prev !==
  3161. this.currentItem.prev().not( ".ui-sortable-helper" )[ 0 ] ||
  3162. this.domPosition.parent !== this.currentItem.parent()[ 0 ] ) && !noPropagation ) {
  3163.  
  3164. // Trigger update callback if the DOM position has changed
  3165. delayedTriggers.push( function( event ) {
  3166. this._trigger( "update", event, this._uiHash() );
  3167. } );
  3168. }
  3169.  
  3170. // Check if the items Container has Changed and trigger appropriate
  3171. // events.
  3172. if ( this !== this.currentContainer ) {
  3173. if ( !noPropagation ) {
  3174. delayedTriggers.push( function( event ) {
  3175. this._trigger( "remove", event, this._uiHash() );
  3176. } );
  3177. delayedTriggers.push( ( function( c ) {
  3178. return function( event ) {
  3179. c._trigger( "receive", event, this._uiHash( this ) );
  3180. };
  3181. } ).call( this, this.currentContainer ) );
  3182. delayedTriggers.push( ( function( c ) {
  3183. return function( event ) {
  3184. c._trigger( "update", event, this._uiHash( this ) );
  3185. };
  3186. } ).call( this, this.currentContainer ) );
  3187. }
  3188. }
  3189.  
  3190. //Post events to containers
  3191. function delayEvent( type, instance, container ) {
  3192. return function( event ) {
  3193. container._trigger( type, event, instance._uiHash( instance ) );
  3194. };
  3195. }
  3196. for ( i = this.containers.length - 1; i >= 0; i-- ) {
  3197. if ( !noPropagation ) {
  3198. delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
  3199. }
  3200. if ( this.containers[ i ].containerCache.over ) {
  3201. delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
  3202. this.containers[ i ].containerCache.over = 0;
  3203. }
  3204. }
  3205.  
  3206. //Do what was originally in plugins
  3207. if ( this.storedCursor ) {
  3208. this.document.find( "body" ).css( "cursor", this.storedCursor );
  3209. this.storedStylesheet.remove();
  3210. }
  3211. if ( this._storedOpacity ) {
  3212. this.helper.css( "opacity", this._storedOpacity );
  3213. }
  3214. if ( this._storedZIndex ) {
  3215. this.helper.css( "zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex );
  3216. }
  3217.  
  3218. this.dragging = false;
  3219.  
  3220. if ( !noPropagation ) {
  3221. this._trigger( "beforeStop", event, this._uiHash() );
  3222. }
  3223.  
  3224. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
  3225. // it unbinds ALL events from the original node!
  3226. this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] );
  3227.  
  3228. if ( !this.cancelHelperRemoval ) {
  3229. if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
  3230. this.helper.remove();
  3231. }
  3232. this.helper = null;
  3233. }
  3234.  
  3235. if ( !noPropagation ) {
  3236. for ( i = 0; i < delayedTriggers.length; i++ ) {
  3237.  
  3238. // Trigger all delayed events
  3239. delayedTriggers[ i ].call( this, event );
  3240. }
  3241. this._trigger( "stop", event, this._uiHash() );
  3242. }
  3243.  
  3244. this.fromOutside = false;
  3245. return !this.cancelHelperRemoval;
  3246.  
  3247. },
  3248.  
  3249. _trigger: function() {
  3250. if ( $.Widget.prototype._trigger.apply( this, arguments ) === false ) {
  3251. this.cancel();
  3252. }
  3253. },
  3254.  
  3255. _uiHash: function( _inst ) {
  3256. var inst = _inst || this;
  3257. return {
  3258. helper: inst.helper,
  3259. placeholder: inst.placeholder || $( [] ),
  3260. position: inst.position,
  3261. originalPosition: inst.originalPosition,
  3262. offset: inst.positionAbs,
  3263. item: inst.currentItem,
  3264. sender: _inst ? _inst.element : null
  3265. };
  3266. }
  3267.  
  3268. } );
  3269.  
  3270.  
  3271. /*!
  3272. * jQuery UI Controlgroup 1.12.1
  3273. * http://jqueryui.com
  3274. *
  3275. * Copyright jQuery Foundation and other contributors
  3276. * Released under the MIT license.
  3277. * http://jquery.org/license
  3278. */
  3279.  
  3280. //>>label: Controlgroup
  3281. //>>group: Widgets
  3282. //>>description: Visually groups form control widgets
  3283. //>>docs: http://api.jqueryui.com/controlgroup/
  3284. //>>demos: http://jqueryui.com/controlgroup/
  3285. //>>css.structure: ../../themes/base/core.css
  3286. //>>css.structure: ../../themes/base/controlgroup.css
  3287. //>>css.theme: ../../themes/base/theme.css
  3288.  
  3289.  
  3290. var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g;
  3291.  
  3292. var widgetsControlgroup = $.widget( "ui.controlgroup", {
  3293. version: "1.12.1",
  3294. defaultElement: "<div>",
  3295. options: {
  3296. direction: "horizontal",
  3297. disabled: null,
  3298. onlyVisible: true,
  3299. items: {
  3300. "button": "input[type=button], input[type=submit], input[type=reset], button, a",
  3301. "controlgroupLabel": ".ui-controlgroup-label",
  3302. "checkboxradio": "input[type='checkbox'], input[type='radio']",
  3303. "selectmenu": "select",
  3304. "spinner": ".ui-spinner-input"
  3305. }
  3306. },
  3307.  
  3308. _create: function() {
  3309. this._enhance();
  3310. },
  3311.  
  3312. // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation
  3313. _enhance: function() {
  3314. this.element.attr( "role", "toolbar" );
  3315. this.refresh();
  3316. },
  3317.  
  3318. _destroy: function() {
  3319. this._callChildMethod( "destroy" );
  3320. this.childWidgets.removeData( "ui-controlgroup-data" );
  3321. this.element.removeAttr( "role" );
  3322. if ( this.options.items.controlgroupLabel ) {
  3323. this.element
  3324. .find( this.options.items.controlgroupLabel )
  3325. .find( ".ui-controlgroup-label-contents" )
  3326. .contents().unwrap();
  3327. }
  3328. },
  3329.  
  3330. _initWidgets: function() {
  3331. var that = this,
  3332. childWidgets = [];
  3333.  
  3334. // First we iterate over each of the items options
  3335. $.each( this.options.items, function( widget, selector ) {
  3336. var labels;
  3337. var options = {};
  3338.  
  3339. // Make sure the widget has a selector set
  3340. if ( !selector ) {
  3341. return;
  3342. }
  3343.  
  3344. if ( widget === "controlgroupLabel" ) {
  3345. labels = that.element.find( selector );
  3346. labels.each( function() {
  3347. var element = $( this );
  3348.  
  3349. if ( element.children( ".ui-controlgroup-label-contents" ).length ) {
  3350. return;
  3351. }
  3352. element.contents()
  3353. .wrapAll( "<span class='ui-controlgroup-label-contents'></span>" );
  3354. } );
  3355. that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" );
  3356. childWidgets = childWidgets.concat( labels.get() );
  3357. return;
  3358. }
  3359.  
  3360. // Make sure the widget actually exists
  3361. if ( !$.fn[ widget ] ) {
  3362. return;
  3363. }
  3364.  
  3365. // We assume everything is in the middle to start because we can't determine
  3366. // first / last elements until all enhancments are done.
  3367. if ( that[ "_" + widget + "Options" ] ) {
  3368. options = that[ "_" + widget + "Options" ]( "middle" );
  3369. } else {
  3370. options = { classes: {} };
  3371. }
  3372.  
  3373. // Find instances of this widget inside controlgroup and init them
  3374. that.element
  3375. .find( selector )
  3376. .each( function() {
  3377. var element = $( this );
  3378. var instance = element[ widget ]( "instance" );
  3379.  
  3380. // We need to clone the default options for this type of widget to avoid
  3381. // polluting the variable options which has a wider scope than a single widget.
  3382. var instanceOptions = $.widget.extend( {}, options );
  3383.  
  3384. // If the button is the child of a spinner ignore it
  3385. // TODO: Find a more generic solution
  3386. if ( widget === "button" && element.parent( ".ui-spinner" ).length ) {
  3387. return;
  3388. }
  3389.  
  3390. // Create the widget if it doesn't exist
  3391. if ( !instance ) {
  3392. instance = element[ widget ]()[ widget ]( "instance" );
  3393. }
  3394. if ( instance ) {
  3395. instanceOptions.classes =
  3396. that._resolveClassesValues( instanceOptions.classes, instance );
  3397. }
  3398. element[ widget ]( instanceOptions );
  3399.  
  3400. // Store an instance of the controlgroup to be able to reference
  3401. // from the outermost element for changing options and refresh
  3402. var widgetElement = element[ widget ]( "widget" );
  3403. $.data( widgetElement[ 0 ], "ui-controlgroup-data",
  3404. instance ? instance : element[ widget ]( "instance" ) );
  3405.  
  3406. childWidgets.push( widgetElement[ 0 ] );
  3407. } );
  3408. } );
  3409.  
  3410. this.childWidgets = $( $.unique( childWidgets ) );
  3411. this._addClass( this.childWidgets, "ui-controlgroup-item" );
  3412. },
  3413.  
  3414. _callChildMethod: function( method ) {
  3415. this.childWidgets.each( function() {
  3416. var element = $( this ),
  3417. data = element.data( "ui-controlgroup-data" );
  3418. if ( data && data[ method ] ) {
  3419. data[ method ]();
  3420. }
  3421. } );
  3422. },
  3423.  
  3424. _updateCornerClass: function( element, position ) {
  3425. var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all";
  3426. var add = this._buildSimpleOptions( position, "label" ).classes.label;
  3427.  
  3428. this._removeClass( element, null, remove );
  3429. this._addClass( element, null, add );
  3430. },
  3431.  
  3432. _buildSimpleOptions: function( position, key ) {
  3433. var direction = this.options.direction === "vertical";
  3434. var result = {
  3435. classes: {}
  3436. };
  3437. result.classes[ key ] = {
  3438. "middle": "",
  3439. "first": "ui-corner-" + ( direction ? "top" : "left" ),
  3440. "last": "ui-corner-" + ( direction ? "bottom" : "right" ),
  3441. "only": "ui-corner-all"
  3442. }[ position ];
  3443.  
  3444. return result;
  3445. },
  3446.  
  3447. _spinnerOptions: function( position ) {
  3448. var options = this._buildSimpleOptions( position, "ui-spinner" );
  3449.  
  3450. options.classes[ "ui-spinner-up" ] = "";
  3451. options.classes[ "ui-spinner-down" ] = "";
  3452.  
  3453. return options;
  3454. },
  3455.  
  3456. _buttonOptions: function( position ) {
  3457. return this._buildSimpleOptions( position, "ui-button" );
  3458. },
  3459.  
  3460. _checkboxradioOptions: function( position ) {
  3461. return this._buildSimpleOptions( position, "ui-checkboxradio-label" );
  3462. },
  3463.  
  3464. _selectmenuOptions: function( position ) {
  3465. var direction = this.options.direction === "vertical";
  3466. return {
  3467. width: direction ? "auto" : false,
  3468. classes: {
  3469. middle: {
  3470. "ui-selectmenu-button-open": "",
  3471. "ui-selectmenu-button-closed": ""
  3472. },
  3473. first: {
  3474. "ui-selectmenu-button-open": "ui-corner-" + ( direction ? "top" : "tl" ),
  3475. "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "top" : "left" )
  3476. },
  3477. last: {
  3478. "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr",
  3479. "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "bottom" : "right" )
  3480. },
  3481. only: {
  3482. "ui-selectmenu-button-open": "ui-corner-top",
  3483. "ui-selectmenu-button-closed": "ui-corner-all"
  3484. }
  3485.  
  3486. }[ position ]
  3487. };
  3488. },
  3489.  
  3490. _resolveClassesValues: function( classes, instance ) {
  3491. var result = {};
  3492. $.each( classes, function( key ) {
  3493. var current = instance.options.classes[ key ] || "";
  3494. current = $.trim( current.replace( controlgroupCornerRegex, "" ) );
  3495. result[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " );
  3496. } );
  3497. return result;
  3498. },
  3499.  
  3500. _setOption: function( key, value ) {
  3501. if ( key === "direction" ) {
  3502. this._removeClass( "ui-controlgroup-" + this.options.direction );
  3503. }
  3504.  
  3505. this._super( key, value );
  3506. if ( key === "disabled" ) {
  3507. this._callChildMethod( value ? "disable" : "enable" );
  3508. return;
  3509. }
  3510.  
  3511. this.refresh();
  3512. },
  3513.  
  3514. refresh: function() {
  3515. var children,
  3516. that = this;
  3517.  
  3518. this._addClass( "ui-controlgroup ui-controlgroup-" + this.options.direction );
  3519.  
  3520. if ( this.options.direction === "horizontal" ) {
  3521. this._addClass( null, "ui-helper-clearfix" );
  3522. }
  3523. this._initWidgets();
  3524.  
  3525. children = this.childWidgets;
  3526.  
  3527. // We filter here because we need to track all childWidgets not just the visible ones
  3528. if ( this.options.onlyVisible ) {
  3529. children = children.filter( ":visible" );
  3530. }
  3531.  
  3532. if ( children.length ) {
  3533.  
  3534. // We do this last because we need to make sure all enhancment is done
  3535. // before determining first and last
  3536. $.each( [ "first", "last" ], function( index, value ) {
  3537. var instance = children[ value ]().data( "ui-controlgroup-data" );
  3538.  
  3539. if ( instance && that[ "_" + instance.widgetName + "Options" ] ) {
  3540. var options = that[ "_" + instance.widgetName + "Options" ](
  3541. children.length === 1 ? "only" : value
  3542. );
  3543. options.classes = that._resolveClassesValues( options.classes, instance );
  3544. instance.element[ instance.widgetName ]( options );
  3545. } else {
  3546. that._updateCornerClass( children[ value ](), value );
  3547. }
  3548. } );
  3549.  
  3550. // Finally call the refresh method on each of the child widgets.
  3551. this._callChildMethod( "refresh" );
  3552. }
  3553. }
  3554. } );
  3555.  
  3556. /*!
  3557. * jQuery UI Checkboxradio 1.12.1
  3558. * http://jqueryui.com
  3559. *
  3560. * Copyright jQuery Foundation and other contributors
  3561. * Released under the MIT license.
  3562. * http://jquery.org/license
  3563. */
  3564.  
  3565. //>>label: Checkboxradio
  3566. //>>group: Widgets
  3567. //>>description: Enhances a form with multiple themeable checkboxes or radio buttons.
  3568. //>>docs: http://api.jqueryui.com/checkboxradio/
  3569. //>>demos: http://jqueryui.com/checkboxradio/
  3570. //>>css.structure: ../../themes/base/core.css
  3571. //>>css.structure: ../../themes/base/button.css
  3572. //>>css.structure: ../../themes/base/checkboxradio.css
  3573. //>>css.theme: ../../themes/base/theme.css
  3574.  
  3575.  
  3576.  
  3577. $.widget( "ui.checkboxradio", [ $.ui.formResetMixin, {
  3578. version: "1.12.1",
  3579. options: {
  3580. disabled: null,
  3581. label: null,
  3582. icon: true,
  3583. classes: {
  3584. "ui-checkboxradio-label": "ui-corner-all",
  3585. "ui-checkboxradio-icon": "ui-corner-all"
  3586. }
  3587. },
  3588.  
  3589. _getCreateOptions: function() {
  3590. var disabled, labels;
  3591. var that = this;
  3592. var options = this._super() || {};
  3593.  
  3594. // We read the type here, because it makes more sense to throw a element type error first,
  3595. // rather then the error for lack of a label. Often if its the wrong type, it
  3596. // won't have a label (e.g. calling on a div, btn, etc)
  3597. this._readType();
  3598.  
  3599. labels = this.element.labels();
  3600.  
  3601. // If there are multiple labels, use the last one
  3602. this.label = $( labels[ labels.length - 1 ] );
  3603. if ( !this.label.length ) {
  3604. $.error( "No label found for checkboxradio widget" );
  3605. }
  3606.  
  3607. this.originalLabel = "";
  3608.  
  3609. // We need to get the label text but this may also need to make sure it does not contain the
  3610. // input itself.
  3611. this.label.contents().not( this.element[ 0 ] ).each( function() {
  3612.  
  3613. // The label contents could be text, html, or a mix. We concat each element to get a
  3614. // string representation of the label, without the input as part of it.
  3615. that.originalLabel += this.nodeType === 3 ? $( this ).text() : this.outerHTML;
  3616. } );
  3617.  
  3618. // Set the label option if we found label text
  3619. if ( this.originalLabel ) {
  3620. options.label = this.originalLabel;
  3621. }
  3622.  
  3623. disabled = this.element[ 0 ].disabled;
  3624. if ( disabled != null ) {
  3625. options.disabled = disabled;
  3626. }
  3627. return options;
  3628. },
  3629.  
  3630. _create: function() {
  3631. var checked = this.element[ 0 ].checked;
  3632.  
  3633. this._bindFormResetHandler();
  3634.  
  3635. if ( this.options.disabled == null ) {
  3636. this.options.disabled = this.element[ 0 ].disabled;
  3637. }
  3638.  
  3639. this._setOption( "disabled", this.options.disabled );
  3640. this._addClass( "ui-checkboxradio", "ui-helper-hidden-accessible" );
  3641. this._addClass( this.label, "ui-checkboxradio-label", "ui-button ui-widget" );
  3642.  
  3643. if ( this.type === "radio" ) {
  3644. this._addClass( this.label, "ui-checkboxradio-radio-label" );
  3645. }
  3646.  
  3647. if ( this.options.label && this.options.label !== this.originalLabel ) {
  3648. this._updateLabel();
  3649. } else if ( this.originalLabel ) {
  3650. this.options.label = this.originalLabel;
  3651. }
  3652.  
  3653. this._enhance();
  3654.  
  3655. if ( checked ) {
  3656. this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" );
  3657. if ( this.icon ) {
  3658. this._addClass( this.icon, null, "ui-state-hover" );
  3659. }
  3660. }
  3661.  
  3662. this._on( {
  3663. change: "_toggleClasses",
  3664. focus: function() {
  3665. this._addClass( this.label, null, "ui-state-focus ui-visual-focus" );
  3666. },
  3667. blur: function() {
  3668. this._removeClass( this.label, null, "ui-state-focus ui-visual-focus" );
  3669. }
  3670. } );
  3671. },
  3672.  
  3673. _readType: function() {
  3674. var nodeName = this.element[ 0 ].nodeName.toLowerCase();
  3675. this.type = this.element[ 0 ].type;
  3676. if ( nodeName !== "input" || !/radio|checkbox/.test( this.type ) ) {
  3677. $.error( "Can't create checkboxradio on element.nodeName=" + nodeName +
  3678. " and element.type=" + this.type );
  3679. }
  3680. },
  3681.  
  3682. // Support jQuery Mobile enhanced option
  3683. _enhance: function() {
  3684. this._updateIcon( this.element[ 0 ].checked );
  3685. },
  3686.  
  3687. widget: function() {
  3688. return this.label;
  3689. },
  3690.  
  3691. _getRadioGroup: function() {
  3692. var group;
  3693. var name = this.element[ 0 ].name;
  3694. var nameSelector = "input[name='" + $.ui.escapeSelector( name ) + "']";
  3695.  
  3696. if ( !name ) {
  3697. return $( [] );
  3698. }
  3699.  
  3700. if ( this.form.length ) {
  3701. group = $( this.form[ 0 ].elements ).filter( nameSelector );
  3702. } else {
  3703.  
  3704. // Not inside a form, check all inputs that also are not inside a form
  3705. group = $( nameSelector ).filter( function() {
  3706. return $( this ).form().length === 0;
  3707. } );
  3708. }
  3709.  
  3710. return group.not( this.element );
  3711. },
  3712.  
  3713. _toggleClasses: function() {
  3714. var checked = this.element[ 0 ].checked;
  3715. this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
  3716.  
  3717. if ( this.options.icon && this.type === "checkbox" ) {
  3718. this._toggleClass( this.icon, null, "ui-icon-check ui-state-checked", checked )
  3719. ._toggleClass( this.icon, null, "ui-icon-blank", !checked );
  3720. }
  3721.  
  3722. if ( this.type === "radio" ) {
  3723. this._getRadioGroup()
  3724. .each( function() {
  3725. var instance = $( this ).checkboxradio( "instance" );
  3726.  
  3727. if ( instance ) {
  3728. instance._removeClass( instance.label,
  3729. "ui-checkboxradio-checked", "ui-state-active" );
  3730. }
  3731. } );
  3732. }
  3733. },
  3734.  
  3735. _destroy: function() {
  3736. this._unbindFormResetHandler();
  3737.  
  3738. if ( this.icon ) {
  3739. this.icon.remove();
  3740. this.iconSpace.remove();
  3741. }
  3742. },
  3743.  
  3744. _setOption: function( key, value ) {
  3745.  
  3746. // We don't allow the value to be set to nothing
  3747. if ( key === "label" && !value ) {
  3748. return;
  3749. }
  3750.  
  3751. this._super( key, value );
  3752.  
  3753. if ( key === "disabled" ) {
  3754. this._toggleClass( this.label, null, "ui-state-disabled", value );
  3755. this.element[ 0 ].disabled = value;
  3756.  
  3757. // Don't refresh when setting disabled
  3758. return;
  3759. }
  3760. this.refresh();
  3761. },
  3762.  
  3763. _updateIcon: function( checked ) {
  3764. var toAdd = "ui-icon ui-icon-background ";
  3765.  
  3766. if ( this.options.icon ) {
  3767. if ( !this.icon ) {
  3768. this.icon = $( "<span>" );
  3769. this.iconSpace = $( "<span> </span>" );
  3770. this._addClass( this.iconSpace, "ui-checkboxradio-icon-space" );
  3771. }
  3772.  
  3773. if ( this.type === "checkbox" ) {
  3774. toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank";
  3775. this._removeClass( this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check" );
  3776. } else {
  3777. toAdd += "ui-icon-blank";
  3778. }
  3779. this._addClass( this.icon, "ui-checkboxradio-icon", toAdd );
  3780. if ( !checked ) {
  3781. this._removeClass( this.icon, null, "ui-icon-check ui-state-checked" );
  3782. }
  3783. this.icon.prependTo( this.label ).after( this.iconSpace );
  3784. } else if ( this.icon !== undefined ) {
  3785. this.icon.remove();
  3786. this.iconSpace.remove();
  3787. delete this.icon;
  3788. }
  3789. },
  3790.  
  3791. _updateLabel: function() {
  3792.  
  3793. // Remove the contents of the label ( minus the icon, icon space, and input )
  3794. var contents = this.label.contents().not( this.element[ 0 ] );
  3795. if ( this.icon ) {
  3796. contents = contents.not( this.icon[ 0 ] );
  3797. }
  3798. if ( this.iconSpace ) {
  3799. contents = contents.not( this.iconSpace[ 0 ] );
  3800. }
  3801. contents.remove();
  3802.  
  3803. this.label.append( this.options.label );
  3804. },
  3805.  
  3806. refresh: function() {
  3807. var checked = this.element[ 0 ].checked,
  3808. isDisabled = this.element[ 0 ].disabled;
  3809.  
  3810. this._updateIcon( checked );
  3811. this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
  3812. if ( this.options.label !== null ) {
  3813. this._updateLabel();
  3814. }
  3815.  
  3816. if ( isDisabled !== this.options.disabled ) {
  3817. this._setOptions( { "disabled": isDisabled } );
  3818. }
  3819. }
  3820.  
  3821. } ] );
  3822.  
  3823. var widgetsCheckboxradio = $.ui.checkboxradio;
  3824.  
  3825.  
  3826. /*!
  3827. * jQuery UI Button 1.12.1
  3828. * http://jqueryui.com
  3829. *
  3830. * Copyright jQuery Foundation and other contributors
  3831. * Released under the MIT license.
  3832. * http://jquery.org/license
  3833. */
  3834.  
  3835. //>>label: Button
  3836. //>>group: Widgets
  3837. //>>description: Enhances a form with themeable buttons.
  3838. //>>docs: http://api.jqueryui.com/button/
  3839. //>>demos: http://jqueryui.com/button/
  3840. //>>css.structure: ../../themes/base/core.css
  3841. //>>css.structure: ../../themes/base/button.css
  3842. //>>css.theme: ../../themes/base/theme.css
  3843.  
  3844.  
  3845.  
  3846. $.widget( "ui.button", {
  3847. version: "1.12.1",
  3848. defaultElement: "<button>",
  3849. options: {
  3850. classes: {
  3851. "ui-button": "ui-corner-all"
  3852. },
  3853. disabled: null,
  3854. icon: null,
  3855. iconPosition: "beginning",
  3856. label: null,
  3857. showLabel: true
  3858. },
  3859.  
  3860. _getCreateOptions: function() {
  3861. var disabled,
  3862.  
  3863. // This is to support cases like in jQuery Mobile where the base widget does have
  3864. // an implementation of _getCreateOptions
  3865. options = this._super() || {};
  3866.  
  3867. this.isInput = this.element.is( "input" );
  3868.  
  3869. disabled = this.element[ 0 ].disabled;
  3870. if ( disabled != null ) {
  3871. options.disabled = disabled;
  3872. }
  3873.  
  3874. this.originalLabel = this.isInput ? this.element.val() : this.element.html();
  3875. if ( this.originalLabel ) {
  3876. options.label = this.originalLabel;
  3877. }
  3878.  
  3879. return options;
  3880. },
  3881.  
  3882. _create: function() {
  3883. if ( !this.option.showLabel & !this.options.icon ) {
  3884. this.options.showLabel = true;
  3885. }
  3886.  
  3887. // We have to check the option again here even though we did in _getCreateOptions,
  3888. // because null may have been passed on init which would override what was set in
  3889. // _getCreateOptions
  3890. if ( this.options.disabled == null ) {
  3891. this.options.disabled = this.element[ 0 ].disabled || false;
  3892. }
  3893.  
  3894. this.hasTitle = !!this.element.attr( "title" );
  3895.  
  3896. // Check to see if the label needs to be set or if its already correct
  3897. if ( this.options.label && this.options.label !== this.originalLabel ) {
  3898. if ( this.isInput ) {
  3899. this.element.val( this.options.label );
  3900. } else {
  3901. this.element.html( this.options.label );
  3902. }
  3903. }
  3904. this._addClass( "ui-button", "ui-widget" );
  3905. this._setOption( "disabled", this.options.disabled );
  3906. this._enhance();
  3907.  
  3908. if ( this.element.is( "a" ) ) {
  3909. this._on( {
  3910. "keyup": function( event ) {
  3911. if ( event.keyCode === $.ui.keyCode.SPACE ) {
  3912. event.preventDefault();
  3913.  
  3914. // Support: PhantomJS <= 1.9, IE 8 Only
  3915. // If a native click is available use it so we actually cause navigation
  3916. // otherwise just trigger a click event
  3917. if ( this.element[ 0 ].click ) {
  3918. this.element[ 0 ].click();
  3919. } else {
  3920. this.element.trigger( "click" );
  3921. }
  3922. }
  3923. }
  3924. } );
  3925. }
  3926. },
  3927.  
  3928. _enhance: function() {
  3929. if ( !this.element.is( "button" ) ) {
  3930. this.element.attr( "role", "button" );
  3931. }
  3932.  
  3933. if ( this.options.icon ) {
  3934. this._updateIcon( "icon", this.options.icon );
  3935. this._updateTooltip();
  3936. }
  3937. },
  3938.  
  3939. _updateTooltip: function() {
  3940. this.title = this.element.attr( "title" );
  3941.  
  3942. if ( !this.options.showLabel && !this.title ) {
  3943. this.element.attr( "title", this.options.label );
  3944. }
  3945. },
  3946.  
  3947. _updateIcon: function( option, value ) {
  3948. var icon = option !== "iconPosition",
  3949. position = icon ? this.options.iconPosition : value,
  3950. displayBlock = position === "top" || position === "bottom";
  3951.  
  3952. // Create icon
  3953. if ( !this.icon ) {
  3954. this.icon = $( "<span>" );
  3955.  
  3956. this._addClass( this.icon, "ui-button-icon", "ui-icon" );
  3957.  
  3958. if ( !this.options.showLabel ) {
  3959. this._addClass( "ui-button-icon-only" );
  3960. }
  3961. } else if ( icon ) {
  3962.  
  3963. // If we are updating the icon remove the old icon class
  3964. this._removeClass( this.icon, null, this.options.icon );
  3965. }
  3966.  
  3967. // If we are updating the icon add the new icon class
  3968. if ( icon ) {
  3969. this._addClass( this.icon, null, value );
  3970. }
  3971.  
  3972. this._attachIcon( position );
  3973.  
  3974. // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove
  3975. // the iconSpace if there is one.
  3976. if ( displayBlock ) {
  3977. this._addClass( this.icon, null, "ui-widget-icon-block" );
  3978. if ( this.iconSpace ) {
  3979. this.iconSpace.remove();
  3980. }
  3981. } else {
  3982.  
  3983. // Position is beginning or end so remove the ui-widget-icon-block class and add the
  3984. // space if it does not exist
  3985. if ( !this.iconSpace ) {
  3986. this.iconSpace = $( "<span> </span>" );
  3987. this._addClass( this.iconSpace, "ui-button-icon-space" );
  3988. }
  3989. this._removeClass( this.icon, null, "ui-wiget-icon-block" );
  3990. this._attachIconSpace( position );
  3991. }
  3992. },
  3993.  
  3994. _destroy: function() {
  3995. this.element.removeAttr( "role" );
  3996.  
  3997. if ( this.icon ) {
  3998. this.icon.remove();
  3999. }
  4000. if ( this.iconSpace ) {
  4001. this.iconSpace.remove();
  4002. }
  4003. if ( !this.hasTitle ) {
  4004. this.element.removeAttr( "title" );
  4005. }
  4006. },
  4007.  
  4008. _attachIconSpace: function( iconPosition ) {
  4009. this.icon[ /^(?:end|bottom)/.test( iconPosition ) ? "before" : "after" ]( this.iconSpace );
  4010. },
  4011.  
  4012. _attachIcon: function( iconPosition ) {
  4013. this.element[ /^(?:end|bottom)/.test( iconPosition ) ? "append" : "prepend" ]( this.icon );
  4014. },
  4015.  
  4016. _setOptions: function( options ) {
  4017. var newShowLabel = options.showLabel === undefined ?
  4018. this.options.showLabel :
  4019. options.showLabel,
  4020. newIcon = options.icon === undefined ? this.options.icon : options.icon;
  4021.  
  4022. if ( !newShowLabel && !newIcon ) {
  4023. options.showLabel = true;
  4024. }
  4025. this._super( options );
  4026. },
  4027.  
  4028. _setOption: function( key, value ) {
  4029. if ( key === "icon" ) {
  4030. if ( value ) {
  4031. this._updateIcon( key, value );
  4032. } else if ( this.icon ) {
  4033. this.icon.remove();
  4034. if ( this.iconSpace ) {
  4035. this.iconSpace.remove();
  4036. }
  4037. }
  4038. }
  4039.  
  4040. if ( key === "iconPosition" ) {
  4041. this._updateIcon( key, value );
  4042. }
  4043.  
  4044. // Make sure we can't end up with a button that has neither text nor icon
  4045. if ( key === "showLabel" ) {
  4046. this._toggleClass( "ui-button-icon-only", null, !value );
  4047. this._updateTooltip();
  4048. }
  4049.  
  4050. if ( key === "label" ) {
  4051. if ( this.isInput ) {
  4052. this.element.val( value );
  4053. } else {
  4054.  
  4055. // If there is an icon, append it, else nothing then append the value
  4056. // this avoids removal of the icon when setting label text
  4057. this.element.html( value );
  4058. if ( this.icon ) {
  4059. this._attachIcon( this.options.iconPosition );
  4060. this._attachIconSpace( this.options.iconPosition );
  4061. }
  4062. }
  4063. }
  4064.  
  4065. this._super( key, value );
  4066.  
  4067. if ( key === "disabled" ) {
  4068. this._toggleClass( null, "ui-state-disabled", value );
  4069. this.element[ 0 ].disabled = value;
  4070. if ( value ) {
  4071. this.element.blur();
  4072. }
  4073. }
  4074. },
  4075.  
  4076. refresh: function() {
  4077.  
  4078. // Make sure to only check disabled if its an element that supports this otherwise
  4079. // check for the disabled class to determine state
  4080. var isDisabled = this.element.is( "input, button" ) ?
  4081. this.element[ 0 ].disabled : this.element.hasClass( "ui-button-disabled" );
  4082.  
  4083. if ( isDisabled !== this.options.disabled ) {
  4084. this._setOptions( { disabled: isDisabled } );
  4085. }
  4086.  
  4087. this._updateTooltip();
  4088. }
  4089. } );
  4090.  
  4091. // DEPRECATED
  4092. if ( $.uiBackCompat !== false ) {
  4093.  
  4094. // Text and Icons options
  4095. $.widget( "ui.button", $.ui.button, {
  4096. options: {
  4097. text: true,
  4098. icons: {
  4099. primary: null,
  4100. secondary: null
  4101. }
  4102. },
  4103.  
  4104. _create: function() {
  4105. if ( this.options.showLabel && !this.options.text ) {
  4106. this.options.showLabel = this.options.text;
  4107. }
  4108. if ( !this.options.showLabel && this.options.text ) {
  4109. this.options.text = this.options.showLabel;
  4110. }
  4111. if ( !this.options.icon && ( this.options.icons.primary ||
  4112. this.options.icons.secondary ) ) {
  4113. if ( this.options.icons.primary ) {
  4114. this.options.icon = this.options.icons.primary;
  4115. } else {
  4116. this.options.icon = this.options.icons.secondary;
  4117. this.options.iconPosition = "end";
  4118. }
  4119. } else if ( this.options.icon ) {
  4120. this.options.icons.primary = this.options.icon;
  4121. }
  4122. this._super();
  4123. },
  4124.  
  4125. _setOption: function( key, value ) {
  4126. if ( key === "text" ) {
  4127. this._super( "showLabel", value );
  4128. return;
  4129. }
  4130. if ( key === "showLabel" ) {
  4131. this.options.text = value;
  4132. }
  4133. if ( key === "icon" ) {
  4134. this.options.icons.primary = value;
  4135. }
  4136. if ( key === "icons" ) {
  4137. if ( value.primary ) {
  4138. this._super( "icon", value.primary );
  4139. this._super( "iconPosition", "beginning" );
  4140. } else if ( value.secondary ) {
  4141. this._super( "icon", value.secondary );
  4142. this._super( "iconPosition", "end" );
  4143. }
  4144. }
  4145. this._superApply( arguments );
  4146. }
  4147. } );
  4148.  
  4149. $.fn.button = ( function( orig ) {
  4150. return function() {
  4151. if ( !this.length || ( this.length && this[ 0 ].tagName !== "INPUT" ) ||
  4152. ( this.length && this[ 0 ].tagName === "INPUT" && (
  4153. this.attr( "type" ) !== "checkbox" && this.attr( "type" ) !== "radio"
  4154. ) ) ) {
  4155. return orig.apply( this, arguments );
  4156. }
  4157. if ( !$.ui.checkboxradio ) {
  4158. $.error( "Checkboxradio widget missing" );
  4159. }
  4160. if ( arguments.length === 0 ) {
  4161. return this.checkboxradio( {
  4162. "icon": false
  4163. } );
  4164. }
  4165. return this.checkboxradio.apply( this, arguments );
  4166. };
  4167. } )( $.fn.button );
  4168.  
  4169. $.fn.buttonset = function() {
  4170. if ( !$.ui.controlgroup ) {
  4171. $.error( "Controlgroup widget missing" );
  4172. }
  4173. if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" && arguments[ 2 ] ) {
  4174. return this.controlgroup.apply( this,
  4175. [ arguments[ 0 ], "items.button", arguments[ 2 ] ] );
  4176. }
  4177. if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" ) {
  4178. return this.controlgroup.apply( this, [ arguments[ 0 ], "items.button" ] );
  4179. }
  4180. if ( typeof arguments[ 0 ] === "object" && arguments[ 0 ].items ) {
  4181. arguments[ 0 ].items = {
  4182. button: arguments[ 0 ].items
  4183. };
  4184. }
  4185. return this.controlgroup.apply( this, arguments );
  4186. };
  4187. }
  4188.  
  4189. var widgetsButton = $.ui.button;
  4190.  
  4191.  
  4192. /*!
  4193. * jQuery UI Slider 1.12.1
  4194. * http://jqueryui.com
  4195. *
  4196. * Copyright jQuery Foundation and other contributors
  4197. * Released under the MIT license.
  4198. * http://jquery.org/license
  4199. */
  4200.  
  4201. //>>label: Slider
  4202. //>>group: Widgets
  4203. //>>description: Displays a flexible slider with ranges and accessibility via keyboard.
  4204. //>>docs: http://api.jqueryui.com/slider/
  4205. //>>demos: http://jqueryui.com/slider/
  4206. //>>css.structure: ../../themes/base/core.css
  4207. //>>css.structure: ../../themes/base/slider.css
  4208. //>>css.theme: ../../themes/base/theme.css
  4209.  
  4210.  
  4211.  
  4212. var widgetsSlider = $.widget( "ui.slider", $.ui.mouse, {
  4213. version: "1.12.1",
  4214. widgetEventPrefix: "slide",
  4215.  
  4216. options: {
  4217. animate: false,
  4218. classes: {
  4219. "ui-slider": "ui-corner-all",
  4220. "ui-slider-handle": "ui-corner-all",
  4221.  
  4222. // Note: ui-widget-header isn't the most fittingly semantic framework class for this
  4223. // element, but worked best visually with a variety of themes
  4224. "ui-slider-range": "ui-corner-all ui-widget-header"
  4225. },
  4226. distance: 0,
  4227. max: 100,
  4228. min: 0,
  4229. orientation: "horizontal",
  4230. range: false,
  4231. step: 1,
  4232. value: 0,
  4233. values: null,
  4234.  
  4235. // Callbacks
  4236. change: null,
  4237. slide: null,
  4238. start: null,
  4239. stop: null
  4240. },
  4241.  
  4242. // Number of pages in a slider
  4243. // (how many times can you page up/down to go through the whole range)
  4244. numPages: 5,
  4245.  
  4246. _create: function() {
  4247. this._keySliding = false;
  4248. this._mouseSliding = false;
  4249. this._animateOff = true;
  4250. this._handleIndex = null;
  4251. this._detectOrientation();
  4252. this._mouseInit();
  4253. this._calculateNewMax();
  4254.  
  4255. this._addClass( "ui-slider ui-slider-" + this.orientation,
  4256. "ui-widget ui-widget-content" );
  4257.  
  4258. this._refresh();
  4259.  
  4260. this._animateOff = false;
  4261. },
  4262.  
  4263. _refresh: function() {
  4264. this._createRange();
  4265. this._createHandles();
  4266. this._setupEvents();
  4267. this._refreshValue();
  4268. },
  4269.  
  4270. _createHandles: function() {
  4271. var i, handleCount,
  4272. options = this.options,
  4273. existingHandles = this.element.find( ".ui-slider-handle" ),
  4274. handle = "<span tabindex='0'></span>",
  4275. handles = [];
  4276.  
  4277. handleCount = ( options.values && options.values.length ) || 1;
  4278.  
  4279. if ( existingHandles.length > handleCount ) {
  4280. existingHandles.slice( handleCount ).remove();
  4281. existingHandles = existingHandles.slice( 0, handleCount );
  4282. }
  4283.  
  4284. for ( i = existingHandles.length; i < handleCount; i++ ) {
  4285. handles.push( handle );
  4286. }
  4287.  
  4288. this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );
  4289.  
  4290. this._addClass( this.handles, "ui-slider-handle", "ui-state-default" );
  4291.  
  4292. this.handle = this.handles.eq( 0 );
  4293.  
  4294. this.handles.each( function( i ) {
  4295. $( this )
  4296. .data( "ui-slider-handle-index", i )
  4297. .attr( "tabIndex", 0 );
  4298. } );
  4299. },
  4300.  
  4301. _createRange: function() {
  4302. var options = this.options;
  4303.  
  4304. if ( options.range ) {
  4305. if ( options.range === true ) {
  4306. if ( !options.values ) {
  4307. options.values = [ this._valueMin(), this._valueMin() ];
  4308. } else if ( options.values.length && options.values.length !== 2 ) {
  4309. options.values = [ options.values[ 0 ], options.values[ 0 ] ];
  4310. } else if ( $.isArray( options.values ) ) {
  4311. options.values = options.values.slice( 0 );
  4312. }
  4313. }
  4314.  
  4315. if ( !this.range || !this.range.length ) {
  4316. this.range = $( "<div>" )
  4317. .appendTo( this.element );
  4318.  
  4319. this._addClass( this.range, "ui-slider-range" );
  4320. } else {
  4321. this._removeClass( this.range, "ui-slider-range-min ui-slider-range-max" );
  4322.  
  4323. // Handle range switching from true to min/max
  4324. this.range.css( {
  4325. "left": "",
  4326. "bottom": ""
  4327. } );
  4328. }
  4329. if ( options.range === "min" || options.range === "max" ) {
  4330. this._addClass( this.range, "ui-slider-range-" + options.range );
  4331. }
  4332. } else {
  4333. if ( this.range ) {
  4334. this.range.remove();
  4335. }
  4336. this.range = null;
  4337. }
  4338. },
  4339.  
  4340. _setupEvents: function() {
  4341. this._off( this.handles );
  4342. this._on( this.handles, this._handleEvents );
  4343. this._hoverable( this.handles );
  4344. this._focusable( this.handles );
  4345. },
  4346.  
  4347. _destroy: function() {
  4348. this.handles.remove();
  4349. if ( this.range ) {
  4350. this.range.remove();
  4351. }
  4352.  
  4353. this._mouseDestroy();
  4354. },
  4355.  
  4356. _mouseCapture: function( event ) {
  4357. var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
  4358. that = this,
  4359. o = this.options;
  4360.  
  4361. if ( o.disabled ) {
  4362. return false;
  4363. }
  4364.  
  4365. this.elementSize = {
  4366. width: this.element.outerWidth(),
  4367. height: this.element.outerHeight()
  4368. };
  4369. this.elementOffset = this.element.offset();
  4370.  
  4371. position = { x: event.pageX, y: event.pageY };
  4372. normValue = this._normValueFromMouse( position );
  4373. distance = this._valueMax() - this._valueMin() + 1;
  4374. this.handles.each( function( i ) {
  4375. var thisDistance = Math.abs( normValue - that.values( i ) );
  4376. if ( ( distance > thisDistance ) ||
  4377. ( distance === thisDistance &&
  4378. ( i === that._lastChangedValue || that.values( i ) === o.min ) ) ) {
  4379. distance = thisDistance;
  4380. closestHandle = $( this );
  4381. index = i;
  4382. }
  4383. } );
  4384.  
  4385. allowed = this._start( event, index );
  4386. if ( allowed === false ) {
  4387. return false;
  4388. }
  4389. this._mouseSliding = true;
  4390.  
  4391. this._handleIndex = index;
  4392.  
  4393. this._addClass( closestHandle, null, "ui-state-active" );
  4394. closestHandle.trigger( "focus" );
  4395.  
  4396. offset = closestHandle.offset();
  4397. mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" );
  4398. this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
  4399. left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
  4400. top: event.pageY - offset.top -
  4401. ( closestHandle.height() / 2 ) -
  4402. ( parseInt( closestHandle.css( "borderTopWidth" ), 10 ) || 0 ) -
  4403. ( parseInt( closestHandle.css( "borderBottomWidth" ), 10 ) || 0 ) +
  4404. ( parseInt( closestHandle.css( "marginTop" ), 10 ) || 0 )
  4405. };
  4406.  
  4407. if ( !this.handles.hasClass( "ui-state-hover" ) ) {
  4408. this._slide( event, index, normValue );
  4409. }
  4410. this._animateOff = true;
  4411. return true;
  4412. },
  4413.  
  4414. _mouseStart: function() {
  4415. return true;
  4416. },
  4417.  
  4418. _mouseDrag: function( event ) {
  4419. var position = { x: event.pageX, y: event.pageY },
  4420. normValue = this._normValueFromMouse( position );
  4421.  
  4422. this._slide( event, this._handleIndex, normValue );
  4423.  
  4424. return false;
  4425. },
  4426.  
  4427. _mouseStop: function( event ) {
  4428. this._removeClass( this.handles, null, "ui-state-active" );
  4429. this._mouseSliding = false;
  4430.  
  4431. this._stop( event, this._handleIndex );
  4432. this._change( event, this._handleIndex );
  4433.  
  4434. this._handleIndex = null;
  4435. this._clickOffset = null;
  4436. this._animateOff = false;
  4437.  
  4438. return false;
  4439. },
  4440.  
  4441. _detectOrientation: function() {
  4442. this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
  4443. },
  4444.  
  4445. _normValueFromMouse: function( position ) {
  4446. var pixelTotal,
  4447. pixelMouse,
  4448. percentMouse,
  4449. valueTotal,
  4450. valueMouse;
  4451.  
  4452. if ( this.orientation === "horizontal" ) {
  4453. pixelTotal = this.elementSize.width;
  4454. pixelMouse = position.x - this.elementOffset.left -
  4455. ( this._clickOffset ? this._clickOffset.left : 0 );
  4456. } else {
  4457. pixelTotal = this.elementSize.height;
  4458. pixelMouse = position.y - this.elementOffset.top -
  4459. ( this._clickOffset ? this._clickOffset.top : 0 );
  4460. }
  4461.  
  4462. percentMouse = ( pixelMouse / pixelTotal );
  4463. if ( percentMouse > 1 ) {
  4464. percentMouse = 1;
  4465. }
  4466. if ( percentMouse < 0 ) {
  4467. percentMouse = 0;
  4468. }
  4469. if ( this.orientation === "vertical" ) {
  4470. percentMouse = 1 - percentMouse;
  4471. }
  4472.  
  4473. valueTotal = this._valueMax() - this._valueMin();
  4474. valueMouse = this._valueMin() + percentMouse * valueTotal;
  4475.  
  4476. return this._trimAlignValue( valueMouse );
  4477. },
  4478.  
  4479. _uiHash: function( index, value, values ) {
  4480. var uiHash = {
  4481. handle: this.handles[ index ],
  4482. handleIndex: index,
  4483. value: value !== undefined ? value : this.value()
  4484. };
  4485.  
  4486. if ( this._hasMultipleValues() ) {
  4487. uiHash.value = value !== undefined ? value : this.values( index );
  4488. uiHash.values = values || this.values();
  4489. }
  4490.  
  4491. return uiHash;
  4492. },
  4493.  
  4494. _hasMultipleValues: function() {
  4495. return this.options.values && this.options.values.length;
  4496. },
  4497.  
  4498. _start: function( event, index ) {
  4499. return this._trigger( "start", event, this._uiHash( index ) );
  4500. },
  4501.  
  4502. _slide: function( event, index, newVal ) {
  4503. var allowed, otherVal,
  4504. currentValue = this.value(),
  4505. newValues = this.values();
  4506.  
  4507. if ( this._hasMultipleValues() ) {
  4508. otherVal = this.values( index ? 0 : 1 );
  4509. currentValue = this.values( index );
  4510.  
  4511. if ( this.options.values.length === 2 && this.options.range === true ) {
  4512. newVal = index === 0 ? Math.min( otherVal, newVal ) : Math.max( otherVal, newVal );
  4513. }
  4514.  
  4515. newValues[ index ] = newVal;
  4516. }
  4517.  
  4518. if ( newVal === currentValue ) {
  4519. return;
  4520. }
  4521.  
  4522. allowed = this._trigger( "slide", event, this._uiHash( index, newVal, newValues ) );
  4523.  
  4524. // A slide can be canceled by returning false from the slide callback
  4525. if ( allowed === false ) {
  4526. return;
  4527. }
  4528.  
  4529. if ( this._hasMultipleValues() ) {
  4530. this.values( index, newVal );
  4531. } else {
  4532. this.value( newVal );
  4533. }
  4534. },
  4535.  
  4536. _stop: function( event, index ) {
  4537. this._trigger( "stop", event, this._uiHash( index ) );
  4538. },
  4539.  
  4540. _change: function( event, index ) {
  4541. if ( !this._keySliding && !this._mouseSliding ) {
  4542.  
  4543. //store the last changed value index for reference when handles overlap
  4544. this._lastChangedValue = index;
  4545. this._trigger( "change", event, this._uiHash( index ) );
  4546. }
  4547. },
  4548.  
  4549. value: function( newValue ) {
  4550. if ( arguments.length ) {
  4551. this.options.value = this._trimAlignValue( newValue );
  4552. this._refreshValue();
  4553. this._change( null, 0 );
  4554. return;
  4555. }
  4556.  
  4557. return this._value();
  4558. },
  4559.  
  4560. values: function( index, newValue ) {
  4561. var vals,
  4562. newValues,
  4563. i;
  4564.  
  4565. if ( arguments.length > 1 ) {
  4566. this.options.values[ index ] = this._trimAlignValue( newValue );
  4567. this._refreshValue();
  4568. this._change( null, index );
  4569. return;
  4570. }
  4571.  
  4572. if ( arguments.length ) {
  4573. if ( $.isArray( arguments[ 0 ] ) ) {
  4574. vals = this.options.values;
  4575. newValues = arguments[ 0 ];
  4576. for ( i = 0; i < vals.length; i += 1 ) {
  4577. vals[ i ] = this._trimAlignValue( newValues[ i ] );
  4578. this._change( null, i );
  4579. }
  4580. this._refreshValue();
  4581. } else {
  4582. if ( this._hasMultipleValues() ) {
  4583. return this._values( index );
  4584. } else {
  4585. return this.value();
  4586. }
  4587. }
  4588. } else {
  4589. return this._values();
  4590. }
  4591. },
  4592.  
  4593. _setOption: function( key, value ) {
  4594. var i,
  4595. valsLength = 0;
  4596.  
  4597. if ( key === "range" && this.options.range === true ) {
  4598. if ( value === "min" ) {
  4599. this.options.value = this._values( 0 );
  4600. this.options.values = null;
  4601. } else if ( value === "max" ) {
  4602. this.options.value = this._values( this.options.values.length - 1 );
  4603. this.options.values = null;
  4604. }
  4605. }
  4606.  
  4607. if ( $.isArray( this.options.values ) ) {
  4608. valsLength = this.options.values.length;
  4609. }
  4610.  
  4611. this._super( key, value );
  4612.  
  4613. switch ( key ) {
  4614. case "orientation":
  4615. this._detectOrientation();
  4616. this._removeClass( "ui-slider-horizontal ui-slider-vertical" )
  4617. ._addClass( "ui-slider-" + this.orientation );
  4618. this._refreshValue();
  4619. if ( this.options.range ) {
  4620. this._refreshRange( value );
  4621. }
  4622.  
  4623. // Reset positioning from previous orientation
  4624. this.handles.css( value === "horizontal" ? "bottom" : "left", "" );
  4625. break;
  4626. case "value":
  4627. this._animateOff = true;
  4628. this._refreshValue();
  4629. this._change( null, 0 );
  4630. this._animateOff = false;
  4631. break;
  4632. case "values":
  4633. this._animateOff = true;
  4634. this._refreshValue();
  4635.  
  4636. // Start from the last handle to prevent unreachable handles (#9046)
  4637. for ( i = valsLength - 1; i >= 0; i-- ) {
  4638. this._change( null, i );
  4639. }
  4640. this._animateOff = false;
  4641. break;
  4642. case "step":
  4643. case "min":
  4644. case "max":
  4645. this._animateOff = true;
  4646. this._calculateNewMax();
  4647. this._refreshValue();
  4648. this._animateOff = false;
  4649. break;
  4650. case "range":
  4651. this._animateOff = true;
  4652. this._refresh();
  4653. this._animateOff = false;
  4654. break;
  4655. }
  4656. },
  4657.  
  4658. _setOptionDisabled: function( value ) {
  4659. this._super( value );
  4660.  
  4661. this._toggleClass( null, "ui-state-disabled", !!value );
  4662. },
  4663.  
  4664. //internal value getter
  4665. // _value() returns value trimmed by min and max, aligned by step
  4666. _value: function() {
  4667. var val = this.options.value;
  4668. val = this._trimAlignValue( val );
  4669.  
  4670. return val;
  4671. },
  4672.  
  4673. //internal values getter
  4674. // _values() returns array of values trimmed by min and max, aligned by step
  4675. // _values( index ) returns single value trimmed by min and max, aligned by step
  4676. _values: function( index ) {
  4677. var val,
  4678. vals,
  4679. i;
  4680.  
  4681. if ( arguments.length ) {
  4682. val = this.options.values[ index ];
  4683. val = this._trimAlignValue( val );
  4684.  
  4685. return val;
  4686. } else if ( this._hasMultipleValues() ) {
  4687.  
  4688. // .slice() creates a copy of the array
  4689. // this copy gets trimmed by min and max and then returned
  4690. vals = this.options.values.slice();
  4691. for ( i = 0; i < vals.length; i += 1 ) {
  4692. vals[ i ] = this._trimAlignValue( vals[ i ] );
  4693. }
  4694.  
  4695. return vals;
  4696. } else {
  4697. return [];
  4698. }
  4699. },
  4700.  
  4701. // Returns the step-aligned value that val is closest to, between (inclusive) min and max
  4702. _trimAlignValue: function( val ) {
  4703. if ( val <= this._valueMin() ) {
  4704. return this._valueMin();
  4705. }
  4706. if ( val >= this._valueMax() ) {
  4707. return this._valueMax();
  4708. }
  4709. var step = ( this.options.step > 0 ) ? this.options.step : 1,
  4710. valModStep = ( val - this._valueMin() ) % step,
  4711. alignValue = val - valModStep;
  4712.  
  4713. if ( Math.abs( valModStep ) * 2 >= step ) {
  4714. alignValue += ( valModStep > 0 ) ? step : ( -step );
  4715. }
  4716.  
  4717. // Since JavaScript has problems with large floats, round
  4718. // the final value to 5 digits after the decimal point (see #4124)
  4719. return parseFloat( alignValue.toFixed( 5 ) );
  4720. },
  4721.  
  4722. _calculateNewMax: function() {
  4723. var max = this.options.max,
  4724. min = this._valueMin(),
  4725. step = this.options.step,
  4726. aboveMin = Math.round( ( max - min ) / step ) * step;
  4727. max = aboveMin + min;
  4728. if ( max > this.options.max ) {
  4729.  
  4730. //If max is not divisible by step, rounding off may increase its value
  4731. max -= step;
  4732. }
  4733. this.max = parseFloat( max.toFixed( this._precision() ) );
  4734. },
  4735.  
  4736. _precision: function() {
  4737. var precision = this._precisionOf( this.options.step );
  4738. if ( this.options.min !== null ) {
  4739. precision = Math.max( precision, this._precisionOf( this.options.min ) );
  4740. }
  4741. return precision;
  4742. },
  4743.  
  4744. _precisionOf: function( num ) {
  4745. var str = num.toString(),
  4746. decimal = str.indexOf( "." );
  4747. return decimal === -1 ? 0 : str.length - decimal - 1;
  4748. },
  4749.  
  4750. _valueMin: function() {
  4751. return this.options.min;
  4752. },
  4753.  
  4754. _valueMax: function() {
  4755. return this.max;
  4756. },
  4757.  
  4758. _refreshRange: function( orientation ) {
  4759. if ( orientation === "vertical" ) {
  4760. this.range.css( { "width": "", "left": "" } );
  4761. }
  4762. if ( orientation === "horizontal" ) {
  4763. this.range.css( { "height": "", "bottom": "" } );
  4764. }
  4765. },
  4766.  
  4767. _refreshValue: function() {
  4768. var lastValPercent, valPercent, value, valueMin, valueMax,
  4769. oRange = this.options.range,
  4770. o = this.options,
  4771. that = this,
  4772. animate = ( !this._animateOff ) ? o.animate : false,
  4773. _set = {};
  4774.  
  4775. if ( this._hasMultipleValues() ) {
  4776. this.handles.each( function( i ) {
  4777. valPercent = ( that.values( i ) - that._valueMin() ) / ( that._valueMax() -
  4778. that._valueMin() ) * 100;
  4779. _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
  4780. $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
  4781. if ( that.options.range === true ) {
  4782. if ( that.orientation === "horizontal" ) {
  4783. if ( i === 0 ) {
  4784. that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  4785. left: valPercent + "%"
  4786. }, o.animate );
  4787. }
  4788. if ( i === 1 ) {
  4789. that.range[ animate ? "animate" : "css" ]( {
  4790. width: ( valPercent - lastValPercent ) + "%"
  4791. }, {
  4792. queue: false,
  4793. duration: o.animate
  4794. } );
  4795. }
  4796. } else {
  4797. if ( i === 0 ) {
  4798. that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  4799. bottom: ( valPercent ) + "%"
  4800. }, o.animate );
  4801. }
  4802. if ( i === 1 ) {
  4803. that.range[ animate ? "animate" : "css" ]( {
  4804. height: ( valPercent - lastValPercent ) + "%"
  4805. }, {
  4806. queue: false,
  4807. duration: o.animate
  4808. } );
  4809. }
  4810. }
  4811. }
  4812. lastValPercent = valPercent;
  4813. } );
  4814. } else {
  4815. value = this.value();
  4816. valueMin = this._valueMin();
  4817. valueMax = this._valueMax();
  4818. valPercent = ( valueMax !== valueMin ) ?
  4819. ( value - valueMin ) / ( valueMax - valueMin ) * 100 :
  4820. 0;
  4821. _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
  4822. this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
  4823.  
  4824. if ( oRange === "min" && this.orientation === "horizontal" ) {
  4825. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  4826. width: valPercent + "%"
  4827. }, o.animate );
  4828. }
  4829. if ( oRange === "max" && this.orientation === "horizontal" ) {
  4830. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  4831. width: ( 100 - valPercent ) + "%"
  4832. }, o.animate );
  4833. }
  4834. if ( oRange === "min" && this.orientation === "vertical" ) {
  4835. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  4836. height: valPercent + "%"
  4837. }, o.animate );
  4838. }
  4839. if ( oRange === "max" && this.orientation === "vertical" ) {
  4840. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  4841. height: ( 100 - valPercent ) + "%"
  4842. }, o.animate );
  4843. }
  4844. }
  4845. },
  4846.  
  4847. _handleEvents: {
  4848. keydown: function( event ) {
  4849. var allowed, curVal, newVal, step,
  4850. index = $( event.target ).data( "ui-slider-handle-index" );
  4851.  
  4852. switch ( event.keyCode ) {
  4853. case $.ui.keyCode.HOME:
  4854. case $.ui.keyCode.END:
  4855. case $.ui.keyCode.PAGE_UP:
  4856. case $.ui.keyCode.PAGE_DOWN:
  4857. case $.ui.keyCode.UP:
  4858. case $.ui.keyCode.RIGHT:
  4859. case $.ui.keyCode.DOWN:
  4860. case $.ui.keyCode.LEFT:
  4861. event.preventDefault();
  4862. if ( !this._keySliding ) {
  4863. this._keySliding = true;
  4864. this._addClass( $( event.target ), null, "ui-state-active" );
  4865. allowed = this._start( event, index );
  4866. if ( allowed === false ) {
  4867. return;
  4868. }
  4869. }
  4870. break;
  4871. }
  4872.  
  4873. step = this.options.step;
  4874. if ( this._hasMultipleValues() ) {
  4875. curVal = newVal = this.values( index );
  4876. } else {
  4877. curVal = newVal = this.value();
  4878. }
  4879.  
  4880. switch ( event.keyCode ) {
  4881. case $.ui.keyCode.HOME:
  4882. newVal = this._valueMin();
  4883. break;
  4884. case $.ui.keyCode.END:
  4885. newVal = this._valueMax();
  4886. break;
  4887. case $.ui.keyCode.PAGE_UP:
  4888. newVal = this._trimAlignValue(
  4889. curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages )
  4890. );
  4891. break;
  4892. case $.ui.keyCode.PAGE_DOWN:
  4893. newVal = this._trimAlignValue(
  4894. curVal - ( ( this._valueMax() - this._valueMin() ) / this.numPages ) );
  4895. break;
  4896. case $.ui.keyCode.UP:
  4897. case $.ui.keyCode.RIGHT:
  4898. if ( curVal === this._valueMax() ) {
  4899. return;
  4900. }
  4901. newVal = this._trimAlignValue( curVal + step );
  4902. break;
  4903. case $.ui.keyCode.DOWN:
  4904. case $.ui.keyCode.LEFT:
  4905. if ( curVal === this._valueMin() ) {
  4906. return;
  4907. }
  4908. newVal = this._trimAlignValue( curVal - step );
  4909. break;
  4910. }
  4911.  
  4912. this._slide( event, index, newVal );
  4913. },
  4914. keyup: function( event ) {
  4915. var index = $( event.target ).data( "ui-slider-handle-index" );
  4916.  
  4917. if ( this._keySliding ) {
  4918. this._keySliding = false;
  4919. this._stop( event, index );
  4920. this._change( event, index );
  4921. this._removeClass( $( event.target ), null, "ui-state-active" );
  4922. }
  4923. }
  4924. }
  4925. } );
  4926.  
  4927.  
  4928. /*!
  4929. * jQuery UI Tooltip 1.12.1
  4930. * http://jqueryui.com
  4931. *
  4932. * Copyright jQuery Foundation and other contributors
  4933. * Released under the MIT license.
  4934. * http://jquery.org/license
  4935. */
  4936.  
  4937. //>>label: Tooltip
  4938. //>>group: Widgets
  4939. //>>description: Shows additional information for any element on hover or focus.
  4940. //>>docs: http://api.jqueryui.com/tooltip/
  4941. //>>demos: http://jqueryui.com/tooltip/
  4942. //>>css.structure: ../../themes/base/core.css
  4943. //>>css.structure: ../../themes/base/tooltip.css
  4944. //>>css.theme: ../../themes/base/theme.css
  4945.  
  4946.  
  4947.  
  4948. $.widget( "ui.tooltip", {
  4949. version: "1.12.1",
  4950. options: {
  4951. classes: {
  4952. "ui-tooltip": "ui-corner-all ui-widget-shadow"
  4953. },
  4954. content: function() {
  4955.  
  4956. // support: IE<9, Opera in jQuery <1.7
  4957. // .text() can't accept undefined, so coerce to a string
  4958. var title = $( this ).attr( "title" ) || "";
  4959.  
  4960. // Escape title, since we're going from an attribute to raw HTML
  4961. return $( "<a>" ).text( title ).html();
  4962. },
  4963. hide: true,
  4964.  
  4965. // Disabled elements have inconsistent behavior across browsers (#8661)
  4966. items: "[title]:not([disabled])",
  4967. position: {
  4968. my: "left top+15",
  4969. at: "left bottom",
  4970. collision: "flipfit flip"
  4971. },
  4972. show: true,
  4973. track: false,
  4974.  
  4975. // Callbacks
  4976. close: null,
  4977. open: null
  4978. },
  4979.  
  4980. _addDescribedBy: function( elem, id ) {
  4981. var describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ );
  4982. describedby.push( id );
  4983. elem
  4984. .data( "ui-tooltip-id", id )
  4985. .attr( "aria-describedby", $.trim( describedby.join( " " ) ) );
  4986. },
  4987.  
  4988. _removeDescribedBy: function( elem ) {
  4989. var id = elem.data( "ui-tooltip-id" ),
  4990. describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ ),
  4991. index = $.inArray( id, describedby );
  4992.  
  4993. if ( index !== -1 ) {
  4994. describedby.splice( index, 1 );
  4995. }
  4996.  
  4997. elem.removeData( "ui-tooltip-id" );
  4998. describedby = $.trim( describedby.join( " " ) );
  4999. if ( describedby ) {
  5000. elem.attr( "aria-describedby", describedby );
  5001. } else {
  5002. elem.removeAttr( "aria-describedby" );
  5003. }
  5004. },
  5005.  
  5006. _create: function() {
  5007. this._on( {
  5008. mouseover: "open",
  5009. focusin: "open"
  5010. } );
  5011.  
  5012. // IDs of generated tooltips, needed for destroy
  5013. this.tooltips = {};
  5014.  
  5015. // IDs of parent tooltips where we removed the title attribute
  5016. this.parents = {};
  5017.  
  5018. // Append the aria-live region so tooltips announce correctly
  5019. this.liveRegion = $( "<div>" )
  5020. .attr( {
  5021. role: "log",
  5022. "aria-live": "assertive",
  5023. "aria-relevant": "additions"
  5024. } )
  5025. .appendTo( this.document[ 0 ].body );
  5026. this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" );
  5027.  
  5028. this.disabledTitles = $( [] );
  5029. },
  5030.  
  5031. _setOption: function( key, value ) {
  5032. var that = this;
  5033.  
  5034. this._super( key, value );
  5035.  
  5036. if ( key === "content" ) {
  5037. $.each( this.tooltips, function( id, tooltipData ) {
  5038. that._updateContent( tooltipData.element );
  5039. } );
  5040. }
  5041. },
  5042.  
  5043. _setOptionDisabled: function( value ) {
  5044. this[ value ? "_disable" : "_enable" ]();
  5045. },
  5046.  
  5047. _disable: function() {
  5048. var that = this;
  5049.  
  5050. // Close open tooltips
  5051. $.each( this.tooltips, function( id, tooltipData ) {
  5052. var event = $.Event( "blur" );
  5053. event.target = event.currentTarget = tooltipData.element[ 0 ];
  5054. that.close( event, true );
  5055. } );
  5056.  
  5057. // Remove title attributes to prevent native tooltips
  5058. this.disabledTitles = this.disabledTitles.add(
  5059. this.element.find( this.options.items ).addBack()
  5060. .filter( function() {
  5061. var element = $( this );
  5062. if ( element.is( "[title]" ) ) {
  5063. return element
  5064. .data( "ui-tooltip-title", element.attr( "title" ) )
  5065. .removeAttr( "title" );
  5066. }
  5067. } )
  5068. );
  5069. },
  5070.  
  5071. _enable: function() {
  5072.  
  5073. // restore title attributes
  5074. this.disabledTitles.each( function() {
  5075. var element = $( this );
  5076. if ( element.data( "ui-tooltip-title" ) ) {
  5077. element.attr( "title", element.data( "ui-tooltip-title" ) );
  5078. }
  5079. } );
  5080. this.disabledTitles = $( [] );
  5081. },
  5082.  
  5083. open: function( event ) {
  5084. var that = this,
  5085. target = $( event ? event.target : this.element )
  5086.  
  5087. // we need closest here due to mouseover bubbling,
  5088. // but always pointing at the same event target
  5089. .closest( this.options.items );
  5090.  
  5091. // No element to show a tooltip for or the tooltip is already open
  5092. if ( !target.length || target.data( "ui-tooltip-id" ) ) {
  5093. return;
  5094. }
  5095.  
  5096. if ( target.attr( "title" ) ) {
  5097. target.data( "ui-tooltip-title", target.attr( "title" ) );
  5098. }
  5099.  
  5100. target.data( "ui-tooltip-open", true );
  5101.  
  5102. // Kill parent tooltips, custom or native, for hover
  5103. if ( event && event.type === "mouseover" ) {
  5104. target.parents().each( function() {
  5105. var parent = $( this ),
  5106. blurEvent;
  5107. if ( parent.data( "ui-tooltip-open" ) ) {
  5108. blurEvent = $.Event( "blur" );
  5109. blurEvent.target = blurEvent.currentTarget = this;
  5110. that.close( blurEvent, true );
  5111. }
  5112. if ( parent.attr( "title" ) ) {
  5113. parent.uniqueId();
  5114. that.parents[ this.id ] = {
  5115. element: this,
  5116. title: parent.attr( "title" )
  5117. };
  5118. parent.attr( "title", "" );
  5119. }
  5120. } );
  5121. }
  5122.  
  5123. this._registerCloseHandlers( event, target );
  5124. this._updateContent( target, event );
  5125. },
  5126.  
  5127. _updateContent: function( target, event ) {
  5128. var content,
  5129. contentOption = this.options.content,
  5130. that = this,
  5131. eventType = event ? event.type : null;
  5132.  
  5133. if ( typeof contentOption === "string" || contentOption.nodeType ||
  5134. contentOption.jquery ) {
  5135. return this._open( event, target, contentOption );
  5136. }
  5137.  
  5138. content = contentOption.call( target[ 0 ], function( response ) {
  5139.  
  5140. // IE may instantly serve a cached response for ajax requests
  5141. // delay this call to _open so the other call to _open runs first
  5142. that._delay( function() {
  5143.  
  5144. // Ignore async response if tooltip was closed already
  5145. if ( !target.data( "ui-tooltip-open" ) ) {
  5146. return;
  5147. }
  5148.  
  5149. // JQuery creates a special event for focusin when it doesn't
  5150. // exist natively. To improve performance, the native event
  5151. // object is reused and the type is changed. Therefore, we can't
  5152. // rely on the type being correct after the event finished
  5153. // bubbling, so we set it back to the previous value. (#8740)
  5154. if ( event ) {
  5155. event.type = eventType;
  5156. }
  5157. this._open( event, target, response );
  5158. } );
  5159. } );
  5160. if ( content ) {
  5161. this._open( event, target, content );
  5162. }
  5163. },
  5164.  
  5165. _open: function( event, target, content ) {
  5166. var tooltipData, tooltip, delayedShow, a11yContent,
  5167. positionOption = $.extend( {}, this.options.position );
  5168.  
  5169. if ( !content ) {
  5170. return;
  5171. }
  5172.  
  5173. // Content can be updated multiple times. If the tooltip already
  5174. // exists, then just update the content and bail.
  5175. tooltipData = this._find( target );
  5176. if ( tooltipData ) {
  5177. tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content );
  5178. return;
  5179. }
  5180.  
  5181. // If we have a title, clear it to prevent the native tooltip
  5182. // we have to check first to avoid defining a title if none exists
  5183. // (we don't want to cause an element to start matching [title])
  5184. //
  5185. // We use removeAttr only for key events, to allow IE to export the correct
  5186. // accessible attributes. For mouse events, set to empty string to avoid
  5187. // native tooltip showing up (happens only when removing inside mouseover).
  5188. if ( target.is( "[title]" ) ) {
  5189. if ( event && event.type === "mouseover" ) {
  5190. target.attr( "title", "" );
  5191. } else {
  5192. target.removeAttr( "title" );
  5193. }
  5194. }
  5195.  
  5196. tooltipData = this._tooltip( target );
  5197. tooltip = tooltipData.tooltip;
  5198. this._addDescribedBy( target, tooltip.attr( "id" ) );
  5199. tooltip.find( ".ui-tooltip-content" ).html( content );
  5200.  
  5201. // Support: Voiceover on OS X, JAWS on IE <= 9
  5202. // JAWS announces deletions even when aria-relevant="additions"
  5203. // Voiceover will sometimes re-read the entire log region's contents from the beginning
  5204. this.liveRegion.children().hide();
  5205. a11yContent = $( "<div>" ).html( tooltip.find( ".ui-tooltip-content" ).html() );
  5206. a11yContent.removeAttr( "name" ).find( "[name]" ).removeAttr( "name" );
  5207. a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" );
  5208. a11yContent.appendTo( this.liveRegion );
  5209.  
  5210. function position( event ) {
  5211. positionOption.of = event;
  5212. if ( tooltip.is( ":hidden" ) ) {
  5213. return;
  5214. }
  5215. tooltip.position( positionOption );
  5216. }
  5217. if ( this.options.track && event && /^mouse/.test( event.type ) ) {
  5218. this._on( this.document, {
  5219. mousemove: position
  5220. } );
  5221.  
  5222. // trigger once to override element-relative positioning
  5223. position( event );
  5224. } else {
  5225. tooltip.position( $.extend( {
  5226. of: target
  5227. }, this.options.position ) );
  5228. }
  5229.  
  5230. tooltip.hide();
  5231.  
  5232. this._show( tooltip, this.options.show );
  5233.  
  5234. // Handle tracking tooltips that are shown with a delay (#8644). As soon
  5235. // as the tooltip is visible, position the tooltip using the most recent
  5236. // event.
  5237. // Adds the check to add the timers only when both delay and track options are set (#14682)
  5238. if ( this.options.track && this.options.show && this.options.show.delay ) {
  5239. delayedShow = this.delayedShow = setInterval( function() {
  5240. if ( tooltip.is( ":visible" ) ) {
  5241. position( positionOption.of );
  5242. clearInterval( delayedShow );
  5243. }
  5244. }, $.fx.interval );
  5245. }
  5246.  
  5247. this._trigger( "open", event, { tooltip: tooltip } );
  5248. },
  5249.  
  5250. _registerCloseHandlers: function( event, target ) {
  5251. var events = {
  5252. keyup: function( event ) {
  5253. if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
  5254. var fakeEvent = $.Event( event );
  5255. fakeEvent.currentTarget = target[ 0 ];
  5256. this.close( fakeEvent, true );
  5257. }
  5258. }
  5259. };
  5260.  
  5261. // Only bind remove handler for delegated targets. Non-delegated
  5262. // tooltips will handle this in destroy.
  5263. if ( target[ 0 ] !== this.element[ 0 ] ) {
  5264. events.remove = function() {
  5265. this._removeTooltip( this._find( target ).tooltip );
  5266. };
  5267. }
  5268.  
  5269. if ( !event || event.type === "mouseover" ) {
  5270. events.mouseleave = "close";
  5271. }
  5272. if ( !event || event.type === "focusin" ) {
  5273. events.focusout = "close";
  5274. }
  5275. this._on( true, target, events );
  5276. },
  5277.  
  5278. close: function( event ) {
  5279. var tooltip,
  5280. that = this,
  5281. target = $( event ? event.currentTarget : this.element ),
  5282. tooltipData = this._find( target );
  5283.  
  5284. // The tooltip may already be closed
  5285. if ( !tooltipData ) {
  5286.  
  5287. // We set ui-tooltip-open immediately upon open (in open()), but only set the
  5288. // additional data once there's actually content to show (in _open()). So even if the
  5289. // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in
  5290. // the period between open() and _open().
  5291. target.removeData( "ui-tooltip-open" );
  5292. return;
  5293. }
  5294.  
  5295. tooltip = tooltipData.tooltip;
  5296.  
  5297. // Disabling closes the tooltip, so we need to track when we're closing
  5298. // to avoid an infinite loop in case the tooltip becomes disabled on close
  5299. if ( tooltipData.closing ) {
  5300. return;
  5301. }
  5302.  
  5303. // Clear the interval for delayed tracking tooltips
  5304. clearInterval( this.delayedShow );
  5305.  
  5306. // Only set title if we had one before (see comment in _open())
  5307. // If the title attribute has changed since open(), don't restore
  5308. if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) {
  5309. target.attr( "title", target.data( "ui-tooltip-title" ) );
  5310. }
  5311.  
  5312. this._removeDescribedBy( target );
  5313.  
  5314. tooltipData.hiding = true;
  5315. tooltip.stop( true );
  5316. this._hide( tooltip, this.options.hide, function() {
  5317. that._removeTooltip( $( this ) );
  5318. } );
  5319.  
  5320. target.removeData( "ui-tooltip-open" );
  5321. this._off( target, "mouseleave focusout keyup" );
  5322.  
  5323. // Remove 'remove' binding only on delegated targets
  5324. if ( target[ 0 ] !== this.element[ 0 ] ) {
  5325. this._off( target, "remove" );
  5326. }
  5327. this._off( this.document, "mousemove" );
  5328.  
  5329. if ( event && event.type === "mouseleave" ) {
  5330. $.each( this.parents, function( id, parent ) {
  5331. $( parent.element ).attr( "title", parent.title );
  5332. delete that.parents[ id ];
  5333. } );
  5334. }
  5335.  
  5336. tooltipData.closing = true;
  5337. this._trigger( "close", event, { tooltip: tooltip } );
  5338. if ( !tooltipData.hiding ) {
  5339. tooltipData.closing = false;
  5340. }
  5341. },
  5342.  
  5343. _tooltip: function( element ) {
  5344. var tooltip = $( "<div>" ).attr( "role", "tooltip" ),
  5345. content = $( "<div>" ).appendTo( tooltip ),
  5346. id = tooltip.uniqueId().attr( "id" );
  5347.  
  5348. this._addClass( content, "ui-tooltip-content" );
  5349. this._addClass( tooltip, "ui-tooltip", "ui-widget ui-widget-content" );
  5350.  
  5351. tooltip.appendTo( this._appendTo( element ) );
  5352.  
  5353. return this.tooltips[ id ] = {
  5354. element: element,
  5355. tooltip: tooltip
  5356. };
  5357. },
  5358.  
  5359. _find: function( target ) {
  5360. var id = target.data( "ui-tooltip-id" );
  5361. return id ? this.tooltips[ id ] : null;
  5362. },
  5363.  
  5364. _removeTooltip: function( tooltip ) {
  5365. tooltip.remove();
  5366. delete this.tooltips[ tooltip.attr( "id" ) ];
  5367. },
  5368.  
  5369. _appendTo: function( target ) {
  5370. var element = target.closest( ".ui-front, dialog" );
  5371.  
  5372. if ( !element.length ) {
  5373. element = this.document[ 0 ].body;
  5374. }
  5375.  
  5376. return element;
  5377. },
  5378.  
  5379. _destroy: function() {
  5380. var that = this;
  5381.  
  5382. // Close open tooltips
  5383. $.each( this.tooltips, function( id, tooltipData ) {
  5384.  
  5385. // Delegate to close method to handle common cleanup
  5386. var event = $.Event( "blur" ),
  5387. element = tooltipData.element;
  5388. event.target = event.currentTarget = element[ 0 ];
  5389. that.close( event, true );
  5390.  
  5391. // Remove immediately; destroying an open tooltip doesn't use the
  5392. // hide animation
  5393. $( "#" + id ).remove();
  5394.  
  5395. // Restore the title
  5396. if ( element.data( "ui-tooltip-title" ) ) {
  5397.  
  5398. // If the title attribute has changed since open(), don't restore
  5399. if ( !element.attr( "title" ) ) {
  5400. element.attr( "title", element.data( "ui-tooltip-title" ) );
  5401. }
  5402. element.removeData( "ui-tooltip-title" );
  5403. }
  5404. } );
  5405. this.liveRegion.remove();
  5406. }
  5407. } );
  5408.  
  5409. // DEPRECATED
  5410. // TODO: Switch return back to widget declaration at top of file when this is removed
  5411. if ( $.uiBackCompat !== false ) {
  5412.  
  5413. // Backcompat for tooltipClass option
  5414. $.widget( "ui.tooltip", $.ui.tooltip, {
  5415. options: {
  5416. tooltipClass: null
  5417. },
  5418. _tooltip: function() {
  5419. var tooltipData = this._superApply( arguments );
  5420. if ( this.options.tooltipClass ) {
  5421. tooltipData.tooltip.addClass( this.options.tooltipClass );
  5422. }
  5423. return tooltipData;
  5424. }
  5425. } );
  5426. }
  5427.  
  5428. var widgetsTooltip = $.ui.tooltip;
  5429.  
  5430.  
  5431. /*!
  5432. * jQuery UI Effects 1.12.1
  5433. * http://jqueryui.com
  5434. *
  5435. * Copyright jQuery Foundation and other contributors
  5436. * Released under the MIT license.
  5437. * http://jquery.org/license
  5438. */
  5439.  
  5440. //>>label: Effects Core
  5441. //>>group: Effects
  5442. // jscs:disable maximumLineLength
  5443. //>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects.
  5444. // jscs:enable maximumLineLength
  5445. //>>docs: http://api.jqueryui.com/category/effects-core/
  5446. //>>demos: http://jqueryui.com/effect/
  5447.  
  5448.  
  5449.  
  5450. var dataSpace = "ui-effects-",
  5451. dataSpaceStyle = "ui-effects-style",
  5452. dataSpaceAnimated = "ui-effects-animated",
  5453.  
  5454. // Create a local jQuery because jQuery Color relies on it and the
  5455. // global may not exist with AMD and a custom build (#10199)
  5456. jQuery = $;
  5457.  
  5458. $.effects = {
  5459. effect: {}
  5460. };
  5461.  
  5462. /*!
  5463. * jQuery Color Animations v2.1.2
  5464. * https://github.com/jquery/jquery-color
  5465. *
  5466. * Copyright 2014 jQuery Foundation and other contributors
  5467. * Released under the MIT license.
  5468. * http://jquery.org/license
  5469. *
  5470. * Date: Wed Jan 16 08:47:09 2013 -0600
  5471. */
  5472. ( function( jQuery, undefined ) {
  5473.  
  5474. var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " +
  5475. "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
  5476.  
  5477. // Plusequals test for += 100 -= 100
  5478. rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
  5479.  
  5480. // A set of RE's that can match strings and generate color tuples.
  5481. stringParsers = [ {
  5482. re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  5483. parse: function( execResult ) {
  5484. return [
  5485. execResult[ 1 ],
  5486. execResult[ 2 ],
  5487. execResult[ 3 ],
  5488. execResult[ 4 ]
  5489. ];
  5490. }
  5491. }, {
  5492. re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  5493. parse: function( execResult ) {
  5494. return [
  5495. execResult[ 1 ] * 2.55,
  5496. execResult[ 2 ] * 2.55,
  5497. execResult[ 3 ] * 2.55,
  5498. execResult[ 4 ]
  5499. ];
  5500. }
  5501. }, {
  5502.  
  5503. // This regex ignores A-F because it's compared against an already lowercased string
  5504. re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
  5505. parse: function( execResult ) {
  5506. return [
  5507. parseInt( execResult[ 1 ], 16 ),
  5508. parseInt( execResult[ 2 ], 16 ),
  5509. parseInt( execResult[ 3 ], 16 )
  5510. ];
  5511. }
  5512. }, {
  5513.  
  5514. // This regex ignores A-F because it's compared against an already lowercased string
  5515. re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
  5516. parse: function( execResult ) {
  5517. return [
  5518. parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
  5519. parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
  5520. parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
  5521. ];
  5522. }
  5523. }, {
  5524. re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  5525. space: "hsla",
  5526. parse: function( execResult ) {
  5527. return [
  5528. execResult[ 1 ],
  5529. execResult[ 2 ] / 100,
  5530. execResult[ 3 ] / 100,
  5531. execResult[ 4 ]
  5532. ];
  5533. }
  5534. } ],
  5535.  
  5536. // JQuery.Color( )
  5537. color = jQuery.Color = function( color, green, blue, alpha ) {
  5538. return new jQuery.Color.fn.parse( color, green, blue, alpha );
  5539. },
  5540. spaces = {
  5541. rgba: {
  5542. props: {
  5543. red: {
  5544. idx: 0,
  5545. type: "byte"
  5546. },
  5547. green: {
  5548. idx: 1,
  5549. type: "byte"
  5550. },
  5551. blue: {
  5552. idx: 2,
  5553. type: "byte"
  5554. }
  5555. }
  5556. },
  5557.  
  5558. hsla: {
  5559. props: {
  5560. hue: {
  5561. idx: 0,
  5562. type: "degrees"
  5563. },
  5564. saturation: {
  5565. idx: 1,
  5566. type: "percent"
  5567. },
  5568. lightness: {
  5569. idx: 2,
  5570. type: "percent"
  5571. }
  5572. }
  5573. }
  5574. },
  5575. propTypes = {
  5576. "byte": {
  5577. floor: true,
  5578. max: 255
  5579. },
  5580. "percent": {
  5581. max: 1
  5582. },
  5583. "degrees": {
  5584. mod: 360,
  5585. floor: true
  5586. }
  5587. },
  5588. support = color.support = {},
  5589.  
  5590. // Element for support tests
  5591. supportElem = jQuery( "<p>" )[ 0 ],
  5592.  
  5593. // Colors = jQuery.Color.names
  5594. colors,
  5595.  
  5596. // Local aliases of functions called often
  5597. each = jQuery.each;
  5598.  
  5599. // Determine rgba support immediately
  5600. supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
  5601. support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
  5602.  
  5603. // Define cache name and alpha properties
  5604. // for rgba and hsla spaces
  5605. each( spaces, function( spaceName, space ) {
  5606. space.cache = "_" + spaceName;
  5607. space.props.alpha = {
  5608. idx: 3,
  5609. type: "percent",
  5610. def: 1
  5611. };
  5612. } );
  5613.  
  5614. function clamp( value, prop, allowEmpty ) {
  5615. var type = propTypes[ prop.type ] || {};
  5616.  
  5617. if ( value == null ) {
  5618. return ( allowEmpty || !prop.def ) ? null : prop.def;
  5619. }
  5620.  
  5621. // ~~ is an short way of doing floor for positive numbers
  5622. value = type.floor ? ~~value : parseFloat( value );
  5623.  
  5624. // IE will pass in empty strings as value for alpha,
  5625. // which will hit this case
  5626. if ( isNaN( value ) ) {
  5627. return prop.def;
  5628. }
  5629.  
  5630. if ( type.mod ) {
  5631.  
  5632. // We add mod before modding to make sure that negatives values
  5633. // get converted properly: -10 -> 350
  5634. return ( value + type.mod ) % type.mod;
  5635. }
  5636.  
  5637. // For now all property types without mod have min and max
  5638. return 0 > value ? 0 : type.max < value ? type.max : value;
  5639. }
  5640.  
  5641. function stringParse( string ) {
  5642. var inst = color(),
  5643. rgba = inst._rgba = [];
  5644.  
  5645. string = string.toLowerCase();
  5646.  
  5647. each( stringParsers, function( i, parser ) {
  5648. var parsed,
  5649. match = parser.re.exec( string ),
  5650. values = match && parser.parse( match ),
  5651. spaceName = parser.space || "rgba";
  5652.  
  5653. if ( values ) {
  5654. parsed = inst[ spaceName ]( values );
  5655.  
  5656. // If this was an rgba parse the assignment might happen twice
  5657. // oh well....
  5658. inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
  5659. rgba = inst._rgba = parsed._rgba;
  5660.  
  5661. // Exit each( stringParsers ) here because we matched
  5662. return false;
  5663. }
  5664. } );
  5665.  
  5666. // Found a stringParser that handled it
  5667. if ( rgba.length ) {
  5668.  
  5669. // If this came from a parsed string, force "transparent" when alpha is 0
  5670. // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
  5671. if ( rgba.join() === "0,0,0,0" ) {
  5672. jQuery.extend( rgba, colors.transparent );
  5673. }
  5674. return inst;
  5675. }
  5676.  
  5677. // Named colors
  5678. return colors[ string ];
  5679. }
  5680.  
  5681. color.fn = jQuery.extend( color.prototype, {
  5682. parse: function( red, green, blue, alpha ) {
  5683. if ( red === undefined ) {
  5684. this._rgba = [ null, null, null, null ];
  5685. return this;
  5686. }
  5687. if ( red.jquery || red.nodeType ) {
  5688. red = jQuery( red ).css( green );
  5689. green = undefined;
  5690. }
  5691.  
  5692. var inst = this,
  5693. type = jQuery.type( red ),
  5694. rgba = this._rgba = [];
  5695.  
  5696. // More than 1 argument specified - assume ( red, green, blue, alpha )
  5697. if ( green !== undefined ) {
  5698. red = [ red, green, blue, alpha ];
  5699. type = "array";
  5700. }
  5701.  
  5702. if ( type === "string" ) {
  5703. return this.parse( stringParse( red ) || colors._default );
  5704. }
  5705.  
  5706. if ( type === "array" ) {
  5707. each( spaces.rgba.props, function( key, prop ) {
  5708. rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
  5709. } );
  5710. return this;
  5711. }
  5712.  
  5713. if ( type === "object" ) {
  5714. if ( red instanceof color ) {
  5715. each( spaces, function( spaceName, space ) {
  5716. if ( red[ space.cache ] ) {
  5717. inst[ space.cache ] = red[ space.cache ].slice();
  5718. }
  5719. } );
  5720. } else {
  5721. each( spaces, function( spaceName, space ) {
  5722. var cache = space.cache;
  5723. each( space.props, function( key, prop ) {
  5724.  
  5725. // If the cache doesn't exist, and we know how to convert
  5726. if ( !inst[ cache ] && space.to ) {
  5727.  
  5728. // If the value was null, we don't need to copy it
  5729. // if the key was alpha, we don't need to copy it either
  5730. if ( key === "alpha" || red[ key ] == null ) {
  5731. return;
  5732. }
  5733. inst[ cache ] = space.to( inst._rgba );
  5734. }
  5735.  
  5736. // This is the only case where we allow nulls for ALL properties.
  5737. // call clamp with alwaysAllowEmpty
  5738. inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
  5739. } );
  5740.  
  5741. // Everything defined but alpha?
  5742. if ( inst[ cache ] &&
  5743. jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
  5744.  
  5745. // Use the default of 1
  5746. inst[ cache ][ 3 ] = 1;
  5747. if ( space.from ) {
  5748. inst._rgba = space.from( inst[ cache ] );
  5749. }
  5750. }
  5751. } );
  5752. }
  5753. return this;
  5754. }
  5755. },
  5756. is: function( compare ) {
  5757. var is = color( compare ),
  5758. same = true,
  5759. inst = this;
  5760.  
  5761. each( spaces, function( _, space ) {
  5762. var localCache,
  5763. isCache = is[ space.cache ];
  5764. if ( isCache ) {
  5765. localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
  5766. each( space.props, function( _, prop ) {
  5767. if ( isCache[ prop.idx ] != null ) {
  5768. same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
  5769. return same;
  5770. }
  5771. } );
  5772. }
  5773. return same;
  5774. } );
  5775. return same;
  5776. },
  5777. _space: function() {
  5778. var used = [],
  5779. inst = this;
  5780. each( spaces, function( spaceName, space ) {
  5781. if ( inst[ space.cache ] ) {
  5782. used.push( spaceName );
  5783. }
  5784. } );
  5785. return used.pop();
  5786. },
  5787. transition: function( other, distance ) {
  5788. var end = color( other ),
  5789. spaceName = end._space(),
  5790. space = spaces[ spaceName ],
  5791. startColor = this.alpha() === 0 ? color( "transparent" ) : this,
  5792. start = startColor[ space.cache ] || space.to( startColor._rgba ),
  5793. result = start.slice();
  5794.  
  5795. end = end[ space.cache ];
  5796. each( space.props, function( key, prop ) {
  5797. var index = prop.idx,
  5798. startValue = start[ index ],
  5799. endValue = end[ index ],
  5800. type = propTypes[ prop.type ] || {};
  5801.  
  5802. // If null, don't override start value
  5803. if ( endValue === null ) {
  5804. return;
  5805. }
  5806.  
  5807. // If null - use end
  5808. if ( startValue === null ) {
  5809. result[ index ] = endValue;
  5810. } else {
  5811. if ( type.mod ) {
  5812. if ( endValue - startValue > type.mod / 2 ) {
  5813. startValue += type.mod;
  5814. } else if ( startValue - endValue > type.mod / 2 ) {
  5815. startValue -= type.mod;
  5816. }
  5817. }
  5818. result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
  5819. }
  5820. } );
  5821. return this[ spaceName ]( result );
  5822. },
  5823. blend: function( opaque ) {
  5824.  
  5825. // If we are already opaque - return ourself
  5826. if ( this._rgba[ 3 ] === 1 ) {
  5827. return this;
  5828. }
  5829.  
  5830. var rgb = this._rgba.slice(),
  5831. a = rgb.pop(),
  5832. blend = color( opaque )._rgba;
  5833.  
  5834. return color( jQuery.map( rgb, function( v, i ) {
  5835. return ( 1 - a ) * blend[ i ] + a * v;
  5836. } ) );
  5837. },
  5838. toRgbaString: function() {
  5839. var prefix = "rgba(",
  5840. rgba = jQuery.map( this._rgba, function( v, i ) {
  5841. return v == null ? ( i > 2 ? 1 : 0 ) : v;
  5842. } );
  5843.  
  5844. if ( rgba[ 3 ] === 1 ) {
  5845. rgba.pop();
  5846. prefix = "rgb(";
  5847. }
  5848.  
  5849. return prefix + rgba.join() + ")";
  5850. },
  5851. toHslaString: function() {
  5852. var prefix = "hsla(",
  5853. hsla = jQuery.map( this.hsla(), function( v, i ) {
  5854. if ( v == null ) {
  5855. v = i > 2 ? 1 : 0;
  5856. }
  5857.  
  5858. // Catch 1 and 2
  5859. if ( i && i < 3 ) {
  5860. v = Math.round( v * 100 ) + "%";
  5861. }
  5862. return v;
  5863. } );
  5864.  
  5865. if ( hsla[ 3 ] === 1 ) {
  5866. hsla.pop();
  5867. prefix = "hsl(";
  5868. }
  5869. return prefix + hsla.join() + ")";
  5870. },
  5871. toHexString: function( includeAlpha ) {
  5872. var rgba = this._rgba.slice(),
  5873. alpha = rgba.pop();
  5874.  
  5875. if ( includeAlpha ) {
  5876. rgba.push( ~~( alpha * 255 ) );
  5877. }
  5878.  
  5879. return "#" + jQuery.map( rgba, function( v ) {
  5880.  
  5881. // Default to 0 when nulls exist
  5882. v = ( v || 0 ).toString( 16 );
  5883. return v.length === 1 ? "0" + v : v;
  5884. } ).join( "" );
  5885. },
  5886. toString: function() {
  5887. return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
  5888. }
  5889. } );
  5890. color.fn.parse.prototype = color.fn;
  5891.  
  5892. // Hsla conversions adapted from:
  5893. // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
  5894.  
  5895. function hue2rgb( p, q, h ) {
  5896. h = ( h + 1 ) % 1;
  5897. if ( h * 6 < 1 ) {
  5898. return p + ( q - p ) * h * 6;
  5899. }
  5900. if ( h * 2 < 1 ) {
  5901. return q;
  5902. }
  5903. if ( h * 3 < 2 ) {
  5904. return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6;
  5905. }
  5906. return p;
  5907. }
  5908.  
  5909. spaces.hsla.to = function( rgba ) {
  5910. if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
  5911. return [ null, null, null, rgba[ 3 ] ];
  5912. }
  5913. var r = rgba[ 0 ] / 255,
  5914. g = rgba[ 1 ] / 255,
  5915. b = rgba[ 2 ] / 255,
  5916. a = rgba[ 3 ],
  5917. max = Math.max( r, g, b ),
  5918. min = Math.min( r, g, b ),
  5919. diff = max - min,
  5920. add = max + min,
  5921. l = add * 0.5,
  5922. h, s;
  5923.  
  5924. if ( min === max ) {
  5925. h = 0;
  5926. } else if ( r === max ) {
  5927. h = ( 60 * ( g - b ) / diff ) + 360;
  5928. } else if ( g === max ) {
  5929. h = ( 60 * ( b - r ) / diff ) + 120;
  5930. } else {
  5931. h = ( 60 * ( r - g ) / diff ) + 240;
  5932. }
  5933.  
  5934. // Chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
  5935. // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
  5936. if ( diff === 0 ) {
  5937. s = 0;
  5938. } else if ( l <= 0.5 ) {
  5939. s = diff / add;
  5940. } else {
  5941. s = diff / ( 2 - add );
  5942. }
  5943. return [ Math.round( h ) % 360, s, l, a == null ? 1 : a ];
  5944. };
  5945.  
  5946. spaces.hsla.from = function( hsla ) {
  5947. if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
  5948. return [ null, null, null, hsla[ 3 ] ];
  5949. }
  5950. var h = hsla[ 0 ] / 360,
  5951. s = hsla[ 1 ],
  5952. l = hsla[ 2 ],
  5953. a = hsla[ 3 ],
  5954. q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
  5955. p = 2 * l - q;
  5956.  
  5957. return [
  5958. Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
  5959. Math.round( hue2rgb( p, q, h ) * 255 ),
  5960. Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
  5961. a
  5962. ];
  5963. };
  5964.  
  5965. each( spaces, function( spaceName, space ) {
  5966. var props = space.props,
  5967. cache = space.cache,
  5968. to = space.to,
  5969. from = space.from;
  5970.  
  5971. // Makes rgba() and hsla()
  5972. color.fn[ spaceName ] = function( value ) {
  5973.  
  5974. // Generate a cache for this space if it doesn't exist
  5975. if ( to && !this[ cache ] ) {
  5976. this[ cache ] = to( this._rgba );
  5977. }
  5978. if ( value === undefined ) {
  5979. return this[ cache ].slice();
  5980. }
  5981.  
  5982. var ret,
  5983. type = jQuery.type( value ),
  5984. arr = ( type === "array" || type === "object" ) ? value : arguments,
  5985. local = this[ cache ].slice();
  5986.  
  5987. each( props, function( key, prop ) {
  5988. var val = arr[ type === "object" ? key : prop.idx ];
  5989. if ( val == null ) {
  5990. val = local[ prop.idx ];
  5991. }
  5992. local[ prop.idx ] = clamp( val, prop );
  5993. } );
  5994.  
  5995. if ( from ) {
  5996. ret = color( from( local ) );
  5997. ret[ cache ] = local;
  5998. return ret;
  5999. } else {
  6000. return color( local );
  6001. }
  6002. };
  6003.  
  6004. // Makes red() green() blue() alpha() hue() saturation() lightness()
  6005. each( props, function( key, prop ) {
  6006.  
  6007. // Alpha is included in more than one space
  6008. if ( color.fn[ key ] ) {
  6009. return;
  6010. }
  6011. color.fn[ key ] = function( value ) {
  6012. var vtype = jQuery.type( value ),
  6013. fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
  6014. local = this[ fn ](),
  6015. cur = local[ prop.idx ],
  6016. match;
  6017.  
  6018. if ( vtype === "undefined" ) {
  6019. return cur;
  6020. }
  6021.  
  6022. if ( vtype === "function" ) {
  6023. value = value.call( this, cur );
  6024. vtype = jQuery.type( value );
  6025. }
  6026. if ( value == null && prop.empty ) {
  6027. return this;
  6028. }
  6029. if ( vtype === "string" ) {
  6030. match = rplusequals.exec( value );
  6031. if ( match ) {
  6032. value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
  6033. }
  6034. }
  6035. local[ prop.idx ] = value;
  6036. return this[ fn ]( local );
  6037. };
  6038. } );
  6039. } );
  6040.  
  6041. // Add cssHook and .fx.step function for each named hook.
  6042. // accept a space separated string of properties
  6043. color.hook = function( hook ) {
  6044. var hooks = hook.split( " " );
  6045. each( hooks, function( i, hook ) {
  6046. jQuery.cssHooks[ hook ] = {
  6047. set: function( elem, value ) {
  6048. var parsed, curElem,
  6049. backgroundColor = "";
  6050.  
  6051. if ( value !== "transparent" && ( jQuery.type( value ) !== "string" ||
  6052. ( parsed = stringParse( value ) ) ) ) {
  6053. value = color( parsed || value );
  6054. if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
  6055. curElem = hook === "backgroundColor" ? elem.parentNode : elem;
  6056. while (
  6057. ( backgroundColor === "" || backgroundColor === "transparent" ) &&
  6058. curElem && curElem.style
  6059. ) {
  6060. try {
  6061. backgroundColor = jQuery.css( curElem, "backgroundColor" );
  6062. curElem = curElem.parentNode;
  6063. } catch ( e ) {
  6064. }
  6065. }
  6066.  
  6067. value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
  6068. backgroundColor :
  6069. "_default" );
  6070. }
  6071.  
  6072. value = value.toRgbaString();
  6073. }
  6074. try {
  6075. elem.style[ hook ] = value;
  6076. } catch ( e ) {
  6077.  
  6078. // Wrapped to prevent IE from throwing errors on "invalid" values like
  6079. // 'auto' or 'inherit'
  6080. }
  6081. }
  6082. };
  6083. jQuery.fx.step[ hook ] = function( fx ) {
  6084. if ( !fx.colorInit ) {
  6085. fx.start = color( fx.elem, hook );
  6086. fx.end = color( fx.end );
  6087. fx.colorInit = true;
  6088. }
  6089. jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
  6090. };
  6091. } );
  6092.  
  6093. };
  6094.  
  6095. color.hook( stepHooks );
  6096.  
  6097. jQuery.cssHooks.borderColor = {
  6098. expand: function( value ) {
  6099. var expanded = {};
  6100.  
  6101. each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
  6102. expanded[ "border" + part + "Color" ] = value;
  6103. } );
  6104. return expanded;
  6105. }
  6106. };
  6107.  
  6108. // Basic color names only.
  6109. // Usage of any of the other color names requires adding yourself or including
  6110. // jquery.color.svg-names.js.
  6111. colors = jQuery.Color.names = {
  6112.  
  6113. // 4.1. Basic color keywords
  6114. aqua: "#00ffff",
  6115. black: "#000000",
  6116. blue: "#0000ff",
  6117. fuchsia: "#ff00ff",
  6118. gray: "#808080",
  6119. green: "#008000",
  6120. lime: "#00ff00",
  6121. maroon: "#800000",
  6122. navy: "#000080",
  6123. olive: "#808000",
  6124. purple: "#800080",
  6125. red: "#ff0000",
  6126. silver: "#c0c0c0",
  6127. teal: "#008080",
  6128. white: "#ffffff",
  6129. yellow: "#ffff00",
  6130.  
  6131. // 4.2.3. "transparent" color keyword
  6132. transparent: [ null, null, null, 0 ],
  6133.  
  6134. _default: "#ffffff"
  6135. };
  6136.  
  6137. } )( jQuery );
  6138.  
  6139. /******************************************************************************/
  6140. /****************************** CLASS ANIMATIONS ******************************/
  6141. /******************************************************************************/
  6142. ( function() {
  6143.  
  6144. var classAnimationActions = [ "add", "remove", "toggle" ],
  6145. shorthandStyles = {
  6146. border: 1,
  6147. borderBottom: 1,
  6148. borderColor: 1,
  6149. borderLeft: 1,
  6150. borderRight: 1,
  6151. borderTop: 1,
  6152. borderWidth: 1,
  6153. margin: 1,
  6154. padding: 1
  6155. };
  6156.  
  6157. $.each(
  6158. [ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ],
  6159. function( _, prop ) {
  6160. $.fx.step[ prop ] = function( fx ) {
  6161. if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
  6162. jQuery.style( fx.elem, prop, fx.end );
  6163. fx.setAttr = true;
  6164. }
  6165. };
  6166. }
  6167. );
  6168.  
  6169. function getElementStyles( elem ) {
  6170. var key, len,
  6171. style = elem.ownerDocument.defaultView ?
  6172. elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
  6173. elem.currentStyle,
  6174. styles = {};
  6175.  
  6176. if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
  6177. len = style.length;
  6178. while ( len-- ) {
  6179. key = style[ len ];
  6180. if ( typeof style[ key ] === "string" ) {
  6181. styles[ $.camelCase( key ) ] = style[ key ];
  6182. }
  6183. }
  6184.  
  6185. // Support: Opera, IE <9
  6186. } else {
  6187. for ( key in style ) {
  6188. if ( typeof style[ key ] === "string" ) {
  6189. styles[ key ] = style[ key ];
  6190. }
  6191. }
  6192. }
  6193.  
  6194. return styles;
  6195. }
  6196.  
  6197. function styleDifference( oldStyle, newStyle ) {
  6198. var diff = {},
  6199. name, value;
  6200.  
  6201. for ( name in newStyle ) {
  6202. value = newStyle[ name ];
  6203. if ( oldStyle[ name ] !== value ) {
  6204. if ( !shorthandStyles[ name ] ) {
  6205. if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
  6206. diff[ name ] = value;
  6207. }
  6208. }
  6209. }
  6210. }
  6211.  
  6212. return diff;
  6213. }
  6214.  
  6215. // Support: jQuery <1.8
  6216. if ( !$.fn.addBack ) {
  6217. $.fn.addBack = function( selector ) {
  6218. return this.add( selector == null ?
  6219. this.prevObject : this.prevObject.filter( selector )
  6220. );
  6221. };
  6222. }
  6223.  
  6224. $.effects.animateClass = function( value, duration, easing, callback ) {
  6225. var o = $.speed( duration, easing, callback );
  6226.  
  6227. return this.queue( function() {
  6228. var animated = $( this ),
  6229. baseClass = animated.attr( "class" ) || "",
  6230. applyClassChange,
  6231. allAnimations = o.children ? animated.find( "*" ).addBack() : animated;
  6232.  
  6233. // Map the animated objects to store the original styles.
  6234. allAnimations = allAnimations.map( function() {
  6235. var el = $( this );
  6236. return {
  6237. el: el,
  6238. start: getElementStyles( this )
  6239. };
  6240. } );
  6241.  
  6242. // Apply class change
  6243. applyClassChange = function() {
  6244. $.each( classAnimationActions, function( i, action ) {
  6245. if ( value[ action ] ) {
  6246. animated[ action + "Class" ]( value[ action ] );
  6247. }
  6248. } );
  6249. };
  6250. applyClassChange();
  6251.  
  6252. // Map all animated objects again - calculate new styles and diff
  6253. allAnimations = allAnimations.map( function() {
  6254. this.end = getElementStyles( this.el[ 0 ] );
  6255. this.diff = styleDifference( this.start, this.end );
  6256. return this;
  6257. } );
  6258.  
  6259. // Apply original class
  6260. animated.attr( "class", baseClass );
  6261.  
  6262. // Map all animated objects again - this time collecting a promise
  6263. allAnimations = allAnimations.map( function() {
  6264. var styleInfo = this,
  6265. dfd = $.Deferred(),
  6266. opts = $.extend( {}, o, {
  6267. queue: false,
  6268. complete: function() {
  6269. dfd.resolve( styleInfo );
  6270. }
  6271. } );
  6272.  
  6273. this.el.animate( this.diff, opts );
  6274. return dfd.promise();
  6275. } );
  6276.  
  6277. // Once all animations have completed:
  6278. $.when.apply( $, allAnimations.get() ).done( function() {
  6279.  
  6280. // Set the final class
  6281. applyClassChange();
  6282.  
  6283. // For each animated element,
  6284. // clear all css properties that were animated
  6285. $.each( arguments, function() {
  6286. var el = this.el;
  6287. $.each( this.diff, function( key ) {
  6288. el.css( key, "" );
  6289. } );
  6290. } );
  6291.  
  6292. // This is guarnteed to be there if you use jQuery.speed()
  6293. // it also handles dequeuing the next anim...
  6294. o.complete.call( animated[ 0 ] );
  6295. } );
  6296. } );
  6297. };
  6298.  
  6299. $.fn.extend( {
  6300. addClass: ( function( orig ) {
  6301. return function( classNames, speed, easing, callback ) {
  6302. return speed ?
  6303. $.effects.animateClass.call( this,
  6304. { add: classNames }, speed, easing, callback ) :
  6305. orig.apply( this, arguments );
  6306. };
  6307. } )( $.fn.addClass ),
  6308.  
  6309. removeClass: ( function( orig ) {
  6310. return function( classNames, speed, easing, callback ) {
  6311. return arguments.length > 1 ?
  6312. $.effects.animateClass.call( this,
  6313. { remove: classNames }, speed, easing, callback ) :
  6314. orig.apply( this, arguments );
  6315. };
  6316. } )( $.fn.removeClass ),
  6317.  
  6318. toggleClass: ( function( orig ) {
  6319. return function( classNames, force, speed, easing, callback ) {
  6320. if ( typeof force === "boolean" || force === undefined ) {
  6321. if ( !speed ) {
  6322.  
  6323. // Without speed parameter
  6324. return orig.apply( this, arguments );
  6325. } else {
  6326. return $.effects.animateClass.call( this,
  6327. ( force ? { add: classNames } : { remove: classNames } ),
  6328. speed, easing, callback );
  6329. }
  6330. } else {
  6331.  
  6332. // Without force parameter
  6333. return $.effects.animateClass.call( this,
  6334. { toggle: classNames }, force, speed, easing );
  6335. }
  6336. };
  6337. } )( $.fn.toggleClass ),
  6338.  
  6339. switchClass: function( remove, add, speed, easing, callback ) {
  6340. return $.effects.animateClass.call( this, {
  6341. add: add,
  6342. remove: remove
  6343. }, speed, easing, callback );
  6344. }
  6345. } );
  6346.  
  6347. } )();
  6348.  
  6349. /******************************************************************************/
  6350. /*********************************** EFFECTS **********************************/
  6351. /******************************************************************************/
  6352.  
  6353. ( function() {
  6354.  
  6355. if ( $.expr && $.expr.filters && $.expr.filters.animated ) {
  6356. $.expr.filters.animated = ( function( orig ) {
  6357. return function( elem ) {
  6358. return !!$( elem ).data( dataSpaceAnimated ) || orig( elem );
  6359. };
  6360. } )( $.expr.filters.animated );
  6361. }
  6362.  
  6363. if ( $.uiBackCompat !== false ) {
  6364. $.extend( $.effects, {
  6365.  
  6366. // Saves a set of properties in a data storage
  6367. save: function( element, set ) {
  6368. var i = 0, length = set.length;
  6369. for ( ; i < length; i++ ) {
  6370. if ( set[ i ] !== null ) {
  6371. element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
  6372. }
  6373. }
  6374. },
  6375.  
  6376. // Restores a set of previously saved properties from a data storage
  6377. restore: function( element, set ) {
  6378. var val, i = 0, length = set.length;
  6379. for ( ; i < length; i++ ) {
  6380. if ( set[ i ] !== null ) {
  6381. val = element.data( dataSpace + set[ i ] );
  6382. element.css( set[ i ], val );
  6383. }
  6384. }
  6385. },
  6386.  
  6387. setMode: function( el, mode ) {
  6388. if ( mode === "toggle" ) {
  6389. mode = el.is( ":hidden" ) ? "show" : "hide";
  6390. }
  6391. return mode;
  6392. },
  6393.  
  6394. // Wraps the element around a wrapper that copies position properties
  6395. createWrapper: function( element ) {
  6396.  
  6397. // If the element is already wrapped, return it
  6398. if ( element.parent().is( ".ui-effects-wrapper" ) ) {
  6399. return element.parent();
  6400. }
  6401.  
  6402. // Wrap the element
  6403. var props = {
  6404. width: element.outerWidth( true ),
  6405. height: element.outerHeight( true ),
  6406. "float": element.css( "float" )
  6407. },
  6408. wrapper = $( "<div></div>" )
  6409. .addClass( "ui-effects-wrapper" )
  6410. .css( {
  6411. fontSize: "100%",
  6412. background: "transparent",
  6413. border: "none",
  6414. margin: 0,
  6415. padding: 0
  6416. } ),
  6417.  
  6418. // Store the size in case width/height are defined in % - Fixes #5245
  6419. size = {
  6420. width: element.width(),
  6421. height: element.height()
  6422. },
  6423. active = document.activeElement;
  6424.  
  6425. // Support: Firefox
  6426. // Firefox incorrectly exposes anonymous content
  6427. // https://bugzilla.mozilla.org/show_bug.cgi?id=561664
  6428. try {
  6429. active.id;
  6430. } catch ( e ) {
  6431. active = document.body;
  6432. }
  6433.  
  6434. element.wrap( wrapper );
  6435.  
  6436. // Fixes #7595 - Elements lose focus when wrapped.
  6437. if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
  6438. $( active ).trigger( "focus" );
  6439. }
  6440.  
  6441. // Hotfix for jQuery 1.4 since some change in wrap() seems to actually
  6442. // lose the reference to the wrapped element
  6443. wrapper = element.parent();
  6444.  
  6445. // Transfer positioning properties to the wrapper
  6446. if ( element.css( "position" ) === "static" ) {
  6447. wrapper.css( { position: "relative" } );
  6448. element.css( { position: "relative" } );
  6449. } else {
  6450. $.extend( props, {
  6451. position: element.css( "position" ),
  6452. zIndex: element.css( "z-index" )
  6453. } );
  6454. $.each( [ "top", "left", "bottom", "right" ], function( i, pos ) {
  6455. props[ pos ] = element.css( pos );
  6456. if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
  6457. props[ pos ] = "auto";
  6458. }
  6459. } );
  6460. element.css( {
  6461. position: "relative",
  6462. top: 0,
  6463. left: 0,
  6464. right: "auto",
  6465. bottom: "auto"
  6466. } );
  6467. }
  6468. element.css( size );
  6469.  
  6470. return wrapper.css( props ).show();
  6471. },
  6472.  
  6473. removeWrapper: function( element ) {
  6474. var active = document.activeElement;
  6475.  
  6476. if ( element.parent().is( ".ui-effects-wrapper" ) ) {
  6477. element.parent().replaceWith( element );
  6478.  
  6479. // Fixes #7595 - Elements lose focus when wrapped.
  6480. if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
  6481. $( active ).trigger( "focus" );
  6482. }
  6483. }
  6484.  
  6485. return element;
  6486. }
  6487. } );
  6488. }
  6489.  
  6490. $.extend( $.effects, {
  6491. version: "1.12.1",
  6492.  
  6493. define: function( name, mode, effect ) {
  6494. if ( !effect ) {
  6495. effect = mode;
  6496. mode = "effect";
  6497. }
  6498.  
  6499. $.effects.effect[ name ] = effect;
  6500. $.effects.effect[ name ].mode = mode;
  6501.  
  6502. return effect;
  6503. },
  6504.  
  6505. scaledDimensions: function( element, percent, direction ) {
  6506. if ( percent === 0 ) {
  6507. return {
  6508. height: 0,
  6509. width: 0,
  6510. outerHeight: 0,
  6511. outerWidth: 0
  6512. };
  6513. }
  6514.  
  6515. var x = direction !== "horizontal" ? ( ( percent || 100 ) / 100 ) : 1,
  6516. y = direction !== "vertical" ? ( ( percent || 100 ) / 100 ) : 1;
  6517.  
  6518. return {
  6519. height: element.height() * y,
  6520. width: element.width() * x,
  6521. outerHeight: element.outerHeight() * y,
  6522. outerWidth: element.outerWidth() * x
  6523. };
  6524.  
  6525. },
  6526.  
  6527. clipToBox: function( animation ) {
  6528. return {
  6529. width: animation.clip.right - animation.clip.left,
  6530. height: animation.clip.bottom - animation.clip.top,
  6531. left: animation.clip.left,
  6532. top: animation.clip.top
  6533. };
  6534. },
  6535.  
  6536. // Injects recently queued functions to be first in line (after "inprogress")
  6537. unshift: function( element, queueLength, count ) {
  6538. var queue = element.queue();
  6539.  
  6540. if ( queueLength > 1 ) {
  6541. queue.splice.apply( queue,
  6542. [ 1, 0 ].concat( queue.splice( queueLength, count ) ) );
  6543. }
  6544. element.dequeue();
  6545. },
  6546.  
  6547. saveStyle: function( element ) {
  6548. element.data( dataSpaceStyle, element[ 0 ].style.cssText );
  6549. },
  6550.  
  6551. restoreStyle: function( element ) {
  6552. element[ 0 ].style.cssText = element.data( dataSpaceStyle ) || "";
  6553. element.removeData( dataSpaceStyle );
  6554. },
  6555.  
  6556. mode: function( element, mode ) {
  6557. var hidden = element.is( ":hidden" );
  6558.  
  6559. if ( mode === "toggle" ) {
  6560. mode = hidden ? "show" : "hide";
  6561. }
  6562. if ( hidden ? mode === "hide" : mode === "show" ) {
  6563. mode = "none";
  6564. }
  6565. return mode;
  6566. },
  6567.  
  6568. // Translates a [top,left] array into a baseline value
  6569. getBaseline: function( origin, original ) {
  6570. var y, x;
  6571.  
  6572. switch ( origin[ 0 ] ) {
  6573. case "top":
  6574. y = 0;
  6575. break;
  6576. case "middle":
  6577. y = 0.5;
  6578. break;
  6579. case "bottom":
  6580. y = 1;
  6581. break;
  6582. default:
  6583. y = origin[ 0 ] / original.height;
  6584. }
  6585.  
  6586. switch ( origin[ 1 ] ) {
  6587. case "left":
  6588. x = 0;
  6589. break;
  6590. case "center":
  6591. x = 0.5;
  6592. break;
  6593. case "right":
  6594. x = 1;
  6595. break;
  6596. default:
  6597. x = origin[ 1 ] / original.width;
  6598. }
  6599.  
  6600. return {
  6601. x: x,
  6602. y: y
  6603. };
  6604. },
  6605.  
  6606. // Creates a placeholder element so that the original element can be made absolute
  6607. createPlaceholder: function( element ) {
  6608. var placeholder,
  6609. cssPosition = element.css( "position" ),
  6610. position = element.position();
  6611.  
  6612. // Lock in margins first to account for form elements, which
  6613. // will change margin if you explicitly set height
  6614. // see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380
  6615. // Support: Safari
  6616. element.css( {
  6617. marginTop: element.css( "marginTop" ),
  6618. marginBottom: element.css( "marginBottom" ),
  6619. marginLeft: element.css( "marginLeft" ),
  6620. marginRight: element.css( "marginRight" )
  6621. } )
  6622. .outerWidth( element.outerWidth() )
  6623. .outerHeight( element.outerHeight() );
  6624.  
  6625. if ( /^(static|relative)/.test( cssPosition ) ) {
  6626. cssPosition = "absolute";
  6627.  
  6628. placeholder = $( "<" + element[ 0 ].nodeName + ">" ).insertAfter( element ).css( {
  6629.  
  6630. // Convert inline to inline block to account for inline elements
  6631. // that turn to inline block based on content (like img)
  6632. display: /^(inline|ruby)/.test( element.css( "display" ) ) ?
  6633. "inline-block" :
  6634. "block",
  6635. visibility: "hidden",
  6636.  
  6637. // Margins need to be set to account for margin collapse
  6638. marginTop: element.css( "marginTop" ),
  6639. marginBottom: element.css( "marginBottom" ),
  6640. marginLeft: element.css( "marginLeft" ),
  6641. marginRight: element.css( "marginRight" ),
  6642. "float": element.css( "float" )
  6643. } )
  6644. .outerWidth( element.outerWidth() )
  6645. .outerHeight( element.outerHeight() )
  6646. .addClass( "ui-effects-placeholder" );
  6647.  
  6648. element.data( dataSpace + "placeholder", placeholder );
  6649. }
  6650.  
  6651. element.css( {
  6652. position: cssPosition,
  6653. left: position.left,
  6654. top: position.top
  6655. } );
  6656.  
  6657. return placeholder;
  6658. },
  6659.  
  6660. removePlaceholder: function( element ) {
  6661. var dataKey = dataSpace + "placeholder",
  6662. placeholder = element.data( dataKey );
  6663.  
  6664. if ( placeholder ) {
  6665. placeholder.remove();
  6666. element.removeData( dataKey );
  6667. }
  6668. },
  6669.  
  6670. // Removes a placeholder if it exists and restores
  6671. // properties that were modified during placeholder creation
  6672. cleanUp: function( element ) {
  6673. $.effects.restoreStyle( element );
  6674. $.effects.removePlaceholder( element );
  6675. },
  6676.  
  6677. setTransition: function( element, list, factor, value ) {
  6678. value = value || {};
  6679. $.each( list, function( i, x ) {
  6680. var unit = element.cssUnit( x );
  6681. if ( unit[ 0 ] > 0 ) {
  6682. value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
  6683. }
  6684. } );
  6685. return value;
  6686. }
  6687. } );
  6688.  
  6689. // Return an effect options object for the given parameters:
  6690. function _normalizeArguments( effect, options, speed, callback ) {
  6691.  
  6692. // Allow passing all options as the first parameter
  6693. if ( $.isPlainObject( effect ) ) {
  6694. options = effect;
  6695. effect = effect.effect;
  6696. }
  6697.  
  6698. // Convert to an object
  6699. effect = { effect: effect };
  6700.  
  6701. // Catch (effect, null, ...)
  6702. if ( options == null ) {
  6703. options = {};
  6704. }
  6705.  
  6706. // Catch (effect, callback)
  6707. if ( $.isFunction( options ) ) {
  6708. callback = options;
  6709. speed = null;
  6710. options = {};
  6711. }
  6712.  
  6713. // Catch (effect, speed, ?)
  6714. if ( typeof options === "number" || $.fx.speeds[ options ] ) {
  6715. callback = speed;
  6716. speed = options;
  6717. options = {};
  6718. }
  6719.  
  6720. // Catch (effect, options, callback)
  6721. if ( $.isFunction( speed ) ) {
  6722. callback = speed;
  6723. speed = null;
  6724. }
  6725.  
  6726. // Add options to effect
  6727. if ( options ) {
  6728. $.extend( effect, options );
  6729. }
  6730.  
  6731. speed = speed || options.duration;
  6732. effect.duration = $.fx.off ? 0 :
  6733. typeof speed === "number" ? speed :
  6734. speed in $.fx.speeds ? $.fx.speeds[ speed ] :
  6735. $.fx.speeds._default;
  6736.  
  6737. effect.complete = callback || options.complete;
  6738.  
  6739. return effect;
  6740. }
  6741.  
  6742. function standardAnimationOption( option ) {
  6743.  
  6744. // Valid standard speeds (nothing, number, named speed)
  6745. if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) {
  6746. return true;
  6747. }
  6748.  
  6749. // Invalid strings - treat as "normal" speed
  6750. if ( typeof option === "string" && !$.effects.effect[ option ] ) {
  6751. return true;
  6752. }
  6753.  
  6754. // Complete callback
  6755. if ( $.isFunction( option ) ) {
  6756. return true;
  6757. }
  6758.  
  6759. // Options hash (but not naming an effect)
  6760. if ( typeof option === "object" && !option.effect ) {
  6761. return true;
  6762. }
  6763.  
  6764. // Didn't match any standard API
  6765. return false;
  6766. }
  6767.  
  6768. $.fn.extend( {
  6769. effect: function( /* effect, options, speed, callback */ ) {
  6770. var args = _normalizeArguments.apply( this, arguments ),
  6771. effectMethod = $.effects.effect[ args.effect ],
  6772. defaultMode = effectMethod.mode,
  6773. queue = args.queue,
  6774. queueName = queue || "fx",
  6775. complete = args.complete,
  6776. mode = args.mode,
  6777. modes = [],
  6778. prefilter = function( next ) {
  6779. var el = $( this ),
  6780. normalizedMode = $.effects.mode( el, mode ) || defaultMode;
  6781.  
  6782. // Sentinel for duck-punching the :animated psuedo-selector
  6783. el.data( dataSpaceAnimated, true );
  6784.  
  6785. // Save effect mode for later use,
  6786. // we can't just call $.effects.mode again later,
  6787. // as the .show() below destroys the initial state
  6788. modes.push( normalizedMode );
  6789.  
  6790. // See $.uiBackCompat inside of run() for removal of defaultMode in 1.13
  6791. if ( defaultMode && ( normalizedMode === "show" ||
  6792. ( normalizedMode === defaultMode && normalizedMode === "hide" ) ) ) {
  6793. el.show();
  6794. }
  6795.  
  6796. if ( !defaultMode || normalizedMode !== "none" ) {
  6797. $.effects.saveStyle( el );
  6798. }
  6799.  
  6800. if ( $.isFunction( next ) ) {
  6801. next();
  6802. }
  6803. };
  6804.  
  6805. if ( $.fx.off || !effectMethod ) {
  6806.  
  6807. // Delegate to the original method (e.g., .show()) if possible
  6808. if ( mode ) {
  6809. return this[ mode ]( args.duration, complete );
  6810. } else {
  6811. return this.each( function() {
  6812. if ( complete ) {
  6813. complete.call( this );
  6814. }
  6815. } );
  6816. }
  6817. }
  6818.  
  6819. function run( next ) {
  6820. var elem = $( this );
  6821.  
  6822. function cleanup() {
  6823. elem.removeData( dataSpaceAnimated );
  6824.  
  6825. $.effects.cleanUp( elem );
  6826.  
  6827. if ( args.mode === "hide" ) {
  6828. elem.hide();
  6829. }
  6830.  
  6831. done();
  6832. }
  6833.  
  6834. function done() {
  6835. if ( $.isFunction( complete ) ) {
  6836. complete.call( elem[ 0 ] );
  6837. }
  6838.  
  6839. if ( $.isFunction( next ) ) {
  6840. next();
  6841. }
  6842. }
  6843.  
  6844. // Override mode option on a per element basis,
  6845. // as toggle can be either show or hide depending on element state
  6846. args.mode = modes.shift();
  6847.  
  6848. if ( $.uiBackCompat !== false && !defaultMode ) {
  6849. if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
  6850.  
  6851. // Call the core method to track "olddisplay" properly
  6852. elem[ mode ]();
  6853. done();
  6854. } else {
  6855. effectMethod.call( elem[ 0 ], args, done );
  6856. }
  6857. } else {
  6858. if ( args.mode === "none" ) {
  6859.  
  6860. // Call the core method to track "olddisplay" properly
  6861. elem[ mode ]();
  6862. done();
  6863. } else {
  6864. effectMethod.call( elem[ 0 ], args, cleanup );
  6865. }
  6866. }
  6867. }
  6868.  
  6869. // Run prefilter on all elements first to ensure that
  6870. // any showing or hiding happens before placeholder creation,
  6871. // which ensures that any layout changes are correctly captured.
  6872. return queue === false ?
  6873. this.each( prefilter ).each( run ) :
  6874. this.queue( queueName, prefilter ).queue( queueName, run );
  6875. },
  6876.  
  6877. show: ( function( orig ) {
  6878. return function( option ) {
  6879. if ( standardAnimationOption( option ) ) {
  6880. return orig.apply( this, arguments );
  6881. } else {
  6882. var args = _normalizeArguments.apply( this, arguments );
  6883. args.mode = "show";
  6884. return this.effect.call( this, args );
  6885. }
  6886. };
  6887. } )( $.fn.show ),
  6888.  
  6889. hide: ( function( orig ) {
  6890. return function( option ) {
  6891. if ( standardAnimationOption( option ) ) {
  6892. return orig.apply( this, arguments );
  6893. } else {
  6894. var args = _normalizeArguments.apply( this, arguments );
  6895. args.mode = "hide";
  6896. return this.effect.call( this, args );
  6897. }
  6898. };
  6899. } )( $.fn.hide ),
  6900.  
  6901. toggle: ( function( orig ) {
  6902. return function( option ) {
  6903. if ( standardAnimationOption( option ) || typeof option === "boolean" ) {
  6904. return orig.apply( this, arguments );
  6905. } else {
  6906. var args = _normalizeArguments.apply( this, arguments );
  6907. args.mode = "toggle";
  6908. return this.effect.call( this, args );
  6909. }
  6910. };
  6911. } )( $.fn.toggle ),
  6912.  
  6913. cssUnit: function( key ) {
  6914. var style = this.css( key ),
  6915. val = [];
  6916.  
  6917. $.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
  6918. if ( style.indexOf( unit ) > 0 ) {
  6919. val = [ parseFloat( style ), unit ];
  6920. }
  6921. } );
  6922. return val;
  6923. },
  6924.  
  6925. cssClip: function( clipObj ) {
  6926. if ( clipObj ) {
  6927. return this.css( "clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " +
  6928. clipObj.bottom + "px " + clipObj.left + "px)" );
  6929. }
  6930. return parseClip( this.css( "clip" ), this );
  6931. },
  6932.  
  6933. transfer: function( options, done ) {
  6934. var element = $( this ),
  6935. target = $( options.to ),
  6936. targetFixed = target.css( "position" ) === "fixed",
  6937. body = $( "body" ),
  6938. fixTop = targetFixed ? body.scrollTop() : 0,
  6939. fixLeft = targetFixed ? body.scrollLeft() : 0,
  6940. endPosition = target.offset(),
  6941. animation = {
  6942. top: endPosition.top - fixTop,
  6943. left: endPosition.left - fixLeft,
  6944. height: target.innerHeight(),
  6945. width: target.innerWidth()
  6946. },
  6947. startPosition = element.offset(),
  6948. transfer = $( "<div class='ui-effects-transfer'></div>" )
  6949. .appendTo( "body" )
  6950. .addClass( options.className )
  6951. .css( {
  6952. top: startPosition.top - fixTop,
  6953. left: startPosition.left - fixLeft,
  6954. height: element.innerHeight(),
  6955. width: element.innerWidth(),
  6956. position: targetFixed ? "fixed" : "absolute"
  6957. } )
  6958. .animate( animation, options.duration, options.easing, function() {
  6959. transfer.remove();
  6960. if ( $.isFunction( done ) ) {
  6961. done();
  6962. }
  6963. } );
  6964. }
  6965. } );
  6966.  
  6967. function parseClip( str, element ) {
  6968. var outerWidth = element.outerWidth(),
  6969. outerHeight = element.outerHeight(),
  6970. clipRegex = /^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/,
  6971. values = clipRegex.exec( str ) || [ "", 0, outerWidth, outerHeight, 0 ];
  6972.  
  6973. return {
  6974. top: parseFloat( values[ 1 ] ) || 0,
  6975. right: values[ 2 ] === "auto" ? outerWidth : parseFloat( values[ 2 ] ),
  6976. bottom: values[ 3 ] === "auto" ? outerHeight : parseFloat( values[ 3 ] ),
  6977. left: parseFloat( values[ 4 ] ) || 0
  6978. };
  6979. }
  6980.  
  6981. $.fx.step.clip = function( fx ) {
  6982. if ( !fx.clipInit ) {
  6983. fx.start = $( fx.elem ).cssClip();
  6984. if ( typeof fx.end === "string" ) {
  6985. fx.end = parseClip( fx.end, fx.elem );
  6986. }
  6987. fx.clipInit = true;
  6988. }
  6989.  
  6990. $( fx.elem ).cssClip( {
  6991. top: fx.pos * ( fx.end.top - fx.start.top ) + fx.start.top,
  6992. right: fx.pos * ( fx.end.right - fx.start.right ) + fx.start.right,
  6993. bottom: fx.pos * ( fx.end.bottom - fx.start.bottom ) + fx.start.bottom,
  6994. left: fx.pos * ( fx.end.left - fx.start.left ) + fx.start.left
  6995. } );
  6996. };
  6997.  
  6998. } )();
  6999.  
  7000. /******************************************************************************/
  7001. /*********************************** EASING ***********************************/
  7002. /******************************************************************************/
  7003.  
  7004. ( function() {
  7005.  
  7006. // Based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
  7007.  
  7008. var baseEasings = {};
  7009.  
  7010. $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
  7011. baseEasings[ name ] = function( p ) {
  7012. return Math.pow( p, i + 2 );
  7013. };
  7014. } );
  7015.  
  7016. $.extend( baseEasings, {
  7017. Sine: function( p ) {
  7018. return 1 - Math.cos( p * Math.PI / 2 );
  7019. },
  7020. Circ: function( p ) {
  7021. return 1 - Math.sqrt( 1 - p * p );
  7022. },
  7023. Elastic: function( p ) {
  7024. return p === 0 || p === 1 ? p :
  7025. -Math.pow( 2, 8 * ( p - 1 ) ) * Math.sin( ( ( p - 1 ) * 80 - 7.5 ) * Math.PI / 15 );
  7026. },
  7027. Back: function( p ) {
  7028. return p * p * ( 3 * p - 2 );
  7029. },
  7030. Bounce: function( p ) {
  7031. var pow2,
  7032. bounce = 4;
  7033.  
  7034. while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
  7035. return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
  7036. }
  7037. } );
  7038.  
  7039. $.each( baseEasings, function( name, easeIn ) {
  7040. $.easing[ "easeIn" + name ] = easeIn;
  7041. $.easing[ "easeOut" + name ] = function( p ) {
  7042. return 1 - easeIn( 1 - p );
  7043. };
  7044. $.easing[ "easeInOut" + name ] = function( p ) {
  7045. return p < 0.5 ?
  7046. easeIn( p * 2 ) / 2 :
  7047. 1 - easeIn( p * -2 + 2 ) / 2;
  7048. };
  7049. } );
  7050.  
  7051. } )();
  7052.  
  7053. var effect = $.effects;
  7054.  
  7055.  
  7056. /*!
  7057. * jQuery UI Effects Size 1.12.1
  7058. * http://jqueryui.com
  7059. *
  7060. * Copyright jQuery Foundation and other contributors
  7061. * Released under the MIT license.
  7062. * http://jquery.org/license
  7063. */
  7064.  
  7065. //>>label: Size Effect
  7066. //>>group: Effects
  7067. //>>description: Resize an element to a specified width and height.
  7068. //>>docs: http://api.jqueryui.com/size-effect/
  7069. //>>demos: http://jqueryui.com/effect/
  7070.  
  7071.  
  7072.  
  7073. var effectsEffectSize = $.effects.define( "size", function( options, done ) {
  7074.  
  7075. // Create element
  7076. var baseline, factor, temp,
  7077. element = $( this ),
  7078.  
  7079. // Copy for children
  7080. cProps = [ "fontSize" ],
  7081. vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
  7082. hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
  7083.  
  7084. // Set options
  7085. mode = options.mode,
  7086. restore = mode !== "effect",
  7087. scale = options.scale || "both",
  7088. origin = options.origin || [ "middle", "center" ],
  7089. position = element.css( "position" ),
  7090. pos = element.position(),
  7091. original = $.effects.scaledDimensions( element ),
  7092. from = options.from || original,
  7093. to = options.to || $.effects.scaledDimensions( element, 0 );
  7094.  
  7095. $.effects.createPlaceholder( element );
  7096.  
  7097. if ( mode === "show" ) {
  7098. temp = from;
  7099. from = to;
  7100. to = temp;
  7101. }
  7102.  
  7103. // Set scaling factor
  7104. factor = {
  7105. from: {
  7106. y: from.height / original.height,
  7107. x: from.width / original.width
  7108. },
  7109. to: {
  7110. y: to.height / original.height,
  7111. x: to.width / original.width
  7112. }
  7113. };
  7114.  
  7115. // Scale the css box
  7116. if ( scale === "box" || scale === "both" ) {
  7117.  
  7118. // Vertical props scaling
  7119. if ( factor.from.y !== factor.to.y ) {
  7120. from = $.effects.setTransition( element, vProps, factor.from.y, from );
  7121. to = $.effects.setTransition( element, vProps, factor.to.y, to );
  7122. }
  7123.  
  7124. // Horizontal props scaling
  7125. if ( factor.from.x !== factor.to.x ) {
  7126. from = $.effects.setTransition( element, hProps, factor.from.x, from );
  7127. to = $.effects.setTransition( element, hProps, factor.to.x, to );
  7128. }
  7129. }
  7130.  
  7131. // Scale the content
  7132. if ( scale === "content" || scale === "both" ) {
  7133.  
  7134. // Vertical props scaling
  7135. if ( factor.from.y !== factor.to.y ) {
  7136. from = $.effects.setTransition( element, cProps, factor.from.y, from );
  7137. to = $.effects.setTransition( element, cProps, factor.to.y, to );
  7138. }
  7139. }
  7140.  
  7141. // Adjust the position properties based on the provided origin points
  7142. if ( origin ) {
  7143. baseline = $.effects.getBaseline( origin, original );
  7144. from.top = ( original.outerHeight - from.outerHeight ) * baseline.y + pos.top;
  7145. from.left = ( original.outerWidth - from.outerWidth ) * baseline.x + pos.left;
  7146. to.top = ( original.outerHeight - to.outerHeight ) * baseline.y + pos.top;
  7147. to.left = ( original.outerWidth - to.outerWidth ) * baseline.x + pos.left;
  7148. }
  7149. element.css( from );
  7150.  
  7151. // Animate the children if desired
  7152. if ( scale === "content" || scale === "both" ) {
  7153.  
  7154. vProps = vProps.concat( [ "marginTop", "marginBottom" ] ).concat( cProps );
  7155. hProps = hProps.concat( [ "marginLeft", "marginRight" ] );
  7156.  
  7157. // Only animate children with width attributes specified
  7158. // TODO: is this right? should we include anything with css width specified as well
  7159. element.find( "*[width]" ).each( function() {
  7160. var child = $( this ),
  7161. childOriginal = $.effects.scaledDimensions( child ),
  7162. childFrom = {
  7163. height: childOriginal.height * factor.from.y,
  7164. width: childOriginal.width * factor.from.x,
  7165. outerHeight: childOriginal.outerHeight * factor.from.y,
  7166. outerWidth: childOriginal.outerWidth * factor.from.x
  7167. },
  7168. childTo = {
  7169. height: childOriginal.height * factor.to.y,
  7170. width: childOriginal.width * factor.to.x,
  7171. outerHeight: childOriginal.height * factor.to.y,
  7172. outerWidth: childOriginal.width * factor.to.x
  7173. };
  7174.  
  7175. // Vertical props scaling
  7176. if ( factor.from.y !== factor.to.y ) {
  7177. childFrom = $.effects.setTransition( child, vProps, factor.from.y, childFrom );
  7178. childTo = $.effects.setTransition( child, vProps, factor.to.y, childTo );
  7179. }
  7180.  
  7181. // Horizontal props scaling
  7182. if ( factor.from.x !== factor.to.x ) {
  7183. childFrom = $.effects.setTransition( child, hProps, factor.from.x, childFrom );
  7184. childTo = $.effects.setTransition( child, hProps, factor.to.x, childTo );
  7185. }
  7186.  
  7187. if ( restore ) {
  7188. $.effects.saveStyle( child );
  7189. }
  7190.  
  7191. // Animate children
  7192. child.css( childFrom );
  7193. child.animate( childTo, options.duration, options.easing, function() {
  7194.  
  7195. // Restore children
  7196. if ( restore ) {
  7197. $.effects.restoreStyle( child );
  7198. }
  7199. } );
  7200. } );
  7201. }
  7202.  
  7203. // Animate
  7204. element.animate( to, {
  7205. queue: false,
  7206. duration: options.duration,
  7207. easing: options.easing,
  7208. complete: function() {
  7209.  
  7210. var offset = element.offset();
  7211.  
  7212. if ( to.opacity === 0 ) {
  7213. element.css( "opacity", from.opacity );
  7214. }
  7215.  
  7216. if ( !restore ) {
  7217. element
  7218. .css( "position", position === "static" ? "relative" : position )
  7219. .offset( offset );
  7220.  
  7221. // Need to save style here so that automatic style restoration
  7222. // doesn't restore to the original styles from before the animation.
  7223. $.effects.saveStyle( element );
  7224. }
  7225.  
  7226. done();
  7227. }
  7228. } );
  7229.  
  7230. } );
  7231.  
  7232.  
  7233. /*!
  7234. * jQuery UI Effects Scale 1.12.1
  7235. * http://jqueryui.com
  7236. *
  7237. * Copyright jQuery Foundation and other contributors
  7238. * Released under the MIT license.
  7239. * http://jquery.org/license
  7240. */
  7241.  
  7242. //>>label: Scale Effect
  7243. //>>group: Effects
  7244. //>>description: Grows or shrinks an element and its content.
  7245. //>>docs: http://api.jqueryui.com/scale-effect/
  7246. //>>demos: http://jqueryui.com/effect/
  7247.  
  7248.  
  7249.  
  7250. var effectsEffectScale = $.effects.define( "scale", function( options, done ) {
  7251.  
  7252. // Create element
  7253. var el = $( this ),
  7254. mode = options.mode,
  7255. percent = parseInt( options.percent, 10 ) ||
  7256. ( parseInt( options.percent, 10 ) === 0 ? 0 : ( mode !== "effect" ? 0 : 100 ) ),
  7257.  
  7258. newOptions = $.extend( true, {
  7259. from: $.effects.scaledDimensions( el ),
  7260. to: $.effects.scaledDimensions( el, percent, options.direction || "both" ),
  7261. origin: options.origin || [ "middle", "center" ]
  7262. }, options );
  7263.  
  7264. // Fade option to support puff
  7265. if ( options.fade ) {
  7266. newOptions.from.opacity = 1;
  7267. newOptions.to.opacity = 0;
  7268. }
  7269.  
  7270. $.effects.effect.size.call( this, newOptions, done );
  7271. } );
  7272.  
  7273.  
  7274.  
  7275.  
  7276. }));