You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18718 line
1.4MB

  1. (self["webpackChunk"] = self["webpackChunk"] || []).push([["vendors-node_modules_jquery-ui-dist_jquery-ui_js"],{
  2. /***/ "./node_modules/jquery-ui-dist/jquery-ui.js":
  3. /*!**************************************************!*\
  4. !*** ./node_modules/jquery-ui-dist/jquery-ui.js ***!
  5. \**************************************************/
  6. /***/ ((module, exports, __webpack_require__) => {
  7. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! jQuery UI - v1.12.1 - 2016-09-14
  8. * http://jqueryui.com
  9. * Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-1-7.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js
  10. * Copyright jQuery Foundation and other contributors; Licensed MIT */
  11. (function( factory ) {
  12. if ( true ) {
  13. // AMD. Register as an anonymous module.
  14. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(/*! jquery */ "./node_modules/jquery/src/jquery.js") ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  15. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  16. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  17. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  18. } else {}
  19. }(function( $ ) {
  20. $.ui = $.ui || {};
  21. var version = $.ui.version = "1.12.1";
  22. /*!
  23. * jQuery UI Widget 1.12.1
  24. * http://jqueryui.com
  25. *
  26. * Copyright jQuery Foundation and other contributors
  27. * Released under the MIT license.
  28. * http://jquery.org/license
  29. */
  30. //>>label: Widget
  31. //>>group: Core
  32. //>>description: Provides a factory for creating stateful widgets with a common API.
  33. //>>docs: http://api.jqueryui.com/jQuery.widget/
  34. //>>demos: http://jqueryui.com/widget/
  35. var widgetUuid = 0;
  36. var widgetSlice = Array.prototype.slice;
  37. $.cleanData = ( function( orig ) {
  38. return function( elems ) {
  39. var events, elem, i;
  40. for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {
  41. try {
  42. // Only trigger remove when necessary to save time
  43. events = $._data( elem, "events" );
  44. if ( events && events.remove ) {
  45. $( elem ).triggerHandler( "remove" );
  46. }
  47. // Http://bugs.jquery.com/ticket/8235
  48. } catch ( e ) {}
  49. }
  50. orig( elems );
  51. };
  52. } )( $.cleanData );
  53. $.widget = function( name, base, prototype ) {
  54. var existingConstructor, constructor, basePrototype;
  55. // ProxiedPrototype allows the provided prototype to remain unmodified
  56. // so that it can be used as a mixin for multiple widgets (#8876)
  57. var proxiedPrototype = {};
  58. var namespace = name.split( "." )[ 0 ];
  59. name = name.split( "." )[ 1 ];
  60. var fullName = namespace + "-" + name;
  61. if ( !prototype ) {
  62. prototype = base;
  63. base = $.Widget;
  64. }
  65. if ( $.isArray( prototype ) ) {
  66. prototype = $.extend.apply( null, [ {} ].concat( prototype ) );
  67. }
  68. // Create selector for plugin
  69. $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
  70. return !!$.data( elem, fullName );
  71. };
  72. $[ namespace ] = $[ namespace ] || {};
  73. existingConstructor = $[ namespace ][ name ];
  74. constructor = $[ namespace ][ name ] = function( options, element ) {
  75. // Allow instantiation without "new" keyword
  76. if ( !this._createWidget ) {
  77. return new constructor( options, element );
  78. }
  79. // Allow instantiation without initializing for simple inheritance
  80. // must use "new" keyword (the code above always passes args)
  81. if ( arguments.length ) {
  82. this._createWidget( options, element );
  83. }
  84. };
  85. // Extend with the existing constructor to carry over any static properties
  86. $.extend( constructor, existingConstructor, {
  87. version: prototype.version,
  88. // Copy the object used to create the prototype in case we need to
  89. // redefine the widget later
  90. _proto: $.extend( {}, prototype ),
  91. // Track widgets that inherit from this widget in case this widget is
  92. // redefined after a widget inherits from it
  93. _childConstructors: []
  94. } );
  95. basePrototype = new base();
  96. // We need to make the options hash a property directly on the new instance
  97. // otherwise we'll modify the options hash on the prototype that we're
  98. // inheriting from
  99. basePrototype.options = $.widget.extend( {}, basePrototype.options );
  100. $.each( prototype, function( prop, value ) {
  101. if ( !$.isFunction( value ) ) {
  102. proxiedPrototype[ prop ] = value;
  103. return;
  104. }
  105. proxiedPrototype[ prop ] = ( function() {
  106. function _super() {
  107. return base.prototype[ prop ].apply( this, arguments );
  108. }
  109. function _superApply( args ) {
  110. return base.prototype[ prop ].apply( this, args );
  111. }
  112. return function() {
  113. var __super = this._super;
  114. var __superApply = this._superApply;
  115. var returnValue;
  116. this._super = _super;
  117. this._superApply = _superApply;
  118. returnValue = value.apply( this, arguments );
  119. this._super = __super;
  120. this._superApply = __superApply;
  121. return returnValue;
  122. };
  123. } )();
  124. } );
  125. constructor.prototype = $.widget.extend( basePrototype, {
  126. // TODO: remove support for widgetEventPrefix
  127. // always use the name + a colon as the prefix, e.g., draggable:start
  128. // don't prefix for widgets that aren't DOM-based
  129. widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name
  130. }, proxiedPrototype, {
  131. constructor: constructor,
  132. namespace: namespace,
  133. widgetName: name,
  134. widgetFullName: fullName
  135. } );
  136. // If this widget is being redefined then we need to find all widgets that
  137. // are inheriting from it and redefine all of them so that they inherit from
  138. // the new version of this widget. We're essentially trying to replace one
  139. // level in the prototype chain.
  140. if ( existingConstructor ) {
  141. $.each( existingConstructor._childConstructors, function( i, child ) {
  142. var childPrototype = child.prototype;
  143. // Redefine the child widget using the same prototype that was
  144. // originally used, but inherit from the new version of the base
  145. $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor,
  146. child._proto );
  147. } );
  148. // Remove the list of existing child constructors from the old constructor
  149. // so the old child constructors can be garbage collected
  150. delete existingConstructor._childConstructors;
  151. } else {
  152. base._childConstructors.push( constructor );
  153. }
  154. $.widget.bridge( name, constructor );
  155. return constructor;
  156. };
  157. $.widget.extend = function( target ) {
  158. var input = widgetSlice.call( arguments, 1 );
  159. var inputIndex = 0;
  160. var inputLength = input.length;
  161. var key;
  162. var value;
  163. for ( ; inputIndex < inputLength; inputIndex++ ) {
  164. for ( key in input[ inputIndex ] ) {
  165. value = input[ inputIndex ][ key ];
  166. if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
  167. // Clone objects
  168. if ( $.isPlainObject( value ) ) {
  169. target[ key ] = $.isPlainObject( target[ key ] ) ?
  170. $.widget.extend( {}, target[ key ], value ) :
  171. // Don't extend strings, arrays, etc. with objects
  172. $.widget.extend( {}, value );
  173. // Copy everything else by reference
  174. } else {
  175. target[ key ] = value;
  176. }
  177. }
  178. }
  179. }
  180. return target;
  181. };
  182. $.widget.bridge = function( name, object ) {
  183. var fullName = object.prototype.widgetFullName || name;
  184. $.fn[ name ] = function( options ) {
  185. var isMethodCall = typeof options === "string";
  186. var args = widgetSlice.call( arguments, 1 );
  187. var returnValue = this;
  188. if ( isMethodCall ) {
  189. // If this is an empty collection, we need to have the instance method
  190. // return undefined instead of the jQuery instance
  191. if ( !this.length && options === "instance" ) {
  192. returnValue = undefined;
  193. } else {
  194. this.each( function() {
  195. var methodValue;
  196. var instance = $.data( this, fullName );
  197. if ( options === "instance" ) {
  198. returnValue = instance;
  199. return false;
  200. }
  201. if ( !instance ) {
  202. return $.error( "cannot call methods on " + name +
  203. " prior to initialization; " +
  204. "attempted to call method '" + options + "'" );
  205. }
  206. if ( !$.isFunction( instance[ options ] ) || options.charAt( 0 ) === "_" ) {
  207. return $.error( "no such method '" + options + "' for " + name +
  208. " widget instance" );
  209. }
  210. methodValue = instance[ options ].apply( instance, args );
  211. if ( methodValue !== instance && methodValue !== undefined ) {
  212. returnValue = methodValue && methodValue.jquery ?
  213. returnValue.pushStack( methodValue.get() ) :
  214. methodValue;
  215. return false;
  216. }
  217. } );
  218. }
  219. } else {
  220. // Allow multiple hashes to be passed on init
  221. if ( args.length ) {
  222. options = $.widget.extend.apply( null, [ options ].concat( args ) );
  223. }
  224. this.each( function() {
  225. var instance = $.data( this, fullName );
  226. if ( instance ) {
  227. instance.option( options || {} );
  228. if ( instance._init ) {
  229. instance._init();
  230. }
  231. } else {
  232. $.data( this, fullName, new object( options, this ) );
  233. }
  234. } );
  235. }
  236. return returnValue;
  237. };
  238. };
  239. $.Widget = function( /* options, element */ ) {};
  240. $.Widget._childConstructors = [];
  241. $.Widget.prototype = {
  242. widgetName: "widget",
  243. widgetEventPrefix: "",
  244. defaultElement: "<div>",
  245. options: {
  246. classes: {},
  247. disabled: false,
  248. // Callbacks
  249. create: null
  250. },
  251. _createWidget: function( options, element ) {
  252. element = $( element || this.defaultElement || this )[ 0 ];
  253. this.element = $( element );
  254. this.uuid = widgetUuid++;
  255. this.eventNamespace = "." + this.widgetName + this.uuid;
  256. this.bindings = $();
  257. this.hoverable = $();
  258. this.focusable = $();
  259. this.classesElementLookup = {};
  260. if ( element !== this ) {
  261. $.data( element, this.widgetFullName, this );
  262. this._on( true, this.element, {
  263. remove: function( event ) {
  264. if ( event.target === element ) {
  265. this.destroy();
  266. }
  267. }
  268. } );
  269. this.document = $( element.style ?
  270. // Element within the document
  271. element.ownerDocument :
  272. // Element is window or document
  273. element.document || element );
  274. this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow );
  275. }
  276. this.options = $.widget.extend( {},
  277. this.options,
  278. this._getCreateOptions(),
  279. options );
  280. this._create();
  281. if ( this.options.disabled ) {
  282. this._setOptionDisabled( this.options.disabled );
  283. }
  284. this._trigger( "create", null, this._getCreateEventData() );
  285. this._init();
  286. },
  287. _getCreateOptions: function() {
  288. return {};
  289. },
  290. _getCreateEventData: $.noop,
  291. _create: $.noop,
  292. _init: $.noop,
  293. destroy: function() {
  294. var that = this;
  295. this._destroy();
  296. $.each( this.classesElementLookup, function( key, value ) {
  297. that._removeClass( value, key );
  298. } );
  299. // We can probably remove the unbind calls in 2.0
  300. // all event bindings should go through this._on()
  301. this.element
  302. .off( this.eventNamespace )
  303. .removeData( this.widgetFullName );
  304. this.widget()
  305. .off( this.eventNamespace )
  306. .removeAttr( "aria-disabled" );
  307. // Clean up events and states
  308. this.bindings.off( this.eventNamespace );
  309. },
  310. _destroy: $.noop,
  311. widget: function() {
  312. return this.element;
  313. },
  314. option: function( key, value ) {
  315. var options = key;
  316. var parts;
  317. var curOption;
  318. var i;
  319. if ( arguments.length === 0 ) {
  320. // Don't return a reference to the internal hash
  321. return $.widget.extend( {}, this.options );
  322. }
  323. if ( typeof key === "string" ) {
  324. // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
  325. options = {};
  326. parts = key.split( "." );
  327. key = parts.shift();
  328. if ( parts.length ) {
  329. curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
  330. for ( i = 0; i < parts.length - 1; i++ ) {
  331. curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
  332. curOption = curOption[ parts[ i ] ];
  333. }
  334. key = parts.pop();
  335. if ( arguments.length === 1 ) {
  336. return curOption[ key ] === undefined ? null : curOption[ key ];
  337. }
  338. curOption[ key ] = value;
  339. } else {
  340. if ( arguments.length === 1 ) {
  341. return this.options[ key ] === undefined ? null : this.options[ key ];
  342. }
  343. options[ key ] = value;
  344. }
  345. }
  346. this._setOptions( options );
  347. return this;
  348. },
  349. _setOptions: function( options ) {
  350. var key;
  351. for ( key in options ) {
  352. this._setOption( key, options[ key ] );
  353. }
  354. return this;
  355. },
  356. _setOption: function( key, value ) {
  357. if ( key === "classes" ) {
  358. this._setOptionClasses( value );
  359. }
  360. this.options[ key ] = value;
  361. if ( key === "disabled" ) {
  362. this._setOptionDisabled( value );
  363. }
  364. return this;
  365. },
  366. _setOptionClasses: function( value ) {
  367. var classKey, elements, currentElements;
  368. for ( classKey in value ) {
  369. currentElements = this.classesElementLookup[ classKey ];
  370. if ( value[ classKey ] === this.options.classes[ classKey ] ||
  371. !currentElements ||
  372. !currentElements.length ) {
  373. continue;
  374. }
  375. // We are doing this to create a new jQuery object because the _removeClass() call
  376. // on the next line is going to destroy the reference to the current elements being
  377. // tracked. We need to save a copy of this collection so that we can add the new classes
  378. // below.
  379. elements = $( currentElements.get() );
  380. this._removeClass( currentElements, classKey );
  381. // We don't use _addClass() here, because that uses this.options.classes
  382. // for generating the string of classes. We want to use the value passed in from
  383. // _setOption(), this is the new value of the classes option which was passed to
  384. // _setOption(). We pass this value directly to _classes().
  385. elements.addClass( this._classes( {
  386. element: elements,
  387. keys: classKey,
  388. classes: value,
  389. add: true
  390. } ) );
  391. }
  392. },
  393. _setOptionDisabled: function( value ) {
  394. this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value );
  395. // If the widget is becoming disabled, then nothing is interactive
  396. if ( value ) {
  397. this._removeClass( this.hoverable, null, "ui-state-hover" );
  398. this._removeClass( this.focusable, null, "ui-state-focus" );
  399. }
  400. },
  401. enable: function() {
  402. return this._setOptions( { disabled: false } );
  403. },
  404. disable: function() {
  405. return this._setOptions( { disabled: true } );
  406. },
  407. _classes: function( options ) {
  408. var full = [];
  409. var that = this;
  410. options = $.extend( {
  411. element: this.element,
  412. classes: this.options.classes || {}
  413. }, options );
  414. function processClassString( classes, checkOption ) {
  415. var current, i;
  416. for ( i = 0; i < classes.length; i++ ) {
  417. current = that.classesElementLookup[ classes[ i ] ] || $();
  418. if ( options.add ) {
  419. current = $( $.unique( current.get().concat( options.element.get() ) ) );
  420. } else {
  421. current = $( current.not( options.element ).get() );
  422. }
  423. that.classesElementLookup[ classes[ i ] ] = current;
  424. full.push( classes[ i ] );
  425. if ( checkOption && options.classes[ classes[ i ] ] ) {
  426. full.push( options.classes[ classes[ i ] ] );
  427. }
  428. }
  429. }
  430. this._on( options.element, {
  431. "remove": "_untrackClassesElement"
  432. } );
  433. if ( options.keys ) {
  434. processClassString( options.keys.match( /\S+/g ) || [], true );
  435. }
  436. if ( options.extra ) {
  437. processClassString( options.extra.match( /\S+/g ) || [] );
  438. }
  439. return full.join( " " );
  440. },
  441. _untrackClassesElement: function( event ) {
  442. var that = this;
  443. $.each( that.classesElementLookup, function( key, value ) {
  444. if ( $.inArray( event.target, value ) !== -1 ) {
  445. that.classesElementLookup[ key ] = $( value.not( event.target ).get() );
  446. }
  447. } );
  448. },
  449. _removeClass: function( element, keys, extra ) {
  450. return this._toggleClass( element, keys, extra, false );
  451. },
  452. _addClass: function( element, keys, extra ) {
  453. return this._toggleClass( element, keys, extra, true );
  454. },
  455. _toggleClass: function( element, keys, extra, add ) {
  456. add = ( typeof add === "boolean" ) ? add : extra;
  457. var shift = ( typeof element === "string" || element === null ),
  458. options = {
  459. extra: shift ? keys : extra,
  460. keys: shift ? element : keys,
  461. element: shift ? this.element : element,
  462. add: add
  463. };
  464. options.element.toggleClass( this._classes( options ), add );
  465. return this;
  466. },
  467. _on: function( suppressDisabledCheck, element, handlers ) {
  468. var delegateElement;
  469. var instance = this;
  470. // No suppressDisabledCheck flag, shuffle arguments
  471. if ( typeof suppressDisabledCheck !== "boolean" ) {
  472. handlers = element;
  473. element = suppressDisabledCheck;
  474. suppressDisabledCheck = false;
  475. }
  476. // No element argument, shuffle and use this.element
  477. if ( !handlers ) {
  478. handlers = element;
  479. element = this.element;
  480. delegateElement = this.widget();
  481. } else {
  482. element = delegateElement = $( element );
  483. this.bindings = this.bindings.add( element );
  484. }
  485. $.each( handlers, function( event, handler ) {
  486. function handlerProxy() {
  487. // Allow widgets to customize the disabled handling
  488. // - disabled as an array instead of boolean
  489. // - disabled class as method for disabling individual parts
  490. if ( !suppressDisabledCheck &&
  491. ( instance.options.disabled === true ||
  492. $( this ).hasClass( "ui-state-disabled" ) ) ) {
  493. return;
  494. }
  495. return ( typeof handler === "string" ? instance[ handler ] : handler )
  496. .apply( instance, arguments );
  497. }
  498. // Copy the guid so direct unbinding works
  499. if ( typeof handler !== "string" ) {
  500. handlerProxy.guid = handler.guid =
  501. handler.guid || handlerProxy.guid || $.guid++;
  502. }
  503. var match = event.match( /^([\w:-]*)\s*(.*)$/ );
  504. var eventName = match[ 1 ] + instance.eventNamespace;
  505. var selector = match[ 2 ];
  506. if ( selector ) {
  507. delegateElement.on( eventName, selector, handlerProxy );
  508. } else {
  509. element.on( eventName, handlerProxy );
  510. }
  511. } );
  512. },
  513. _off: function( element, eventName ) {
  514. eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) +
  515. this.eventNamespace;
  516. element.off( eventName ).off( eventName );
  517. // Clear the stack to avoid memory leaks (#10056)
  518. this.bindings = $( this.bindings.not( element ).get() );
  519. this.focusable = $( this.focusable.not( element ).get() );
  520. this.hoverable = $( this.hoverable.not( element ).get() );
  521. },
  522. _delay: function( handler, delay ) {
  523. function handlerProxy() {
  524. return ( typeof handler === "string" ? instance[ handler ] : handler )
  525. .apply( instance, arguments );
  526. }
  527. var instance = this;
  528. return setTimeout( handlerProxy, delay || 0 );
  529. },
  530. _hoverable: function( element ) {
  531. this.hoverable = this.hoverable.add( element );
  532. this._on( element, {
  533. mouseenter: function( event ) {
  534. this._addClass( $( event.currentTarget ), null, "ui-state-hover" );
  535. },
  536. mouseleave: function( event ) {
  537. this._removeClass( $( event.currentTarget ), null, "ui-state-hover" );
  538. }
  539. } );
  540. },
  541. _focusable: function( element ) {
  542. this.focusable = this.focusable.add( element );
  543. this._on( element, {
  544. focusin: function( event ) {
  545. this._addClass( $( event.currentTarget ), null, "ui-state-focus" );
  546. },
  547. focusout: function( event ) {
  548. this._removeClass( $( event.currentTarget ), null, "ui-state-focus" );
  549. }
  550. } );
  551. },
  552. _trigger: function( type, event, data ) {
  553. var prop, orig;
  554. var callback = this.options[ type ];
  555. data = data || {};
  556. event = $.Event( event );
  557. event.type = ( type === this.widgetEventPrefix ?
  558. type :
  559. this.widgetEventPrefix + type ).toLowerCase();
  560. // The original event may come from any element
  561. // so we need to reset the target on the new event
  562. event.target = this.element[ 0 ];
  563. // Copy original event properties over to the new event
  564. orig = event.originalEvent;
  565. if ( orig ) {
  566. for ( prop in orig ) {
  567. if ( !( prop in event ) ) {
  568. event[ prop ] = orig[ prop ];
  569. }
  570. }
  571. }
  572. this.element.trigger( event, data );
  573. return !( $.isFunction( callback ) &&
  574. callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false ||
  575. event.isDefaultPrevented() );
  576. }
  577. };
  578. $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
  579. $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
  580. if ( typeof options === "string" ) {
  581. options = { effect: options };
  582. }
  583. var hasOptions;
  584. var effectName = !options ?
  585. method :
  586. options === true || typeof options === "number" ?
  587. defaultEffect :
  588. options.effect || defaultEffect;
  589. options = options || {};
  590. if ( typeof options === "number" ) {
  591. options = { duration: options };
  592. }
  593. hasOptions = !$.isEmptyObject( options );
  594. options.complete = callback;
  595. if ( options.delay ) {
  596. element.delay( options.delay );
  597. }
  598. if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
  599. element[ method ]( options );
  600. } else if ( effectName !== method && element[ effectName ] ) {
  601. element[ effectName ]( options.duration, options.easing, callback );
  602. } else {
  603. element.queue( function( next ) {
  604. $( this )[ method ]();
  605. if ( callback ) {
  606. callback.call( element[ 0 ] );
  607. }
  608. next();
  609. } );
  610. }
  611. };
  612. } );
  613. var widget = $.widget;
  614. /*!
  615. * jQuery UI Position 1.12.1
  616. * http://jqueryui.com
  617. *
  618. * Copyright jQuery Foundation and other contributors
  619. * Released under the MIT license.
  620. * http://jquery.org/license
  621. *
  622. * http://api.jqueryui.com/position/
  623. */
  624. //>>label: Position
  625. //>>group: Core
  626. //>>description: Positions elements relative to other elements.
  627. //>>docs: http://api.jqueryui.com/position/
  628. //>>demos: http://jqueryui.com/position/
  629. ( function() {
  630. var cachedScrollbarWidth,
  631. max = Math.max,
  632. abs = Math.abs,
  633. rhorizontal = /left|center|right/,
  634. rvertical = /top|center|bottom/,
  635. roffset = /[\+\-]\d+(\.[\d]+)?%?/,
  636. rposition = /^\w+/,
  637. rpercent = /%$/,
  638. _position = $.fn.position;
  639. function getOffsets( offsets, width, height ) {
  640. return [
  641. parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
  642. parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
  643. ];
  644. }
  645. function parseCss( element, property ) {
  646. return parseInt( $.css( element, property ), 10 ) || 0;
  647. }
  648. function getDimensions( elem ) {
  649. var raw = elem[ 0 ];
  650. if ( raw.nodeType === 9 ) {
  651. return {
  652. width: elem.width(),
  653. height: elem.height(),
  654. offset: { top: 0, left: 0 }
  655. };
  656. }
  657. if ( $.isWindow( raw ) ) {
  658. return {
  659. width: elem.width(),
  660. height: elem.height(),
  661. offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
  662. };
  663. }
  664. if ( raw.preventDefault ) {
  665. return {
  666. width: 0,
  667. height: 0,
  668. offset: { top: raw.pageY, left: raw.pageX }
  669. };
  670. }
  671. return {
  672. width: elem.outerWidth(),
  673. height: elem.outerHeight(),
  674. offset: elem.offset()
  675. };
  676. }
  677. $.position = {
  678. scrollbarWidth: function() {
  679. if ( cachedScrollbarWidth !== undefined ) {
  680. return cachedScrollbarWidth;
  681. }
  682. var w1, w2,
  683. div = $( "<div " +
  684. "style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'>" +
  685. "<div style='height:100px;width:auto;'></div></div>" ),
  686. innerDiv = div.children()[ 0 ];
  687. $( "body" ).append( div );
  688. w1 = innerDiv.offsetWidth;
  689. div.css( "overflow", "scroll" );
  690. w2 = innerDiv.offsetWidth;
  691. if ( w1 === w2 ) {
  692. w2 = div[ 0 ].clientWidth;
  693. }
  694. div.remove();
  695. return ( cachedScrollbarWidth = w1 - w2 );
  696. },
  697. getScrollInfo: function( within ) {
  698. var overflowX = within.isWindow || within.isDocument ? "" :
  699. within.element.css( "overflow-x" ),
  700. overflowY = within.isWindow || within.isDocument ? "" :
  701. within.element.css( "overflow-y" ),
  702. hasOverflowX = overflowX === "scroll" ||
  703. ( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ),
  704. hasOverflowY = overflowY === "scroll" ||
  705. ( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight );
  706. return {
  707. width: hasOverflowY ? $.position.scrollbarWidth() : 0,
  708. height: hasOverflowX ? $.position.scrollbarWidth() : 0
  709. };
  710. },
  711. getWithinInfo: function( element ) {
  712. var withinElement = $( element || window ),
  713. isWindow = $.isWindow( withinElement[ 0 ] ),
  714. isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9,
  715. hasOffset = !isWindow && !isDocument;
  716. return {
  717. element: withinElement,
  718. isWindow: isWindow,
  719. isDocument: isDocument,
  720. offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 },
  721. scrollLeft: withinElement.scrollLeft(),
  722. scrollTop: withinElement.scrollTop(),
  723. width: withinElement.outerWidth(),
  724. height: withinElement.outerHeight()
  725. };
  726. }
  727. };
  728. $.fn.position = function( options ) {
  729. if ( !options || !options.of ) {
  730. return _position.apply( this, arguments );
  731. }
  732. // Make a copy, we don't want to modify arguments
  733. options = $.extend( {}, options );
  734. var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
  735. target = $( options.of ),
  736. within = $.position.getWithinInfo( options.within ),
  737. scrollInfo = $.position.getScrollInfo( within ),
  738. collision = ( options.collision || "flip" ).split( " " ),
  739. offsets = {};
  740. dimensions = getDimensions( target );
  741. if ( target[ 0 ].preventDefault ) {
  742. // Force left top to allow flipping
  743. options.at = "left top";
  744. }
  745. targetWidth = dimensions.width;
  746. targetHeight = dimensions.height;
  747. targetOffset = dimensions.offset;
  748. // Clone to reuse original targetOffset later
  749. basePosition = $.extend( {}, targetOffset );
  750. // Force my and at to have valid horizontal and vertical positions
  751. // if a value is missing or invalid, it will be converted to center
  752. $.each( [ "my", "at" ], function() {
  753. var pos = ( options[ this ] || "" ).split( " " ),
  754. horizontalOffset,
  755. verticalOffset;
  756. if ( pos.length === 1 ) {
  757. pos = rhorizontal.test( pos[ 0 ] ) ?
  758. pos.concat( [ "center" ] ) :
  759. rvertical.test( pos[ 0 ] ) ?
  760. [ "center" ].concat( pos ) :
  761. [ "center", "center" ];
  762. }
  763. pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
  764. pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
  765. // Calculate offsets
  766. horizontalOffset = roffset.exec( pos[ 0 ] );
  767. verticalOffset = roffset.exec( pos[ 1 ] );
  768. offsets[ this ] = [
  769. horizontalOffset ? horizontalOffset[ 0 ] : 0,
  770. verticalOffset ? verticalOffset[ 0 ] : 0
  771. ];
  772. // Reduce to just the positions without the offsets
  773. options[ this ] = [
  774. rposition.exec( pos[ 0 ] )[ 0 ],
  775. rposition.exec( pos[ 1 ] )[ 0 ]
  776. ];
  777. } );
  778. // Normalize collision option
  779. if ( collision.length === 1 ) {
  780. collision[ 1 ] = collision[ 0 ];
  781. }
  782. if ( options.at[ 0 ] === "right" ) {
  783. basePosition.left += targetWidth;
  784. } else if ( options.at[ 0 ] === "center" ) {
  785. basePosition.left += targetWidth / 2;
  786. }
  787. if ( options.at[ 1 ] === "bottom" ) {
  788. basePosition.top += targetHeight;
  789. } else if ( options.at[ 1 ] === "center" ) {
  790. basePosition.top += targetHeight / 2;
  791. }
  792. atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
  793. basePosition.left += atOffset[ 0 ];
  794. basePosition.top += atOffset[ 1 ];
  795. return this.each( function() {
  796. var collisionPosition, using,
  797. elem = $( this ),
  798. elemWidth = elem.outerWidth(),
  799. elemHeight = elem.outerHeight(),
  800. marginLeft = parseCss( this, "marginLeft" ),
  801. marginTop = parseCss( this, "marginTop" ),
  802. collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) +
  803. scrollInfo.width,
  804. collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) +
  805. scrollInfo.height,
  806. position = $.extend( {}, basePosition ),
  807. myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
  808. if ( options.my[ 0 ] === "right" ) {
  809. position.left -= elemWidth;
  810. } else if ( options.my[ 0 ] === "center" ) {
  811. position.left -= elemWidth / 2;
  812. }
  813. if ( options.my[ 1 ] === "bottom" ) {
  814. position.top -= elemHeight;
  815. } else if ( options.my[ 1 ] === "center" ) {
  816. position.top -= elemHeight / 2;
  817. }
  818. position.left += myOffset[ 0 ];
  819. position.top += myOffset[ 1 ];
  820. collisionPosition = {
  821. marginLeft: marginLeft,
  822. marginTop: marginTop
  823. };
  824. $.each( [ "left", "top" ], function( i, dir ) {
  825. if ( $.ui.position[ collision[ i ] ] ) {
  826. $.ui.position[ collision[ i ] ][ dir ]( position, {
  827. targetWidth: targetWidth,
  828. targetHeight: targetHeight,
  829. elemWidth: elemWidth,
  830. elemHeight: elemHeight,
  831. collisionPosition: collisionPosition,
  832. collisionWidth: collisionWidth,
  833. collisionHeight: collisionHeight,
  834. offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
  835. my: options.my,
  836. at: options.at,
  837. within: within,
  838. elem: elem
  839. } );
  840. }
  841. } );
  842. if ( options.using ) {
  843. // Adds feedback as second argument to using callback, if present
  844. using = function( props ) {
  845. var left = targetOffset.left - position.left,
  846. right = left + targetWidth - elemWidth,
  847. top = targetOffset.top - position.top,
  848. bottom = top + targetHeight - elemHeight,
  849. feedback = {
  850. target: {
  851. element: target,
  852. left: targetOffset.left,
  853. top: targetOffset.top,
  854. width: targetWidth,
  855. height: targetHeight
  856. },
  857. element: {
  858. element: elem,
  859. left: position.left,
  860. top: position.top,
  861. width: elemWidth,
  862. height: elemHeight
  863. },
  864. horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
  865. vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
  866. };
  867. if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
  868. feedback.horizontal = "center";
  869. }
  870. if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
  871. feedback.vertical = "middle";
  872. }
  873. if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
  874. feedback.important = "horizontal";
  875. } else {
  876. feedback.important = "vertical";
  877. }
  878. options.using.call( this, props, feedback );
  879. };
  880. }
  881. elem.offset( $.extend( position, { using: using } ) );
  882. } );
  883. };
  884. $.ui.position = {
  885. fit: {
  886. left: function( position, data ) {
  887. var within = data.within,
  888. withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
  889. outerWidth = within.width,
  890. collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  891. overLeft = withinOffset - collisionPosLeft,
  892. overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
  893. newOverRight;
  894. // Element is wider than within
  895. if ( data.collisionWidth > outerWidth ) {
  896. // Element is initially over the left side of within
  897. if ( overLeft > 0 && overRight <= 0 ) {
  898. newOverRight = position.left + overLeft + data.collisionWidth - outerWidth -
  899. withinOffset;
  900. position.left += overLeft - newOverRight;
  901. // Element is initially over right side of within
  902. } else if ( overRight > 0 && overLeft <= 0 ) {
  903. position.left = withinOffset;
  904. // Element is initially over both left and right sides of within
  905. } else {
  906. if ( overLeft > overRight ) {
  907. position.left = withinOffset + outerWidth - data.collisionWidth;
  908. } else {
  909. position.left = withinOffset;
  910. }
  911. }
  912. // Too far left -> align with left edge
  913. } else if ( overLeft > 0 ) {
  914. position.left += overLeft;
  915. // Too far right -> align with right edge
  916. } else if ( overRight > 0 ) {
  917. position.left -= overRight;
  918. // Adjust based on position and margin
  919. } else {
  920. position.left = max( position.left - collisionPosLeft, position.left );
  921. }
  922. },
  923. top: function( position, data ) {
  924. var within = data.within,
  925. withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
  926. outerHeight = data.within.height,
  927. collisionPosTop = position.top - data.collisionPosition.marginTop,
  928. overTop = withinOffset - collisionPosTop,
  929. overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
  930. newOverBottom;
  931. // Element is taller than within
  932. if ( data.collisionHeight > outerHeight ) {
  933. // Element is initially over the top of within
  934. if ( overTop > 0 && overBottom <= 0 ) {
  935. newOverBottom = position.top + overTop + data.collisionHeight - outerHeight -
  936. withinOffset;
  937. position.top += overTop - newOverBottom;
  938. // Element is initially over bottom of within
  939. } else if ( overBottom > 0 && overTop <= 0 ) {
  940. position.top = withinOffset;
  941. // Element is initially over both top and bottom of within
  942. } else {
  943. if ( overTop > overBottom ) {
  944. position.top = withinOffset + outerHeight - data.collisionHeight;
  945. } else {
  946. position.top = withinOffset;
  947. }
  948. }
  949. // Too far up -> align with top
  950. } else if ( overTop > 0 ) {
  951. position.top += overTop;
  952. // Too far down -> align with bottom edge
  953. } else if ( overBottom > 0 ) {
  954. position.top -= overBottom;
  955. // Adjust based on position and margin
  956. } else {
  957. position.top = max( position.top - collisionPosTop, position.top );
  958. }
  959. }
  960. },
  961. flip: {
  962. left: function( position, data ) {
  963. var within = data.within,
  964. withinOffset = within.offset.left + within.scrollLeft,
  965. outerWidth = within.width,
  966. offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
  967. collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  968. overLeft = collisionPosLeft - offsetLeft,
  969. overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
  970. myOffset = data.my[ 0 ] === "left" ?
  971. -data.elemWidth :
  972. data.my[ 0 ] === "right" ?
  973. data.elemWidth :
  974. 0,
  975. atOffset = data.at[ 0 ] === "left" ?
  976. data.targetWidth :
  977. data.at[ 0 ] === "right" ?
  978. -data.targetWidth :
  979. 0,
  980. offset = -2 * data.offset[ 0 ],
  981. newOverRight,
  982. newOverLeft;
  983. if ( overLeft < 0 ) {
  984. newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth -
  985. outerWidth - withinOffset;
  986. if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
  987. position.left += myOffset + atOffset + offset;
  988. }
  989. } else if ( overRight > 0 ) {
  990. newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset +
  991. atOffset + offset - offsetLeft;
  992. if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
  993. position.left += myOffset + atOffset + offset;
  994. }
  995. }
  996. },
  997. top: function( position, data ) {
  998. var within = data.within,
  999. withinOffset = within.offset.top + within.scrollTop,
  1000. outerHeight = within.height,
  1001. offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
  1002. collisionPosTop = position.top - data.collisionPosition.marginTop,
  1003. overTop = collisionPosTop - offsetTop,
  1004. overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
  1005. top = data.my[ 1 ] === "top",
  1006. myOffset = top ?
  1007. -data.elemHeight :
  1008. data.my[ 1 ] === "bottom" ?
  1009. data.elemHeight :
  1010. 0,
  1011. atOffset = data.at[ 1 ] === "top" ?
  1012. data.targetHeight :
  1013. data.at[ 1 ] === "bottom" ?
  1014. -data.targetHeight :
  1015. 0,
  1016. offset = -2 * data.offset[ 1 ],
  1017. newOverTop,
  1018. newOverBottom;
  1019. if ( overTop < 0 ) {
  1020. newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight -
  1021. outerHeight - withinOffset;
  1022. if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
  1023. position.top += myOffset + atOffset + offset;
  1024. }
  1025. } else if ( overBottom > 0 ) {
  1026. newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset +
  1027. offset - offsetTop;
  1028. if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {
  1029. position.top += myOffset + atOffset + offset;
  1030. }
  1031. }
  1032. }
  1033. },
  1034. flipfit: {
  1035. left: function() {
  1036. $.ui.position.flip.left.apply( this, arguments );
  1037. $.ui.position.fit.left.apply( this, arguments );
  1038. },
  1039. top: function() {
  1040. $.ui.position.flip.top.apply( this, arguments );
  1041. $.ui.position.fit.top.apply( this, arguments );
  1042. }
  1043. }
  1044. };
  1045. } )();
  1046. var position = $.ui.position;
  1047. /*!
  1048. * jQuery UI :data 1.12.1
  1049. * http://jqueryui.com
  1050. *
  1051. * Copyright jQuery Foundation and other contributors
  1052. * Released under the MIT license.
  1053. * http://jquery.org/license
  1054. */
  1055. //>>label: :data Selector
  1056. //>>group: Core
  1057. //>>description: Selects elements which have data stored under the specified key.
  1058. //>>docs: http://api.jqueryui.com/data-selector/
  1059. var data = $.extend( $.expr[ ":" ], {
  1060. data: $.expr.createPseudo ?
  1061. $.expr.createPseudo( function( dataName ) {
  1062. return function( elem ) {
  1063. return !!$.data( elem, dataName );
  1064. };
  1065. } ) :
  1066. // Support: jQuery <1.8
  1067. function( elem, i, match ) {
  1068. return !!$.data( elem, match[ 3 ] );
  1069. }
  1070. } );
  1071. /*!
  1072. * jQuery UI Disable Selection 1.12.1
  1073. * http://jqueryui.com
  1074. *
  1075. * Copyright jQuery Foundation and other contributors
  1076. * Released under the MIT license.
  1077. * http://jquery.org/license
  1078. */
  1079. //>>label: disableSelection
  1080. //>>group: Core
  1081. //>>description: Disable selection of text content within the set of matched elements.
  1082. //>>docs: http://api.jqueryui.com/disableSelection/
  1083. // This file is deprecated
  1084. var disableSelection = $.fn.extend( {
  1085. disableSelection: ( function() {
  1086. var eventType = "onselectstart" in document.createElement( "div" ) ?
  1087. "selectstart" :
  1088. "mousedown";
  1089. return function() {
  1090. return this.on( eventType + ".ui-disableSelection", function( event ) {
  1091. event.preventDefault();
  1092. } );
  1093. };
  1094. } )(),
  1095. enableSelection: function() {
  1096. return this.off( ".ui-disableSelection" );
  1097. }
  1098. } );
  1099. /*!
  1100. * jQuery UI Effects 1.12.1
  1101. * http://jqueryui.com
  1102. *
  1103. * Copyright jQuery Foundation and other contributors
  1104. * Released under the MIT license.
  1105. * http://jquery.org/license
  1106. */
  1107. //>>label: Effects Core
  1108. //>>group: Effects
  1109. // jscs:disable maximumLineLength
  1110. //>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects.
  1111. // jscs:enable maximumLineLength
  1112. //>>docs: http://api.jqueryui.com/category/effects-core/
  1113. //>>demos: http://jqueryui.com/effect/
  1114. var dataSpace = "ui-effects-",
  1115. dataSpaceStyle = "ui-effects-style",
  1116. dataSpaceAnimated = "ui-effects-animated",
  1117. // Create a local jQuery because jQuery Color relies on it and the
  1118. // global may not exist with AMD and a custom build (#10199)
  1119. jQuery = $;
  1120. $.effects = {
  1121. effect: {}
  1122. };
  1123. /*!
  1124. * jQuery Color Animations v2.1.2
  1125. * https://github.com/jquery/jquery-color
  1126. *
  1127. * Copyright 2014 jQuery Foundation and other contributors
  1128. * Released under the MIT license.
  1129. * http://jquery.org/license
  1130. *
  1131. * Date: Wed Jan 16 08:47:09 2013 -0600
  1132. */
  1133. ( function( jQuery, undefined ) {
  1134. var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " +
  1135. "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
  1136. // Plusequals test for += 100 -= 100
  1137. rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
  1138. // A set of RE's that can match strings and generate color tuples.
  1139. stringParsers = [ {
  1140. re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  1141. parse: function( execResult ) {
  1142. return [
  1143. execResult[ 1 ],
  1144. execResult[ 2 ],
  1145. execResult[ 3 ],
  1146. execResult[ 4 ]
  1147. ];
  1148. }
  1149. }, {
  1150. re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  1151. parse: function( execResult ) {
  1152. return [
  1153. execResult[ 1 ] * 2.55,
  1154. execResult[ 2 ] * 2.55,
  1155. execResult[ 3 ] * 2.55,
  1156. execResult[ 4 ]
  1157. ];
  1158. }
  1159. }, {
  1160. // This regex ignores A-F because it's compared against an already lowercased string
  1161. re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
  1162. parse: function( execResult ) {
  1163. return [
  1164. parseInt( execResult[ 1 ], 16 ),
  1165. parseInt( execResult[ 2 ], 16 ),
  1166. parseInt( execResult[ 3 ], 16 )
  1167. ];
  1168. }
  1169. }, {
  1170. // This regex ignores A-F because it's compared against an already lowercased string
  1171. re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
  1172. parse: function( execResult ) {
  1173. return [
  1174. parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
  1175. parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
  1176. parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
  1177. ];
  1178. }
  1179. }, {
  1180. re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  1181. space: "hsla",
  1182. parse: function( execResult ) {
  1183. return [
  1184. execResult[ 1 ],
  1185. execResult[ 2 ] / 100,
  1186. execResult[ 3 ] / 100,
  1187. execResult[ 4 ]
  1188. ];
  1189. }
  1190. } ],
  1191. // JQuery.Color( )
  1192. color = jQuery.Color = function( color, green, blue, alpha ) {
  1193. return new jQuery.Color.fn.parse( color, green, blue, alpha );
  1194. },
  1195. spaces = {
  1196. rgba: {
  1197. props: {
  1198. red: {
  1199. idx: 0,
  1200. type: "byte"
  1201. },
  1202. green: {
  1203. idx: 1,
  1204. type: "byte"
  1205. },
  1206. blue: {
  1207. idx: 2,
  1208. type: "byte"
  1209. }
  1210. }
  1211. },
  1212. hsla: {
  1213. props: {
  1214. hue: {
  1215. idx: 0,
  1216. type: "degrees"
  1217. },
  1218. saturation: {
  1219. idx: 1,
  1220. type: "percent"
  1221. },
  1222. lightness: {
  1223. idx: 2,
  1224. type: "percent"
  1225. }
  1226. }
  1227. }
  1228. },
  1229. propTypes = {
  1230. "byte": {
  1231. floor: true,
  1232. max: 255
  1233. },
  1234. "percent": {
  1235. max: 1
  1236. },
  1237. "degrees": {
  1238. mod: 360,
  1239. floor: true
  1240. }
  1241. },
  1242. support = color.support = {},
  1243. // Element for support tests
  1244. supportElem = jQuery( "<p>" )[ 0 ],
  1245. // Colors = jQuery.Color.names
  1246. colors,
  1247. // Local aliases of functions called often
  1248. each = jQuery.each;
  1249. // Determine rgba support immediately
  1250. supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
  1251. support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
  1252. // Define cache name and alpha properties
  1253. // for rgba and hsla spaces
  1254. each( spaces, function( spaceName, space ) {
  1255. space.cache = "_" + spaceName;
  1256. space.props.alpha = {
  1257. idx: 3,
  1258. type: "percent",
  1259. def: 1
  1260. };
  1261. } );
  1262. function clamp( value, prop, allowEmpty ) {
  1263. var type = propTypes[ prop.type ] || {};
  1264. if ( value == null ) {
  1265. return ( allowEmpty || !prop.def ) ? null : prop.def;
  1266. }
  1267. // ~~ is an short way of doing floor for positive numbers
  1268. value = type.floor ? ~~value : parseFloat( value );
  1269. // IE will pass in empty strings as value for alpha,
  1270. // which will hit this case
  1271. if ( isNaN( value ) ) {
  1272. return prop.def;
  1273. }
  1274. if ( type.mod ) {
  1275. // We add mod before modding to make sure that negatives values
  1276. // get converted properly: -10 -> 350
  1277. return ( value + type.mod ) % type.mod;
  1278. }
  1279. // For now all property types without mod have min and max
  1280. return 0 > value ? 0 : type.max < value ? type.max : value;
  1281. }
  1282. function stringParse( string ) {
  1283. var inst = color(),
  1284. rgba = inst._rgba = [];
  1285. string = string.toLowerCase();
  1286. each( stringParsers, function( i, parser ) {
  1287. var parsed,
  1288. match = parser.re.exec( string ),
  1289. values = match && parser.parse( match ),
  1290. spaceName = parser.space || "rgba";
  1291. if ( values ) {
  1292. parsed = inst[ spaceName ]( values );
  1293. // If this was an rgba parse the assignment might happen twice
  1294. // oh well....
  1295. inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
  1296. rgba = inst._rgba = parsed._rgba;
  1297. // Exit each( stringParsers ) here because we matched
  1298. return false;
  1299. }
  1300. } );
  1301. // Found a stringParser that handled it
  1302. if ( rgba.length ) {
  1303. // If this came from a parsed string, force "transparent" when alpha is 0
  1304. // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
  1305. if ( rgba.join() === "0,0,0,0" ) {
  1306. jQuery.extend( rgba, colors.transparent );
  1307. }
  1308. return inst;
  1309. }
  1310. // Named colors
  1311. return colors[ string ];
  1312. }
  1313. color.fn = jQuery.extend( color.prototype, {
  1314. parse: function( red, green, blue, alpha ) {
  1315. if ( red === undefined ) {
  1316. this._rgba = [ null, null, null, null ];
  1317. return this;
  1318. }
  1319. if ( red.jquery || red.nodeType ) {
  1320. red = jQuery( red ).css( green );
  1321. green = undefined;
  1322. }
  1323. var inst = this,
  1324. type = jQuery.type( red ),
  1325. rgba = this._rgba = [];
  1326. // More than 1 argument specified - assume ( red, green, blue, alpha )
  1327. if ( green !== undefined ) {
  1328. red = [ red, green, blue, alpha ];
  1329. type = "array";
  1330. }
  1331. if ( type === "string" ) {
  1332. return this.parse( stringParse( red ) || colors._default );
  1333. }
  1334. if ( type === "array" ) {
  1335. each( spaces.rgba.props, function( key, prop ) {
  1336. rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
  1337. } );
  1338. return this;
  1339. }
  1340. if ( type === "object" ) {
  1341. if ( red instanceof color ) {
  1342. each( spaces, function( spaceName, space ) {
  1343. if ( red[ space.cache ] ) {
  1344. inst[ space.cache ] = red[ space.cache ].slice();
  1345. }
  1346. } );
  1347. } else {
  1348. each( spaces, function( spaceName, space ) {
  1349. var cache = space.cache;
  1350. each( space.props, function( key, prop ) {
  1351. // If the cache doesn't exist, and we know how to convert
  1352. if ( !inst[ cache ] && space.to ) {
  1353. // If the value was null, we don't need to copy it
  1354. // if the key was alpha, we don't need to copy it either
  1355. if ( key === "alpha" || red[ key ] == null ) {
  1356. return;
  1357. }
  1358. inst[ cache ] = space.to( inst._rgba );
  1359. }
  1360. // This is the only case where we allow nulls for ALL properties.
  1361. // call clamp with alwaysAllowEmpty
  1362. inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
  1363. } );
  1364. // Everything defined but alpha?
  1365. if ( inst[ cache ] &&
  1366. jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
  1367. // Use the default of 1
  1368. inst[ cache ][ 3 ] = 1;
  1369. if ( space.from ) {
  1370. inst._rgba = space.from( inst[ cache ] );
  1371. }
  1372. }
  1373. } );
  1374. }
  1375. return this;
  1376. }
  1377. },
  1378. is: function( compare ) {
  1379. var is = color( compare ),
  1380. same = true,
  1381. inst = this;
  1382. each( spaces, function( _, space ) {
  1383. var localCache,
  1384. isCache = is[ space.cache ];
  1385. if ( isCache ) {
  1386. localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
  1387. each( space.props, function( _, prop ) {
  1388. if ( isCache[ prop.idx ] != null ) {
  1389. same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
  1390. return same;
  1391. }
  1392. } );
  1393. }
  1394. return same;
  1395. } );
  1396. return same;
  1397. },
  1398. _space: function() {
  1399. var used = [],
  1400. inst = this;
  1401. each( spaces, function( spaceName, space ) {
  1402. if ( inst[ space.cache ] ) {
  1403. used.push( spaceName );
  1404. }
  1405. } );
  1406. return used.pop();
  1407. },
  1408. transition: function( other, distance ) {
  1409. var end = color( other ),
  1410. spaceName = end._space(),
  1411. space = spaces[ spaceName ],
  1412. startColor = this.alpha() === 0 ? color( "transparent" ) : this,
  1413. start = startColor[ space.cache ] || space.to( startColor._rgba ),
  1414. result = start.slice();
  1415. end = end[ space.cache ];
  1416. each( space.props, function( key, prop ) {
  1417. var index = prop.idx,
  1418. startValue = start[ index ],
  1419. endValue = end[ index ],
  1420. type = propTypes[ prop.type ] || {};
  1421. // If null, don't override start value
  1422. if ( endValue === null ) {
  1423. return;
  1424. }
  1425. // If null - use end
  1426. if ( startValue === null ) {
  1427. result[ index ] = endValue;
  1428. } else {
  1429. if ( type.mod ) {
  1430. if ( endValue - startValue > type.mod / 2 ) {
  1431. startValue += type.mod;
  1432. } else if ( startValue - endValue > type.mod / 2 ) {
  1433. startValue -= type.mod;
  1434. }
  1435. }
  1436. result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
  1437. }
  1438. } );
  1439. return this[ spaceName ]( result );
  1440. },
  1441. blend: function( opaque ) {
  1442. // If we are already opaque - return ourself
  1443. if ( this._rgba[ 3 ] === 1 ) {
  1444. return this;
  1445. }
  1446. var rgb = this._rgba.slice(),
  1447. a = rgb.pop(),
  1448. blend = color( opaque )._rgba;
  1449. return color( jQuery.map( rgb, function( v, i ) {
  1450. return ( 1 - a ) * blend[ i ] + a * v;
  1451. } ) );
  1452. },
  1453. toRgbaString: function() {
  1454. var prefix = "rgba(",
  1455. rgba = jQuery.map( this._rgba, function( v, i ) {
  1456. return v == null ? ( i > 2 ? 1 : 0 ) : v;
  1457. } );
  1458. if ( rgba[ 3 ] === 1 ) {
  1459. rgba.pop();
  1460. prefix = "rgb(";
  1461. }
  1462. return prefix + rgba.join() + ")";
  1463. },
  1464. toHslaString: function() {
  1465. var prefix = "hsla(",
  1466. hsla = jQuery.map( this.hsla(), function( v, i ) {
  1467. if ( v == null ) {
  1468. v = i > 2 ? 1 : 0;
  1469. }
  1470. // Catch 1 and 2
  1471. if ( i && i < 3 ) {
  1472. v = Math.round( v * 100 ) + "%";
  1473. }
  1474. return v;
  1475. } );
  1476. if ( hsla[ 3 ] === 1 ) {
  1477. hsla.pop();
  1478. prefix = "hsl(";
  1479. }
  1480. return prefix + hsla.join() + ")";
  1481. },
  1482. toHexString: function( includeAlpha ) {
  1483. var rgba = this._rgba.slice(),
  1484. alpha = rgba.pop();
  1485. if ( includeAlpha ) {
  1486. rgba.push( ~~( alpha * 255 ) );
  1487. }
  1488. return "#" + jQuery.map( rgba, function( v ) {
  1489. // Default to 0 when nulls exist
  1490. v = ( v || 0 ).toString( 16 );
  1491. return v.length === 1 ? "0" + v : v;
  1492. } ).join( "" );
  1493. },
  1494. toString: function() {
  1495. return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
  1496. }
  1497. } );
  1498. color.fn.parse.prototype = color.fn;
  1499. // Hsla conversions adapted from:
  1500. // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
  1501. function hue2rgb( p, q, h ) {
  1502. h = ( h + 1 ) % 1;
  1503. if ( h * 6 < 1 ) {
  1504. return p + ( q - p ) * h * 6;
  1505. }
  1506. if ( h * 2 < 1 ) {
  1507. return q;
  1508. }
  1509. if ( h * 3 < 2 ) {
  1510. return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6;
  1511. }
  1512. return p;
  1513. }
  1514. spaces.hsla.to = function( rgba ) {
  1515. if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
  1516. return [ null, null, null, rgba[ 3 ] ];
  1517. }
  1518. var r = rgba[ 0 ] / 255,
  1519. g = rgba[ 1 ] / 255,
  1520. b = rgba[ 2 ] / 255,
  1521. a = rgba[ 3 ],
  1522. max = Math.max( r, g, b ),
  1523. min = Math.min( r, g, b ),
  1524. diff = max - min,
  1525. add = max + min,
  1526. l = add * 0.5,
  1527. h, s;
  1528. if ( min === max ) {
  1529. h = 0;
  1530. } else if ( r === max ) {
  1531. h = ( 60 * ( g - b ) / diff ) + 360;
  1532. } else if ( g === max ) {
  1533. h = ( 60 * ( b - r ) / diff ) + 120;
  1534. } else {
  1535. h = ( 60 * ( r - g ) / diff ) + 240;
  1536. }
  1537. // Chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
  1538. // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
  1539. if ( diff === 0 ) {
  1540. s = 0;
  1541. } else if ( l <= 0.5 ) {
  1542. s = diff / add;
  1543. } else {
  1544. s = diff / ( 2 - add );
  1545. }
  1546. return [ Math.round( h ) % 360, s, l, a == null ? 1 : a ];
  1547. };
  1548. spaces.hsla.from = function( hsla ) {
  1549. if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
  1550. return [ null, null, null, hsla[ 3 ] ];
  1551. }
  1552. var h = hsla[ 0 ] / 360,
  1553. s = hsla[ 1 ],
  1554. l = hsla[ 2 ],
  1555. a = hsla[ 3 ],
  1556. q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
  1557. p = 2 * l - q;
  1558. return [
  1559. Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
  1560. Math.round( hue2rgb( p, q, h ) * 255 ),
  1561. Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
  1562. a
  1563. ];
  1564. };
  1565. each( spaces, function( spaceName, space ) {
  1566. var props = space.props,
  1567. cache = space.cache,
  1568. to = space.to,
  1569. from = space.from;
  1570. // Makes rgba() and hsla()
  1571. color.fn[ spaceName ] = function( value ) {
  1572. // Generate a cache for this space if it doesn't exist
  1573. if ( to && !this[ cache ] ) {
  1574. this[ cache ] = to( this._rgba );
  1575. }
  1576. if ( value === undefined ) {
  1577. return this[ cache ].slice();
  1578. }
  1579. var ret,
  1580. type = jQuery.type( value ),
  1581. arr = ( type === "array" || type === "object" ) ? value : arguments,
  1582. local = this[ cache ].slice();
  1583. each( props, function( key, prop ) {
  1584. var val = arr[ type === "object" ? key : prop.idx ];
  1585. if ( val == null ) {
  1586. val = local[ prop.idx ];
  1587. }
  1588. local[ prop.idx ] = clamp( val, prop );
  1589. } );
  1590. if ( from ) {
  1591. ret = color( from( local ) );
  1592. ret[ cache ] = local;
  1593. return ret;
  1594. } else {
  1595. return color( local );
  1596. }
  1597. };
  1598. // Makes red() green() blue() alpha() hue() saturation() lightness()
  1599. each( props, function( key, prop ) {
  1600. // Alpha is included in more than one space
  1601. if ( color.fn[ key ] ) {
  1602. return;
  1603. }
  1604. color.fn[ key ] = function( value ) {
  1605. var vtype = jQuery.type( value ),
  1606. fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
  1607. local = this[ fn ](),
  1608. cur = local[ prop.idx ],
  1609. match;
  1610. if ( vtype === "undefined" ) {
  1611. return cur;
  1612. }
  1613. if ( vtype === "function" ) {
  1614. value = value.call( this, cur );
  1615. vtype = jQuery.type( value );
  1616. }
  1617. if ( value == null && prop.empty ) {
  1618. return this;
  1619. }
  1620. if ( vtype === "string" ) {
  1621. match = rplusequals.exec( value );
  1622. if ( match ) {
  1623. value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
  1624. }
  1625. }
  1626. local[ prop.idx ] = value;
  1627. return this[ fn ]( local );
  1628. };
  1629. } );
  1630. } );
  1631. // Add cssHook and .fx.step function for each named hook.
  1632. // accept a space separated string of properties
  1633. color.hook = function( hook ) {
  1634. var hooks = hook.split( " " );
  1635. each( hooks, function( i, hook ) {
  1636. jQuery.cssHooks[ hook ] = {
  1637. set: function( elem, value ) {
  1638. var parsed, curElem,
  1639. backgroundColor = "";
  1640. if ( value !== "transparent" && ( jQuery.type( value ) !== "string" ||
  1641. ( parsed = stringParse( value ) ) ) ) {
  1642. value = color( parsed || value );
  1643. if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
  1644. curElem = hook === "backgroundColor" ? elem.parentNode : elem;
  1645. while (
  1646. ( backgroundColor === "" || backgroundColor === "transparent" ) &&
  1647. curElem && curElem.style
  1648. ) {
  1649. try {
  1650. backgroundColor = jQuery.css( curElem, "backgroundColor" );
  1651. curElem = curElem.parentNode;
  1652. } catch ( e ) {
  1653. }
  1654. }
  1655. value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
  1656. backgroundColor :
  1657. "_default" );
  1658. }
  1659. value = value.toRgbaString();
  1660. }
  1661. try {
  1662. elem.style[ hook ] = value;
  1663. } catch ( e ) {
  1664. // Wrapped to prevent IE from throwing errors on "invalid" values like
  1665. // 'auto' or 'inherit'
  1666. }
  1667. }
  1668. };
  1669. jQuery.fx.step[ hook ] = function( fx ) {
  1670. if ( !fx.colorInit ) {
  1671. fx.start = color( fx.elem, hook );
  1672. fx.end = color( fx.end );
  1673. fx.colorInit = true;
  1674. }
  1675. jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
  1676. };
  1677. } );
  1678. };
  1679. color.hook( stepHooks );
  1680. jQuery.cssHooks.borderColor = {
  1681. expand: function( value ) {
  1682. var expanded = {};
  1683. each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
  1684. expanded[ "border" + part + "Color" ] = value;
  1685. } );
  1686. return expanded;
  1687. }
  1688. };
  1689. // Basic color names only.
  1690. // Usage of any of the other color names requires adding yourself or including
  1691. // jquery.color.svg-names.js.
  1692. colors = jQuery.Color.names = {
  1693. // 4.1. Basic color keywords
  1694. aqua: "#00ffff",
  1695. black: "#000000",
  1696. blue: "#0000ff",
  1697. fuchsia: "#ff00ff",
  1698. gray: "#808080",
  1699. green: "#008000",
  1700. lime: "#00ff00",
  1701. maroon: "#800000",
  1702. navy: "#000080",
  1703. olive: "#808000",
  1704. purple: "#800080",
  1705. red: "#ff0000",
  1706. silver: "#c0c0c0",
  1707. teal: "#008080",
  1708. white: "#ffffff",
  1709. yellow: "#ffff00",
  1710. // 4.2.3. "transparent" color keyword
  1711. transparent: [ null, null, null, 0 ],
  1712. _default: "#ffffff"
  1713. };
  1714. } )( jQuery );
  1715. /******************************************************************************/
  1716. /****************************** CLASS ANIMATIONS ******************************/
  1717. /******************************************************************************/
  1718. ( function() {
  1719. var classAnimationActions = [ "add", "remove", "toggle" ],
  1720. shorthandStyles = {
  1721. border: 1,
  1722. borderBottom: 1,
  1723. borderColor: 1,
  1724. borderLeft: 1,
  1725. borderRight: 1,
  1726. borderTop: 1,
  1727. borderWidth: 1,
  1728. margin: 1,
  1729. padding: 1
  1730. };
  1731. $.each(
  1732. [ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ],
  1733. function( _, prop ) {
  1734. $.fx.step[ prop ] = function( fx ) {
  1735. if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
  1736. jQuery.style( fx.elem, prop, fx.end );
  1737. fx.setAttr = true;
  1738. }
  1739. };
  1740. }
  1741. );
  1742. function getElementStyles( elem ) {
  1743. var key, len,
  1744. style = elem.ownerDocument.defaultView ?
  1745. elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
  1746. elem.currentStyle,
  1747. styles = {};
  1748. if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
  1749. len = style.length;
  1750. while ( len-- ) {
  1751. key = style[ len ];
  1752. if ( typeof style[ key ] === "string" ) {
  1753. styles[ $.camelCase( key ) ] = style[ key ];
  1754. }
  1755. }
  1756. // Support: Opera, IE <9
  1757. } else {
  1758. for ( key in style ) {
  1759. if ( typeof style[ key ] === "string" ) {
  1760. styles[ key ] = style[ key ];
  1761. }
  1762. }
  1763. }
  1764. return styles;
  1765. }
  1766. function styleDifference( oldStyle, newStyle ) {
  1767. var diff = {},
  1768. name, value;
  1769. for ( name in newStyle ) {
  1770. value = newStyle[ name ];
  1771. if ( oldStyle[ name ] !== value ) {
  1772. if ( !shorthandStyles[ name ] ) {
  1773. if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
  1774. diff[ name ] = value;
  1775. }
  1776. }
  1777. }
  1778. }
  1779. return diff;
  1780. }
  1781. // Support: jQuery <1.8
  1782. if ( !$.fn.addBack ) {
  1783. $.fn.addBack = function( selector ) {
  1784. return this.add( selector == null ?
  1785. this.prevObject : this.prevObject.filter( selector )
  1786. );
  1787. };
  1788. }
  1789. $.effects.animateClass = function( value, duration, easing, callback ) {
  1790. var o = $.speed( duration, easing, callback );
  1791. return this.queue( function() {
  1792. var animated = $( this ),
  1793. baseClass = animated.attr( "class" ) || "",
  1794. applyClassChange,
  1795. allAnimations = o.children ? animated.find( "*" ).addBack() : animated;
  1796. // Map the animated objects to store the original styles.
  1797. allAnimations = allAnimations.map( function() {
  1798. var el = $( this );
  1799. return {
  1800. el: el,
  1801. start: getElementStyles( this )
  1802. };
  1803. } );
  1804. // Apply class change
  1805. applyClassChange = function() {
  1806. $.each( classAnimationActions, function( i, action ) {
  1807. if ( value[ action ] ) {
  1808. animated[ action + "Class" ]( value[ action ] );
  1809. }
  1810. } );
  1811. };
  1812. applyClassChange();
  1813. // Map all animated objects again - calculate new styles and diff
  1814. allAnimations = allAnimations.map( function() {
  1815. this.end = getElementStyles( this.el[ 0 ] );
  1816. this.diff = styleDifference( this.start, this.end );
  1817. return this;
  1818. } );
  1819. // Apply original class
  1820. animated.attr( "class", baseClass );
  1821. // Map all animated objects again - this time collecting a promise
  1822. allAnimations = allAnimations.map( function() {
  1823. var styleInfo = this,
  1824. dfd = $.Deferred(),
  1825. opts = $.extend( {}, o, {
  1826. queue: false,
  1827. complete: function() {
  1828. dfd.resolve( styleInfo );
  1829. }
  1830. } );
  1831. this.el.animate( this.diff, opts );
  1832. return dfd.promise();
  1833. } );
  1834. // Once all animations have completed:
  1835. $.when.apply( $, allAnimations.get() ).done( function() {
  1836. // Set the final class
  1837. applyClassChange();
  1838. // For each animated element,
  1839. // clear all css properties that were animated
  1840. $.each( arguments, function() {
  1841. var el = this.el;
  1842. $.each( this.diff, function( key ) {
  1843. el.css( key, "" );
  1844. } );
  1845. } );
  1846. // This is guarnteed to be there if you use jQuery.speed()
  1847. // it also handles dequeuing the next anim...
  1848. o.complete.call( animated[ 0 ] );
  1849. } );
  1850. } );
  1851. };
  1852. $.fn.extend( {
  1853. addClass: ( function( orig ) {
  1854. return function( classNames, speed, easing, callback ) {
  1855. return speed ?
  1856. $.effects.animateClass.call( this,
  1857. { add: classNames }, speed, easing, callback ) :
  1858. orig.apply( this, arguments );
  1859. };
  1860. } )( $.fn.addClass ),
  1861. removeClass: ( function( orig ) {
  1862. return function( classNames, speed, easing, callback ) {
  1863. return arguments.length > 1 ?
  1864. $.effects.animateClass.call( this,
  1865. { remove: classNames }, speed, easing, callback ) :
  1866. orig.apply( this, arguments );
  1867. };
  1868. } )( $.fn.removeClass ),
  1869. toggleClass: ( function( orig ) {
  1870. return function( classNames, force, speed, easing, callback ) {
  1871. if ( typeof force === "boolean" || force === undefined ) {
  1872. if ( !speed ) {
  1873. // Without speed parameter
  1874. return orig.apply( this, arguments );
  1875. } else {
  1876. return $.effects.animateClass.call( this,
  1877. ( force ? { add: classNames } : { remove: classNames } ),
  1878. speed, easing, callback );
  1879. }
  1880. } else {
  1881. // Without force parameter
  1882. return $.effects.animateClass.call( this,
  1883. { toggle: classNames }, force, speed, easing );
  1884. }
  1885. };
  1886. } )( $.fn.toggleClass ),
  1887. switchClass: function( remove, add, speed, easing, callback ) {
  1888. return $.effects.animateClass.call( this, {
  1889. add: add,
  1890. remove: remove
  1891. }, speed, easing, callback );
  1892. }
  1893. } );
  1894. } )();
  1895. /******************************************************************************/
  1896. /*********************************** EFFECTS **********************************/
  1897. /******************************************************************************/
  1898. ( function() {
  1899. if ( $.expr && $.expr.filters && $.expr.filters.animated ) {
  1900. $.expr.filters.animated = ( function( orig ) {
  1901. return function( elem ) {
  1902. return !!$( elem ).data( dataSpaceAnimated ) || orig( elem );
  1903. };
  1904. } )( $.expr.filters.animated );
  1905. }
  1906. if ( $.uiBackCompat !== false ) {
  1907. $.extend( $.effects, {
  1908. // Saves a set of properties in a data storage
  1909. save: function( element, set ) {
  1910. var i = 0, length = set.length;
  1911. for ( ; i < length; i++ ) {
  1912. if ( set[ i ] !== null ) {
  1913. element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
  1914. }
  1915. }
  1916. },
  1917. // Restores a set of previously saved properties from a data storage
  1918. restore: function( element, set ) {
  1919. var val, i = 0, length = set.length;
  1920. for ( ; i < length; i++ ) {
  1921. if ( set[ i ] !== null ) {
  1922. val = element.data( dataSpace + set[ i ] );
  1923. element.css( set[ i ], val );
  1924. }
  1925. }
  1926. },
  1927. setMode: function( el, mode ) {
  1928. if ( mode === "toggle" ) {
  1929. mode = el.is( ":hidden" ) ? "show" : "hide";
  1930. }
  1931. return mode;
  1932. },
  1933. // Wraps the element around a wrapper that copies position properties
  1934. createWrapper: function( element ) {
  1935. // If the element is already wrapped, return it
  1936. if ( element.parent().is( ".ui-effects-wrapper" ) ) {
  1937. return element.parent();
  1938. }
  1939. // Wrap the element
  1940. var props = {
  1941. width: element.outerWidth( true ),
  1942. height: element.outerHeight( true ),
  1943. "float": element.css( "float" )
  1944. },
  1945. wrapper = $( "<div></div>" )
  1946. .addClass( "ui-effects-wrapper" )
  1947. .css( {
  1948. fontSize: "100%",
  1949. background: "transparent",
  1950. border: "none",
  1951. margin: 0,
  1952. padding: 0
  1953. } ),
  1954. // Store the size in case width/height are defined in % - Fixes #5245
  1955. size = {
  1956. width: element.width(),
  1957. height: element.height()
  1958. },
  1959. active = document.activeElement;
  1960. // Support: Firefox
  1961. // Firefox incorrectly exposes anonymous content
  1962. // https://bugzilla.mozilla.org/show_bug.cgi?id=561664
  1963. try {
  1964. active.id;
  1965. } catch ( e ) {
  1966. active = document.body;
  1967. }
  1968. element.wrap( wrapper );
  1969. // Fixes #7595 - Elements lose focus when wrapped.
  1970. if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
  1971. $( active ).trigger( "focus" );
  1972. }
  1973. // Hotfix for jQuery 1.4 since some change in wrap() seems to actually
  1974. // lose the reference to the wrapped element
  1975. wrapper = element.parent();
  1976. // Transfer positioning properties to the wrapper
  1977. if ( element.css( "position" ) === "static" ) {
  1978. wrapper.css( { position: "relative" } );
  1979. element.css( { position: "relative" } );
  1980. } else {
  1981. $.extend( props, {
  1982. position: element.css( "position" ),
  1983. zIndex: element.css( "z-index" )
  1984. } );
  1985. $.each( [ "top", "left", "bottom", "right" ], function( i, pos ) {
  1986. props[ pos ] = element.css( pos );
  1987. if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
  1988. props[ pos ] = "auto";
  1989. }
  1990. } );
  1991. element.css( {
  1992. position: "relative",
  1993. top: 0,
  1994. left: 0,
  1995. right: "auto",
  1996. bottom: "auto"
  1997. } );
  1998. }
  1999. element.css( size );
  2000. return wrapper.css( props ).show();
  2001. },
  2002. removeWrapper: function( element ) {
  2003. var active = document.activeElement;
  2004. if ( element.parent().is( ".ui-effects-wrapper" ) ) {
  2005. element.parent().replaceWith( element );
  2006. // Fixes #7595 - Elements lose focus when wrapped.
  2007. if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
  2008. $( active ).trigger( "focus" );
  2009. }
  2010. }
  2011. return element;
  2012. }
  2013. } );
  2014. }
  2015. $.extend( $.effects, {
  2016. version: "1.12.1",
  2017. define: function( name, mode, effect ) {
  2018. if ( !effect ) {
  2019. effect = mode;
  2020. mode = "effect";
  2021. }
  2022. $.effects.effect[ name ] = effect;
  2023. $.effects.effect[ name ].mode = mode;
  2024. return effect;
  2025. },
  2026. scaledDimensions: function( element, percent, direction ) {
  2027. if ( percent === 0 ) {
  2028. return {
  2029. height: 0,
  2030. width: 0,
  2031. outerHeight: 0,
  2032. outerWidth: 0
  2033. };
  2034. }
  2035. var x = direction !== "horizontal" ? ( ( percent || 100 ) / 100 ) : 1,
  2036. y = direction !== "vertical" ? ( ( percent || 100 ) / 100 ) : 1;
  2037. return {
  2038. height: element.height() * y,
  2039. width: element.width() * x,
  2040. outerHeight: element.outerHeight() * y,
  2041. outerWidth: element.outerWidth() * x
  2042. };
  2043. },
  2044. clipToBox: function( animation ) {
  2045. return {
  2046. width: animation.clip.right - animation.clip.left,
  2047. height: animation.clip.bottom - animation.clip.top,
  2048. left: animation.clip.left,
  2049. top: animation.clip.top
  2050. };
  2051. },
  2052. // Injects recently queued functions to be first in line (after "inprogress")
  2053. unshift: function( element, queueLength, count ) {
  2054. var queue = element.queue();
  2055. if ( queueLength > 1 ) {
  2056. queue.splice.apply( queue,
  2057. [ 1, 0 ].concat( queue.splice( queueLength, count ) ) );
  2058. }
  2059. element.dequeue();
  2060. },
  2061. saveStyle: function( element ) {
  2062. element.data( dataSpaceStyle, element[ 0 ].style.cssText );
  2063. },
  2064. restoreStyle: function( element ) {
  2065. element[ 0 ].style.cssText = element.data( dataSpaceStyle ) || "";
  2066. element.removeData( dataSpaceStyle );
  2067. },
  2068. mode: function( element, mode ) {
  2069. var hidden = element.is( ":hidden" );
  2070. if ( mode === "toggle" ) {
  2071. mode = hidden ? "show" : "hide";
  2072. }
  2073. if ( hidden ? mode === "hide" : mode === "show" ) {
  2074. mode = "none";
  2075. }
  2076. return mode;
  2077. },
  2078. // Translates a [top,left] array into a baseline value
  2079. getBaseline: function( origin, original ) {
  2080. var y, x;
  2081. switch ( origin[ 0 ] ) {
  2082. case "top":
  2083. y = 0;
  2084. break;
  2085. case "middle":
  2086. y = 0.5;
  2087. break;
  2088. case "bottom":
  2089. y = 1;
  2090. break;
  2091. default:
  2092. y = origin[ 0 ] / original.height;
  2093. }
  2094. switch ( origin[ 1 ] ) {
  2095. case "left":
  2096. x = 0;
  2097. break;
  2098. case "center":
  2099. x = 0.5;
  2100. break;
  2101. case "right":
  2102. x = 1;
  2103. break;
  2104. default:
  2105. x = origin[ 1 ] / original.width;
  2106. }
  2107. return {
  2108. x: x,
  2109. y: y
  2110. };
  2111. },
  2112. // Creates a placeholder element so that the original element can be made absolute
  2113. createPlaceholder: function( element ) {
  2114. var placeholder,
  2115. cssPosition = element.css( "position" ),
  2116. position = element.position();
  2117. // Lock in margins first to account for form elements, which
  2118. // will change margin if you explicitly set height
  2119. // see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380
  2120. // Support: Safari
  2121. element.css( {
  2122. marginTop: element.css( "marginTop" ),
  2123. marginBottom: element.css( "marginBottom" ),
  2124. marginLeft: element.css( "marginLeft" ),
  2125. marginRight: element.css( "marginRight" )
  2126. } )
  2127. .outerWidth( element.outerWidth() )
  2128. .outerHeight( element.outerHeight() );
  2129. if ( /^(static|relative)/.test( cssPosition ) ) {
  2130. cssPosition = "absolute";
  2131. placeholder = $( "<" + element[ 0 ].nodeName + ">" ).insertAfter( element ).css( {
  2132. // Convert inline to inline block to account for inline elements
  2133. // that turn to inline block based on content (like img)
  2134. display: /^(inline|ruby)/.test( element.css( "display" ) ) ?
  2135. "inline-block" :
  2136. "block",
  2137. visibility: "hidden",
  2138. // Margins need to be set to account for margin collapse
  2139. marginTop: element.css( "marginTop" ),
  2140. marginBottom: element.css( "marginBottom" ),
  2141. marginLeft: element.css( "marginLeft" ),
  2142. marginRight: element.css( "marginRight" ),
  2143. "float": element.css( "float" )
  2144. } )
  2145. .outerWidth( element.outerWidth() )
  2146. .outerHeight( element.outerHeight() )
  2147. .addClass( "ui-effects-placeholder" );
  2148. element.data( dataSpace + "placeholder", placeholder );
  2149. }
  2150. element.css( {
  2151. position: cssPosition,
  2152. left: position.left,
  2153. top: position.top
  2154. } );
  2155. return placeholder;
  2156. },
  2157. removePlaceholder: function( element ) {
  2158. var dataKey = dataSpace + "placeholder",
  2159. placeholder = element.data( dataKey );
  2160. if ( placeholder ) {
  2161. placeholder.remove();
  2162. element.removeData( dataKey );
  2163. }
  2164. },
  2165. // Removes a placeholder if it exists and restores
  2166. // properties that were modified during placeholder creation
  2167. cleanUp: function( element ) {
  2168. $.effects.restoreStyle( element );
  2169. $.effects.removePlaceholder( element );
  2170. },
  2171. setTransition: function( element, list, factor, value ) {
  2172. value = value || {};
  2173. $.each( list, function( i, x ) {
  2174. var unit = element.cssUnit( x );
  2175. if ( unit[ 0 ] > 0 ) {
  2176. value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
  2177. }
  2178. } );
  2179. return value;
  2180. }
  2181. } );
  2182. // Return an effect options object for the given parameters:
  2183. function _normalizeArguments( effect, options, speed, callback ) {
  2184. // Allow passing all options as the first parameter
  2185. if ( $.isPlainObject( effect ) ) {
  2186. options = effect;
  2187. effect = effect.effect;
  2188. }
  2189. // Convert to an object
  2190. effect = { effect: effect };
  2191. // Catch (effect, null, ...)
  2192. if ( options == null ) {
  2193. options = {};
  2194. }
  2195. // Catch (effect, callback)
  2196. if ( $.isFunction( options ) ) {
  2197. callback = options;
  2198. speed = null;
  2199. options = {};
  2200. }
  2201. // Catch (effect, speed, ?)
  2202. if ( typeof options === "number" || $.fx.speeds[ options ] ) {
  2203. callback = speed;
  2204. speed = options;
  2205. options = {};
  2206. }
  2207. // Catch (effect, options, callback)
  2208. if ( $.isFunction( speed ) ) {
  2209. callback = speed;
  2210. speed = null;
  2211. }
  2212. // Add options to effect
  2213. if ( options ) {
  2214. $.extend( effect, options );
  2215. }
  2216. speed = speed || options.duration;
  2217. effect.duration = $.fx.off ? 0 :
  2218. typeof speed === "number" ? speed :
  2219. speed in $.fx.speeds ? $.fx.speeds[ speed ] :
  2220. $.fx.speeds._default;
  2221. effect.complete = callback || options.complete;
  2222. return effect;
  2223. }
  2224. function standardAnimationOption( option ) {
  2225. // Valid standard speeds (nothing, number, named speed)
  2226. if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) {
  2227. return true;
  2228. }
  2229. // Invalid strings - treat as "normal" speed
  2230. if ( typeof option === "string" && !$.effects.effect[ option ] ) {
  2231. return true;
  2232. }
  2233. // Complete callback
  2234. if ( $.isFunction( option ) ) {
  2235. return true;
  2236. }
  2237. // Options hash (but not naming an effect)
  2238. if ( typeof option === "object" && !option.effect ) {
  2239. return true;
  2240. }
  2241. // Didn't match any standard API
  2242. return false;
  2243. }
  2244. $.fn.extend( {
  2245. effect: function( /* effect, options, speed, callback */ ) {
  2246. var args = _normalizeArguments.apply( this, arguments ),
  2247. effectMethod = $.effects.effect[ args.effect ],
  2248. defaultMode = effectMethod.mode,
  2249. queue = args.queue,
  2250. queueName = queue || "fx",
  2251. complete = args.complete,
  2252. mode = args.mode,
  2253. modes = [],
  2254. prefilter = function( next ) {
  2255. var el = $( this ),
  2256. normalizedMode = $.effects.mode( el, mode ) || defaultMode;
  2257. // Sentinel for duck-punching the :animated psuedo-selector
  2258. el.data( dataSpaceAnimated, true );
  2259. // Save effect mode for later use,
  2260. // we can't just call $.effects.mode again later,
  2261. // as the .show() below destroys the initial state
  2262. modes.push( normalizedMode );
  2263. // See $.uiBackCompat inside of run() for removal of defaultMode in 1.13
  2264. if ( defaultMode && ( normalizedMode === "show" ||
  2265. ( normalizedMode === defaultMode && normalizedMode === "hide" ) ) ) {
  2266. el.show();
  2267. }
  2268. if ( !defaultMode || normalizedMode !== "none" ) {
  2269. $.effects.saveStyle( el );
  2270. }
  2271. if ( $.isFunction( next ) ) {
  2272. next();
  2273. }
  2274. };
  2275. if ( $.fx.off || !effectMethod ) {
  2276. // Delegate to the original method (e.g., .show()) if possible
  2277. if ( mode ) {
  2278. return this[ mode ]( args.duration, complete );
  2279. } else {
  2280. return this.each( function() {
  2281. if ( complete ) {
  2282. complete.call( this );
  2283. }
  2284. } );
  2285. }
  2286. }
  2287. function run( next ) {
  2288. var elem = $( this );
  2289. function cleanup() {
  2290. elem.removeData( dataSpaceAnimated );
  2291. $.effects.cleanUp( elem );
  2292. if ( args.mode === "hide" ) {
  2293. elem.hide();
  2294. }
  2295. done();
  2296. }
  2297. function done() {
  2298. if ( $.isFunction( complete ) ) {
  2299. complete.call( elem[ 0 ] );
  2300. }
  2301. if ( $.isFunction( next ) ) {
  2302. next();
  2303. }
  2304. }
  2305. // Override mode option on a per element basis,
  2306. // as toggle can be either show or hide depending on element state
  2307. args.mode = modes.shift();
  2308. if ( $.uiBackCompat !== false && !defaultMode ) {
  2309. if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
  2310. // Call the core method to track "olddisplay" properly
  2311. elem[ mode ]();
  2312. done();
  2313. } else {
  2314. effectMethod.call( elem[ 0 ], args, done );
  2315. }
  2316. } else {
  2317. if ( args.mode === "none" ) {
  2318. // Call the core method to track "olddisplay" properly
  2319. elem[ mode ]();
  2320. done();
  2321. } else {
  2322. effectMethod.call( elem[ 0 ], args, cleanup );
  2323. }
  2324. }
  2325. }
  2326. // Run prefilter on all elements first to ensure that
  2327. // any showing or hiding happens before placeholder creation,
  2328. // which ensures that any layout changes are correctly captured.
  2329. return queue === false ?
  2330. this.each( prefilter ).each( run ) :
  2331. this.queue( queueName, prefilter ).queue( queueName, run );
  2332. },
  2333. show: ( function( orig ) {
  2334. return function( option ) {
  2335. if ( standardAnimationOption( option ) ) {
  2336. return orig.apply( this, arguments );
  2337. } else {
  2338. var args = _normalizeArguments.apply( this, arguments );
  2339. args.mode = "show";
  2340. return this.effect.call( this, args );
  2341. }
  2342. };
  2343. } )( $.fn.show ),
  2344. hide: ( function( orig ) {
  2345. return function( option ) {
  2346. if ( standardAnimationOption( option ) ) {
  2347. return orig.apply( this, arguments );
  2348. } else {
  2349. var args = _normalizeArguments.apply( this, arguments );
  2350. args.mode = "hide";
  2351. return this.effect.call( this, args );
  2352. }
  2353. };
  2354. } )( $.fn.hide ),
  2355. toggle: ( function( orig ) {
  2356. return function( option ) {
  2357. if ( standardAnimationOption( option ) || typeof option === "boolean" ) {
  2358. return orig.apply( this, arguments );
  2359. } else {
  2360. var args = _normalizeArguments.apply( this, arguments );
  2361. args.mode = "toggle";
  2362. return this.effect.call( this, args );
  2363. }
  2364. };
  2365. } )( $.fn.toggle ),
  2366. cssUnit: function( key ) {
  2367. var style = this.css( key ),
  2368. val = [];
  2369. $.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
  2370. if ( style.indexOf( unit ) > 0 ) {
  2371. val = [ parseFloat( style ), unit ];
  2372. }
  2373. } );
  2374. return val;
  2375. },
  2376. cssClip: function( clipObj ) {
  2377. if ( clipObj ) {
  2378. return this.css( "clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " +
  2379. clipObj.bottom + "px " + clipObj.left + "px)" );
  2380. }
  2381. return parseClip( this.css( "clip" ), this );
  2382. },
  2383. transfer: function( options, done ) {
  2384. var element = $( this ),
  2385. target = $( options.to ),
  2386. targetFixed = target.css( "position" ) === "fixed",
  2387. body = $( "body" ),
  2388. fixTop = targetFixed ? body.scrollTop() : 0,
  2389. fixLeft = targetFixed ? body.scrollLeft() : 0,
  2390. endPosition = target.offset(),
  2391. animation = {
  2392. top: endPosition.top - fixTop,
  2393. left: endPosition.left - fixLeft,
  2394. height: target.innerHeight(),
  2395. width: target.innerWidth()
  2396. },
  2397. startPosition = element.offset(),
  2398. transfer = $( "<div class='ui-effects-transfer'></div>" )
  2399. .appendTo( "body" )
  2400. .addClass( options.className )
  2401. .css( {
  2402. top: startPosition.top - fixTop,
  2403. left: startPosition.left - fixLeft,
  2404. height: element.innerHeight(),
  2405. width: element.innerWidth(),
  2406. position: targetFixed ? "fixed" : "absolute"
  2407. } )
  2408. .animate( animation, options.duration, options.easing, function() {
  2409. transfer.remove();
  2410. if ( $.isFunction( done ) ) {
  2411. done();
  2412. }
  2413. } );
  2414. }
  2415. } );
  2416. function parseClip( str, element ) {
  2417. var outerWidth = element.outerWidth(),
  2418. outerHeight = element.outerHeight(),
  2419. 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)\)$/,
  2420. values = clipRegex.exec( str ) || [ "", 0, outerWidth, outerHeight, 0 ];
  2421. return {
  2422. top: parseFloat( values[ 1 ] ) || 0,
  2423. right: values[ 2 ] === "auto" ? outerWidth : parseFloat( values[ 2 ] ),
  2424. bottom: values[ 3 ] === "auto" ? outerHeight : parseFloat( values[ 3 ] ),
  2425. left: parseFloat( values[ 4 ] ) || 0
  2426. };
  2427. }
  2428. $.fx.step.clip = function( fx ) {
  2429. if ( !fx.clipInit ) {
  2430. fx.start = $( fx.elem ).cssClip();
  2431. if ( typeof fx.end === "string" ) {
  2432. fx.end = parseClip( fx.end, fx.elem );
  2433. }
  2434. fx.clipInit = true;
  2435. }
  2436. $( fx.elem ).cssClip( {
  2437. top: fx.pos * ( fx.end.top - fx.start.top ) + fx.start.top,
  2438. right: fx.pos * ( fx.end.right - fx.start.right ) + fx.start.right,
  2439. bottom: fx.pos * ( fx.end.bottom - fx.start.bottom ) + fx.start.bottom,
  2440. left: fx.pos * ( fx.end.left - fx.start.left ) + fx.start.left
  2441. } );
  2442. };
  2443. } )();
  2444. /******************************************************************************/
  2445. /*********************************** EASING ***********************************/
  2446. /******************************************************************************/
  2447. ( function() {
  2448. // Based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
  2449. var baseEasings = {};
  2450. $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
  2451. baseEasings[ name ] = function( p ) {
  2452. return Math.pow( p, i + 2 );
  2453. };
  2454. } );
  2455. $.extend( baseEasings, {
  2456. Sine: function( p ) {
  2457. return 1 - Math.cos( p * Math.PI / 2 );
  2458. },
  2459. Circ: function( p ) {
  2460. return 1 - Math.sqrt( 1 - p * p );
  2461. },
  2462. Elastic: function( p ) {
  2463. return p === 0 || p === 1 ? p :
  2464. -Math.pow( 2, 8 * ( p - 1 ) ) * Math.sin( ( ( p - 1 ) * 80 - 7.5 ) * Math.PI / 15 );
  2465. },
  2466. Back: function( p ) {
  2467. return p * p * ( 3 * p - 2 );
  2468. },
  2469. Bounce: function( p ) {
  2470. var pow2,
  2471. bounce = 4;
  2472. while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
  2473. return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
  2474. }
  2475. } );
  2476. $.each( baseEasings, function( name, easeIn ) {
  2477. $.easing[ "easeIn" + name ] = easeIn;
  2478. $.easing[ "easeOut" + name ] = function( p ) {
  2479. return 1 - easeIn( 1 - p );
  2480. };
  2481. $.easing[ "easeInOut" + name ] = function( p ) {
  2482. return p < 0.5 ?
  2483. easeIn( p * 2 ) / 2 :
  2484. 1 - easeIn( p * -2 + 2 ) / 2;
  2485. };
  2486. } );
  2487. } )();
  2488. var effect = $.effects;
  2489. /*!
  2490. * jQuery UI Effects Blind 1.12.1
  2491. * http://jqueryui.com
  2492. *
  2493. * Copyright jQuery Foundation and other contributors
  2494. * Released under the MIT license.
  2495. * http://jquery.org/license
  2496. */
  2497. //>>label: Blind Effect
  2498. //>>group: Effects
  2499. //>>description: Blinds the element.
  2500. //>>docs: http://api.jqueryui.com/blind-effect/
  2501. //>>demos: http://jqueryui.com/effect/
  2502. var effectsEffectBlind = $.effects.define( "blind", "hide", function( options, done ) {
  2503. var map = {
  2504. up: [ "bottom", "top" ],
  2505. vertical: [ "bottom", "top" ],
  2506. down: [ "top", "bottom" ],
  2507. left: [ "right", "left" ],
  2508. horizontal: [ "right", "left" ],
  2509. right: [ "left", "right" ]
  2510. },
  2511. element = $( this ),
  2512. direction = options.direction || "up",
  2513. start = element.cssClip(),
  2514. animate = { clip: $.extend( {}, start ) },
  2515. placeholder = $.effects.createPlaceholder( element );
  2516. animate.clip[ map[ direction ][ 0 ] ] = animate.clip[ map[ direction ][ 1 ] ];
  2517. if ( options.mode === "show" ) {
  2518. element.cssClip( animate.clip );
  2519. if ( placeholder ) {
  2520. placeholder.css( $.effects.clipToBox( animate ) );
  2521. }
  2522. animate.clip = start;
  2523. }
  2524. if ( placeholder ) {
  2525. placeholder.animate( $.effects.clipToBox( animate ), options.duration, options.easing );
  2526. }
  2527. element.animate( animate, {
  2528. queue: false,
  2529. duration: options.duration,
  2530. easing: options.easing,
  2531. complete: done
  2532. } );
  2533. } );
  2534. /*!
  2535. * jQuery UI Effects Bounce 1.12.1
  2536. * http://jqueryui.com
  2537. *
  2538. * Copyright jQuery Foundation and other contributors
  2539. * Released under the MIT license.
  2540. * http://jquery.org/license
  2541. */
  2542. //>>label: Bounce Effect
  2543. //>>group: Effects
  2544. //>>description: Bounces an element horizontally or vertically n times.
  2545. //>>docs: http://api.jqueryui.com/bounce-effect/
  2546. //>>demos: http://jqueryui.com/effect/
  2547. var effectsEffectBounce = $.effects.define( "bounce", function( options, done ) {
  2548. var upAnim, downAnim, refValue,
  2549. element = $( this ),
  2550. // Defaults:
  2551. mode = options.mode,
  2552. hide = mode === "hide",
  2553. show = mode === "show",
  2554. direction = options.direction || "up",
  2555. distance = options.distance,
  2556. times = options.times || 5,
  2557. // Number of internal animations
  2558. anims = times * 2 + ( show || hide ? 1 : 0 ),
  2559. speed = options.duration / anims,
  2560. easing = options.easing,
  2561. // Utility:
  2562. ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
  2563. motion = ( direction === "up" || direction === "left" ),
  2564. i = 0,
  2565. queuelen = element.queue().length;
  2566. $.effects.createPlaceholder( element );
  2567. refValue = element.css( ref );
  2568. // Default distance for the BIGGEST bounce is the outer Distance / 3
  2569. if ( !distance ) {
  2570. distance = element[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
  2571. }
  2572. if ( show ) {
  2573. downAnim = { opacity: 1 };
  2574. downAnim[ ref ] = refValue;
  2575. // If we are showing, force opacity 0 and set the initial position
  2576. // then do the "first" animation
  2577. element
  2578. .css( "opacity", 0 )
  2579. .css( ref, motion ? -distance * 2 : distance * 2 )
  2580. .animate( downAnim, speed, easing );
  2581. }
  2582. // Start at the smallest distance if we are hiding
  2583. if ( hide ) {
  2584. distance = distance / Math.pow( 2, times - 1 );
  2585. }
  2586. downAnim = {};
  2587. downAnim[ ref ] = refValue;
  2588. // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
  2589. for ( ; i < times; i++ ) {
  2590. upAnim = {};
  2591. upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
  2592. element
  2593. .animate( upAnim, speed, easing )
  2594. .animate( downAnim, speed, easing );
  2595. distance = hide ? distance * 2 : distance / 2;
  2596. }
  2597. // Last Bounce when Hiding
  2598. if ( hide ) {
  2599. upAnim = { opacity: 0 };
  2600. upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
  2601. element.animate( upAnim, speed, easing );
  2602. }
  2603. element.queue( done );
  2604. $.effects.unshift( element, queuelen, anims + 1 );
  2605. } );
  2606. /*!
  2607. * jQuery UI Effects Clip 1.12.1
  2608. * http://jqueryui.com
  2609. *
  2610. * Copyright jQuery Foundation and other contributors
  2611. * Released under the MIT license.
  2612. * http://jquery.org/license
  2613. */
  2614. //>>label: Clip Effect
  2615. //>>group: Effects
  2616. //>>description: Clips the element on and off like an old TV.
  2617. //>>docs: http://api.jqueryui.com/clip-effect/
  2618. //>>demos: http://jqueryui.com/effect/
  2619. var effectsEffectClip = $.effects.define( "clip", "hide", function( options, done ) {
  2620. var start,
  2621. animate = {},
  2622. element = $( this ),
  2623. direction = options.direction || "vertical",
  2624. both = direction === "both",
  2625. horizontal = both || direction === "horizontal",
  2626. vertical = both || direction === "vertical";
  2627. start = element.cssClip();
  2628. animate.clip = {
  2629. top: vertical ? ( start.bottom - start.top ) / 2 : start.top,
  2630. right: horizontal ? ( start.right - start.left ) / 2 : start.right,
  2631. bottom: vertical ? ( start.bottom - start.top ) / 2 : start.bottom,
  2632. left: horizontal ? ( start.right - start.left ) / 2 : start.left
  2633. };
  2634. $.effects.createPlaceholder( element );
  2635. if ( options.mode === "show" ) {
  2636. element.cssClip( animate.clip );
  2637. animate.clip = start;
  2638. }
  2639. element.animate( animate, {
  2640. queue: false,
  2641. duration: options.duration,
  2642. easing: options.easing,
  2643. complete: done
  2644. } );
  2645. } );
  2646. /*!
  2647. * jQuery UI Effects Drop 1.12.1
  2648. * http://jqueryui.com
  2649. *
  2650. * Copyright jQuery Foundation and other contributors
  2651. * Released under the MIT license.
  2652. * http://jquery.org/license
  2653. */
  2654. //>>label: Drop Effect
  2655. //>>group: Effects
  2656. //>>description: Moves an element in one direction and hides it at the same time.
  2657. //>>docs: http://api.jqueryui.com/drop-effect/
  2658. //>>demos: http://jqueryui.com/effect/
  2659. var effectsEffectDrop = $.effects.define( "drop", "hide", function( options, done ) {
  2660. var distance,
  2661. element = $( this ),
  2662. mode = options.mode,
  2663. show = mode === "show",
  2664. direction = options.direction || "left",
  2665. ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
  2666. motion = ( direction === "up" || direction === "left" ) ? "-=" : "+=",
  2667. oppositeMotion = ( motion === "+=" ) ? "-=" : "+=",
  2668. animation = {
  2669. opacity: 0
  2670. };
  2671. $.effects.createPlaceholder( element );
  2672. distance = options.distance ||
  2673. element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2;
  2674. animation[ ref ] = motion + distance;
  2675. if ( show ) {
  2676. element.css( animation );
  2677. animation[ ref ] = oppositeMotion + distance;
  2678. animation.opacity = 1;
  2679. }
  2680. // Animate
  2681. element.animate( animation, {
  2682. queue: false,
  2683. duration: options.duration,
  2684. easing: options.easing,
  2685. complete: done
  2686. } );
  2687. } );
  2688. /*!
  2689. * jQuery UI Effects Explode 1.12.1
  2690. * http://jqueryui.com
  2691. *
  2692. * Copyright jQuery Foundation and other contributors
  2693. * Released under the MIT license.
  2694. * http://jquery.org/license
  2695. */
  2696. //>>label: Explode Effect
  2697. //>>group: Effects
  2698. // jscs:disable maximumLineLength
  2699. //>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness.
  2700. // jscs:enable maximumLineLength
  2701. //>>docs: http://api.jqueryui.com/explode-effect/
  2702. //>>demos: http://jqueryui.com/effect/
  2703. var effectsEffectExplode = $.effects.define( "explode", "hide", function( options, done ) {
  2704. var i, j, left, top, mx, my,
  2705. rows = options.pieces ? Math.round( Math.sqrt( options.pieces ) ) : 3,
  2706. cells = rows,
  2707. element = $( this ),
  2708. mode = options.mode,
  2709. show = mode === "show",
  2710. // Show and then visibility:hidden the element before calculating offset
  2711. offset = element.show().css( "visibility", "hidden" ).offset(),
  2712. // Width and height of a piece
  2713. width = Math.ceil( element.outerWidth() / cells ),
  2714. height = Math.ceil( element.outerHeight() / rows ),
  2715. pieces = [];
  2716. // Children animate complete:
  2717. function childComplete() {
  2718. pieces.push( this );
  2719. if ( pieces.length === rows * cells ) {
  2720. animComplete();
  2721. }
  2722. }
  2723. // Clone the element for each row and cell.
  2724. for ( i = 0; i < rows; i++ ) { // ===>
  2725. top = offset.top + i * height;
  2726. my = i - ( rows - 1 ) / 2;
  2727. for ( j = 0; j < cells; j++ ) { // |||
  2728. left = offset.left + j * width;
  2729. mx = j - ( cells - 1 ) / 2;
  2730. // Create a clone of the now hidden main element that will be absolute positioned
  2731. // within a wrapper div off the -left and -top equal to size of our pieces
  2732. element
  2733. .clone()
  2734. .appendTo( "body" )
  2735. .wrap( "<div></div>" )
  2736. .css( {
  2737. position: "absolute",
  2738. visibility: "visible",
  2739. left: -j * width,
  2740. top: -i * height
  2741. } )
  2742. // Select the wrapper - make it overflow: hidden and absolute positioned based on
  2743. // where the original was located +left and +top equal to the size of pieces
  2744. .parent()
  2745. .addClass( "ui-effects-explode" )
  2746. .css( {
  2747. position: "absolute",
  2748. overflow: "hidden",
  2749. width: width,
  2750. height: height,
  2751. left: left + ( show ? mx * width : 0 ),
  2752. top: top + ( show ? my * height : 0 ),
  2753. opacity: show ? 0 : 1
  2754. } )
  2755. .animate( {
  2756. left: left + ( show ? 0 : mx * width ),
  2757. top: top + ( show ? 0 : my * height ),
  2758. opacity: show ? 1 : 0
  2759. }, options.duration || 500, options.easing, childComplete );
  2760. }
  2761. }
  2762. function animComplete() {
  2763. element.css( {
  2764. visibility: "visible"
  2765. } );
  2766. $( pieces ).remove();
  2767. done();
  2768. }
  2769. } );
  2770. /*!
  2771. * jQuery UI Effects Fade 1.12.1
  2772. * http://jqueryui.com
  2773. *
  2774. * Copyright jQuery Foundation and other contributors
  2775. * Released under the MIT license.
  2776. * http://jquery.org/license
  2777. */
  2778. //>>label: Fade Effect
  2779. //>>group: Effects
  2780. //>>description: Fades the element.
  2781. //>>docs: http://api.jqueryui.com/fade-effect/
  2782. //>>demos: http://jqueryui.com/effect/
  2783. var effectsEffectFade = $.effects.define( "fade", "toggle", function( options, done ) {
  2784. var show = options.mode === "show";
  2785. $( this )
  2786. .css( "opacity", show ? 0 : 1 )
  2787. .animate( {
  2788. opacity: show ? 1 : 0
  2789. }, {
  2790. queue: false,
  2791. duration: options.duration,
  2792. easing: options.easing,
  2793. complete: done
  2794. } );
  2795. } );
  2796. /*!
  2797. * jQuery UI Effects Fold 1.12.1
  2798. * http://jqueryui.com
  2799. *
  2800. * Copyright jQuery Foundation and other contributors
  2801. * Released under the MIT license.
  2802. * http://jquery.org/license
  2803. */
  2804. //>>label: Fold Effect
  2805. //>>group: Effects
  2806. //>>description: Folds an element first horizontally and then vertically.
  2807. //>>docs: http://api.jqueryui.com/fold-effect/
  2808. //>>demos: http://jqueryui.com/effect/
  2809. var effectsEffectFold = $.effects.define( "fold", "hide", function( options, done ) {
  2810. // Create element
  2811. var element = $( this ),
  2812. mode = options.mode,
  2813. show = mode === "show",
  2814. hide = mode === "hide",
  2815. size = options.size || 15,
  2816. percent = /([0-9]+)%/.exec( size ),
  2817. horizFirst = !!options.horizFirst,
  2818. ref = horizFirst ? [ "right", "bottom" ] : [ "bottom", "right" ],
  2819. duration = options.duration / 2,
  2820. placeholder = $.effects.createPlaceholder( element ),
  2821. start = element.cssClip(),
  2822. animation1 = { clip: $.extend( {}, start ) },
  2823. animation2 = { clip: $.extend( {}, start ) },
  2824. distance = [ start[ ref[ 0 ] ], start[ ref[ 1 ] ] ],
  2825. queuelen = element.queue().length;
  2826. if ( percent ) {
  2827. size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ];
  2828. }
  2829. animation1.clip[ ref[ 0 ] ] = size;
  2830. animation2.clip[ ref[ 0 ] ] = size;
  2831. animation2.clip[ ref[ 1 ] ] = 0;
  2832. if ( show ) {
  2833. element.cssClip( animation2.clip );
  2834. if ( placeholder ) {
  2835. placeholder.css( $.effects.clipToBox( animation2 ) );
  2836. }
  2837. animation2.clip = start;
  2838. }
  2839. // Animate
  2840. element
  2841. .queue( function( next ) {
  2842. if ( placeholder ) {
  2843. placeholder
  2844. .animate( $.effects.clipToBox( animation1 ), duration, options.easing )
  2845. .animate( $.effects.clipToBox( animation2 ), duration, options.easing );
  2846. }
  2847. next();
  2848. } )
  2849. .animate( animation1, duration, options.easing )
  2850. .animate( animation2, duration, options.easing )
  2851. .queue( done );
  2852. $.effects.unshift( element, queuelen, 4 );
  2853. } );
  2854. /*!
  2855. * jQuery UI Effects Highlight 1.12.1
  2856. * http://jqueryui.com
  2857. *
  2858. * Copyright jQuery Foundation and other contributors
  2859. * Released under the MIT license.
  2860. * http://jquery.org/license
  2861. */
  2862. //>>label: Highlight Effect
  2863. //>>group: Effects
  2864. //>>description: Highlights the background of an element in a defined color for a custom duration.
  2865. //>>docs: http://api.jqueryui.com/highlight-effect/
  2866. //>>demos: http://jqueryui.com/effect/
  2867. var effectsEffectHighlight = $.effects.define( "highlight", "show", function( options, done ) {
  2868. var element = $( this ),
  2869. animation = {
  2870. backgroundColor: element.css( "backgroundColor" )
  2871. };
  2872. if ( options.mode === "hide" ) {
  2873. animation.opacity = 0;
  2874. }
  2875. $.effects.saveStyle( element );
  2876. element
  2877. .css( {
  2878. backgroundImage: "none",
  2879. backgroundColor: options.color || "#ffff99"
  2880. } )
  2881. .animate( animation, {
  2882. queue: false,
  2883. duration: options.duration,
  2884. easing: options.easing,
  2885. complete: done
  2886. } );
  2887. } );
  2888. /*!
  2889. * jQuery UI Effects Size 1.12.1
  2890. * http://jqueryui.com
  2891. *
  2892. * Copyright jQuery Foundation and other contributors
  2893. * Released under the MIT license.
  2894. * http://jquery.org/license
  2895. */
  2896. //>>label: Size Effect
  2897. //>>group: Effects
  2898. //>>description: Resize an element to a specified width and height.
  2899. //>>docs: http://api.jqueryui.com/size-effect/
  2900. //>>demos: http://jqueryui.com/effect/
  2901. var effectsEffectSize = $.effects.define( "size", function( options, done ) {
  2902. // Create element
  2903. var baseline, factor, temp,
  2904. element = $( this ),
  2905. // Copy for children
  2906. cProps = [ "fontSize" ],
  2907. vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
  2908. hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
  2909. // Set options
  2910. mode = options.mode,
  2911. restore = mode !== "effect",
  2912. scale = options.scale || "both",
  2913. origin = options.origin || [ "middle", "center" ],
  2914. position = element.css( "position" ),
  2915. pos = element.position(),
  2916. original = $.effects.scaledDimensions( element ),
  2917. from = options.from || original,
  2918. to = options.to || $.effects.scaledDimensions( element, 0 );
  2919. $.effects.createPlaceholder( element );
  2920. if ( mode === "show" ) {
  2921. temp = from;
  2922. from = to;
  2923. to = temp;
  2924. }
  2925. // Set scaling factor
  2926. factor = {
  2927. from: {
  2928. y: from.height / original.height,
  2929. x: from.width / original.width
  2930. },
  2931. to: {
  2932. y: to.height / original.height,
  2933. x: to.width / original.width
  2934. }
  2935. };
  2936. // Scale the css box
  2937. if ( scale === "box" || scale === "both" ) {
  2938. // Vertical props scaling
  2939. if ( factor.from.y !== factor.to.y ) {
  2940. from = $.effects.setTransition( element, vProps, factor.from.y, from );
  2941. to = $.effects.setTransition( element, vProps, factor.to.y, to );
  2942. }
  2943. // Horizontal props scaling
  2944. if ( factor.from.x !== factor.to.x ) {
  2945. from = $.effects.setTransition( element, hProps, factor.from.x, from );
  2946. to = $.effects.setTransition( element, hProps, factor.to.x, to );
  2947. }
  2948. }
  2949. // Scale the content
  2950. if ( scale === "content" || scale === "both" ) {
  2951. // Vertical props scaling
  2952. if ( factor.from.y !== factor.to.y ) {
  2953. from = $.effects.setTransition( element, cProps, factor.from.y, from );
  2954. to = $.effects.setTransition( element, cProps, factor.to.y, to );
  2955. }
  2956. }
  2957. // Adjust the position properties based on the provided origin points
  2958. if ( origin ) {
  2959. baseline = $.effects.getBaseline( origin, original );
  2960. from.top = ( original.outerHeight - from.outerHeight ) * baseline.y + pos.top;
  2961. from.left = ( original.outerWidth - from.outerWidth ) * baseline.x + pos.left;
  2962. to.top = ( original.outerHeight - to.outerHeight ) * baseline.y + pos.top;
  2963. to.left = ( original.outerWidth - to.outerWidth ) * baseline.x + pos.left;
  2964. }
  2965. element.css( from );
  2966. // Animate the children if desired
  2967. if ( scale === "content" || scale === "both" ) {
  2968. vProps = vProps.concat( [ "marginTop", "marginBottom" ] ).concat( cProps );
  2969. hProps = hProps.concat( [ "marginLeft", "marginRight" ] );
  2970. // Only animate children with width attributes specified
  2971. // TODO: is this right? should we include anything with css width specified as well
  2972. element.find( "*[width]" ).each( function() {
  2973. var child = $( this ),
  2974. childOriginal = $.effects.scaledDimensions( child ),
  2975. childFrom = {
  2976. height: childOriginal.height * factor.from.y,
  2977. width: childOriginal.width * factor.from.x,
  2978. outerHeight: childOriginal.outerHeight * factor.from.y,
  2979. outerWidth: childOriginal.outerWidth * factor.from.x
  2980. },
  2981. childTo = {
  2982. height: childOriginal.height * factor.to.y,
  2983. width: childOriginal.width * factor.to.x,
  2984. outerHeight: childOriginal.height * factor.to.y,
  2985. outerWidth: childOriginal.width * factor.to.x
  2986. };
  2987. // Vertical props scaling
  2988. if ( factor.from.y !== factor.to.y ) {
  2989. childFrom = $.effects.setTransition( child, vProps, factor.from.y, childFrom );
  2990. childTo = $.effects.setTransition( child, vProps, factor.to.y, childTo );
  2991. }
  2992. // Horizontal props scaling
  2993. if ( factor.from.x !== factor.to.x ) {
  2994. childFrom = $.effects.setTransition( child, hProps, factor.from.x, childFrom );
  2995. childTo = $.effects.setTransition( child, hProps, factor.to.x, childTo );
  2996. }
  2997. if ( restore ) {
  2998. $.effects.saveStyle( child );
  2999. }
  3000. // Animate children
  3001. child.css( childFrom );
  3002. child.animate( childTo, options.duration, options.easing, function() {
  3003. // Restore children
  3004. if ( restore ) {
  3005. $.effects.restoreStyle( child );
  3006. }
  3007. } );
  3008. } );
  3009. }
  3010. // Animate
  3011. element.animate( to, {
  3012. queue: false,
  3013. duration: options.duration,
  3014. easing: options.easing,
  3015. complete: function() {
  3016. var offset = element.offset();
  3017. if ( to.opacity === 0 ) {
  3018. element.css( "opacity", from.opacity );
  3019. }
  3020. if ( !restore ) {
  3021. element
  3022. .css( "position", position === "static" ? "relative" : position )
  3023. .offset( offset );
  3024. // Need to save style here so that automatic style restoration
  3025. // doesn't restore to the original styles from before the animation.
  3026. $.effects.saveStyle( element );
  3027. }
  3028. done();
  3029. }
  3030. } );
  3031. } );
  3032. /*!
  3033. * jQuery UI Effects Scale 1.12.1
  3034. * http://jqueryui.com
  3035. *
  3036. * Copyright jQuery Foundation and other contributors
  3037. * Released under the MIT license.
  3038. * http://jquery.org/license
  3039. */
  3040. //>>label: Scale Effect
  3041. //>>group: Effects
  3042. //>>description: Grows or shrinks an element and its content.
  3043. //>>docs: http://api.jqueryui.com/scale-effect/
  3044. //>>demos: http://jqueryui.com/effect/
  3045. var effectsEffectScale = $.effects.define( "scale", function( options, done ) {
  3046. // Create element
  3047. var el = $( this ),
  3048. mode = options.mode,
  3049. percent = parseInt( options.percent, 10 ) ||
  3050. ( parseInt( options.percent, 10 ) === 0 ? 0 : ( mode !== "effect" ? 0 : 100 ) ),
  3051. newOptions = $.extend( true, {
  3052. from: $.effects.scaledDimensions( el ),
  3053. to: $.effects.scaledDimensions( el, percent, options.direction || "both" ),
  3054. origin: options.origin || [ "middle", "center" ]
  3055. }, options );
  3056. // Fade option to support puff
  3057. if ( options.fade ) {
  3058. newOptions.from.opacity = 1;
  3059. newOptions.to.opacity = 0;
  3060. }
  3061. $.effects.effect.size.call( this, newOptions, done );
  3062. } );
  3063. /*!
  3064. * jQuery UI Effects Puff 1.12.1
  3065. * http://jqueryui.com
  3066. *
  3067. * Copyright jQuery Foundation and other contributors
  3068. * Released under the MIT license.
  3069. * http://jquery.org/license
  3070. */
  3071. //>>label: Puff Effect
  3072. //>>group: Effects
  3073. //>>description: Creates a puff effect by scaling the element up and hiding it at the same time.
  3074. //>>docs: http://api.jqueryui.com/puff-effect/
  3075. //>>demos: http://jqueryui.com/effect/
  3076. var effectsEffectPuff = $.effects.define( "puff", "hide", function( options, done ) {
  3077. var newOptions = $.extend( true, {}, options, {
  3078. fade: true,
  3079. percent: parseInt( options.percent, 10 ) || 150
  3080. } );
  3081. $.effects.effect.scale.call( this, newOptions, done );
  3082. } );
  3083. /*!
  3084. * jQuery UI Effects Pulsate 1.12.1
  3085. * http://jqueryui.com
  3086. *
  3087. * Copyright jQuery Foundation and other contributors
  3088. * Released under the MIT license.
  3089. * http://jquery.org/license
  3090. */
  3091. //>>label: Pulsate Effect
  3092. //>>group: Effects
  3093. //>>description: Pulsates an element n times by changing the opacity to zero and back.
  3094. //>>docs: http://api.jqueryui.com/pulsate-effect/
  3095. //>>demos: http://jqueryui.com/effect/
  3096. var effectsEffectPulsate = $.effects.define( "pulsate", "show", function( options, done ) {
  3097. var element = $( this ),
  3098. mode = options.mode,
  3099. show = mode === "show",
  3100. hide = mode === "hide",
  3101. showhide = show || hide,
  3102. // Showing or hiding leaves off the "last" animation
  3103. anims = ( ( options.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
  3104. duration = options.duration / anims,
  3105. animateTo = 0,
  3106. i = 1,
  3107. queuelen = element.queue().length;
  3108. if ( show || !element.is( ":visible" ) ) {
  3109. element.css( "opacity", 0 ).show();
  3110. animateTo = 1;
  3111. }
  3112. // Anims - 1 opacity "toggles"
  3113. for ( ; i < anims; i++ ) {
  3114. element.animate( { opacity: animateTo }, duration, options.easing );
  3115. animateTo = 1 - animateTo;
  3116. }
  3117. element.animate( { opacity: animateTo }, duration, options.easing );
  3118. element.queue( done );
  3119. $.effects.unshift( element, queuelen, anims + 1 );
  3120. } );
  3121. /*!
  3122. * jQuery UI Effects Shake 1.12.1
  3123. * http://jqueryui.com
  3124. *
  3125. * Copyright jQuery Foundation and other contributors
  3126. * Released under the MIT license.
  3127. * http://jquery.org/license
  3128. */
  3129. //>>label: Shake Effect
  3130. //>>group: Effects
  3131. //>>description: Shakes an element horizontally or vertically n times.
  3132. //>>docs: http://api.jqueryui.com/shake-effect/
  3133. //>>demos: http://jqueryui.com/effect/
  3134. var effectsEffectShake = $.effects.define( "shake", function( options, done ) {
  3135. var i = 1,
  3136. element = $( this ),
  3137. direction = options.direction || "left",
  3138. distance = options.distance || 20,
  3139. times = options.times || 3,
  3140. anims = times * 2 + 1,
  3141. speed = Math.round( options.duration / anims ),
  3142. ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
  3143. positiveMotion = ( direction === "up" || direction === "left" ),
  3144. animation = {},
  3145. animation1 = {},
  3146. animation2 = {},
  3147. queuelen = element.queue().length;
  3148. $.effects.createPlaceholder( element );
  3149. // Animation
  3150. animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance;
  3151. animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2;
  3152. animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2;
  3153. // Animate
  3154. element.animate( animation, speed, options.easing );
  3155. // Shakes
  3156. for ( ; i < times; i++ ) {
  3157. element
  3158. .animate( animation1, speed, options.easing )
  3159. .animate( animation2, speed, options.easing );
  3160. }
  3161. element
  3162. .animate( animation1, speed, options.easing )
  3163. .animate( animation, speed / 2, options.easing )
  3164. .queue( done );
  3165. $.effects.unshift( element, queuelen, anims + 1 );
  3166. } );
  3167. /*!
  3168. * jQuery UI Effects Slide 1.12.1
  3169. * http://jqueryui.com
  3170. *
  3171. * Copyright jQuery Foundation and other contributors
  3172. * Released under the MIT license.
  3173. * http://jquery.org/license
  3174. */
  3175. //>>label: Slide Effect
  3176. //>>group: Effects
  3177. //>>description: Slides an element in and out of the viewport.
  3178. //>>docs: http://api.jqueryui.com/slide-effect/
  3179. //>>demos: http://jqueryui.com/effect/
  3180. var effectsEffectSlide = $.effects.define( "slide", "show", function( options, done ) {
  3181. var startClip, startRef,
  3182. element = $( this ),
  3183. map = {
  3184. up: [ "bottom", "top" ],
  3185. down: [ "top", "bottom" ],
  3186. left: [ "right", "left" ],
  3187. right: [ "left", "right" ]
  3188. },
  3189. mode = options.mode,
  3190. direction = options.direction || "left",
  3191. ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
  3192. positiveMotion = ( direction === "up" || direction === "left" ),
  3193. distance = options.distance ||
  3194. element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ),
  3195. animation = {};
  3196. $.effects.createPlaceholder( element );
  3197. startClip = element.cssClip();
  3198. startRef = element.position()[ ref ];
  3199. // Define hide animation
  3200. animation[ ref ] = ( positiveMotion ? -1 : 1 ) * distance + startRef;
  3201. animation.clip = element.cssClip();
  3202. animation.clip[ map[ direction ][ 1 ] ] = animation.clip[ map[ direction ][ 0 ] ];
  3203. // Reverse the animation if we're showing
  3204. if ( mode === "show" ) {
  3205. element.cssClip( animation.clip );
  3206. element.css( ref, animation[ ref ] );
  3207. animation.clip = startClip;
  3208. animation[ ref ] = startRef;
  3209. }
  3210. // Actually animate
  3211. element.animate( animation, {
  3212. queue: false,
  3213. duration: options.duration,
  3214. easing: options.easing,
  3215. complete: done
  3216. } );
  3217. } );
  3218. /*!
  3219. * jQuery UI Effects Transfer 1.12.1
  3220. * http://jqueryui.com
  3221. *
  3222. * Copyright jQuery Foundation and other contributors
  3223. * Released under the MIT license.
  3224. * http://jquery.org/license
  3225. */
  3226. //>>label: Transfer Effect
  3227. //>>group: Effects
  3228. //>>description: Displays a transfer effect from one element to another.
  3229. //>>docs: http://api.jqueryui.com/transfer-effect/
  3230. //>>demos: http://jqueryui.com/effect/
  3231. var effect;
  3232. if ( $.uiBackCompat !== false ) {
  3233. effect = $.effects.define( "transfer", function( options, done ) {
  3234. $( this ).transfer( options, done );
  3235. } );
  3236. }
  3237. var effectsEffectTransfer = effect;
  3238. /*!
  3239. * jQuery UI Focusable 1.12.1
  3240. * http://jqueryui.com
  3241. *
  3242. * Copyright jQuery Foundation and other contributors
  3243. * Released under the MIT license.
  3244. * http://jquery.org/license
  3245. */
  3246. //>>label: :focusable Selector
  3247. //>>group: Core
  3248. //>>description: Selects elements which can be focused.
  3249. //>>docs: http://api.jqueryui.com/focusable-selector/
  3250. // Selectors
  3251. $.ui.focusable = function( element, hasTabindex ) {
  3252. var map, mapName, img, focusableIfVisible, fieldset,
  3253. nodeName = element.nodeName.toLowerCase();
  3254. if ( "area" === nodeName ) {
  3255. map = element.parentNode;
  3256. mapName = map.name;
  3257. if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
  3258. return false;
  3259. }
  3260. img = $( "img[usemap='#" + mapName + "']" );
  3261. return img.length > 0 && img.is( ":visible" );
  3262. }
  3263. if ( /^(input|select|textarea|button|object)$/.test( nodeName ) ) {
  3264. focusableIfVisible = !element.disabled;
  3265. if ( focusableIfVisible ) {
  3266. // Form controls within a disabled fieldset are disabled.
  3267. // However, controls within the fieldset's legend do not get disabled.
  3268. // Since controls generally aren't placed inside legends, we skip
  3269. // this portion of the check.
  3270. fieldset = $( element ).closest( "fieldset" )[ 0 ];
  3271. if ( fieldset ) {
  3272. focusableIfVisible = !fieldset.disabled;
  3273. }
  3274. }
  3275. } else if ( "a" === nodeName ) {
  3276. focusableIfVisible = element.href || hasTabindex;
  3277. } else {
  3278. focusableIfVisible = hasTabindex;
  3279. }
  3280. return focusableIfVisible && $( element ).is( ":visible" ) && visible( $( element ) );
  3281. };
  3282. // Support: IE 8 only
  3283. // IE 8 doesn't resolve inherit to visible/hidden for computed values
  3284. function visible( element ) {
  3285. var visibility = element.css( "visibility" );
  3286. while ( visibility === "inherit" ) {
  3287. element = element.parent();
  3288. visibility = element.css( "visibility" );
  3289. }
  3290. return visibility !== "hidden";
  3291. }
  3292. $.extend( $.expr[ ":" ], {
  3293. focusable: function( element ) {
  3294. return $.ui.focusable( element, $.attr( element, "tabindex" ) != null );
  3295. }
  3296. } );
  3297. var focusable = $.ui.focusable;
  3298. // Support: IE8 Only
  3299. // IE8 does not support the form attribute and when it is supplied. It overwrites the form prop
  3300. // with a string, so we need to find the proper form.
  3301. var form = $.fn.form = function() {
  3302. return typeof this[ 0 ].form === "string" ? this.closest( "form" ) : $( this[ 0 ].form );
  3303. };
  3304. /*!
  3305. * jQuery UI Form Reset Mixin 1.12.1
  3306. * http://jqueryui.com
  3307. *
  3308. * Copyright jQuery Foundation and other contributors
  3309. * Released under the MIT license.
  3310. * http://jquery.org/license
  3311. */
  3312. //>>label: Form Reset Mixin
  3313. //>>group: Core
  3314. //>>description: Refresh input widgets when their form is reset
  3315. //>>docs: http://api.jqueryui.com/form-reset-mixin/
  3316. var formResetMixin = $.ui.formResetMixin = {
  3317. _formResetHandler: function() {
  3318. var form = $( this );
  3319. // Wait for the form reset to actually happen before refreshing
  3320. setTimeout( function() {
  3321. var instances = form.data( "ui-form-reset-instances" );
  3322. $.each( instances, function() {
  3323. this.refresh();
  3324. } );
  3325. } );
  3326. },
  3327. _bindFormResetHandler: function() {
  3328. this.form = this.element.form();
  3329. if ( !this.form.length ) {
  3330. return;
  3331. }
  3332. var instances = this.form.data( "ui-form-reset-instances" ) || [];
  3333. if ( !instances.length ) {
  3334. // We don't use _on() here because we use a single event handler per form
  3335. this.form.on( "reset.ui-form-reset", this._formResetHandler );
  3336. }
  3337. instances.push( this );
  3338. this.form.data( "ui-form-reset-instances", instances );
  3339. },
  3340. _unbindFormResetHandler: function() {
  3341. if ( !this.form.length ) {
  3342. return;
  3343. }
  3344. var instances = this.form.data( "ui-form-reset-instances" );
  3345. instances.splice( $.inArray( this, instances ), 1 );
  3346. if ( instances.length ) {
  3347. this.form.data( "ui-form-reset-instances", instances );
  3348. } else {
  3349. this.form
  3350. .removeData( "ui-form-reset-instances" )
  3351. .off( "reset.ui-form-reset" );
  3352. }
  3353. }
  3354. };
  3355. /*!
  3356. * jQuery UI Support for jQuery core 1.7.x 1.12.1
  3357. * http://jqueryui.com
  3358. *
  3359. * Copyright jQuery Foundation and other contributors
  3360. * Released under the MIT license.
  3361. * http://jquery.org/license
  3362. *
  3363. */
  3364. //>>label: jQuery 1.7 Support
  3365. //>>group: Core
  3366. //>>description: Support version 1.7.x of jQuery core
  3367. // Support: jQuery 1.7 only
  3368. // Not a great way to check versions, but since we only support 1.7+ and only
  3369. // need to detect <1.8, this is a simple check that should suffice. Checking
  3370. // for "1.7." would be a bit safer, but the version string is 1.7, not 1.7.0
  3371. // and we'll never reach 1.70.0 (if we do, we certainly won't be supporting
  3372. // 1.7 anymore). See #11197 for why we're not using feature detection.
  3373. if ( $.fn.jquery.substring( 0, 3 ) === "1.7" ) {
  3374. // Setters for .innerWidth(), .innerHeight(), .outerWidth(), .outerHeight()
  3375. // Unlike jQuery Core 1.8+, these only support numeric values to set the
  3376. // dimensions in pixels
  3377. $.each( [ "Width", "Height" ], function( i, name ) {
  3378. var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
  3379. type = name.toLowerCase(),
  3380. orig = {
  3381. innerWidth: $.fn.innerWidth,
  3382. innerHeight: $.fn.innerHeight,
  3383. outerWidth: $.fn.outerWidth,
  3384. outerHeight: $.fn.outerHeight
  3385. };
  3386. function reduce( elem, size, border, margin ) {
  3387. $.each( side, function() {
  3388. size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
  3389. if ( border ) {
  3390. size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
  3391. }
  3392. if ( margin ) {
  3393. size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
  3394. }
  3395. } );
  3396. return size;
  3397. }
  3398. $.fn[ "inner" + name ] = function( size ) {
  3399. if ( size === undefined ) {
  3400. return orig[ "inner" + name ].call( this );
  3401. }
  3402. return this.each( function() {
  3403. $( this ).css( type, reduce( this, size ) + "px" );
  3404. } );
  3405. };
  3406. $.fn[ "outer" + name ] = function( size, margin ) {
  3407. if ( typeof size !== "number" ) {
  3408. return orig[ "outer" + name ].call( this, size );
  3409. }
  3410. return this.each( function() {
  3411. $( this ).css( type, reduce( this, size, true, margin ) + "px" );
  3412. } );
  3413. };
  3414. } );
  3415. $.fn.addBack = function( selector ) {
  3416. return this.add( selector == null ?
  3417. this.prevObject : this.prevObject.filter( selector )
  3418. );
  3419. };
  3420. }
  3421. ;
  3422. /*!
  3423. * jQuery UI Keycode 1.12.1
  3424. * http://jqueryui.com
  3425. *
  3426. * Copyright jQuery Foundation and other contributors
  3427. * Released under the MIT license.
  3428. * http://jquery.org/license
  3429. */
  3430. //>>label: Keycode
  3431. //>>group: Core
  3432. //>>description: Provide keycodes as keynames
  3433. //>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/
  3434. var keycode = $.ui.keyCode = {
  3435. BACKSPACE: 8,
  3436. COMMA: 188,
  3437. DELETE: 46,
  3438. DOWN: 40,
  3439. END: 35,
  3440. ENTER: 13,
  3441. ESCAPE: 27,
  3442. HOME: 36,
  3443. LEFT: 37,
  3444. PAGE_DOWN: 34,
  3445. PAGE_UP: 33,
  3446. PERIOD: 190,
  3447. RIGHT: 39,
  3448. SPACE: 32,
  3449. TAB: 9,
  3450. UP: 38
  3451. };
  3452. // Internal use only
  3453. var escapeSelector = $.ui.escapeSelector = ( function() {
  3454. var selectorEscape = /([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;
  3455. return function( selector ) {
  3456. return selector.replace( selectorEscape, "\\$1" );
  3457. };
  3458. } )();
  3459. /*!
  3460. * jQuery UI Labels 1.12.1
  3461. * http://jqueryui.com
  3462. *
  3463. * Copyright jQuery Foundation and other contributors
  3464. * Released under the MIT license.
  3465. * http://jquery.org/license
  3466. */
  3467. //>>label: labels
  3468. //>>group: Core
  3469. //>>description: Find all the labels associated with a given input
  3470. //>>docs: http://api.jqueryui.com/labels/
  3471. var labels = $.fn.labels = function() {
  3472. var ancestor, selector, id, labels, ancestors;
  3473. // Check control.labels first
  3474. if ( this[ 0 ].labels && this[ 0 ].labels.length ) {
  3475. return this.pushStack( this[ 0 ].labels );
  3476. }
  3477. // Support: IE <= 11, FF <= 37, Android <= 2.3 only
  3478. // Above browsers do not support control.labels. Everything below is to support them
  3479. // as well as document fragments. control.labels does not work on document fragments
  3480. labels = this.eq( 0 ).parents( "label" );
  3481. // Look for the label based on the id
  3482. id = this.attr( "id" );
  3483. if ( id ) {
  3484. // We don't search against the document in case the element
  3485. // is disconnected from the DOM
  3486. ancestor = this.eq( 0 ).parents().last();
  3487. // Get a full set of top level ancestors
  3488. ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() );
  3489. // Create a selector for the label based on the id
  3490. selector = "label[for='" + $.ui.escapeSelector( id ) + "']";
  3491. labels = labels.add( ancestors.find( selector ).addBack( selector ) );
  3492. }
  3493. // Return whatever we have found for labels
  3494. return this.pushStack( labels );
  3495. };
  3496. /*!
  3497. * jQuery UI Scroll Parent 1.12.1
  3498. * http://jqueryui.com
  3499. *
  3500. * Copyright jQuery Foundation and other contributors
  3501. * Released under the MIT license.
  3502. * http://jquery.org/license
  3503. */
  3504. //>>label: scrollParent
  3505. //>>group: Core
  3506. //>>description: Get the closest ancestor element that is scrollable.
  3507. //>>docs: http://api.jqueryui.com/scrollParent/
  3508. var scrollParent = $.fn.scrollParent = function( includeHidden ) {
  3509. var position = this.css( "position" ),
  3510. excludeStaticParent = position === "absolute",
  3511. overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
  3512. scrollParent = this.parents().filter( function() {
  3513. var parent = $( this );
  3514. if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
  3515. return false;
  3516. }
  3517. return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) +
  3518. parent.css( "overflow-x" ) );
  3519. } ).eq( 0 );
  3520. return position === "fixed" || !scrollParent.length ?
  3521. $( this[ 0 ].ownerDocument || document ) :
  3522. scrollParent;
  3523. };
  3524. /*!
  3525. * jQuery UI Tabbable 1.12.1
  3526. * http://jqueryui.com
  3527. *
  3528. * Copyright jQuery Foundation and other contributors
  3529. * Released under the MIT license.
  3530. * http://jquery.org/license
  3531. */
  3532. //>>label: :tabbable Selector
  3533. //>>group: Core
  3534. //>>description: Selects elements which can be tabbed to.
  3535. //>>docs: http://api.jqueryui.com/tabbable-selector/
  3536. var tabbable = $.extend( $.expr[ ":" ], {
  3537. tabbable: function( element ) {
  3538. var tabIndex = $.attr( element, "tabindex" ),
  3539. hasTabindex = tabIndex != null;
  3540. return ( !hasTabindex || tabIndex >= 0 ) && $.ui.focusable( element, hasTabindex );
  3541. }
  3542. } );
  3543. /*!
  3544. * jQuery UI Unique ID 1.12.1
  3545. * http://jqueryui.com
  3546. *
  3547. * Copyright jQuery Foundation and other contributors
  3548. * Released under the MIT license.
  3549. * http://jquery.org/license
  3550. */
  3551. //>>label: uniqueId
  3552. //>>group: Core
  3553. //>>description: Functions to generate and remove uniqueId's
  3554. //>>docs: http://api.jqueryui.com/uniqueId/
  3555. var uniqueId = $.fn.extend( {
  3556. uniqueId: ( function() {
  3557. var uuid = 0;
  3558. return function() {
  3559. return this.each( function() {
  3560. if ( !this.id ) {
  3561. this.id = "ui-id-" + ( ++uuid );
  3562. }
  3563. } );
  3564. };
  3565. } )(),
  3566. removeUniqueId: function() {
  3567. return this.each( function() {
  3568. if ( /^ui-id-\d+$/.test( this.id ) ) {
  3569. $( this ).removeAttr( "id" );
  3570. }
  3571. } );
  3572. }
  3573. } );
  3574. /*!
  3575. * jQuery UI Accordion 1.12.1
  3576. * http://jqueryui.com
  3577. *
  3578. * Copyright jQuery Foundation and other contributors
  3579. * Released under the MIT license.
  3580. * http://jquery.org/license
  3581. */
  3582. //>>label: Accordion
  3583. //>>group: Widgets
  3584. // jscs:disable maximumLineLength
  3585. //>>description: Displays collapsible content panels for presenting information in a limited amount of space.
  3586. // jscs:enable maximumLineLength
  3587. //>>docs: http://api.jqueryui.com/accordion/
  3588. //>>demos: http://jqueryui.com/accordion/
  3589. //>>css.structure: ../../themes/base/core.css
  3590. //>>css.structure: ../../themes/base/accordion.css
  3591. //>>css.theme: ../../themes/base/theme.css
  3592. var widgetsAccordion = $.widget( "ui.accordion", {
  3593. version: "1.12.1",
  3594. options: {
  3595. active: 0,
  3596. animate: {},
  3597. classes: {
  3598. "ui-accordion-header": "ui-corner-top",
  3599. "ui-accordion-header-collapsed": "ui-corner-all",
  3600. "ui-accordion-content": "ui-corner-bottom"
  3601. },
  3602. collapsible: false,
  3603. event: "click",
  3604. header: "> li > :first-child, > :not(li):even",
  3605. heightStyle: "auto",
  3606. icons: {
  3607. activeHeader: "ui-icon-triangle-1-s",
  3608. header: "ui-icon-triangle-1-e"
  3609. },
  3610. // Callbacks
  3611. activate: null,
  3612. beforeActivate: null
  3613. },
  3614. hideProps: {
  3615. borderTopWidth: "hide",
  3616. borderBottomWidth: "hide",
  3617. paddingTop: "hide",
  3618. paddingBottom: "hide",
  3619. height: "hide"
  3620. },
  3621. showProps: {
  3622. borderTopWidth: "show",
  3623. borderBottomWidth: "show",
  3624. paddingTop: "show",
  3625. paddingBottom: "show",
  3626. height: "show"
  3627. },
  3628. _create: function() {
  3629. var options = this.options;
  3630. this.prevShow = this.prevHide = $();
  3631. this._addClass( "ui-accordion", "ui-widget ui-helper-reset" );
  3632. this.element.attr( "role", "tablist" );
  3633. // Don't allow collapsible: false and active: false / null
  3634. if ( !options.collapsible && ( options.active === false || options.active == null ) ) {
  3635. options.active = 0;
  3636. }
  3637. this._processPanels();
  3638. // handle negative values
  3639. if ( options.active < 0 ) {
  3640. options.active += this.headers.length;
  3641. }
  3642. this._refresh();
  3643. },
  3644. _getCreateEventData: function() {
  3645. return {
  3646. header: this.active,
  3647. panel: !this.active.length ? $() : this.active.next()
  3648. };
  3649. },
  3650. _createIcons: function() {
  3651. var icon, children,
  3652. icons = this.options.icons;
  3653. if ( icons ) {
  3654. icon = $( "<span>" );
  3655. this._addClass( icon, "ui-accordion-header-icon", "ui-icon " + icons.header );
  3656. icon.prependTo( this.headers );
  3657. children = this.active.children( ".ui-accordion-header-icon" );
  3658. this._removeClass( children, icons.header )
  3659. ._addClass( children, null, icons.activeHeader )
  3660. ._addClass( this.headers, "ui-accordion-icons" );
  3661. }
  3662. },
  3663. _destroyIcons: function() {
  3664. this._removeClass( this.headers, "ui-accordion-icons" );
  3665. this.headers.children( ".ui-accordion-header-icon" ).remove();
  3666. },
  3667. _destroy: function() {
  3668. var contents;
  3669. // Clean up main element
  3670. this.element.removeAttr( "role" );
  3671. // Clean up headers
  3672. this.headers
  3673. .removeAttr( "role aria-expanded aria-selected aria-controls tabIndex" )
  3674. .removeUniqueId();
  3675. this._destroyIcons();
  3676. // Clean up content panels
  3677. contents = this.headers.next()
  3678. .css( "display", "" )
  3679. .removeAttr( "role aria-hidden aria-labelledby" )
  3680. .removeUniqueId();
  3681. if ( this.options.heightStyle !== "content" ) {
  3682. contents.css( "height", "" );
  3683. }
  3684. },
  3685. _setOption: function( key, value ) {
  3686. if ( key === "active" ) {
  3687. // _activate() will handle invalid values and update this.options
  3688. this._activate( value );
  3689. return;
  3690. }
  3691. if ( key === "event" ) {
  3692. if ( this.options.event ) {
  3693. this._off( this.headers, this.options.event );
  3694. }
  3695. this._setupEvents( value );
  3696. }
  3697. this._super( key, value );
  3698. // Setting collapsible: false while collapsed; open first panel
  3699. if ( key === "collapsible" && !value && this.options.active === false ) {
  3700. this._activate( 0 );
  3701. }
  3702. if ( key === "icons" ) {
  3703. this._destroyIcons();
  3704. if ( value ) {
  3705. this._createIcons();
  3706. }
  3707. }
  3708. },
  3709. _setOptionDisabled: function( value ) {
  3710. this._super( value );
  3711. this.element.attr( "aria-disabled", value );
  3712. // Support: IE8 Only
  3713. // #5332 / #6059 - opacity doesn't cascade to positioned elements in IE
  3714. // so we need to add the disabled class to the headers and panels
  3715. this._toggleClass( null, "ui-state-disabled", !!value );
  3716. this._toggleClass( this.headers.add( this.headers.next() ), null, "ui-state-disabled",
  3717. !!value );
  3718. },
  3719. _keydown: function( event ) {
  3720. if ( event.altKey || event.ctrlKey ) {
  3721. return;
  3722. }
  3723. var keyCode = $.ui.keyCode,
  3724. length = this.headers.length,
  3725. currentIndex = this.headers.index( event.target ),
  3726. toFocus = false;
  3727. switch ( event.keyCode ) {
  3728. case keyCode.RIGHT:
  3729. case keyCode.DOWN:
  3730. toFocus = this.headers[ ( currentIndex + 1 ) % length ];
  3731. break;
  3732. case keyCode.LEFT:
  3733. case keyCode.UP:
  3734. toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
  3735. break;
  3736. case keyCode.SPACE:
  3737. case keyCode.ENTER:
  3738. this._eventHandler( event );
  3739. break;
  3740. case keyCode.HOME:
  3741. toFocus = this.headers[ 0 ];
  3742. break;
  3743. case keyCode.END:
  3744. toFocus = this.headers[ length - 1 ];
  3745. break;
  3746. }
  3747. if ( toFocus ) {
  3748. $( event.target ).attr( "tabIndex", -1 );
  3749. $( toFocus ).attr( "tabIndex", 0 );
  3750. $( toFocus ).trigger( "focus" );
  3751. event.preventDefault();
  3752. }
  3753. },
  3754. _panelKeyDown: function( event ) {
  3755. if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
  3756. $( event.currentTarget ).prev().trigger( "focus" );
  3757. }
  3758. },
  3759. refresh: function() {
  3760. var options = this.options;
  3761. this._processPanels();
  3762. // Was collapsed or no panel
  3763. if ( ( options.active === false && options.collapsible === true ) ||
  3764. !this.headers.length ) {
  3765. options.active = false;
  3766. this.active = $();
  3767. // active false only when collapsible is true
  3768. } else if ( options.active === false ) {
  3769. this._activate( 0 );
  3770. // was active, but active panel is gone
  3771. } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
  3772. // all remaining panel are disabled
  3773. if ( this.headers.length === this.headers.find( ".ui-state-disabled" ).length ) {
  3774. options.active = false;
  3775. this.active = $();
  3776. // activate previous panel
  3777. } else {
  3778. this._activate( Math.max( 0, options.active - 1 ) );
  3779. }
  3780. // was active, active panel still exists
  3781. } else {
  3782. // make sure active index is correct
  3783. options.active = this.headers.index( this.active );
  3784. }
  3785. this._destroyIcons();
  3786. this._refresh();
  3787. },
  3788. _processPanels: function() {
  3789. var prevHeaders = this.headers,
  3790. prevPanels = this.panels;
  3791. this.headers = this.element.find( this.options.header );
  3792. this._addClass( this.headers, "ui-accordion-header ui-accordion-header-collapsed",
  3793. "ui-state-default" );
  3794. this.panels = this.headers.next().filter( ":not(.ui-accordion-content-active)" ).hide();
  3795. this._addClass( this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content" );
  3796. // Avoid memory leaks (#10056)
  3797. if ( prevPanels ) {
  3798. this._off( prevHeaders.not( this.headers ) );
  3799. this._off( prevPanels.not( this.panels ) );
  3800. }
  3801. },
  3802. _refresh: function() {
  3803. var maxHeight,
  3804. options = this.options,
  3805. heightStyle = options.heightStyle,
  3806. parent = this.element.parent();
  3807. this.active = this._findActive( options.active );
  3808. this._addClass( this.active, "ui-accordion-header-active", "ui-state-active" )
  3809. ._removeClass( this.active, "ui-accordion-header-collapsed" );
  3810. this._addClass( this.active.next(), "ui-accordion-content-active" );
  3811. this.active.next().show();
  3812. this.headers
  3813. .attr( "role", "tab" )
  3814. .each( function() {
  3815. var header = $( this ),
  3816. headerId = header.uniqueId().attr( "id" ),
  3817. panel = header.next(),
  3818. panelId = panel.uniqueId().attr( "id" );
  3819. header.attr( "aria-controls", panelId );
  3820. panel.attr( "aria-labelledby", headerId );
  3821. } )
  3822. .next()
  3823. .attr( "role", "tabpanel" );
  3824. this.headers
  3825. .not( this.active )
  3826. .attr( {
  3827. "aria-selected": "false",
  3828. "aria-expanded": "false",
  3829. tabIndex: -1
  3830. } )
  3831. .next()
  3832. .attr( {
  3833. "aria-hidden": "true"
  3834. } )
  3835. .hide();
  3836. // Make sure at least one header is in the tab order
  3837. if ( !this.active.length ) {
  3838. this.headers.eq( 0 ).attr( "tabIndex", 0 );
  3839. } else {
  3840. this.active.attr( {
  3841. "aria-selected": "true",
  3842. "aria-expanded": "true",
  3843. tabIndex: 0
  3844. } )
  3845. .next()
  3846. .attr( {
  3847. "aria-hidden": "false"
  3848. } );
  3849. }
  3850. this._createIcons();
  3851. this._setupEvents( options.event );
  3852. if ( heightStyle === "fill" ) {
  3853. maxHeight = parent.height();
  3854. this.element.siblings( ":visible" ).each( function() {
  3855. var elem = $( this ),
  3856. position = elem.css( "position" );
  3857. if ( position === "absolute" || position === "fixed" ) {
  3858. return;
  3859. }
  3860. maxHeight -= elem.outerHeight( true );
  3861. } );
  3862. this.headers.each( function() {
  3863. maxHeight -= $( this ).outerHeight( true );
  3864. } );
  3865. this.headers.next()
  3866. .each( function() {
  3867. $( this ).height( Math.max( 0, maxHeight -
  3868. $( this ).innerHeight() + $( this ).height() ) );
  3869. } )
  3870. .css( "overflow", "auto" );
  3871. } else if ( heightStyle === "auto" ) {
  3872. maxHeight = 0;
  3873. this.headers.next()
  3874. .each( function() {
  3875. var isVisible = $( this ).is( ":visible" );
  3876. if ( !isVisible ) {
  3877. $( this ).show();
  3878. }
  3879. maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
  3880. if ( !isVisible ) {
  3881. $( this ).hide();
  3882. }
  3883. } )
  3884. .height( maxHeight );
  3885. }
  3886. },
  3887. _activate: function( index ) {
  3888. var active = this._findActive( index )[ 0 ];
  3889. // Trying to activate the already active panel
  3890. if ( active === this.active[ 0 ] ) {
  3891. return;
  3892. }
  3893. // Trying to collapse, simulate a click on the currently active header
  3894. active = active || this.active[ 0 ];
  3895. this._eventHandler( {
  3896. target: active,
  3897. currentTarget: active,
  3898. preventDefault: $.noop
  3899. } );
  3900. },
  3901. _findActive: function( selector ) {
  3902. return typeof selector === "number" ? this.headers.eq( selector ) : $();
  3903. },
  3904. _setupEvents: function( event ) {
  3905. var events = {
  3906. keydown: "_keydown"
  3907. };
  3908. if ( event ) {
  3909. $.each( event.split( " " ), function( index, eventName ) {
  3910. events[ eventName ] = "_eventHandler";
  3911. } );
  3912. }
  3913. this._off( this.headers.add( this.headers.next() ) );
  3914. this._on( this.headers, events );
  3915. this._on( this.headers.next(), { keydown: "_panelKeyDown" } );
  3916. this._hoverable( this.headers );
  3917. this._focusable( this.headers );
  3918. },
  3919. _eventHandler: function( event ) {
  3920. var activeChildren, clickedChildren,
  3921. options = this.options,
  3922. active = this.active,
  3923. clicked = $( event.currentTarget ),
  3924. clickedIsActive = clicked[ 0 ] === active[ 0 ],
  3925. collapsing = clickedIsActive && options.collapsible,
  3926. toShow = collapsing ? $() : clicked.next(),
  3927. toHide = active.next(),
  3928. eventData = {
  3929. oldHeader: active,
  3930. oldPanel: toHide,
  3931. newHeader: collapsing ? $() : clicked,
  3932. newPanel: toShow
  3933. };
  3934. event.preventDefault();
  3935. if (
  3936. // click on active header, but not collapsible
  3937. ( clickedIsActive && !options.collapsible ) ||
  3938. // allow canceling activation
  3939. ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
  3940. return;
  3941. }
  3942. options.active = collapsing ? false : this.headers.index( clicked );
  3943. // When the call to ._toggle() comes after the class changes
  3944. // it causes a very odd bug in IE 8 (see #6720)
  3945. this.active = clickedIsActive ? $() : clicked;
  3946. this._toggle( eventData );
  3947. // Switch classes
  3948. // corner classes on the previously active header stay after the animation
  3949. this._removeClass( active, "ui-accordion-header-active", "ui-state-active" );
  3950. if ( options.icons ) {
  3951. activeChildren = active.children( ".ui-accordion-header-icon" );
  3952. this._removeClass( activeChildren, null, options.icons.activeHeader )
  3953. ._addClass( activeChildren, null, options.icons.header );
  3954. }
  3955. if ( !clickedIsActive ) {
  3956. this._removeClass( clicked, "ui-accordion-header-collapsed" )
  3957. ._addClass( clicked, "ui-accordion-header-active", "ui-state-active" );
  3958. if ( options.icons ) {
  3959. clickedChildren = clicked.children( ".ui-accordion-header-icon" );
  3960. this._removeClass( clickedChildren, null, options.icons.header )
  3961. ._addClass( clickedChildren, null, options.icons.activeHeader );
  3962. }
  3963. this._addClass( clicked.next(), "ui-accordion-content-active" );
  3964. }
  3965. },
  3966. _toggle: function( data ) {
  3967. var toShow = data.newPanel,
  3968. toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
  3969. // Handle activating a panel during the animation for another activation
  3970. this.prevShow.add( this.prevHide ).stop( true, true );
  3971. this.prevShow = toShow;
  3972. this.prevHide = toHide;
  3973. if ( this.options.animate ) {
  3974. this._animate( toShow, toHide, data );
  3975. } else {
  3976. toHide.hide();
  3977. toShow.show();
  3978. this._toggleComplete( data );
  3979. }
  3980. toHide.attr( {
  3981. "aria-hidden": "true"
  3982. } );
  3983. toHide.prev().attr( {
  3984. "aria-selected": "false",
  3985. "aria-expanded": "false"
  3986. } );
  3987. // if we're switching panels, remove the old header from the tab order
  3988. // if we're opening from collapsed state, remove the previous header from the tab order
  3989. // if we're collapsing, then keep the collapsing header in the tab order
  3990. if ( toShow.length && toHide.length ) {
  3991. toHide.prev().attr( {
  3992. "tabIndex": -1,
  3993. "aria-expanded": "false"
  3994. } );
  3995. } else if ( toShow.length ) {
  3996. this.headers.filter( function() {
  3997. return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0;
  3998. } )
  3999. .attr( "tabIndex", -1 );
  4000. }
  4001. toShow
  4002. .attr( "aria-hidden", "false" )
  4003. .prev()
  4004. .attr( {
  4005. "aria-selected": "true",
  4006. "aria-expanded": "true",
  4007. tabIndex: 0
  4008. } );
  4009. },
  4010. _animate: function( toShow, toHide, data ) {
  4011. var total, easing, duration,
  4012. that = this,
  4013. adjust = 0,
  4014. boxSizing = toShow.css( "box-sizing" ),
  4015. down = toShow.length &&
  4016. ( !toHide.length || ( toShow.index() < toHide.index() ) ),
  4017. animate = this.options.animate || {},
  4018. options = down && animate.down || animate,
  4019. complete = function() {
  4020. that._toggleComplete( data );
  4021. };
  4022. if ( typeof options === "number" ) {
  4023. duration = options;
  4024. }
  4025. if ( typeof options === "string" ) {
  4026. easing = options;
  4027. }
  4028. // fall back from options to animation in case of partial down settings
  4029. easing = easing || options.easing || animate.easing;
  4030. duration = duration || options.duration || animate.duration;
  4031. if ( !toHide.length ) {
  4032. return toShow.animate( this.showProps, duration, easing, complete );
  4033. }
  4034. if ( !toShow.length ) {
  4035. return toHide.animate( this.hideProps, duration, easing, complete );
  4036. }
  4037. total = toShow.show().outerHeight();
  4038. toHide.animate( this.hideProps, {
  4039. duration: duration,
  4040. easing: easing,
  4041. step: function( now, fx ) {
  4042. fx.now = Math.round( now );
  4043. }
  4044. } );
  4045. toShow
  4046. .hide()
  4047. .animate( this.showProps, {
  4048. duration: duration,
  4049. easing: easing,
  4050. complete: complete,
  4051. step: function( now, fx ) {
  4052. fx.now = Math.round( now );
  4053. if ( fx.prop !== "height" ) {
  4054. if ( boxSizing === "content-box" ) {
  4055. adjust += fx.now;
  4056. }
  4057. } else if ( that.options.heightStyle !== "content" ) {
  4058. fx.now = Math.round( total - toHide.outerHeight() - adjust );
  4059. adjust = 0;
  4060. }
  4061. }
  4062. } );
  4063. },
  4064. _toggleComplete: function( data ) {
  4065. var toHide = data.oldPanel,
  4066. prev = toHide.prev();
  4067. this._removeClass( toHide, "ui-accordion-content-active" );
  4068. this._removeClass( prev, "ui-accordion-header-active" )
  4069. ._addClass( prev, "ui-accordion-header-collapsed" );
  4070. // Work around for rendering bug in IE (#5421)
  4071. if ( toHide.length ) {
  4072. toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className;
  4073. }
  4074. this._trigger( "activate", null, data );
  4075. }
  4076. } );
  4077. var safeActiveElement = $.ui.safeActiveElement = function( document ) {
  4078. var activeElement;
  4079. // Support: IE 9 only
  4080. // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
  4081. try {
  4082. activeElement = document.activeElement;
  4083. } catch ( error ) {
  4084. activeElement = document.body;
  4085. }
  4086. // Support: IE 9 - 11 only
  4087. // IE may return null instead of an element
  4088. // Interestingly, this only seems to occur when NOT in an iframe
  4089. if ( !activeElement ) {
  4090. activeElement = document.body;
  4091. }
  4092. // Support: IE 11 only
  4093. // IE11 returns a seemingly empty object in some cases when accessing
  4094. // document.activeElement from an <iframe>
  4095. if ( !activeElement.nodeName ) {
  4096. activeElement = document.body;
  4097. }
  4098. return activeElement;
  4099. };
  4100. /*!
  4101. * jQuery UI Menu 1.12.1
  4102. * http://jqueryui.com
  4103. *
  4104. * Copyright jQuery Foundation and other contributors
  4105. * Released under the MIT license.
  4106. * http://jquery.org/license
  4107. */
  4108. //>>label: Menu
  4109. //>>group: Widgets
  4110. //>>description: Creates nestable menus.
  4111. //>>docs: http://api.jqueryui.com/menu/
  4112. //>>demos: http://jqueryui.com/menu/
  4113. //>>css.structure: ../../themes/base/core.css
  4114. //>>css.structure: ../../themes/base/menu.css
  4115. //>>css.theme: ../../themes/base/theme.css
  4116. var widgetsMenu = $.widget( "ui.menu", {
  4117. version: "1.12.1",
  4118. defaultElement: "<ul>",
  4119. delay: 300,
  4120. options: {
  4121. icons: {
  4122. submenu: "ui-icon-caret-1-e"
  4123. },
  4124. items: "> *",
  4125. menus: "ul",
  4126. position: {
  4127. my: "left top",
  4128. at: "right top"
  4129. },
  4130. role: "menu",
  4131. // Callbacks
  4132. blur: null,
  4133. focus: null,
  4134. select: null
  4135. },
  4136. _create: function() {
  4137. this.activeMenu = this.element;
  4138. // Flag used to prevent firing of the click handler
  4139. // as the event bubbles up through nested menus
  4140. this.mouseHandled = false;
  4141. this.element
  4142. .uniqueId()
  4143. .attr( {
  4144. role: this.options.role,
  4145. tabIndex: 0
  4146. } );
  4147. this._addClass( "ui-menu", "ui-widget ui-widget-content" );
  4148. this._on( {
  4149. // Prevent focus from sticking to links inside menu after clicking
  4150. // them (focus should always stay on UL during navigation).
  4151. "mousedown .ui-menu-item": function( event ) {
  4152. event.preventDefault();
  4153. },
  4154. "click .ui-menu-item": function( event ) {
  4155. var target = $( event.target );
  4156. var active = $( $.ui.safeActiveElement( this.document[ 0 ] ) );
  4157. if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
  4158. this.select( event );
  4159. // Only set the mouseHandled flag if the event will bubble, see #9469.
  4160. if ( !event.isPropagationStopped() ) {
  4161. this.mouseHandled = true;
  4162. }
  4163. // Open submenu on click
  4164. if ( target.has( ".ui-menu" ).length ) {
  4165. this.expand( event );
  4166. } else if ( !this.element.is( ":focus" ) &&
  4167. active.closest( ".ui-menu" ).length ) {
  4168. // Redirect focus to the menu
  4169. this.element.trigger( "focus", [ true ] );
  4170. // If the active item is on the top level, let it stay active.
  4171. // Otherwise, blur the active item since it is no longer visible.
  4172. if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
  4173. clearTimeout( this.timer );
  4174. }
  4175. }
  4176. }
  4177. },
  4178. "mouseenter .ui-menu-item": function( event ) {
  4179. // Ignore mouse events while typeahead is active, see #10458.
  4180. // Prevents focusing the wrong item when typeahead causes a scroll while the mouse
  4181. // is over an item in the menu
  4182. if ( this.previousFilter ) {
  4183. return;
  4184. }
  4185. var actualTarget = $( event.target ).closest( ".ui-menu-item" ),
  4186. target = $( event.currentTarget );
  4187. // Ignore bubbled events on parent items, see #11641
  4188. if ( actualTarget[ 0 ] !== target[ 0 ] ) {
  4189. return;
  4190. }
  4191. // Remove ui-state-active class from siblings of the newly focused menu item
  4192. // to avoid a jump caused by adjacent elements both having a class with a border
  4193. this._removeClass( target.siblings().children( ".ui-state-active" ),
  4194. null, "ui-state-active" );
  4195. this.focus( event, target );
  4196. },
  4197. mouseleave: "collapseAll",
  4198. "mouseleave .ui-menu": "collapseAll",
  4199. focus: function( event, keepActiveItem ) {
  4200. // If there's already an active item, keep it active
  4201. // If not, activate the first item
  4202. var item = this.active || this.element.find( this.options.items ).eq( 0 );
  4203. if ( !keepActiveItem ) {
  4204. this.focus( event, item );
  4205. }
  4206. },
  4207. blur: function( event ) {
  4208. this._delay( function() {
  4209. var notContained = !$.contains(
  4210. this.element[ 0 ],
  4211. $.ui.safeActiveElement( this.document[ 0 ] )
  4212. );
  4213. if ( notContained ) {
  4214. this.collapseAll( event );
  4215. }
  4216. } );
  4217. },
  4218. keydown: "_keydown"
  4219. } );
  4220. this.refresh();
  4221. // Clicks outside of a menu collapse any open menus
  4222. this._on( this.document, {
  4223. click: function( event ) {
  4224. if ( this._closeOnDocumentClick( event ) ) {
  4225. this.collapseAll( event );
  4226. }
  4227. // Reset the mouseHandled flag
  4228. this.mouseHandled = false;
  4229. }
  4230. } );
  4231. },
  4232. _destroy: function() {
  4233. var items = this.element.find( ".ui-menu-item" )
  4234. .removeAttr( "role aria-disabled" ),
  4235. submenus = items.children( ".ui-menu-item-wrapper" )
  4236. .removeUniqueId()
  4237. .removeAttr( "tabIndex role aria-haspopup" );
  4238. // Destroy (sub)menus
  4239. this.element
  4240. .removeAttr( "aria-activedescendant" )
  4241. .find( ".ui-menu" ).addBack()
  4242. .removeAttr( "role aria-labelledby aria-expanded aria-hidden aria-disabled " +
  4243. "tabIndex" )
  4244. .removeUniqueId()
  4245. .show();
  4246. submenus.children().each( function() {
  4247. var elem = $( this );
  4248. if ( elem.data( "ui-menu-submenu-caret" ) ) {
  4249. elem.remove();
  4250. }
  4251. } );
  4252. },
  4253. _keydown: function( event ) {
  4254. var match, prev, character, skip,
  4255. preventDefault = true;
  4256. switch ( event.keyCode ) {
  4257. case $.ui.keyCode.PAGE_UP:
  4258. this.previousPage( event );
  4259. break;
  4260. case $.ui.keyCode.PAGE_DOWN:
  4261. this.nextPage( event );
  4262. break;
  4263. case $.ui.keyCode.HOME:
  4264. this._move( "first", "first", event );
  4265. break;
  4266. case $.ui.keyCode.END:
  4267. this._move( "last", "last", event );
  4268. break;
  4269. case $.ui.keyCode.UP:
  4270. this.previous( event );
  4271. break;
  4272. case $.ui.keyCode.DOWN:
  4273. this.next( event );
  4274. break;
  4275. case $.ui.keyCode.LEFT:
  4276. this.collapse( event );
  4277. break;
  4278. case $.ui.keyCode.RIGHT:
  4279. if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
  4280. this.expand( event );
  4281. }
  4282. break;
  4283. case $.ui.keyCode.ENTER:
  4284. case $.ui.keyCode.SPACE:
  4285. this._activate( event );
  4286. break;
  4287. case $.ui.keyCode.ESCAPE:
  4288. this.collapse( event );
  4289. break;
  4290. default:
  4291. preventDefault = false;
  4292. prev = this.previousFilter || "";
  4293. skip = false;
  4294. // Support number pad values
  4295. character = event.keyCode >= 96 && event.keyCode <= 105 ?
  4296. ( event.keyCode - 96 ).toString() : String.fromCharCode( event.keyCode );
  4297. clearTimeout( this.filterTimer );
  4298. if ( character === prev ) {
  4299. skip = true;
  4300. } else {
  4301. character = prev + character;
  4302. }
  4303. match = this._filterMenuItems( character );
  4304. match = skip && match.index( this.active.next() ) !== -1 ?
  4305. this.active.nextAll( ".ui-menu-item" ) :
  4306. match;
  4307. // If no matches on the current filter, reset to the last character pressed
  4308. // to move down the menu to the first item that starts with that character
  4309. if ( !match.length ) {
  4310. character = String.fromCharCode( event.keyCode );
  4311. match = this._filterMenuItems( character );
  4312. }
  4313. if ( match.length ) {
  4314. this.focus( event, match );
  4315. this.previousFilter = character;
  4316. this.filterTimer = this._delay( function() {
  4317. delete this.previousFilter;
  4318. }, 1000 );
  4319. } else {
  4320. delete this.previousFilter;
  4321. }
  4322. }
  4323. if ( preventDefault ) {
  4324. event.preventDefault();
  4325. }
  4326. },
  4327. _activate: function( event ) {
  4328. if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
  4329. if ( this.active.children( "[aria-haspopup='true']" ).length ) {
  4330. this.expand( event );
  4331. } else {
  4332. this.select( event );
  4333. }
  4334. }
  4335. },
  4336. refresh: function() {
  4337. var menus, items, newSubmenus, newItems, newWrappers,
  4338. that = this,
  4339. icon = this.options.icons.submenu,
  4340. submenus = this.element.find( this.options.menus );
  4341. this._toggleClass( "ui-menu-icons", null, !!this.element.find( ".ui-icon" ).length );
  4342. // Initialize nested menus
  4343. newSubmenus = submenus.filter( ":not(.ui-menu)" )
  4344. .hide()
  4345. .attr( {
  4346. role: this.options.role,
  4347. "aria-hidden": "true",
  4348. "aria-expanded": "false"
  4349. } )
  4350. .each( function() {
  4351. var menu = $( this ),
  4352. item = menu.prev(),
  4353. submenuCaret = $( "<span>" ).data( "ui-menu-submenu-caret", true );
  4354. that._addClass( submenuCaret, "ui-menu-icon", "ui-icon " + icon );
  4355. item
  4356. .attr( "aria-haspopup", "true" )
  4357. .prepend( submenuCaret );
  4358. menu.attr( "aria-labelledby", item.attr( "id" ) );
  4359. } );
  4360. this._addClass( newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front" );
  4361. menus = submenus.add( this.element );
  4362. items = menus.find( this.options.items );
  4363. // Initialize menu-items containing spaces and/or dashes only as dividers
  4364. items.not( ".ui-menu-item" ).each( function() {
  4365. var item = $( this );
  4366. if ( that._isDivider( item ) ) {
  4367. that._addClass( item, "ui-menu-divider", "ui-widget-content" );
  4368. }
  4369. } );
  4370. // Don't refresh list items that are already adapted
  4371. newItems = items.not( ".ui-menu-item, .ui-menu-divider" );
  4372. newWrappers = newItems.children()
  4373. .not( ".ui-menu" )
  4374. .uniqueId()
  4375. .attr( {
  4376. tabIndex: -1,
  4377. role: this._itemRole()
  4378. } );
  4379. this._addClass( newItems, "ui-menu-item" )
  4380. ._addClass( newWrappers, "ui-menu-item-wrapper" );
  4381. // Add aria-disabled attribute to any disabled menu item
  4382. items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
  4383. // If the active item has been removed, blur the menu
  4384. if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
  4385. this.blur();
  4386. }
  4387. },
  4388. _itemRole: function() {
  4389. return {
  4390. menu: "menuitem",
  4391. listbox: "option"
  4392. }[ this.options.role ];
  4393. },
  4394. _setOption: function( key, value ) {
  4395. if ( key === "icons" ) {
  4396. var icons = this.element.find( ".ui-menu-icon" );
  4397. this._removeClass( icons, null, this.options.icons.submenu )
  4398. ._addClass( icons, null, value.submenu );
  4399. }
  4400. this._super( key, value );
  4401. },
  4402. _setOptionDisabled: function( value ) {
  4403. this._super( value );
  4404. this.element.attr( "aria-disabled", String( value ) );
  4405. this._toggleClass( null, "ui-state-disabled", !!value );
  4406. },
  4407. focus: function( event, item ) {
  4408. var nested, focused, activeParent;
  4409. this.blur( event, event && event.type === "focus" );
  4410. this._scrollIntoView( item );
  4411. this.active = item.first();
  4412. focused = this.active.children( ".ui-menu-item-wrapper" );
  4413. this._addClass( focused, null, "ui-state-active" );
  4414. // Only update aria-activedescendant if there's a role
  4415. // otherwise we assume focus is managed elsewhere
  4416. if ( this.options.role ) {
  4417. this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
  4418. }
  4419. // Highlight active parent menu item, if any
  4420. activeParent = this.active
  4421. .parent()
  4422. .closest( ".ui-menu-item" )
  4423. .children( ".ui-menu-item-wrapper" );
  4424. this._addClass( activeParent, null, "ui-state-active" );
  4425. if ( event && event.type === "keydown" ) {
  4426. this._close();
  4427. } else {
  4428. this.timer = this._delay( function() {
  4429. this._close();
  4430. }, this.delay );
  4431. }
  4432. nested = item.children( ".ui-menu" );
  4433. if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) {
  4434. this._startOpening( nested );
  4435. }
  4436. this.activeMenu = item.parent();
  4437. this._trigger( "focus", event, { item: item } );
  4438. },
  4439. _scrollIntoView: function( item ) {
  4440. var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
  4441. if ( this._hasScroll() ) {
  4442. borderTop = parseFloat( $.css( this.activeMenu[ 0 ], "borderTopWidth" ) ) || 0;
  4443. paddingTop = parseFloat( $.css( this.activeMenu[ 0 ], "paddingTop" ) ) || 0;
  4444. offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
  4445. scroll = this.activeMenu.scrollTop();
  4446. elementHeight = this.activeMenu.height();
  4447. itemHeight = item.outerHeight();
  4448. if ( offset < 0 ) {
  4449. this.activeMenu.scrollTop( scroll + offset );
  4450. } else if ( offset + itemHeight > elementHeight ) {
  4451. this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
  4452. }
  4453. }
  4454. },
  4455. blur: function( event, fromFocus ) {
  4456. if ( !fromFocus ) {
  4457. clearTimeout( this.timer );
  4458. }
  4459. if ( !this.active ) {
  4460. return;
  4461. }
  4462. this._removeClass( this.active.children( ".ui-menu-item-wrapper" ),
  4463. null, "ui-state-active" );
  4464. this._trigger( "blur", event, { item: this.active } );
  4465. this.active = null;
  4466. },
  4467. _startOpening: function( submenu ) {
  4468. clearTimeout( this.timer );
  4469. // Don't open if already open fixes a Firefox bug that caused a .5 pixel
  4470. // shift in the submenu position when mousing over the caret icon
  4471. if ( submenu.attr( "aria-hidden" ) !== "true" ) {
  4472. return;
  4473. }
  4474. this.timer = this._delay( function() {
  4475. this._close();
  4476. this._open( submenu );
  4477. }, this.delay );
  4478. },
  4479. _open: function( submenu ) {
  4480. var position = $.extend( {
  4481. of: this.active
  4482. }, this.options.position );
  4483. clearTimeout( this.timer );
  4484. this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
  4485. .hide()
  4486. .attr( "aria-hidden", "true" );
  4487. submenu
  4488. .show()
  4489. .removeAttr( "aria-hidden" )
  4490. .attr( "aria-expanded", "true" )
  4491. .position( position );
  4492. },
  4493. collapseAll: function( event, all ) {
  4494. clearTimeout( this.timer );
  4495. this.timer = this._delay( function() {
  4496. // If we were passed an event, look for the submenu that contains the event
  4497. var currentMenu = all ? this.element :
  4498. $( event && event.target ).closest( this.element.find( ".ui-menu" ) );
  4499. // If we found no valid submenu ancestor, use the main menu to close all
  4500. // sub menus anyway
  4501. if ( !currentMenu.length ) {
  4502. currentMenu = this.element;
  4503. }
  4504. this._close( currentMenu );
  4505. this.blur( event );
  4506. // Work around active item staying active after menu is blurred
  4507. this._removeClass( currentMenu.find( ".ui-state-active" ), null, "ui-state-active" );
  4508. this.activeMenu = currentMenu;
  4509. }, this.delay );
  4510. },
  4511. // With no arguments, closes the currently active menu - if nothing is active
  4512. // it closes all menus. If passed an argument, it will search for menus BELOW
  4513. _close: function( startMenu ) {
  4514. if ( !startMenu ) {
  4515. startMenu = this.active ? this.active.parent() : this.element;
  4516. }
  4517. startMenu.find( ".ui-menu" )
  4518. .hide()
  4519. .attr( "aria-hidden", "true" )
  4520. .attr( "aria-expanded", "false" );
  4521. },
  4522. _closeOnDocumentClick: function( event ) {
  4523. return !$( event.target ).closest( ".ui-menu" ).length;
  4524. },
  4525. _isDivider: function( item ) {
  4526. // Match hyphen, em dash, en dash
  4527. return !/[^\-\u2014\u2013\s]/.test( item.text() );
  4528. },
  4529. collapse: function( event ) {
  4530. var newItem = this.active &&
  4531. this.active.parent().closest( ".ui-menu-item", this.element );
  4532. if ( newItem && newItem.length ) {
  4533. this._close();
  4534. this.focus( event, newItem );
  4535. }
  4536. },
  4537. expand: function( event ) {
  4538. var newItem = this.active &&
  4539. this.active
  4540. .children( ".ui-menu " )
  4541. .find( this.options.items )
  4542. .first();
  4543. if ( newItem && newItem.length ) {
  4544. this._open( newItem.parent() );
  4545. // Delay so Firefox will not hide activedescendant change in expanding submenu from AT
  4546. this._delay( function() {
  4547. this.focus( event, newItem );
  4548. } );
  4549. }
  4550. },
  4551. next: function( event ) {
  4552. this._move( "next", "first", event );
  4553. },
  4554. previous: function( event ) {
  4555. this._move( "prev", "last", event );
  4556. },
  4557. isFirstItem: function() {
  4558. return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
  4559. },
  4560. isLastItem: function() {
  4561. return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
  4562. },
  4563. _move: function( direction, filter, event ) {
  4564. var next;
  4565. if ( this.active ) {
  4566. if ( direction === "first" || direction === "last" ) {
  4567. next = this.active
  4568. [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
  4569. .eq( -1 );
  4570. } else {
  4571. next = this.active
  4572. [ direction + "All" ]( ".ui-menu-item" )
  4573. .eq( 0 );
  4574. }
  4575. }
  4576. if ( !next || !next.length || !this.active ) {
  4577. next = this.activeMenu.find( this.options.items )[ filter ]();
  4578. }
  4579. this.focus( event, next );
  4580. },
  4581. nextPage: function( event ) {
  4582. var item, base, height;
  4583. if ( !this.active ) {
  4584. this.next( event );
  4585. return;
  4586. }
  4587. if ( this.isLastItem() ) {
  4588. return;
  4589. }
  4590. if ( this._hasScroll() ) {
  4591. base = this.active.offset().top;
  4592. height = this.element.height();
  4593. this.active.nextAll( ".ui-menu-item" ).each( function() {
  4594. item = $( this );
  4595. return item.offset().top - base - height < 0;
  4596. } );
  4597. this.focus( event, item );
  4598. } else {
  4599. this.focus( event, this.activeMenu.find( this.options.items )
  4600. [ !this.active ? "first" : "last" ]() );
  4601. }
  4602. },
  4603. previousPage: function( event ) {
  4604. var item, base, height;
  4605. if ( !this.active ) {
  4606. this.next( event );
  4607. return;
  4608. }
  4609. if ( this.isFirstItem() ) {
  4610. return;
  4611. }
  4612. if ( this._hasScroll() ) {
  4613. base = this.active.offset().top;
  4614. height = this.element.height();
  4615. this.active.prevAll( ".ui-menu-item" ).each( function() {
  4616. item = $( this );
  4617. return item.offset().top - base + height > 0;
  4618. } );
  4619. this.focus( event, item );
  4620. } else {
  4621. this.focus( event, this.activeMenu.find( this.options.items ).first() );
  4622. }
  4623. },
  4624. _hasScroll: function() {
  4625. return this.element.outerHeight() < this.element.prop( "scrollHeight" );
  4626. },
  4627. select: function( event ) {
  4628. // TODO: It should never be possible to not have an active item at this
  4629. // point, but the tests don't trigger mouseenter before click.
  4630. this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
  4631. var ui = { item: this.active };
  4632. if ( !this.active.has( ".ui-menu" ).length ) {
  4633. this.collapseAll( event, true );
  4634. }
  4635. this._trigger( "select", event, ui );
  4636. },
  4637. _filterMenuItems: function( character ) {
  4638. var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ),
  4639. regex = new RegExp( "^" + escapedCharacter, "i" );
  4640. return this.activeMenu
  4641. .find( this.options.items )
  4642. // Only match on items, not dividers or other content (#10571)
  4643. .filter( ".ui-menu-item" )
  4644. .filter( function() {
  4645. return regex.test(
  4646. $.trim( $( this ).children( ".ui-menu-item-wrapper" ).text() ) );
  4647. } );
  4648. }
  4649. } );
  4650. /*!
  4651. * jQuery UI Autocomplete 1.12.1
  4652. * http://jqueryui.com
  4653. *
  4654. * Copyright jQuery Foundation and other contributors
  4655. * Released under the MIT license.
  4656. * http://jquery.org/license
  4657. */
  4658. //>>label: Autocomplete
  4659. //>>group: Widgets
  4660. //>>description: Lists suggested words as the user is typing.
  4661. //>>docs: http://api.jqueryui.com/autocomplete/
  4662. //>>demos: http://jqueryui.com/autocomplete/
  4663. //>>css.structure: ../../themes/base/core.css
  4664. //>>css.structure: ../../themes/base/autocomplete.css
  4665. //>>css.theme: ../../themes/base/theme.css
  4666. $.widget( "ui.autocomplete", {
  4667. version: "1.12.1",
  4668. defaultElement: "<input>",
  4669. options: {
  4670. appendTo: null,
  4671. autoFocus: false,
  4672. delay: 300,
  4673. minLength: 1,
  4674. position: {
  4675. my: "left top",
  4676. at: "left bottom",
  4677. collision: "none"
  4678. },
  4679. source: null,
  4680. // Callbacks
  4681. change: null,
  4682. close: null,
  4683. focus: null,
  4684. open: null,
  4685. response: null,
  4686. search: null,
  4687. select: null
  4688. },
  4689. requestIndex: 0,
  4690. pending: 0,
  4691. _create: function() {
  4692. // Some browsers only repeat keydown events, not keypress events,
  4693. // so we use the suppressKeyPress flag to determine if we've already
  4694. // handled the keydown event. #7269
  4695. // Unfortunately the code for & in keypress is the same as the up arrow,
  4696. // so we use the suppressKeyPressRepeat flag to avoid handling keypress
  4697. // events when we know the keydown event was used to modify the
  4698. // search term. #7799
  4699. var suppressKeyPress, suppressKeyPressRepeat, suppressInput,
  4700. nodeName = this.element[ 0 ].nodeName.toLowerCase(),
  4701. isTextarea = nodeName === "textarea",
  4702. isInput = nodeName === "input";
  4703. // Textareas are always multi-line
  4704. // Inputs are always single-line, even if inside a contentEditable element
  4705. // IE also treats inputs as contentEditable
  4706. // All other element types are determined by whether or not they're contentEditable
  4707. this.isMultiLine = isTextarea || !isInput && this._isContentEditable( this.element );
  4708. this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ];
  4709. this.isNewMenu = true;
  4710. this._addClass( "ui-autocomplete-input" );
  4711. this.element.attr( "autocomplete", "off" );
  4712. this._on( this.element, {
  4713. keydown: function( event ) {
  4714. if ( this.element.prop( "readOnly" ) ) {
  4715. suppressKeyPress = true;
  4716. suppressInput = true;
  4717. suppressKeyPressRepeat = true;
  4718. return;
  4719. }
  4720. suppressKeyPress = false;
  4721. suppressInput = false;
  4722. suppressKeyPressRepeat = false;
  4723. var keyCode = $.ui.keyCode;
  4724. switch ( event.keyCode ) {
  4725. case keyCode.PAGE_UP:
  4726. suppressKeyPress = true;
  4727. this._move( "previousPage", event );
  4728. break;
  4729. case keyCode.PAGE_DOWN:
  4730. suppressKeyPress = true;
  4731. this._move( "nextPage", event );
  4732. break;
  4733. case keyCode.UP:
  4734. suppressKeyPress = true;
  4735. this._keyEvent( "previous", event );
  4736. break;
  4737. case keyCode.DOWN:
  4738. suppressKeyPress = true;
  4739. this._keyEvent( "next", event );
  4740. break;
  4741. case keyCode.ENTER:
  4742. // when menu is open and has focus
  4743. if ( this.menu.active ) {
  4744. // #6055 - Opera still allows the keypress to occur
  4745. // which causes forms to submit
  4746. suppressKeyPress = true;
  4747. event.preventDefault();
  4748. this.menu.select( event );
  4749. }
  4750. break;
  4751. case keyCode.TAB:
  4752. if ( this.menu.active ) {
  4753. this.menu.select( event );
  4754. }
  4755. break;
  4756. case keyCode.ESCAPE:
  4757. if ( this.menu.element.is( ":visible" ) ) {
  4758. if ( !this.isMultiLine ) {
  4759. this._value( this.term );
  4760. }
  4761. this.close( event );
  4762. // Different browsers have different default behavior for escape
  4763. // Single press can mean undo or clear
  4764. // Double press in IE means clear the whole form
  4765. event.preventDefault();
  4766. }
  4767. break;
  4768. default:
  4769. suppressKeyPressRepeat = true;
  4770. // search timeout should be triggered before the input value is changed
  4771. this._searchTimeout( event );
  4772. break;
  4773. }
  4774. },
  4775. keypress: function( event ) {
  4776. if ( suppressKeyPress ) {
  4777. suppressKeyPress = false;
  4778. if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
  4779. event.preventDefault();
  4780. }
  4781. return;
  4782. }
  4783. if ( suppressKeyPressRepeat ) {
  4784. return;
  4785. }
  4786. // Replicate some key handlers to allow them to repeat in Firefox and Opera
  4787. var keyCode = $.ui.keyCode;
  4788. switch ( event.keyCode ) {
  4789. case keyCode.PAGE_UP:
  4790. this._move( "previousPage", event );
  4791. break;
  4792. case keyCode.PAGE_DOWN:
  4793. this._move( "nextPage", event );
  4794. break;
  4795. case keyCode.UP:
  4796. this._keyEvent( "previous", event );
  4797. break;
  4798. case keyCode.DOWN:
  4799. this._keyEvent( "next", event );
  4800. break;
  4801. }
  4802. },
  4803. input: function( event ) {
  4804. if ( suppressInput ) {
  4805. suppressInput = false;
  4806. event.preventDefault();
  4807. return;
  4808. }
  4809. this._searchTimeout( event );
  4810. },
  4811. focus: function() {
  4812. this.selectedItem = null;
  4813. this.previous = this._value();
  4814. },
  4815. blur: function( event ) {
  4816. if ( this.cancelBlur ) {
  4817. delete this.cancelBlur;
  4818. return;
  4819. }
  4820. clearTimeout( this.searching );
  4821. this.close( event );
  4822. this._change( event );
  4823. }
  4824. } );
  4825. this._initSource();
  4826. this.menu = $( "<ul>" )
  4827. .appendTo( this._appendTo() )
  4828. .menu( {
  4829. // disable ARIA support, the live region takes care of that
  4830. role: null
  4831. } )
  4832. .hide()
  4833. .menu( "instance" );
  4834. this._addClass( this.menu.element, "ui-autocomplete", "ui-front" );
  4835. this._on( this.menu.element, {
  4836. mousedown: function( event ) {
  4837. // prevent moving focus out of the text field
  4838. event.preventDefault();
  4839. // IE doesn't prevent moving focus even with event.preventDefault()
  4840. // so we set a flag to know when we should ignore the blur event
  4841. this.cancelBlur = true;
  4842. this._delay( function() {
  4843. delete this.cancelBlur;
  4844. // Support: IE 8 only
  4845. // Right clicking a menu item or selecting text from the menu items will
  4846. // result in focus moving out of the input. However, we've already received
  4847. // and ignored the blur event because of the cancelBlur flag set above. So
  4848. // we restore focus to ensure that the menu closes properly based on the user's
  4849. // next actions.
  4850. if ( this.element[ 0 ] !== $.ui.safeActiveElement( this.document[ 0 ] ) ) {
  4851. this.element.trigger( "focus" );
  4852. }
  4853. } );
  4854. },
  4855. menufocus: function( event, ui ) {
  4856. var label, item;
  4857. // support: Firefox
  4858. // Prevent accidental activation of menu items in Firefox (#7024 #9118)
  4859. if ( this.isNewMenu ) {
  4860. this.isNewMenu = false;
  4861. if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {
  4862. this.menu.blur();
  4863. this.document.one( "mousemove", function() {
  4864. $( event.target ).trigger( event.originalEvent );
  4865. } );
  4866. return;
  4867. }
  4868. }
  4869. item = ui.item.data( "ui-autocomplete-item" );
  4870. if ( false !== this._trigger( "focus", event, { item: item } ) ) {
  4871. // use value to match what will end up in the input, if it was a key event
  4872. if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) {
  4873. this._value( item.value );
  4874. }
  4875. }
  4876. // Announce the value in the liveRegion
  4877. label = ui.item.attr( "aria-label" ) || item.value;
  4878. if ( label && $.trim( label ).length ) {
  4879. this.liveRegion.children().hide();
  4880. $( "<div>" ).text( label ).appendTo( this.liveRegion );
  4881. }
  4882. },
  4883. menuselect: function( event, ui ) {
  4884. var item = ui.item.data( "ui-autocomplete-item" ),
  4885. previous = this.previous;
  4886. // Only trigger when focus was lost (click on menu)
  4887. if ( this.element[ 0 ] !== $.ui.safeActiveElement( this.document[ 0 ] ) ) {
  4888. this.element.trigger( "focus" );
  4889. this.previous = previous;
  4890. // #6109 - IE triggers two focus events and the second
  4891. // is asynchronous, so we need to reset the previous
  4892. // term synchronously and asynchronously :-(
  4893. this._delay( function() {
  4894. this.previous = previous;
  4895. this.selectedItem = item;
  4896. } );
  4897. }
  4898. if ( false !== this._trigger( "select", event, { item: item } ) ) {
  4899. this._value( item.value );
  4900. }
  4901. // reset the term after the select event
  4902. // this allows custom select handling to work properly
  4903. this.term = this._value();
  4904. this.close( event );
  4905. this.selectedItem = item;
  4906. }
  4907. } );
  4908. this.liveRegion = $( "<div>", {
  4909. role: "status",
  4910. "aria-live": "assertive",
  4911. "aria-relevant": "additions"
  4912. } )
  4913. .appendTo( this.document[ 0 ].body );
  4914. this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" );
  4915. // Turning off autocomplete prevents the browser from remembering the
  4916. // value when navigating through history, so we re-enable autocomplete
  4917. // if the page is unloaded before the widget is destroyed. #7790
  4918. this._on( this.window, {
  4919. beforeunload: function() {
  4920. this.element.removeAttr( "autocomplete" );
  4921. }
  4922. } );
  4923. },
  4924. _destroy: function() {
  4925. clearTimeout( this.searching );
  4926. this.element.removeAttr( "autocomplete" );
  4927. this.menu.element.remove();
  4928. this.liveRegion.remove();
  4929. },
  4930. _setOption: function( key, value ) {
  4931. this._super( key, value );
  4932. if ( key === "source" ) {
  4933. this._initSource();
  4934. }
  4935. if ( key === "appendTo" ) {
  4936. this.menu.element.appendTo( this._appendTo() );
  4937. }
  4938. if ( key === "disabled" && value && this.xhr ) {
  4939. this.xhr.abort();
  4940. }
  4941. },
  4942. _isEventTargetInWidget: function( event ) {
  4943. var menuElement = this.menu.element[ 0 ];
  4944. return event.target === this.element[ 0 ] ||
  4945. event.target === menuElement ||
  4946. $.contains( menuElement, event.target );
  4947. },
  4948. _closeOnClickOutside: function( event ) {
  4949. if ( !this._isEventTargetInWidget( event ) ) {
  4950. this.close();
  4951. }
  4952. },
  4953. _appendTo: function() {
  4954. var element = this.options.appendTo;
  4955. if ( element ) {
  4956. element = element.jquery || element.nodeType ?
  4957. $( element ) :
  4958. this.document.find( element ).eq( 0 );
  4959. }
  4960. if ( !element || !element[ 0 ] ) {
  4961. element = this.element.closest( ".ui-front, dialog" );
  4962. }
  4963. if ( !element.length ) {
  4964. element = this.document[ 0 ].body;
  4965. }
  4966. return element;
  4967. },
  4968. _initSource: function() {
  4969. var array, url,
  4970. that = this;
  4971. if ( $.isArray( this.options.source ) ) {
  4972. array = this.options.source;
  4973. this.source = function( request, response ) {
  4974. response( $.ui.autocomplete.filter( array, request.term ) );
  4975. };
  4976. } else if ( typeof this.options.source === "string" ) {
  4977. url = this.options.source;
  4978. this.source = function( request, response ) {
  4979. if ( that.xhr ) {
  4980. that.xhr.abort();
  4981. }
  4982. that.xhr = $.ajax( {
  4983. url: url,
  4984. data: request,
  4985. dataType: "json",
  4986. success: function( data ) {
  4987. response( data );
  4988. },
  4989. error: function() {
  4990. response( [] );
  4991. }
  4992. } );
  4993. };
  4994. } else {
  4995. this.source = this.options.source;
  4996. }
  4997. },
  4998. _searchTimeout: function( event ) {
  4999. clearTimeout( this.searching );
  5000. this.searching = this._delay( function() {
  5001. // Search if the value has changed, or if the user retypes the same value (see #7434)
  5002. var equalValues = this.term === this._value(),
  5003. menuVisible = this.menu.element.is( ":visible" ),
  5004. modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
  5005. if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) {
  5006. this.selectedItem = null;
  5007. this.search( null, event );
  5008. }
  5009. }, this.options.delay );
  5010. },
  5011. search: function( value, event ) {
  5012. value = value != null ? value : this._value();
  5013. // Always save the actual value, not the one passed as an argument
  5014. this.term = this._value();
  5015. if ( value.length < this.options.minLength ) {
  5016. return this.close( event );
  5017. }
  5018. if ( this._trigger( "search", event ) === false ) {
  5019. return;
  5020. }
  5021. return this._search( value );
  5022. },
  5023. _search: function( value ) {
  5024. this.pending++;
  5025. this._addClass( "ui-autocomplete-loading" );
  5026. this.cancelSearch = false;
  5027. this.source( { term: value }, this._response() );
  5028. },
  5029. _response: function() {
  5030. var index = ++this.requestIndex;
  5031. return $.proxy( function( content ) {
  5032. if ( index === this.requestIndex ) {
  5033. this.__response( content );
  5034. }
  5035. this.pending--;
  5036. if ( !this.pending ) {
  5037. this._removeClass( "ui-autocomplete-loading" );
  5038. }
  5039. }, this );
  5040. },
  5041. __response: function( content ) {
  5042. if ( content ) {
  5043. content = this._normalize( content );
  5044. }
  5045. this._trigger( "response", null, { content: content } );
  5046. if ( !this.options.disabled && content && content.length && !this.cancelSearch ) {
  5047. this._suggest( content );
  5048. this._trigger( "open" );
  5049. } else {
  5050. // use ._close() instead of .close() so we don't cancel future searches
  5051. this._close();
  5052. }
  5053. },
  5054. close: function( event ) {
  5055. this.cancelSearch = true;
  5056. this._close( event );
  5057. },
  5058. _close: function( event ) {
  5059. // Remove the handler that closes the menu on outside clicks
  5060. this._off( this.document, "mousedown" );
  5061. if ( this.menu.element.is( ":visible" ) ) {
  5062. this.menu.element.hide();
  5063. this.menu.blur();
  5064. this.isNewMenu = true;
  5065. this._trigger( "close", event );
  5066. }
  5067. },
  5068. _change: function( event ) {
  5069. if ( this.previous !== this._value() ) {
  5070. this._trigger( "change", event, { item: this.selectedItem } );
  5071. }
  5072. },
  5073. _normalize: function( items ) {
  5074. // assume all items have the right format when the first item is complete
  5075. if ( items.length && items[ 0 ].label && items[ 0 ].value ) {
  5076. return items;
  5077. }
  5078. return $.map( items, function( item ) {
  5079. if ( typeof item === "string" ) {
  5080. return {
  5081. label: item,
  5082. value: item
  5083. };
  5084. }
  5085. return $.extend( {}, item, {
  5086. label: item.label || item.value,
  5087. value: item.value || item.label
  5088. } );
  5089. } );
  5090. },
  5091. _suggest: function( items ) {
  5092. var ul = this.menu.element.empty();
  5093. this._renderMenu( ul, items );
  5094. this.isNewMenu = true;
  5095. this.menu.refresh();
  5096. // Size and position menu
  5097. ul.show();
  5098. this._resizeMenu();
  5099. ul.position( $.extend( {
  5100. of: this.element
  5101. }, this.options.position ) );
  5102. if ( this.options.autoFocus ) {
  5103. this.menu.next();
  5104. }
  5105. // Listen for interactions outside of the widget (#6642)
  5106. this._on( this.document, {
  5107. mousedown: "_closeOnClickOutside"
  5108. } );
  5109. },
  5110. _resizeMenu: function() {
  5111. var ul = this.menu.element;
  5112. ul.outerWidth( Math.max(
  5113. // Firefox wraps long text (possibly a rounding bug)
  5114. // so we add 1px to avoid the wrapping (#7513)
  5115. ul.width( "" ).outerWidth() + 1,
  5116. this.element.outerWidth()
  5117. ) );
  5118. },
  5119. _renderMenu: function( ul, items ) {
  5120. var that = this;
  5121. $.each( items, function( index, item ) {
  5122. that._renderItemData( ul, item );
  5123. } );
  5124. },
  5125. _renderItemData: function( ul, item ) {
  5126. return this._renderItem( ul, item ).data( "ui-autocomplete-item", item );
  5127. },
  5128. _renderItem: function( ul, item ) {
  5129. return $( "<li>" )
  5130. .append( $( "<div>" ).text( item.label ) )
  5131. .appendTo( ul );
  5132. },
  5133. _move: function( direction, event ) {
  5134. if ( !this.menu.element.is( ":visible" ) ) {
  5135. this.search( null, event );
  5136. return;
  5137. }
  5138. if ( this.menu.isFirstItem() && /^previous/.test( direction ) ||
  5139. this.menu.isLastItem() && /^next/.test( direction ) ) {
  5140. if ( !this.isMultiLine ) {
  5141. this._value( this.term );
  5142. }
  5143. this.menu.blur();
  5144. return;
  5145. }
  5146. this.menu[ direction ]( event );
  5147. },
  5148. widget: function() {
  5149. return this.menu.element;
  5150. },
  5151. _value: function() {
  5152. return this.valueMethod.apply( this.element, arguments );
  5153. },
  5154. _keyEvent: function( keyEvent, event ) {
  5155. if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
  5156. this._move( keyEvent, event );
  5157. // Prevents moving cursor to beginning/end of the text field in some browsers
  5158. event.preventDefault();
  5159. }
  5160. },
  5161. // Support: Chrome <=50
  5162. // We should be able to just use this.element.prop( "isContentEditable" )
  5163. // but hidden elements always report false in Chrome.
  5164. // https://code.google.com/p/chromium/issues/detail?id=313082
  5165. _isContentEditable: function( element ) {
  5166. if ( !element.length ) {
  5167. return false;
  5168. }
  5169. var editable = element.prop( "contentEditable" );
  5170. if ( editable === "inherit" ) {
  5171. return this._isContentEditable( element.parent() );
  5172. }
  5173. return editable === "true";
  5174. }
  5175. } );
  5176. $.extend( $.ui.autocomplete, {
  5177. escapeRegex: function( value ) {
  5178. return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
  5179. },
  5180. filter: function( array, term ) {
  5181. var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" );
  5182. return $.grep( array, function( value ) {
  5183. return matcher.test( value.label || value.value || value );
  5184. } );
  5185. }
  5186. } );
  5187. // Live region extension, adding a `messages` option
  5188. // NOTE: This is an experimental API. We are still investigating
  5189. // a full solution for string manipulation and internationalization.
  5190. $.widget( "ui.autocomplete", $.ui.autocomplete, {
  5191. options: {
  5192. messages: {
  5193. noResults: "No search results.",
  5194. results: function( amount ) {
  5195. return amount + ( amount > 1 ? " results are" : " result is" ) +
  5196. " available, use up and down arrow keys to navigate.";
  5197. }
  5198. }
  5199. },
  5200. __response: function( content ) {
  5201. var message;
  5202. this._superApply( arguments );
  5203. if ( this.options.disabled || this.cancelSearch ) {
  5204. return;
  5205. }
  5206. if ( content && content.length ) {
  5207. message = this.options.messages.results( content.length );
  5208. } else {
  5209. message = this.options.messages.noResults;
  5210. }
  5211. this.liveRegion.children().hide();
  5212. $( "<div>" ).text( message ).appendTo( this.liveRegion );
  5213. }
  5214. } );
  5215. var widgetsAutocomplete = $.ui.autocomplete;
  5216. /*!
  5217. * jQuery UI Controlgroup 1.12.1
  5218. * http://jqueryui.com
  5219. *
  5220. * Copyright jQuery Foundation and other contributors
  5221. * Released under the MIT license.
  5222. * http://jquery.org/license
  5223. */
  5224. //>>label: Controlgroup
  5225. //>>group: Widgets
  5226. //>>description: Visually groups form control widgets
  5227. //>>docs: http://api.jqueryui.com/controlgroup/
  5228. //>>demos: http://jqueryui.com/controlgroup/
  5229. //>>css.structure: ../../themes/base/core.css
  5230. //>>css.structure: ../../themes/base/controlgroup.css
  5231. //>>css.theme: ../../themes/base/theme.css
  5232. var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g;
  5233. var widgetsControlgroup = $.widget( "ui.controlgroup", {
  5234. version: "1.12.1",
  5235. defaultElement: "<div>",
  5236. options: {
  5237. direction: "horizontal",
  5238. disabled: null,
  5239. onlyVisible: true,
  5240. items: {
  5241. "button": "input[type=button], input[type=submit], input[type=reset], button, a",
  5242. "controlgroupLabel": ".ui-controlgroup-label",
  5243. "checkboxradio": "input[type='checkbox'], input[type='radio']",
  5244. "selectmenu": "select",
  5245. "spinner": ".ui-spinner-input"
  5246. }
  5247. },
  5248. _create: function() {
  5249. this._enhance();
  5250. },
  5251. // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation
  5252. _enhance: function() {
  5253. this.element.attr( "role", "toolbar" );
  5254. this.refresh();
  5255. },
  5256. _destroy: function() {
  5257. this._callChildMethod( "destroy" );
  5258. this.childWidgets.removeData( "ui-controlgroup-data" );
  5259. this.element.removeAttr( "role" );
  5260. if ( this.options.items.controlgroupLabel ) {
  5261. this.element
  5262. .find( this.options.items.controlgroupLabel )
  5263. .find( ".ui-controlgroup-label-contents" )
  5264. .contents().unwrap();
  5265. }
  5266. },
  5267. _initWidgets: function() {
  5268. var that = this,
  5269. childWidgets = [];
  5270. // First we iterate over each of the items options
  5271. $.each( this.options.items, function( widget, selector ) {
  5272. var labels;
  5273. var options = {};
  5274. // Make sure the widget has a selector set
  5275. if ( !selector ) {
  5276. return;
  5277. }
  5278. if ( widget === "controlgroupLabel" ) {
  5279. labels = that.element.find( selector );
  5280. labels.each( function() {
  5281. var element = $( this );
  5282. if ( element.children( ".ui-controlgroup-label-contents" ).length ) {
  5283. return;
  5284. }
  5285. element.contents()
  5286. .wrapAll( "<span class='ui-controlgroup-label-contents'></span>" );
  5287. } );
  5288. that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" );
  5289. childWidgets = childWidgets.concat( labels.get() );
  5290. return;
  5291. }
  5292. // Make sure the widget actually exists
  5293. if ( !$.fn[ widget ] ) {
  5294. return;
  5295. }
  5296. // We assume everything is in the middle to start because we can't determine
  5297. // first / last elements until all enhancments are done.
  5298. if ( that[ "_" + widget + "Options" ] ) {
  5299. options = that[ "_" + widget + "Options" ]( "middle" );
  5300. } else {
  5301. options = { classes: {} };
  5302. }
  5303. // Find instances of this widget inside controlgroup and init them
  5304. that.element
  5305. .find( selector )
  5306. .each( function() {
  5307. var element = $( this );
  5308. var instance = element[ widget ]( "instance" );
  5309. // We need to clone the default options for this type of widget to avoid
  5310. // polluting the variable options which has a wider scope than a single widget.
  5311. var instanceOptions = $.widget.extend( {}, options );
  5312. // If the button is the child of a spinner ignore it
  5313. // TODO: Find a more generic solution
  5314. if ( widget === "button" && element.parent( ".ui-spinner" ).length ) {
  5315. return;
  5316. }
  5317. // Create the widget if it doesn't exist
  5318. if ( !instance ) {
  5319. instance = element[ widget ]()[ widget ]( "instance" );
  5320. }
  5321. if ( instance ) {
  5322. instanceOptions.classes =
  5323. that._resolveClassesValues( instanceOptions.classes, instance );
  5324. }
  5325. element[ widget ]( instanceOptions );
  5326. // Store an instance of the controlgroup to be able to reference
  5327. // from the outermost element for changing options and refresh
  5328. var widgetElement = element[ widget ]( "widget" );
  5329. $.data( widgetElement[ 0 ], "ui-controlgroup-data",
  5330. instance ? instance : element[ widget ]( "instance" ) );
  5331. childWidgets.push( widgetElement[ 0 ] );
  5332. } );
  5333. } );
  5334. this.childWidgets = $( $.unique( childWidgets ) );
  5335. this._addClass( this.childWidgets, "ui-controlgroup-item" );
  5336. },
  5337. _callChildMethod: function( method ) {
  5338. this.childWidgets.each( function() {
  5339. var element = $( this ),
  5340. data = element.data( "ui-controlgroup-data" );
  5341. if ( data && data[ method ] ) {
  5342. data[ method ]();
  5343. }
  5344. } );
  5345. },
  5346. _updateCornerClass: function( element, position ) {
  5347. var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all";
  5348. var add = this._buildSimpleOptions( position, "label" ).classes.label;
  5349. this._removeClass( element, null, remove );
  5350. this._addClass( element, null, add );
  5351. },
  5352. _buildSimpleOptions: function( position, key ) {
  5353. var direction = this.options.direction === "vertical";
  5354. var result = {
  5355. classes: {}
  5356. };
  5357. result.classes[ key ] = {
  5358. "middle": "",
  5359. "first": "ui-corner-" + ( direction ? "top" : "left" ),
  5360. "last": "ui-corner-" + ( direction ? "bottom" : "right" ),
  5361. "only": "ui-corner-all"
  5362. }[ position ];
  5363. return result;
  5364. },
  5365. _spinnerOptions: function( position ) {
  5366. var options = this._buildSimpleOptions( position, "ui-spinner" );
  5367. options.classes[ "ui-spinner-up" ] = "";
  5368. options.classes[ "ui-spinner-down" ] = "";
  5369. return options;
  5370. },
  5371. _buttonOptions: function( position ) {
  5372. return this._buildSimpleOptions( position, "ui-button" );
  5373. },
  5374. _checkboxradioOptions: function( position ) {
  5375. return this._buildSimpleOptions( position, "ui-checkboxradio-label" );
  5376. },
  5377. _selectmenuOptions: function( position ) {
  5378. var direction = this.options.direction === "vertical";
  5379. return {
  5380. width: direction ? "auto" : false,
  5381. classes: {
  5382. middle: {
  5383. "ui-selectmenu-button-open": "",
  5384. "ui-selectmenu-button-closed": ""
  5385. },
  5386. first: {
  5387. "ui-selectmenu-button-open": "ui-corner-" + ( direction ? "top" : "tl" ),
  5388. "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "top" : "left" )
  5389. },
  5390. last: {
  5391. "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr",
  5392. "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "bottom" : "right" )
  5393. },
  5394. only: {
  5395. "ui-selectmenu-button-open": "ui-corner-top",
  5396. "ui-selectmenu-button-closed": "ui-corner-all"
  5397. }
  5398. }[ position ]
  5399. };
  5400. },
  5401. _resolveClassesValues: function( classes, instance ) {
  5402. var result = {};
  5403. $.each( classes, function( key ) {
  5404. var current = instance.options.classes[ key ] || "";
  5405. current = $.trim( current.replace( controlgroupCornerRegex, "" ) );
  5406. result[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " );
  5407. } );
  5408. return result;
  5409. },
  5410. _setOption: function( key, value ) {
  5411. if ( key === "direction" ) {
  5412. this._removeClass( "ui-controlgroup-" + this.options.direction );
  5413. }
  5414. this._super( key, value );
  5415. if ( key === "disabled" ) {
  5416. this._callChildMethod( value ? "disable" : "enable" );
  5417. return;
  5418. }
  5419. this.refresh();
  5420. },
  5421. refresh: function() {
  5422. var children,
  5423. that = this;
  5424. this._addClass( "ui-controlgroup ui-controlgroup-" + this.options.direction );
  5425. if ( this.options.direction === "horizontal" ) {
  5426. this._addClass( null, "ui-helper-clearfix" );
  5427. }
  5428. this._initWidgets();
  5429. children = this.childWidgets;
  5430. // We filter here because we need to track all childWidgets not just the visible ones
  5431. if ( this.options.onlyVisible ) {
  5432. children = children.filter( ":visible" );
  5433. }
  5434. if ( children.length ) {
  5435. // We do this last because we need to make sure all enhancment is done
  5436. // before determining first and last
  5437. $.each( [ "first", "last" ], function( index, value ) {
  5438. var instance = children[ value ]().data( "ui-controlgroup-data" );
  5439. if ( instance && that[ "_" + instance.widgetName + "Options" ] ) {
  5440. var options = that[ "_" + instance.widgetName + "Options" ](
  5441. children.length === 1 ? "only" : value
  5442. );
  5443. options.classes = that._resolveClassesValues( options.classes, instance );
  5444. instance.element[ instance.widgetName ]( options );
  5445. } else {
  5446. that._updateCornerClass( children[ value ](), value );
  5447. }
  5448. } );
  5449. // Finally call the refresh method on each of the child widgets.
  5450. this._callChildMethod( "refresh" );
  5451. }
  5452. }
  5453. } );
  5454. /*!
  5455. * jQuery UI Checkboxradio 1.12.1
  5456. * http://jqueryui.com
  5457. *
  5458. * Copyright jQuery Foundation and other contributors
  5459. * Released under the MIT license.
  5460. * http://jquery.org/license
  5461. */
  5462. //>>label: Checkboxradio
  5463. //>>group: Widgets
  5464. //>>description: Enhances a form with multiple themeable checkboxes or radio buttons.
  5465. //>>docs: http://api.jqueryui.com/checkboxradio/
  5466. //>>demos: http://jqueryui.com/checkboxradio/
  5467. //>>css.structure: ../../themes/base/core.css
  5468. //>>css.structure: ../../themes/base/button.css
  5469. //>>css.structure: ../../themes/base/checkboxradio.css
  5470. //>>css.theme: ../../themes/base/theme.css
  5471. $.widget( "ui.checkboxradio", [ $.ui.formResetMixin, {
  5472. version: "1.12.1",
  5473. options: {
  5474. disabled: null,
  5475. label: null,
  5476. icon: true,
  5477. classes: {
  5478. "ui-checkboxradio-label": "ui-corner-all",
  5479. "ui-checkboxradio-icon": "ui-corner-all"
  5480. }
  5481. },
  5482. _getCreateOptions: function() {
  5483. var disabled, labels;
  5484. var that = this;
  5485. var options = this._super() || {};
  5486. // We read the type here, because it makes more sense to throw a element type error first,
  5487. // rather then the error for lack of a label. Often if its the wrong type, it
  5488. // won't have a label (e.g. calling on a div, btn, etc)
  5489. this._readType();
  5490. labels = this.element.labels();
  5491. // If there are multiple labels, use the last one
  5492. this.label = $( labels[ labels.length - 1 ] );
  5493. if ( !this.label.length ) {
  5494. $.error( "No label found for checkboxradio widget" );
  5495. }
  5496. this.originalLabel = "";
  5497. // We need to get the label text but this may also need to make sure it does not contain the
  5498. // input itself.
  5499. this.label.contents().not( this.element[ 0 ] ).each( function() {
  5500. // The label contents could be text, html, or a mix. We concat each element to get a
  5501. // string representation of the label, without the input as part of it.
  5502. that.originalLabel += this.nodeType === 3 ? $( this ).text() : this.outerHTML;
  5503. } );
  5504. // Set the label option if we found label text
  5505. if ( this.originalLabel ) {
  5506. options.label = this.originalLabel;
  5507. }
  5508. disabled = this.element[ 0 ].disabled;
  5509. if ( disabled != null ) {
  5510. options.disabled = disabled;
  5511. }
  5512. return options;
  5513. },
  5514. _create: function() {
  5515. var checked = this.element[ 0 ].checked;
  5516. this._bindFormResetHandler();
  5517. if ( this.options.disabled == null ) {
  5518. this.options.disabled = this.element[ 0 ].disabled;
  5519. }
  5520. this._setOption( "disabled", this.options.disabled );
  5521. this._addClass( "ui-checkboxradio", "ui-helper-hidden-accessible" );
  5522. this._addClass( this.label, "ui-checkboxradio-label", "ui-button ui-widget" );
  5523. if ( this.type === "radio" ) {
  5524. this._addClass( this.label, "ui-checkboxradio-radio-label" );
  5525. }
  5526. if ( this.options.label && this.options.label !== this.originalLabel ) {
  5527. this._updateLabel();
  5528. } else if ( this.originalLabel ) {
  5529. this.options.label = this.originalLabel;
  5530. }
  5531. this._enhance();
  5532. if ( checked ) {
  5533. this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" );
  5534. if ( this.icon ) {
  5535. this._addClass( this.icon, null, "ui-state-hover" );
  5536. }
  5537. }
  5538. this._on( {
  5539. change: "_toggleClasses",
  5540. focus: function() {
  5541. this._addClass( this.label, null, "ui-state-focus ui-visual-focus" );
  5542. },
  5543. blur: function() {
  5544. this._removeClass( this.label, null, "ui-state-focus ui-visual-focus" );
  5545. }
  5546. } );
  5547. },
  5548. _readType: function() {
  5549. var nodeName = this.element[ 0 ].nodeName.toLowerCase();
  5550. this.type = this.element[ 0 ].type;
  5551. if ( nodeName !== "input" || !/radio|checkbox/.test( this.type ) ) {
  5552. $.error( "Can't create checkboxradio on element.nodeName=" + nodeName +
  5553. " and element.type=" + this.type );
  5554. }
  5555. },
  5556. // Support jQuery Mobile enhanced option
  5557. _enhance: function() {
  5558. this._updateIcon( this.element[ 0 ].checked );
  5559. },
  5560. widget: function() {
  5561. return this.label;
  5562. },
  5563. _getRadioGroup: function() {
  5564. var group;
  5565. var name = this.element[ 0 ].name;
  5566. var nameSelector = "input[name='" + $.ui.escapeSelector( name ) + "']";
  5567. if ( !name ) {
  5568. return $( [] );
  5569. }
  5570. if ( this.form.length ) {
  5571. group = $( this.form[ 0 ].elements ).filter( nameSelector );
  5572. } else {
  5573. // Not inside a form, check all inputs that also are not inside a form
  5574. group = $( nameSelector ).filter( function() {
  5575. return $( this ).form().length === 0;
  5576. } );
  5577. }
  5578. return group.not( this.element );
  5579. },
  5580. _toggleClasses: function() {
  5581. var checked = this.element[ 0 ].checked;
  5582. this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
  5583. if ( this.options.icon && this.type === "checkbox" ) {
  5584. this._toggleClass( this.icon, null, "ui-icon-check ui-state-checked", checked )
  5585. ._toggleClass( this.icon, null, "ui-icon-blank", !checked );
  5586. }
  5587. if ( this.type === "radio" ) {
  5588. this._getRadioGroup()
  5589. .each( function() {
  5590. var instance = $( this ).checkboxradio( "instance" );
  5591. if ( instance ) {
  5592. instance._removeClass( instance.label,
  5593. "ui-checkboxradio-checked", "ui-state-active" );
  5594. }
  5595. } );
  5596. }
  5597. },
  5598. _destroy: function() {
  5599. this._unbindFormResetHandler();
  5600. if ( this.icon ) {
  5601. this.icon.remove();
  5602. this.iconSpace.remove();
  5603. }
  5604. },
  5605. _setOption: function( key, value ) {
  5606. // We don't allow the value to be set to nothing
  5607. if ( key === "label" && !value ) {
  5608. return;
  5609. }
  5610. this._super( key, value );
  5611. if ( key === "disabled" ) {
  5612. this._toggleClass( this.label, null, "ui-state-disabled", value );
  5613. this.element[ 0 ].disabled = value;
  5614. // Don't refresh when setting disabled
  5615. return;
  5616. }
  5617. this.refresh();
  5618. },
  5619. _updateIcon: function( checked ) {
  5620. var toAdd = "ui-icon ui-icon-background ";
  5621. if ( this.options.icon ) {
  5622. if ( !this.icon ) {
  5623. this.icon = $( "<span>" );
  5624. this.iconSpace = $( "<span> </span>" );
  5625. this._addClass( this.iconSpace, "ui-checkboxradio-icon-space" );
  5626. }
  5627. if ( this.type === "checkbox" ) {
  5628. toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank";
  5629. this._removeClass( this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check" );
  5630. } else {
  5631. toAdd += "ui-icon-blank";
  5632. }
  5633. this._addClass( this.icon, "ui-checkboxradio-icon", toAdd );
  5634. if ( !checked ) {
  5635. this._removeClass( this.icon, null, "ui-icon-check ui-state-checked" );
  5636. }
  5637. this.icon.prependTo( this.label ).after( this.iconSpace );
  5638. } else if ( this.icon !== undefined ) {
  5639. this.icon.remove();
  5640. this.iconSpace.remove();
  5641. delete this.icon;
  5642. }
  5643. },
  5644. _updateLabel: function() {
  5645. // Remove the contents of the label ( minus the icon, icon space, and input )
  5646. var contents = this.label.contents().not( this.element[ 0 ] );
  5647. if ( this.icon ) {
  5648. contents = contents.not( this.icon[ 0 ] );
  5649. }
  5650. if ( this.iconSpace ) {
  5651. contents = contents.not( this.iconSpace[ 0 ] );
  5652. }
  5653. contents.remove();
  5654. this.label.append( this.options.label );
  5655. },
  5656. refresh: function() {
  5657. var checked = this.element[ 0 ].checked,
  5658. isDisabled = this.element[ 0 ].disabled;
  5659. this._updateIcon( checked );
  5660. this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
  5661. if ( this.options.label !== null ) {
  5662. this._updateLabel();
  5663. }
  5664. if ( isDisabled !== this.options.disabled ) {
  5665. this._setOptions( { "disabled": isDisabled } );
  5666. }
  5667. }
  5668. } ] );
  5669. var widgetsCheckboxradio = $.ui.checkboxradio;
  5670. /*!
  5671. * jQuery UI Button 1.12.1
  5672. * http://jqueryui.com
  5673. *
  5674. * Copyright jQuery Foundation and other contributors
  5675. * Released under the MIT license.
  5676. * http://jquery.org/license
  5677. */
  5678. //>>label: Button
  5679. //>>group: Widgets
  5680. //>>description: Enhances a form with themeable buttons.
  5681. //>>docs: http://api.jqueryui.com/button/
  5682. //>>demos: http://jqueryui.com/button/
  5683. //>>css.structure: ../../themes/base/core.css
  5684. //>>css.structure: ../../themes/base/button.css
  5685. //>>css.theme: ../../themes/base/theme.css
  5686. $.widget( "ui.button", {
  5687. version: "1.12.1",
  5688. defaultElement: "<button>",
  5689. options: {
  5690. classes: {
  5691. "ui-button": "ui-corner-all"
  5692. },
  5693. disabled: null,
  5694. icon: null,
  5695. iconPosition: "beginning",
  5696. label: null,
  5697. showLabel: true
  5698. },
  5699. _getCreateOptions: function() {
  5700. var disabled,
  5701. // This is to support cases like in jQuery Mobile where the base widget does have
  5702. // an implementation of _getCreateOptions
  5703. options = this._super() || {};
  5704. this.isInput = this.element.is( "input" );
  5705. disabled = this.element[ 0 ].disabled;
  5706. if ( disabled != null ) {
  5707. options.disabled = disabled;
  5708. }
  5709. this.originalLabel = this.isInput ? this.element.val() : this.element.html();
  5710. if ( this.originalLabel ) {
  5711. options.label = this.originalLabel;
  5712. }
  5713. return options;
  5714. },
  5715. _create: function() {
  5716. if ( !this.option.showLabel & !this.options.icon ) {
  5717. this.options.showLabel = true;
  5718. }
  5719. // We have to check the option again here even though we did in _getCreateOptions,
  5720. // because null may have been passed on init which would override what was set in
  5721. // _getCreateOptions
  5722. if ( this.options.disabled == null ) {
  5723. this.options.disabled = this.element[ 0 ].disabled || false;
  5724. }
  5725. this.hasTitle = !!this.element.attr( "title" );
  5726. // Check to see if the label needs to be set or if its already correct
  5727. if ( this.options.label && this.options.label !== this.originalLabel ) {
  5728. if ( this.isInput ) {
  5729. this.element.val( this.options.label );
  5730. } else {
  5731. this.element.html( this.options.label );
  5732. }
  5733. }
  5734. this._addClass( "ui-button", "ui-widget" );
  5735. this._setOption( "disabled", this.options.disabled );
  5736. this._enhance();
  5737. if ( this.element.is( "a" ) ) {
  5738. this._on( {
  5739. "keyup": function( event ) {
  5740. if ( event.keyCode === $.ui.keyCode.SPACE ) {
  5741. event.preventDefault();
  5742. // Support: PhantomJS <= 1.9, IE 8 Only
  5743. // If a native click is available use it so we actually cause navigation
  5744. // otherwise just trigger a click event
  5745. if ( this.element[ 0 ].click ) {
  5746. this.element[ 0 ].click();
  5747. } else {
  5748. this.element.trigger( "click" );
  5749. }
  5750. }
  5751. }
  5752. } );
  5753. }
  5754. },
  5755. _enhance: function() {
  5756. if ( !this.element.is( "button" ) ) {
  5757. this.element.attr( "role", "button" );
  5758. }
  5759. if ( this.options.icon ) {
  5760. this._updateIcon( "icon", this.options.icon );
  5761. this._updateTooltip();
  5762. }
  5763. },
  5764. _updateTooltip: function() {
  5765. this.title = this.element.attr( "title" );
  5766. if ( !this.options.showLabel && !this.title ) {
  5767. this.element.attr( "title", this.options.label );
  5768. }
  5769. },
  5770. _updateIcon: function( option, value ) {
  5771. var icon = option !== "iconPosition",
  5772. position = icon ? this.options.iconPosition : value,
  5773. displayBlock = position === "top" || position === "bottom";
  5774. // Create icon
  5775. if ( !this.icon ) {
  5776. this.icon = $( "<span>" );
  5777. this._addClass( this.icon, "ui-button-icon", "ui-icon" );
  5778. if ( !this.options.showLabel ) {
  5779. this._addClass( "ui-button-icon-only" );
  5780. }
  5781. } else if ( icon ) {
  5782. // If we are updating the icon remove the old icon class
  5783. this._removeClass( this.icon, null, this.options.icon );
  5784. }
  5785. // If we are updating the icon add the new icon class
  5786. if ( icon ) {
  5787. this._addClass( this.icon, null, value );
  5788. }
  5789. this._attachIcon( position );
  5790. // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove
  5791. // the iconSpace if there is one.
  5792. if ( displayBlock ) {
  5793. this._addClass( this.icon, null, "ui-widget-icon-block" );
  5794. if ( this.iconSpace ) {
  5795. this.iconSpace.remove();
  5796. }
  5797. } else {
  5798. // Position is beginning or end so remove the ui-widget-icon-block class and add the
  5799. // space if it does not exist
  5800. if ( !this.iconSpace ) {
  5801. this.iconSpace = $( "<span> </span>" );
  5802. this._addClass( this.iconSpace, "ui-button-icon-space" );
  5803. }
  5804. this._removeClass( this.icon, null, "ui-wiget-icon-block" );
  5805. this._attachIconSpace( position );
  5806. }
  5807. },
  5808. _destroy: function() {
  5809. this.element.removeAttr( "role" );
  5810. if ( this.icon ) {
  5811. this.icon.remove();
  5812. }
  5813. if ( this.iconSpace ) {
  5814. this.iconSpace.remove();
  5815. }
  5816. if ( !this.hasTitle ) {
  5817. this.element.removeAttr( "title" );
  5818. }
  5819. },
  5820. _attachIconSpace: function( iconPosition ) {
  5821. this.icon[ /^(?:end|bottom)/.test( iconPosition ) ? "before" : "after" ]( this.iconSpace );
  5822. },
  5823. _attachIcon: function( iconPosition ) {
  5824. this.element[ /^(?:end|bottom)/.test( iconPosition ) ? "append" : "prepend" ]( this.icon );
  5825. },
  5826. _setOptions: function( options ) {
  5827. var newShowLabel = options.showLabel === undefined ?
  5828. this.options.showLabel :
  5829. options.showLabel,
  5830. newIcon = options.icon === undefined ? this.options.icon : options.icon;
  5831. if ( !newShowLabel && !newIcon ) {
  5832. options.showLabel = true;
  5833. }
  5834. this._super( options );
  5835. },
  5836. _setOption: function( key, value ) {
  5837. if ( key === "icon" ) {
  5838. if ( value ) {
  5839. this._updateIcon( key, value );
  5840. } else if ( this.icon ) {
  5841. this.icon.remove();
  5842. if ( this.iconSpace ) {
  5843. this.iconSpace.remove();
  5844. }
  5845. }
  5846. }
  5847. if ( key === "iconPosition" ) {
  5848. this._updateIcon( key, value );
  5849. }
  5850. // Make sure we can't end up with a button that has neither text nor icon
  5851. if ( key === "showLabel" ) {
  5852. this._toggleClass( "ui-button-icon-only", null, !value );
  5853. this._updateTooltip();
  5854. }
  5855. if ( key === "label" ) {
  5856. if ( this.isInput ) {
  5857. this.element.val( value );
  5858. } else {
  5859. // If there is an icon, append it, else nothing then append the value
  5860. // this avoids removal of the icon when setting label text
  5861. this.element.html( value );
  5862. if ( this.icon ) {
  5863. this._attachIcon( this.options.iconPosition );
  5864. this._attachIconSpace( this.options.iconPosition );
  5865. }
  5866. }
  5867. }
  5868. this._super( key, value );
  5869. if ( key === "disabled" ) {
  5870. this._toggleClass( null, "ui-state-disabled", value );
  5871. this.element[ 0 ].disabled = value;
  5872. if ( value ) {
  5873. this.element.blur();
  5874. }
  5875. }
  5876. },
  5877. refresh: function() {
  5878. // Make sure to only check disabled if its an element that supports this otherwise
  5879. // check for the disabled class to determine state
  5880. var isDisabled = this.element.is( "input, button" ) ?
  5881. this.element[ 0 ].disabled : this.element.hasClass( "ui-button-disabled" );
  5882. if ( isDisabled !== this.options.disabled ) {
  5883. this._setOptions( { disabled: isDisabled } );
  5884. }
  5885. this._updateTooltip();
  5886. }
  5887. } );
  5888. // DEPRECATED
  5889. if ( $.uiBackCompat !== false ) {
  5890. // Text and Icons options
  5891. $.widget( "ui.button", $.ui.button, {
  5892. options: {
  5893. text: true,
  5894. icons: {
  5895. primary: null,
  5896. secondary: null
  5897. }
  5898. },
  5899. _create: function() {
  5900. if ( this.options.showLabel && !this.options.text ) {
  5901. this.options.showLabel = this.options.text;
  5902. }
  5903. if ( !this.options.showLabel && this.options.text ) {
  5904. this.options.text = this.options.showLabel;
  5905. }
  5906. if ( !this.options.icon && ( this.options.icons.primary ||
  5907. this.options.icons.secondary ) ) {
  5908. if ( this.options.icons.primary ) {
  5909. this.options.icon = this.options.icons.primary;
  5910. } else {
  5911. this.options.icon = this.options.icons.secondary;
  5912. this.options.iconPosition = "end";
  5913. }
  5914. } else if ( this.options.icon ) {
  5915. this.options.icons.primary = this.options.icon;
  5916. }
  5917. this._super();
  5918. },
  5919. _setOption: function( key, value ) {
  5920. if ( key === "text" ) {
  5921. this._super( "showLabel", value );
  5922. return;
  5923. }
  5924. if ( key === "showLabel" ) {
  5925. this.options.text = value;
  5926. }
  5927. if ( key === "icon" ) {
  5928. this.options.icons.primary = value;
  5929. }
  5930. if ( key === "icons" ) {
  5931. if ( value.primary ) {
  5932. this._super( "icon", value.primary );
  5933. this._super( "iconPosition", "beginning" );
  5934. } else if ( value.secondary ) {
  5935. this._super( "icon", value.secondary );
  5936. this._super( "iconPosition", "end" );
  5937. }
  5938. }
  5939. this._superApply( arguments );
  5940. }
  5941. } );
  5942. $.fn.button = ( function( orig ) {
  5943. return function() {
  5944. if ( !this.length || ( this.length && this[ 0 ].tagName !== "INPUT" ) ||
  5945. ( this.length && this[ 0 ].tagName === "INPUT" && (
  5946. this.attr( "type" ) !== "checkbox" && this.attr( "type" ) !== "radio"
  5947. ) ) ) {
  5948. return orig.apply( this, arguments );
  5949. }
  5950. if ( !$.ui.checkboxradio ) {
  5951. $.error( "Checkboxradio widget missing" );
  5952. }
  5953. if ( arguments.length === 0 ) {
  5954. return this.checkboxradio( {
  5955. "icon": false
  5956. } );
  5957. }
  5958. return this.checkboxradio.apply( this, arguments );
  5959. };
  5960. } )( $.fn.button );
  5961. $.fn.buttonset = function() {
  5962. if ( !$.ui.controlgroup ) {
  5963. $.error( "Controlgroup widget missing" );
  5964. }
  5965. if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" && arguments[ 2 ] ) {
  5966. return this.controlgroup.apply( this,
  5967. [ arguments[ 0 ], "items.button", arguments[ 2 ] ] );
  5968. }
  5969. if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" ) {
  5970. return this.controlgroup.apply( this, [ arguments[ 0 ], "items.button" ] );
  5971. }
  5972. if ( typeof arguments[ 0 ] === "object" && arguments[ 0 ].items ) {
  5973. arguments[ 0 ].items = {
  5974. button: arguments[ 0 ].items
  5975. };
  5976. }
  5977. return this.controlgroup.apply( this, arguments );
  5978. };
  5979. }
  5980. var widgetsButton = $.ui.button;
  5981. // jscs:disable maximumLineLength
  5982. /* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
  5983. /*!
  5984. * jQuery UI Datepicker 1.12.1
  5985. * http://jqueryui.com
  5986. *
  5987. * Copyright jQuery Foundation and other contributors
  5988. * Released under the MIT license.
  5989. * http://jquery.org/license
  5990. */
  5991. //>>label: Datepicker
  5992. //>>group: Widgets
  5993. //>>description: Displays a calendar from an input or inline for selecting dates.
  5994. //>>docs: http://api.jqueryui.com/datepicker/
  5995. //>>demos: http://jqueryui.com/datepicker/
  5996. //>>css.structure: ../../themes/base/core.css
  5997. //>>css.structure: ../../themes/base/datepicker.css
  5998. //>>css.theme: ../../themes/base/theme.css
  5999. $.extend( $.ui, { datepicker: { version: "1.12.1" } } );
  6000. var datepicker_instActive;
  6001. function datepicker_getZindex( elem ) {
  6002. var position, value;
  6003. while ( elem.length && elem[ 0 ] !== document ) {
  6004. // Ignore z-index if position is set to a value where z-index is ignored by the browser
  6005. // This makes behavior of this function consistent across browsers
  6006. // WebKit always returns auto if the element is positioned
  6007. position = elem.css( "position" );
  6008. if ( position === "absolute" || position === "relative" || position === "fixed" ) {
  6009. // IE returns 0 when zIndex is not specified
  6010. // other browsers return a string
  6011. // we ignore the case of nested elements with an explicit value of 0
  6012. // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
  6013. value = parseInt( elem.css( "zIndex" ), 10 );
  6014. if ( !isNaN( value ) && value !== 0 ) {
  6015. return value;
  6016. }
  6017. }
  6018. elem = elem.parent();
  6019. }
  6020. return 0;
  6021. }
  6022. /* Date picker manager.
  6023. Use the singleton instance of this class, $.datepicker, to interact with the date picker.
  6024. Settings for (groups of) date pickers are maintained in an instance object,
  6025. allowing multiple different settings on the same page. */
  6026. function Datepicker() {
  6027. this._curInst = null; // The current instance in use
  6028. this._keyEvent = false; // If the last event was a key event
  6029. this._disabledInputs = []; // List of date picker inputs that have been disabled
  6030. this._datepickerShowing = false; // True if the popup picker is showing , false if not
  6031. this._inDialog = false; // True if showing within a "dialog", false if not
  6032. this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division
  6033. this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class
  6034. this._appendClass = "ui-datepicker-append"; // The name of the append marker class
  6035. this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class
  6036. this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class
  6037. this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class
  6038. this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class
  6039. this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class
  6040. this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class
  6041. this.regional = []; // Available regional settings, indexed by language code
  6042. this.regional[ "" ] = { // Default regional settings
  6043. closeText: "Done", // Display text for close link
  6044. prevText: "Prev", // Display text for previous month link
  6045. nextText: "Next", // Display text for next month link
  6046. currentText: "Today", // Display text for current month link
  6047. monthNames: [ "January","February","March","April","May","June",
  6048. "July","August","September","October","November","December" ], // Names of months for drop-down and formatting
  6049. monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting
  6050. dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting
  6051. dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting
  6052. dayNamesMin: [ "Su","Mo","Tu","We","Th","Fr","Sa" ], // Column headings for days starting at Sunday
  6053. weekHeader: "Wk", // Column header for week of the year
  6054. dateFormat: "mm/dd/yy", // See format options on parseDate
  6055. firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
  6056. isRTL: false, // True if right-to-left language, false if left-to-right
  6057. showMonthAfterYear: false, // True if the year select precedes month, false for month then year
  6058. yearSuffix: "" // Additional text to append to the year in the month headers
  6059. };
  6060. this._defaults = { // Global defaults for all the date picker instances
  6061. showOn: "focus", // "focus" for popup on focus,
  6062. // "button" for trigger button, or "both" for either
  6063. showAnim: "fadeIn", // Name of jQuery animation for popup
  6064. showOptions: {}, // Options for enhanced animations
  6065. defaultDate: null, // Used when field is blank: actual date,
  6066. // +/-number for offset from today, null for today
  6067. appendText: "", // Display text following the input box, e.g. showing the format
  6068. buttonText: "...", // Text for trigger button
  6069. buttonImage: "", // URL for trigger button image
  6070. buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
  6071. hideIfNoPrevNext: false, // True to hide next/previous month links
  6072. // if not applicable, false to just disable them
  6073. navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
  6074. gotoCurrent: false, // True if today link goes back to current selection instead
  6075. changeMonth: false, // True if month can be selected directly, false if only prev/next
  6076. changeYear: false, // True if year can be selected directly, false if only prev/next
  6077. yearRange: "c-10:c+10", // Range of years to display in drop-down,
  6078. // either relative to today's year (-nn:+nn), relative to currently displayed year
  6079. // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
  6080. showOtherMonths: false, // True to show dates in other months, false to leave blank
  6081. selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
  6082. showWeek: false, // True to show week of the year, false to not show it
  6083. calculateWeek: this.iso8601Week, // How to calculate the week of the year,
  6084. // takes a Date and returns the number of the week for it
  6085. shortYearCutoff: "+10", // Short year values < this are in the current century,
  6086. // > this are in the previous century,
  6087. // string value starting with "+" for current year + value
  6088. minDate: null, // The earliest selectable date, or null for no limit
  6089. maxDate: null, // The latest selectable date, or null for no limit
  6090. duration: "fast", // Duration of display/closure
  6091. beforeShowDay: null, // Function that takes a date and returns an array with
  6092. // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",
  6093. // [2] = cell title (optional), e.g. $.datepicker.noWeekends
  6094. beforeShow: null, // Function that takes an input field and
  6095. // returns a set of custom settings for the date picker
  6096. onSelect: null, // Define a callback function when a date is selected
  6097. onChangeMonthYear: null, // Define a callback function when the month or year is changed
  6098. onClose: null, // Define a callback function when the datepicker is closed
  6099. numberOfMonths: 1, // Number of months to show at a time
  6100. showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
  6101. stepMonths: 1, // Number of months to step back/forward
  6102. stepBigMonths: 12, // Number of months to step back/forward for the big links
  6103. altField: "", // Selector for an alternate field to store selected dates into
  6104. altFormat: "", // The date format to use for the alternate field
  6105. constrainInput: true, // The input is constrained by the current date format
  6106. showButtonPanel: false, // True to show button panel, false to not show it
  6107. autoSize: false, // True to size the input for the date format, false to leave as is
  6108. disabled: false // The initial disabled state
  6109. };
  6110. $.extend( this._defaults, this.regional[ "" ] );
  6111. this.regional.en = $.extend( true, {}, this.regional[ "" ] );
  6112. this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en );
  6113. this.dpDiv = datepicker_bindHover( $( "<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) );
  6114. }
  6115. $.extend( Datepicker.prototype, {
  6116. /* Class name added to elements to indicate already configured with a date picker. */
  6117. markerClassName: "hasDatepicker",
  6118. //Keep track of the maximum number of rows displayed (see #7043)
  6119. maxRows: 4,
  6120. // TODO rename to "widget" when switching to widget factory
  6121. _widgetDatepicker: function() {
  6122. return this.dpDiv;
  6123. },
  6124. /* Override the default settings for all instances of the date picker.
  6125. * @param settings object - the new settings to use as defaults (anonymous object)
  6126. * @return the manager object
  6127. */
  6128. setDefaults: function( settings ) {
  6129. datepicker_extendRemove( this._defaults, settings || {} );
  6130. return this;
  6131. },
  6132. /* Attach the date picker to a jQuery selection.
  6133. * @param target element - the target input field or division or span
  6134. * @param settings object - the new settings to use for this date picker instance (anonymous)
  6135. */
  6136. _attachDatepicker: function( target, settings ) {
  6137. var nodeName, inline, inst;
  6138. nodeName = target.nodeName.toLowerCase();
  6139. inline = ( nodeName === "div" || nodeName === "span" );
  6140. if ( !target.id ) {
  6141. this.uuid += 1;
  6142. target.id = "dp" + this.uuid;
  6143. }
  6144. inst = this._newInst( $( target ), inline );
  6145. inst.settings = $.extend( {}, settings || {} );
  6146. if ( nodeName === "input" ) {
  6147. this._connectDatepicker( target, inst );
  6148. } else if ( inline ) {
  6149. this._inlineDatepicker( target, inst );
  6150. }
  6151. },
  6152. /* Create a new instance object. */
  6153. _newInst: function( target, inline ) {
  6154. var id = target[ 0 ].id.replace( /([^A-Za-z0-9_\-])/g, "\\\\$1" ); // escape jQuery meta chars
  6155. return { id: id, input: target, // associated target
  6156. selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
  6157. drawMonth: 0, drawYear: 0, // month being drawn
  6158. inline: inline, // is datepicker inline or not
  6159. dpDiv: ( !inline ? this.dpDiv : // presentation div
  6160. datepicker_bindHover( $( "<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ) ) };
  6161. },
  6162. /* Attach the date picker to an input field. */
  6163. _connectDatepicker: function( target, inst ) {
  6164. var input = $( target );
  6165. inst.append = $( [] );
  6166. inst.trigger = $( [] );
  6167. if ( input.hasClass( this.markerClassName ) ) {
  6168. return;
  6169. }
  6170. this._attachments( input, inst );
  6171. input.addClass( this.markerClassName ).on( "keydown", this._doKeyDown ).
  6172. on( "keypress", this._doKeyPress ).on( "keyup", this._doKeyUp );
  6173. this._autoSize( inst );
  6174. $.data( target, "datepicker", inst );
  6175. //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
  6176. if ( inst.settings.disabled ) {
  6177. this._disableDatepicker( target );
  6178. }
  6179. },
  6180. /* Make attachments based on settings. */
  6181. _attachments: function( input, inst ) {
  6182. var showOn, buttonText, buttonImage,
  6183. appendText = this._get( inst, "appendText" ),
  6184. isRTL = this._get( inst, "isRTL" );
  6185. if ( inst.append ) {
  6186. inst.append.remove();
  6187. }
  6188. if ( appendText ) {
  6189. inst.append = $( "<span class='" + this._appendClass + "'>" + appendText + "</span>" );
  6190. input[ isRTL ? "before" : "after" ]( inst.append );
  6191. }
  6192. input.off( "focus", this._showDatepicker );
  6193. if ( inst.trigger ) {
  6194. inst.trigger.remove();
  6195. }
  6196. showOn = this._get( inst, "showOn" );
  6197. if ( showOn === "focus" || showOn === "both" ) { // pop-up date picker when in the marked field
  6198. input.on( "focus", this._showDatepicker );
  6199. }
  6200. if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked
  6201. buttonText = this._get( inst, "buttonText" );
  6202. buttonImage = this._get( inst, "buttonImage" );
  6203. inst.trigger = $( this._get( inst, "buttonImageOnly" ) ?
  6204. $( "<img/>" ).addClass( this._triggerClass ).
  6205. attr( { src: buttonImage, alt: buttonText, title: buttonText } ) :
  6206. $( "<button type='button'></button>" ).addClass( this._triggerClass ).
  6207. html( !buttonImage ? buttonText : $( "<img/>" ).attr(
  6208. { src:buttonImage, alt:buttonText, title:buttonText } ) ) );
  6209. input[ isRTL ? "before" : "after" ]( inst.trigger );
  6210. inst.trigger.on( "click", function() {
  6211. if ( $.datepicker._datepickerShowing && $.datepicker._lastInput === input[ 0 ] ) {
  6212. $.datepicker._hideDatepicker();
  6213. } else if ( $.datepicker._datepickerShowing && $.datepicker._lastInput !== input[ 0 ] ) {
  6214. $.datepicker._hideDatepicker();
  6215. $.datepicker._showDatepicker( input[ 0 ] );
  6216. } else {
  6217. $.datepicker._showDatepicker( input[ 0 ] );
  6218. }
  6219. return false;
  6220. } );
  6221. }
  6222. },
  6223. /* Apply the maximum length for the date format. */
  6224. _autoSize: function( inst ) {
  6225. if ( this._get( inst, "autoSize" ) && !inst.inline ) {
  6226. var findMax, max, maxI, i,
  6227. date = new Date( 2009, 12 - 1, 20 ), // Ensure double digits
  6228. dateFormat = this._get( inst, "dateFormat" );
  6229. if ( dateFormat.match( /[DM]/ ) ) {
  6230. findMax = function( names ) {
  6231. max = 0;
  6232. maxI = 0;
  6233. for ( i = 0; i < names.length; i++ ) {
  6234. if ( names[ i ].length > max ) {
  6235. max = names[ i ].length;
  6236. maxI = i;
  6237. }
  6238. }
  6239. return maxI;
  6240. };
  6241. date.setMonth( findMax( this._get( inst, ( dateFormat.match( /MM/ ) ?
  6242. "monthNames" : "monthNamesShort" ) ) ) );
  6243. date.setDate( findMax( this._get( inst, ( dateFormat.match( /DD/ ) ?
  6244. "dayNames" : "dayNamesShort" ) ) ) + 20 - date.getDay() );
  6245. }
  6246. inst.input.attr( "size", this._formatDate( inst, date ).length );
  6247. }
  6248. },
  6249. /* Attach an inline date picker to a div. */
  6250. _inlineDatepicker: function( target, inst ) {
  6251. var divSpan = $( target );
  6252. if ( divSpan.hasClass( this.markerClassName ) ) {
  6253. return;
  6254. }
  6255. divSpan.addClass( this.markerClassName ).append( inst.dpDiv );
  6256. $.data( target, "datepicker", inst );
  6257. this._setDate( inst, this._getDefaultDate( inst ), true );
  6258. this._updateDatepicker( inst );
  6259. this._updateAlternate( inst );
  6260. //If disabled option is true, disable the datepicker before showing it (see ticket #5665)
  6261. if ( inst.settings.disabled ) {
  6262. this._disableDatepicker( target );
  6263. }
  6264. // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
  6265. // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
  6266. inst.dpDiv.css( "display", "block" );
  6267. },
  6268. /* Pop-up the date picker in a "dialog" box.
  6269. * @param input element - ignored
  6270. * @param date string or Date - the initial date to display
  6271. * @param onSelect function - the function to call when a date is selected
  6272. * @param settings object - update the dialog date picker instance's settings (anonymous object)
  6273. * @param pos int[2] - coordinates for the dialog's position within the screen or
  6274. * event - with x/y coordinates or
  6275. * leave empty for default (screen centre)
  6276. * @return the manager object
  6277. */
  6278. _dialogDatepicker: function( input, date, onSelect, settings, pos ) {
  6279. var id, browserWidth, browserHeight, scrollX, scrollY,
  6280. inst = this._dialogInst; // internal instance
  6281. if ( !inst ) {
  6282. this.uuid += 1;
  6283. id = "dp" + this.uuid;
  6284. this._dialogInput = $( "<input type='text' id='" + id +
  6285. "' style='position: absolute; top: -100px; width: 0px;'/>" );
  6286. this._dialogInput.on( "keydown", this._doKeyDown );
  6287. $( "body" ).append( this._dialogInput );
  6288. inst = this._dialogInst = this._newInst( this._dialogInput, false );
  6289. inst.settings = {};
  6290. $.data( this._dialogInput[ 0 ], "datepicker", inst );
  6291. }
  6292. datepicker_extendRemove( inst.settings, settings || {} );
  6293. date = ( date && date.constructor === Date ? this._formatDate( inst, date ) : date );
  6294. this._dialogInput.val( date );
  6295. this._pos = ( pos ? ( pos.length ? pos : [ pos.pageX, pos.pageY ] ) : null );
  6296. if ( !this._pos ) {
  6297. browserWidth = document.documentElement.clientWidth;
  6298. browserHeight = document.documentElement.clientHeight;
  6299. scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
  6300. scrollY = document.documentElement.scrollTop || document.body.scrollTop;
  6301. this._pos = // should use actual width/height below
  6302. [ ( browserWidth / 2 ) - 100 + scrollX, ( browserHeight / 2 ) - 150 + scrollY ];
  6303. }
  6304. // Move input on screen for focus, but hidden behind dialog
  6305. this._dialogInput.css( "left", ( this._pos[ 0 ] + 20 ) + "px" ).css( "top", this._pos[ 1 ] + "px" );
  6306. inst.settings.onSelect = onSelect;
  6307. this._inDialog = true;
  6308. this.dpDiv.addClass( this._dialogClass );
  6309. this._showDatepicker( this._dialogInput[ 0 ] );
  6310. if ( $.blockUI ) {
  6311. $.blockUI( this.dpDiv );
  6312. }
  6313. $.data( this._dialogInput[ 0 ], "datepicker", inst );
  6314. return this;
  6315. },
  6316. /* Detach a datepicker from its control.
  6317. * @param target element - the target input field or division or span
  6318. */
  6319. _destroyDatepicker: function( target ) {
  6320. var nodeName,
  6321. $target = $( target ),
  6322. inst = $.data( target, "datepicker" );
  6323. if ( !$target.hasClass( this.markerClassName ) ) {
  6324. return;
  6325. }
  6326. nodeName = target.nodeName.toLowerCase();
  6327. $.removeData( target, "datepicker" );
  6328. if ( nodeName === "input" ) {
  6329. inst.append.remove();
  6330. inst.trigger.remove();
  6331. $target.removeClass( this.markerClassName ).
  6332. off( "focus", this._showDatepicker ).
  6333. off( "keydown", this._doKeyDown ).
  6334. off( "keypress", this._doKeyPress ).
  6335. off( "keyup", this._doKeyUp );
  6336. } else if ( nodeName === "div" || nodeName === "span" ) {
  6337. $target.removeClass( this.markerClassName ).empty();
  6338. }
  6339. if ( datepicker_instActive === inst ) {
  6340. datepicker_instActive = null;
  6341. }
  6342. },
  6343. /* Enable the date picker to a jQuery selection.
  6344. * @param target element - the target input field or division or span
  6345. */
  6346. _enableDatepicker: function( target ) {
  6347. var nodeName, inline,
  6348. $target = $( target ),
  6349. inst = $.data( target, "datepicker" );
  6350. if ( !$target.hasClass( this.markerClassName ) ) {
  6351. return;
  6352. }
  6353. nodeName = target.nodeName.toLowerCase();
  6354. if ( nodeName === "input" ) {
  6355. target.disabled = false;
  6356. inst.trigger.filter( "button" ).
  6357. each( function() { this.disabled = false; } ).end().
  6358. filter( "img" ).css( { opacity: "1.0", cursor: "" } );
  6359. } else if ( nodeName === "div" || nodeName === "span" ) {
  6360. inline = $target.children( "." + this._inlineClass );
  6361. inline.children().removeClass( "ui-state-disabled" );
  6362. inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ).
  6363. prop( "disabled", false );
  6364. }
  6365. this._disabledInputs = $.map( this._disabledInputs,
  6366. function( value ) { return ( value === target ? null : value ); } ); // delete entry
  6367. },
  6368. /* Disable the date picker to a jQuery selection.
  6369. * @param target element - the target input field or division or span
  6370. */
  6371. _disableDatepicker: function( target ) {
  6372. var nodeName, inline,
  6373. $target = $( target ),
  6374. inst = $.data( target, "datepicker" );
  6375. if ( !$target.hasClass( this.markerClassName ) ) {
  6376. return;
  6377. }
  6378. nodeName = target.nodeName.toLowerCase();
  6379. if ( nodeName === "input" ) {
  6380. target.disabled = true;
  6381. inst.trigger.filter( "button" ).
  6382. each( function() { this.disabled = true; } ).end().
  6383. filter( "img" ).css( { opacity: "0.5", cursor: "default" } );
  6384. } else if ( nodeName === "div" || nodeName === "span" ) {
  6385. inline = $target.children( "." + this._inlineClass );
  6386. inline.children().addClass( "ui-state-disabled" );
  6387. inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ).
  6388. prop( "disabled", true );
  6389. }
  6390. this._disabledInputs = $.map( this._disabledInputs,
  6391. function( value ) { return ( value === target ? null : value ); } ); // delete entry
  6392. this._disabledInputs[ this._disabledInputs.length ] = target;
  6393. },
  6394. /* Is the first field in a jQuery collection disabled as a datepicker?
  6395. * @param target element - the target input field or division or span
  6396. * @return boolean - true if disabled, false if enabled
  6397. */
  6398. _isDisabledDatepicker: function( target ) {
  6399. if ( !target ) {
  6400. return false;
  6401. }
  6402. for ( var i = 0; i < this._disabledInputs.length; i++ ) {
  6403. if ( this._disabledInputs[ i ] === target ) {
  6404. return true;
  6405. }
  6406. }
  6407. return false;
  6408. },
  6409. /* Retrieve the instance data for the target control.
  6410. * @param target element - the target input field or division or span
  6411. * @return object - the associated instance data
  6412. * @throws error if a jQuery problem getting data
  6413. */
  6414. _getInst: function( target ) {
  6415. try {
  6416. return $.data( target, "datepicker" );
  6417. }
  6418. catch ( err ) {
  6419. throw "Missing instance data for this datepicker";
  6420. }
  6421. },
  6422. /* Update or retrieve the settings for a date picker attached to an input field or division.
  6423. * @param target element - the target input field or division or span
  6424. * @param name object - the new settings to update or
  6425. * string - the name of the setting to change or retrieve,
  6426. * when retrieving also "all" for all instance settings or
  6427. * "defaults" for all global defaults
  6428. * @param value any - the new value for the setting
  6429. * (omit if above is an object or to retrieve a value)
  6430. */
  6431. _optionDatepicker: function( target, name, value ) {
  6432. var settings, date, minDate, maxDate,
  6433. inst = this._getInst( target );
  6434. if ( arguments.length === 2 && typeof name === "string" ) {
  6435. return ( name === "defaults" ? $.extend( {}, $.datepicker._defaults ) :
  6436. ( inst ? ( name === "all" ? $.extend( {}, inst.settings ) :
  6437. this._get( inst, name ) ) : null ) );
  6438. }
  6439. settings = name || {};
  6440. if ( typeof name === "string" ) {
  6441. settings = {};
  6442. settings[ name ] = value;
  6443. }
  6444. if ( inst ) {
  6445. if ( this._curInst === inst ) {
  6446. this._hideDatepicker();
  6447. }
  6448. date = this._getDateDatepicker( target, true );
  6449. minDate = this._getMinMaxDate( inst, "min" );
  6450. maxDate = this._getMinMaxDate( inst, "max" );
  6451. datepicker_extendRemove( inst.settings, settings );
  6452. // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
  6453. if ( minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined ) {
  6454. inst.settings.minDate = this._formatDate( inst, minDate );
  6455. }
  6456. if ( maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined ) {
  6457. inst.settings.maxDate = this._formatDate( inst, maxDate );
  6458. }
  6459. if ( "disabled" in settings ) {
  6460. if ( settings.disabled ) {
  6461. this._disableDatepicker( target );
  6462. } else {
  6463. this._enableDatepicker( target );
  6464. }
  6465. }
  6466. this._attachments( $( target ), inst );
  6467. this._autoSize( inst );
  6468. this._setDate( inst, date );
  6469. this._updateAlternate( inst );
  6470. this._updateDatepicker( inst );
  6471. }
  6472. },
  6473. // Change method deprecated
  6474. _changeDatepicker: function( target, name, value ) {
  6475. this._optionDatepicker( target, name, value );
  6476. },
  6477. /* Redraw the date picker attached to an input field or division.
  6478. * @param target element - the target input field or division or span
  6479. */
  6480. _refreshDatepicker: function( target ) {
  6481. var inst = this._getInst( target );
  6482. if ( inst ) {
  6483. this._updateDatepicker( inst );
  6484. }
  6485. },
  6486. /* Set the dates for a jQuery selection.
  6487. * @param target element - the target input field or division or span
  6488. * @param date Date - the new date
  6489. */
  6490. _setDateDatepicker: function( target, date ) {
  6491. var inst = this._getInst( target );
  6492. if ( inst ) {
  6493. this._setDate( inst, date );
  6494. this._updateDatepicker( inst );
  6495. this._updateAlternate( inst );
  6496. }
  6497. },
  6498. /* Get the date(s) for the first entry in a jQuery selection.
  6499. * @param target element - the target input field or division or span
  6500. * @param noDefault boolean - true if no default date is to be used
  6501. * @return Date - the current date
  6502. */
  6503. _getDateDatepicker: function( target, noDefault ) {
  6504. var inst = this._getInst( target );
  6505. if ( inst && !inst.inline ) {
  6506. this._setDateFromField( inst, noDefault );
  6507. }
  6508. return ( inst ? this._getDate( inst ) : null );
  6509. },
  6510. /* Handle keystrokes. */
  6511. _doKeyDown: function( event ) {
  6512. var onSelect, dateStr, sel,
  6513. inst = $.datepicker._getInst( event.target ),
  6514. handled = true,
  6515. isRTL = inst.dpDiv.is( ".ui-datepicker-rtl" );
  6516. inst._keyEvent = true;
  6517. if ( $.datepicker._datepickerShowing ) {
  6518. switch ( event.keyCode ) {
  6519. case 9: $.datepicker._hideDatepicker();
  6520. handled = false;
  6521. break; // hide on tab out
  6522. case 13: sel = $( "td." + $.datepicker._dayOverClass + ":not(." +
  6523. $.datepicker._currentClass + ")", inst.dpDiv );
  6524. if ( sel[ 0 ] ) {
  6525. $.datepicker._selectDay( event.target, inst.selectedMonth, inst.selectedYear, sel[ 0 ] );
  6526. }
  6527. onSelect = $.datepicker._get( inst, "onSelect" );
  6528. if ( onSelect ) {
  6529. dateStr = $.datepicker._formatDate( inst );
  6530. // Trigger custom callback
  6531. onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] );
  6532. } else {
  6533. $.datepicker._hideDatepicker();
  6534. }
  6535. return false; // don't submit the form
  6536. case 27: $.datepicker._hideDatepicker();
  6537. break; // hide on escape
  6538. case 33: $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
  6539. -$.datepicker._get( inst, "stepBigMonths" ) :
  6540. -$.datepicker._get( inst, "stepMonths" ) ), "M" );
  6541. break; // previous month/year on page up/+ ctrl
  6542. case 34: $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
  6543. +$.datepicker._get( inst, "stepBigMonths" ) :
  6544. +$.datepicker._get( inst, "stepMonths" ) ), "M" );
  6545. break; // next month/year on page down/+ ctrl
  6546. case 35: if ( event.ctrlKey || event.metaKey ) {
  6547. $.datepicker._clearDate( event.target );
  6548. }
  6549. handled = event.ctrlKey || event.metaKey;
  6550. break; // clear on ctrl or command +end
  6551. case 36: if ( event.ctrlKey || event.metaKey ) {
  6552. $.datepicker._gotoToday( event.target );
  6553. }
  6554. handled = event.ctrlKey || event.metaKey;
  6555. break; // current on ctrl or command +home
  6556. case 37: if ( event.ctrlKey || event.metaKey ) {
  6557. $.datepicker._adjustDate( event.target, ( isRTL ? +1 : -1 ), "D" );
  6558. }
  6559. handled = event.ctrlKey || event.metaKey;
  6560. // -1 day on ctrl or command +left
  6561. if ( event.originalEvent.altKey ) {
  6562. $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
  6563. -$.datepicker._get( inst, "stepBigMonths" ) :
  6564. -$.datepicker._get( inst, "stepMonths" ) ), "M" );
  6565. }
  6566. // next month/year on alt +left on Mac
  6567. break;
  6568. case 38: if ( event.ctrlKey || event.metaKey ) {
  6569. $.datepicker._adjustDate( event.target, -7, "D" );
  6570. }
  6571. handled = event.ctrlKey || event.metaKey;
  6572. break; // -1 week on ctrl or command +up
  6573. case 39: if ( event.ctrlKey || event.metaKey ) {
  6574. $.datepicker._adjustDate( event.target, ( isRTL ? -1 : +1 ), "D" );
  6575. }
  6576. handled = event.ctrlKey || event.metaKey;
  6577. // +1 day on ctrl or command +right
  6578. if ( event.originalEvent.altKey ) {
  6579. $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
  6580. +$.datepicker._get( inst, "stepBigMonths" ) :
  6581. +$.datepicker._get( inst, "stepMonths" ) ), "M" );
  6582. }
  6583. // next month/year on alt +right
  6584. break;
  6585. case 40: if ( event.ctrlKey || event.metaKey ) {
  6586. $.datepicker._adjustDate( event.target, +7, "D" );
  6587. }
  6588. handled = event.ctrlKey || event.metaKey;
  6589. break; // +1 week on ctrl or command +down
  6590. default: handled = false;
  6591. }
  6592. } else if ( event.keyCode === 36 && event.ctrlKey ) { // display the date picker on ctrl+home
  6593. $.datepicker._showDatepicker( this );
  6594. } else {
  6595. handled = false;
  6596. }
  6597. if ( handled ) {
  6598. event.preventDefault();
  6599. event.stopPropagation();
  6600. }
  6601. },
  6602. /* Filter entered characters - based on date format. */
  6603. _doKeyPress: function( event ) {
  6604. var chars, chr,
  6605. inst = $.datepicker._getInst( event.target );
  6606. if ( $.datepicker._get( inst, "constrainInput" ) ) {
  6607. chars = $.datepicker._possibleChars( $.datepicker._get( inst, "dateFormat" ) );
  6608. chr = String.fromCharCode( event.charCode == null ? event.keyCode : event.charCode );
  6609. return event.ctrlKey || event.metaKey || ( chr < " " || !chars || chars.indexOf( chr ) > -1 );
  6610. }
  6611. },
  6612. /* Synchronise manual entry and field/alternate field. */
  6613. _doKeyUp: function( event ) {
  6614. var date,
  6615. inst = $.datepicker._getInst( event.target );
  6616. if ( inst.input.val() !== inst.lastVal ) {
  6617. try {
  6618. date = $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ),
  6619. ( inst.input ? inst.input.val() : null ),
  6620. $.datepicker._getFormatConfig( inst ) );
  6621. if ( date ) { // only if valid
  6622. $.datepicker._setDateFromField( inst );
  6623. $.datepicker._updateAlternate( inst );
  6624. $.datepicker._updateDatepicker( inst );
  6625. }
  6626. }
  6627. catch ( err ) {
  6628. }
  6629. }
  6630. return true;
  6631. },
  6632. /* Pop-up the date picker for a given input field.
  6633. * If false returned from beforeShow event handler do not show.
  6634. * @param input element - the input field attached to the date picker or
  6635. * event - if triggered by focus
  6636. */
  6637. _showDatepicker: function( input ) {
  6638. input = input.target || input;
  6639. if ( input.nodeName.toLowerCase() !== "input" ) { // find from button/image trigger
  6640. input = $( "input", input.parentNode )[ 0 ];
  6641. }
  6642. if ( $.datepicker._isDisabledDatepicker( input ) || $.datepicker._lastInput === input ) { // already here
  6643. return;
  6644. }
  6645. var inst, beforeShow, beforeShowSettings, isFixed,
  6646. offset, showAnim, duration;
  6647. inst = $.datepicker._getInst( input );
  6648. if ( $.datepicker._curInst && $.datepicker._curInst !== inst ) {
  6649. $.datepicker._curInst.dpDiv.stop( true, true );
  6650. if ( inst && $.datepicker._datepickerShowing ) {
  6651. $.datepicker._hideDatepicker( $.datepicker._curInst.input[ 0 ] );
  6652. }
  6653. }
  6654. beforeShow = $.datepicker._get( inst, "beforeShow" );
  6655. beforeShowSettings = beforeShow ? beforeShow.apply( input, [ input, inst ] ) : {};
  6656. if ( beforeShowSettings === false ) {
  6657. return;
  6658. }
  6659. datepicker_extendRemove( inst.settings, beforeShowSettings );
  6660. inst.lastVal = null;
  6661. $.datepicker._lastInput = input;
  6662. $.datepicker._setDateFromField( inst );
  6663. if ( $.datepicker._inDialog ) { // hide cursor
  6664. input.value = "";
  6665. }
  6666. if ( !$.datepicker._pos ) { // position below input
  6667. $.datepicker._pos = $.datepicker._findPos( input );
  6668. $.datepicker._pos[ 1 ] += input.offsetHeight; // add the height
  6669. }
  6670. isFixed = false;
  6671. $( input ).parents().each( function() {
  6672. isFixed |= $( this ).css( "position" ) === "fixed";
  6673. return !isFixed;
  6674. } );
  6675. offset = { left: $.datepicker._pos[ 0 ], top: $.datepicker._pos[ 1 ] };
  6676. $.datepicker._pos = null;
  6677. //to avoid flashes on Firefox
  6678. inst.dpDiv.empty();
  6679. // determine sizing offscreen
  6680. inst.dpDiv.css( { position: "absolute", display: "block", top: "-1000px" } );
  6681. $.datepicker._updateDatepicker( inst );
  6682. // fix width for dynamic number of date pickers
  6683. // and adjust position before showing
  6684. offset = $.datepicker._checkOffset( inst, offset, isFixed );
  6685. inst.dpDiv.css( { position: ( $.datepicker._inDialog && $.blockUI ?
  6686. "static" : ( isFixed ? "fixed" : "absolute" ) ), display: "none",
  6687. left: offset.left + "px", top: offset.top + "px" } );
  6688. if ( !inst.inline ) {
  6689. showAnim = $.datepicker._get( inst, "showAnim" );
  6690. duration = $.datepicker._get( inst, "duration" );
  6691. inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 );
  6692. $.datepicker._datepickerShowing = true;
  6693. if ( $.effects && $.effects.effect[ showAnim ] ) {
  6694. inst.dpDiv.show( showAnim, $.datepicker._get( inst, "showOptions" ), duration );
  6695. } else {
  6696. inst.dpDiv[ showAnim || "show" ]( showAnim ? duration : null );
  6697. }
  6698. if ( $.datepicker._shouldFocusInput( inst ) ) {
  6699. inst.input.trigger( "focus" );
  6700. }
  6701. $.datepicker._curInst = inst;
  6702. }
  6703. },
  6704. /* Generate the date picker content. */
  6705. _updateDatepicker: function( inst ) {
  6706. this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
  6707. datepicker_instActive = inst; // for delegate hover events
  6708. inst.dpDiv.empty().append( this._generateHTML( inst ) );
  6709. this._attachHandlers( inst );
  6710. var origyearshtml,
  6711. numMonths = this._getNumberOfMonths( inst ),
  6712. cols = numMonths[ 1 ],
  6713. width = 17,
  6714. activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" );
  6715. if ( activeCell.length > 0 ) {
  6716. datepicker_handleMouseover.apply( activeCell.get( 0 ) );
  6717. }
  6718. inst.dpDiv.removeClass( "ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4" ).width( "" );
  6719. if ( cols > 1 ) {
  6720. inst.dpDiv.addClass( "ui-datepicker-multi-" + cols ).css( "width", ( width * cols ) + "em" );
  6721. }
  6722. inst.dpDiv[ ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ? "add" : "remove" ) +
  6723. "Class" ]( "ui-datepicker-multi" );
  6724. inst.dpDiv[ ( this._get( inst, "isRTL" ) ? "add" : "remove" ) +
  6725. "Class" ]( "ui-datepicker-rtl" );
  6726. if ( inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) {
  6727. inst.input.trigger( "focus" );
  6728. }
  6729. // Deffered render of the years select (to avoid flashes on Firefox)
  6730. if ( inst.yearshtml ) {
  6731. origyearshtml = inst.yearshtml;
  6732. setTimeout( function() {
  6733. //assure that inst.yearshtml didn't change.
  6734. if ( origyearshtml === inst.yearshtml && inst.yearshtml ) {
  6735. inst.dpDiv.find( "select.ui-datepicker-year:first" ).replaceWith( inst.yearshtml );
  6736. }
  6737. origyearshtml = inst.yearshtml = null;
  6738. }, 0 );
  6739. }
  6740. },
  6741. // #6694 - don't focus the input if it's already focused
  6742. // this breaks the change event in IE
  6743. // Support: IE and jQuery <1.9
  6744. _shouldFocusInput: function( inst ) {
  6745. return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" );
  6746. },
  6747. /* Check positioning to remain on screen. */
  6748. _checkOffset: function( inst, offset, isFixed ) {
  6749. var dpWidth = inst.dpDiv.outerWidth(),
  6750. dpHeight = inst.dpDiv.outerHeight(),
  6751. inputWidth = inst.input ? inst.input.outerWidth() : 0,
  6752. inputHeight = inst.input ? inst.input.outerHeight() : 0,
  6753. viewWidth = document.documentElement.clientWidth + ( isFixed ? 0 : $( document ).scrollLeft() ),
  6754. viewHeight = document.documentElement.clientHeight + ( isFixed ? 0 : $( document ).scrollTop() );
  6755. offset.left -= ( this._get( inst, "isRTL" ) ? ( dpWidth - inputWidth ) : 0 );
  6756. offset.left -= ( isFixed && offset.left === inst.input.offset().left ) ? $( document ).scrollLeft() : 0;
  6757. offset.top -= ( isFixed && offset.top === ( inst.input.offset().top + inputHeight ) ) ? $( document ).scrollTop() : 0;
  6758. // Now check if datepicker is showing outside window viewport - move to a better place if so.
  6759. offset.left -= Math.min( offset.left, ( offset.left + dpWidth > viewWidth && viewWidth > dpWidth ) ?
  6760. Math.abs( offset.left + dpWidth - viewWidth ) : 0 );
  6761. offset.top -= Math.min( offset.top, ( offset.top + dpHeight > viewHeight && viewHeight > dpHeight ) ?
  6762. Math.abs( dpHeight + inputHeight ) : 0 );
  6763. return offset;
  6764. },
  6765. /* Find an object's position on the screen. */
  6766. _findPos: function( obj ) {
  6767. var position,
  6768. inst = this._getInst( obj ),
  6769. isRTL = this._get( inst, "isRTL" );
  6770. while ( obj && ( obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden( obj ) ) ) {
  6771. obj = obj[ isRTL ? "previousSibling" : "nextSibling" ];
  6772. }
  6773. position = $( obj ).offset();
  6774. return [ position.left, position.top ];
  6775. },
  6776. /* Hide the date picker from view.
  6777. * @param input element - the input field attached to the date picker
  6778. */
  6779. _hideDatepicker: function( input ) {
  6780. var showAnim, duration, postProcess, onClose,
  6781. inst = this._curInst;
  6782. if ( !inst || ( input && inst !== $.data( input, "datepicker" ) ) ) {
  6783. return;
  6784. }
  6785. if ( this._datepickerShowing ) {
  6786. showAnim = this._get( inst, "showAnim" );
  6787. duration = this._get( inst, "duration" );
  6788. postProcess = function() {
  6789. $.datepicker._tidyDialog( inst );
  6790. };
  6791. // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
  6792. if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) {
  6793. inst.dpDiv.hide( showAnim, $.datepicker._get( inst, "showOptions" ), duration, postProcess );
  6794. } else {
  6795. inst.dpDiv[ ( showAnim === "slideDown" ? "slideUp" :
  6796. ( showAnim === "fadeIn" ? "fadeOut" : "hide" ) ) ]( ( showAnim ? duration : null ), postProcess );
  6797. }
  6798. if ( !showAnim ) {
  6799. postProcess();
  6800. }
  6801. this._datepickerShowing = false;
  6802. onClose = this._get( inst, "onClose" );
  6803. if ( onClose ) {
  6804. onClose.apply( ( inst.input ? inst.input[ 0 ] : null ), [ ( inst.input ? inst.input.val() : "" ), inst ] );
  6805. }
  6806. this._lastInput = null;
  6807. if ( this._inDialog ) {
  6808. this._dialogInput.css( { position: "absolute", left: "0", top: "-100px" } );
  6809. if ( $.blockUI ) {
  6810. $.unblockUI();
  6811. $( "body" ).append( this.dpDiv );
  6812. }
  6813. }
  6814. this._inDialog = false;
  6815. }
  6816. },
  6817. /* Tidy up after a dialog display. */
  6818. _tidyDialog: function( inst ) {
  6819. inst.dpDiv.removeClass( this._dialogClass ).off( ".ui-datepicker-calendar" );
  6820. },
  6821. /* Close date picker if clicked elsewhere. */
  6822. _checkExternalClick: function( event ) {
  6823. if ( !$.datepicker._curInst ) {
  6824. return;
  6825. }
  6826. var $target = $( event.target ),
  6827. inst = $.datepicker._getInst( $target[ 0 ] );
  6828. if ( ( ( $target[ 0 ].id !== $.datepicker._mainDivId &&
  6829. $target.parents( "#" + $.datepicker._mainDivId ).length === 0 &&
  6830. !$target.hasClass( $.datepicker.markerClassName ) &&
  6831. !$target.closest( "." + $.datepicker._triggerClass ).length &&
  6832. $.datepicker._datepickerShowing && !( $.datepicker._inDialog && $.blockUI ) ) ) ||
  6833. ( $target.hasClass( $.datepicker.markerClassName ) && $.datepicker._curInst !== inst ) ) {
  6834. $.datepicker._hideDatepicker();
  6835. }
  6836. },
  6837. /* Adjust one of the date sub-fields. */
  6838. _adjustDate: function( id, offset, period ) {
  6839. var target = $( id ),
  6840. inst = this._getInst( target[ 0 ] );
  6841. if ( this._isDisabledDatepicker( target[ 0 ] ) ) {
  6842. return;
  6843. }
  6844. this._adjustInstDate( inst, offset +
  6845. ( period === "M" ? this._get( inst, "showCurrentAtPos" ) : 0 ), // undo positioning
  6846. period );
  6847. this._updateDatepicker( inst );
  6848. },
  6849. /* Action for current link. */
  6850. _gotoToday: function( id ) {
  6851. var date,
  6852. target = $( id ),
  6853. inst = this._getInst( target[ 0 ] );
  6854. if ( this._get( inst, "gotoCurrent" ) && inst.currentDay ) {
  6855. inst.selectedDay = inst.currentDay;
  6856. inst.drawMonth = inst.selectedMonth = inst.currentMonth;
  6857. inst.drawYear = inst.selectedYear = inst.currentYear;
  6858. } else {
  6859. date = new Date();
  6860. inst.selectedDay = date.getDate();
  6861. inst.drawMonth = inst.selectedMonth = date.getMonth();
  6862. inst.drawYear = inst.selectedYear = date.getFullYear();
  6863. }
  6864. this._notifyChange( inst );
  6865. this._adjustDate( target );
  6866. },
  6867. /* Action for selecting a new month/year. */
  6868. _selectMonthYear: function( id, select, period ) {
  6869. var target = $( id ),
  6870. inst = this._getInst( target[ 0 ] );
  6871. inst[ "selected" + ( period === "M" ? "Month" : "Year" ) ] =
  6872. inst[ "draw" + ( period === "M" ? "Month" : "Year" ) ] =
  6873. parseInt( select.options[ select.selectedIndex ].value, 10 );
  6874. this._notifyChange( inst );
  6875. this._adjustDate( target );
  6876. },
  6877. /* Action for selecting a day. */
  6878. _selectDay: function( id, month, year, td ) {
  6879. var inst,
  6880. target = $( id );
  6881. if ( $( td ).hasClass( this._unselectableClass ) || this._isDisabledDatepicker( target[ 0 ] ) ) {
  6882. return;
  6883. }
  6884. inst = this._getInst( target[ 0 ] );
  6885. inst.selectedDay = inst.currentDay = $( "a", td ).html();
  6886. inst.selectedMonth = inst.currentMonth = month;
  6887. inst.selectedYear = inst.currentYear = year;
  6888. this._selectDate( id, this._formatDate( inst,
  6889. inst.currentDay, inst.currentMonth, inst.currentYear ) );
  6890. },
  6891. /* Erase the input field and hide the date picker. */
  6892. _clearDate: function( id ) {
  6893. var target = $( id );
  6894. this._selectDate( target, "" );
  6895. },
  6896. /* Update the input field with the selected date. */
  6897. _selectDate: function( id, dateStr ) {
  6898. var onSelect,
  6899. target = $( id ),
  6900. inst = this._getInst( target[ 0 ] );
  6901. dateStr = ( dateStr != null ? dateStr : this._formatDate( inst ) );
  6902. if ( inst.input ) {
  6903. inst.input.val( dateStr );
  6904. }
  6905. this._updateAlternate( inst );
  6906. onSelect = this._get( inst, "onSelect" );
  6907. if ( onSelect ) {
  6908. onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); // trigger custom callback
  6909. } else if ( inst.input ) {
  6910. inst.input.trigger( "change" ); // fire the change event
  6911. }
  6912. if ( inst.inline ) {
  6913. this._updateDatepicker( inst );
  6914. } else {
  6915. this._hideDatepicker();
  6916. this._lastInput = inst.input[ 0 ];
  6917. if ( typeof( inst.input[ 0 ] ) !== "object" ) {
  6918. inst.input.trigger( "focus" ); // restore focus
  6919. }
  6920. this._lastInput = null;
  6921. }
  6922. },
  6923. /* Update any alternate field to synchronise with the main field. */
  6924. _updateAlternate: function( inst ) {
  6925. var altFormat, date, dateStr,
  6926. altField = this._get( inst, "altField" );
  6927. if ( altField ) { // update alternate field too
  6928. altFormat = this._get( inst, "altFormat" ) || this._get( inst, "dateFormat" );
  6929. date = this._getDate( inst );
  6930. dateStr = this.formatDate( altFormat, date, this._getFormatConfig( inst ) );
  6931. $( altField ).val( dateStr );
  6932. }
  6933. },
  6934. /* Set as beforeShowDay function to prevent selection of weekends.
  6935. * @param date Date - the date to customise
  6936. * @return [boolean, string] - is this date selectable?, what is its CSS class?
  6937. */
  6938. noWeekends: function( date ) {
  6939. var day = date.getDay();
  6940. return [ ( day > 0 && day < 6 ), "" ];
  6941. },
  6942. /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
  6943. * @param date Date - the date to get the week for
  6944. * @return number - the number of the week within the year that contains this date
  6945. */
  6946. iso8601Week: function( date ) {
  6947. var time,
  6948. checkDate = new Date( date.getTime() );
  6949. // Find Thursday of this week starting on Monday
  6950. checkDate.setDate( checkDate.getDate() + 4 - ( checkDate.getDay() || 7 ) );
  6951. time = checkDate.getTime();
  6952. checkDate.setMonth( 0 ); // Compare with Jan 1
  6953. checkDate.setDate( 1 );
  6954. return Math.floor( Math.round( ( time - checkDate ) / 86400000 ) / 7 ) + 1;
  6955. },
  6956. /* Parse a string value into a date object.
  6957. * See formatDate below for the possible formats.
  6958. *
  6959. * @param format string - the expected format of the date
  6960. * @param value string - the date in the above format
  6961. * @param settings Object - attributes include:
  6962. * shortYearCutoff number - the cutoff year for determining the century (optional)
  6963. * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
  6964. * dayNames string[7] - names of the days from Sunday (optional)
  6965. * monthNamesShort string[12] - abbreviated names of the months (optional)
  6966. * monthNames string[12] - names of the months (optional)
  6967. * @return Date - the extracted date value or null if value is blank
  6968. */
  6969. parseDate: function( format, value, settings ) {
  6970. if ( format == null || value == null ) {
  6971. throw "Invalid arguments";
  6972. }
  6973. value = ( typeof value === "object" ? value.toString() : value + "" );
  6974. if ( value === "" ) {
  6975. return null;
  6976. }
  6977. var iFormat, dim, extra,
  6978. iValue = 0,
  6979. shortYearCutoffTemp = ( settings ? settings.shortYearCutoff : null ) || this._defaults.shortYearCutoff,
  6980. shortYearCutoff = ( typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp :
  6981. new Date().getFullYear() % 100 + parseInt( shortYearCutoffTemp, 10 ) ),
  6982. dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort,
  6983. dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames,
  6984. monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort,
  6985. monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames,
  6986. year = -1,
  6987. month = -1,
  6988. day = -1,
  6989. doy = -1,
  6990. literal = false,
  6991. date,
  6992. // Check whether a format character is doubled
  6993. lookAhead = function( match ) {
  6994. var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );
  6995. if ( matches ) {
  6996. iFormat++;
  6997. }
  6998. return matches;
  6999. },
  7000. // Extract a number from the string value
  7001. getNumber = function( match ) {
  7002. var isDoubled = lookAhead( match ),
  7003. size = ( match === "@" ? 14 : ( match === "!" ? 20 :
  7004. ( match === "y" && isDoubled ? 4 : ( match === "o" ? 3 : 2 ) ) ) ),
  7005. minSize = ( match === "y" ? size : 1 ),
  7006. digits = new RegExp( "^\\d{" + minSize + "," + size + "}" ),
  7007. num = value.substring( iValue ).match( digits );
  7008. if ( !num ) {
  7009. throw "Missing number at position " + iValue;
  7010. }
  7011. iValue += num[ 0 ].length;
  7012. return parseInt( num[ 0 ], 10 );
  7013. },
  7014. // Extract a name from the string value and convert to an index
  7015. getName = function( match, shortNames, longNames ) {
  7016. var index = -1,
  7017. names = $.map( lookAhead( match ) ? longNames : shortNames, function( v, k ) {
  7018. return [ [ k, v ] ];
  7019. } ).sort( function( a, b ) {
  7020. return -( a[ 1 ].length - b[ 1 ].length );
  7021. } );
  7022. $.each( names, function( i, pair ) {
  7023. var name = pair[ 1 ];
  7024. if ( value.substr( iValue, name.length ).toLowerCase() === name.toLowerCase() ) {
  7025. index = pair[ 0 ];
  7026. iValue += name.length;
  7027. return false;
  7028. }
  7029. } );
  7030. if ( index !== -1 ) {
  7031. return index + 1;
  7032. } else {
  7033. throw "Unknown name at position " + iValue;
  7034. }
  7035. },
  7036. // Confirm that a literal character matches the string value
  7037. checkLiteral = function() {
  7038. if ( value.charAt( iValue ) !== format.charAt( iFormat ) ) {
  7039. throw "Unexpected literal at position " + iValue;
  7040. }
  7041. iValue++;
  7042. };
  7043. for ( iFormat = 0; iFormat < format.length; iFormat++ ) {
  7044. if ( literal ) {
  7045. if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {
  7046. literal = false;
  7047. } else {
  7048. checkLiteral();
  7049. }
  7050. } else {
  7051. switch ( format.charAt( iFormat ) ) {
  7052. case "d":
  7053. day = getNumber( "d" );
  7054. break;
  7055. case "D":
  7056. getName( "D", dayNamesShort, dayNames );
  7057. break;
  7058. case "o":
  7059. doy = getNumber( "o" );
  7060. break;
  7061. case "m":
  7062. month = getNumber( "m" );
  7063. break;
  7064. case "M":
  7065. month = getName( "M", monthNamesShort, monthNames );
  7066. break;
  7067. case "y":
  7068. year = getNumber( "y" );
  7069. break;
  7070. case "@":
  7071. date = new Date( getNumber( "@" ) );
  7072. year = date.getFullYear();
  7073. month = date.getMonth() + 1;
  7074. day = date.getDate();
  7075. break;
  7076. case "!":
  7077. date = new Date( ( getNumber( "!" ) - this._ticksTo1970 ) / 10000 );
  7078. year = date.getFullYear();
  7079. month = date.getMonth() + 1;
  7080. day = date.getDate();
  7081. break;
  7082. case "'":
  7083. if ( lookAhead( "'" ) ) {
  7084. checkLiteral();
  7085. } else {
  7086. literal = true;
  7087. }
  7088. break;
  7089. default:
  7090. checkLiteral();
  7091. }
  7092. }
  7093. }
  7094. if ( iValue < value.length ) {
  7095. extra = value.substr( iValue );
  7096. if ( !/^\s+/.test( extra ) ) {
  7097. throw "Extra/unparsed characters found in date: " + extra;
  7098. }
  7099. }
  7100. if ( year === -1 ) {
  7101. year = new Date().getFullYear();
  7102. } else if ( year < 100 ) {
  7103. year += new Date().getFullYear() - new Date().getFullYear() % 100 +
  7104. ( year <= shortYearCutoff ? 0 : -100 );
  7105. }
  7106. if ( doy > -1 ) {
  7107. month = 1;
  7108. day = doy;
  7109. do {
  7110. dim = this._getDaysInMonth( year, month - 1 );
  7111. if ( day <= dim ) {
  7112. break;
  7113. }
  7114. month++;
  7115. day -= dim;
  7116. } while ( true );
  7117. }
  7118. date = this._daylightSavingAdjust( new Date( year, month - 1, day ) );
  7119. if ( date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day ) {
  7120. throw "Invalid date"; // E.g. 31/02/00
  7121. }
  7122. return date;
  7123. },
  7124. /* Standard date formats. */
  7125. ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601)
  7126. COOKIE: "D, dd M yy",
  7127. ISO_8601: "yy-mm-dd",
  7128. RFC_822: "D, d M y",
  7129. RFC_850: "DD, dd-M-y",
  7130. RFC_1036: "D, d M y",
  7131. RFC_1123: "D, d M yy",
  7132. RFC_2822: "D, d M yy",
  7133. RSS: "D, d M y", // RFC 822
  7134. TICKS: "!",
  7135. TIMESTAMP: "@",
  7136. W3C: "yy-mm-dd", // ISO 8601
  7137. _ticksTo1970: ( ( ( 1970 - 1 ) * 365 + Math.floor( 1970 / 4 ) - Math.floor( 1970 / 100 ) +
  7138. Math.floor( 1970 / 400 ) ) * 24 * 60 * 60 * 10000000 ),
  7139. /* Format a date object into a string value.
  7140. * The format can be combinations of the following:
  7141. * d - day of month (no leading zero)
  7142. * dd - day of month (two digit)
  7143. * o - day of year (no leading zeros)
  7144. * oo - day of year (three digit)
  7145. * D - day name short
  7146. * DD - day name long
  7147. * m - month of year (no leading zero)
  7148. * mm - month of year (two digit)
  7149. * M - month name short
  7150. * MM - month name long
  7151. * y - year (two digit)
  7152. * yy - year (four digit)
  7153. * @ - Unix timestamp (ms since 01/01/1970)
  7154. * ! - Windows ticks (100ns since 01/01/0001)
  7155. * "..." - literal text
  7156. * '' - single quote
  7157. *
  7158. * @param format string - the desired format of the date
  7159. * @param date Date - the date value to format
  7160. * @param settings Object - attributes include:
  7161. * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
  7162. * dayNames string[7] - names of the days from Sunday (optional)
  7163. * monthNamesShort string[12] - abbreviated names of the months (optional)
  7164. * monthNames string[12] - names of the months (optional)
  7165. * @return string - the date in the above format
  7166. */
  7167. formatDate: function( format, date, settings ) {
  7168. if ( !date ) {
  7169. return "";
  7170. }
  7171. var iFormat,
  7172. dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort,
  7173. dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames,
  7174. monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort,
  7175. monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames,
  7176. // Check whether a format character is doubled
  7177. lookAhead = function( match ) {
  7178. var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );
  7179. if ( matches ) {
  7180. iFormat++;
  7181. }
  7182. return matches;
  7183. },
  7184. // Format a number, with leading zero if necessary
  7185. formatNumber = function( match, value, len ) {
  7186. var num = "" + value;
  7187. if ( lookAhead( match ) ) {
  7188. while ( num.length < len ) {
  7189. num = "0" + num;
  7190. }
  7191. }
  7192. return num;
  7193. },
  7194. // Format a name, short or long as requested
  7195. formatName = function( match, value, shortNames, longNames ) {
  7196. return ( lookAhead( match ) ? longNames[ value ] : shortNames[ value ] );
  7197. },
  7198. output = "",
  7199. literal = false;
  7200. if ( date ) {
  7201. for ( iFormat = 0; iFormat < format.length; iFormat++ ) {
  7202. if ( literal ) {
  7203. if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {
  7204. literal = false;
  7205. } else {
  7206. output += format.charAt( iFormat );
  7207. }
  7208. } else {
  7209. switch ( format.charAt( iFormat ) ) {
  7210. case "d":
  7211. output += formatNumber( "d", date.getDate(), 2 );
  7212. break;
  7213. case "D":
  7214. output += formatName( "D", date.getDay(), dayNamesShort, dayNames );
  7215. break;
  7216. case "o":
  7217. output += formatNumber( "o",
  7218. Math.round( ( new Date( date.getFullYear(), date.getMonth(), date.getDate() ).getTime() - new Date( date.getFullYear(), 0, 0 ).getTime() ) / 86400000 ), 3 );
  7219. break;
  7220. case "m":
  7221. output += formatNumber( "m", date.getMonth() + 1, 2 );
  7222. break;
  7223. case "M":
  7224. output += formatName( "M", date.getMonth(), monthNamesShort, monthNames );
  7225. break;
  7226. case "y":
  7227. output += ( lookAhead( "y" ) ? date.getFullYear() :
  7228. ( date.getFullYear() % 100 < 10 ? "0" : "" ) + date.getFullYear() % 100 );
  7229. break;
  7230. case "@":
  7231. output += date.getTime();
  7232. break;
  7233. case "!":
  7234. output += date.getTime() * 10000 + this._ticksTo1970;
  7235. break;
  7236. case "'":
  7237. if ( lookAhead( "'" ) ) {
  7238. output += "'";
  7239. } else {
  7240. literal = true;
  7241. }
  7242. break;
  7243. default:
  7244. output += format.charAt( iFormat );
  7245. }
  7246. }
  7247. }
  7248. }
  7249. return output;
  7250. },
  7251. /* Extract all possible characters from the date format. */
  7252. _possibleChars: function( format ) {
  7253. var iFormat,
  7254. chars = "",
  7255. literal = false,
  7256. // Check whether a format character is doubled
  7257. lookAhead = function( match ) {
  7258. var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );
  7259. if ( matches ) {
  7260. iFormat++;
  7261. }
  7262. return matches;
  7263. };
  7264. for ( iFormat = 0; iFormat < format.length; iFormat++ ) {
  7265. if ( literal ) {
  7266. if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {
  7267. literal = false;
  7268. } else {
  7269. chars += format.charAt( iFormat );
  7270. }
  7271. } else {
  7272. switch ( format.charAt( iFormat ) ) {
  7273. case "d": case "m": case "y": case "@":
  7274. chars += "0123456789";
  7275. break;
  7276. case "D": case "M":
  7277. return null; // Accept anything
  7278. case "'":
  7279. if ( lookAhead( "'" ) ) {
  7280. chars += "'";
  7281. } else {
  7282. literal = true;
  7283. }
  7284. break;
  7285. default:
  7286. chars += format.charAt( iFormat );
  7287. }
  7288. }
  7289. }
  7290. return chars;
  7291. },
  7292. /* Get a setting value, defaulting if necessary. */
  7293. _get: function( inst, name ) {
  7294. return inst.settings[ name ] !== undefined ?
  7295. inst.settings[ name ] : this._defaults[ name ];
  7296. },
  7297. /* Parse existing date and initialise date picker. */
  7298. _setDateFromField: function( inst, noDefault ) {
  7299. if ( inst.input.val() === inst.lastVal ) {
  7300. return;
  7301. }
  7302. var dateFormat = this._get( inst, "dateFormat" ),
  7303. dates = inst.lastVal = inst.input ? inst.input.val() : null,
  7304. defaultDate = this._getDefaultDate( inst ),
  7305. date = defaultDate,
  7306. settings = this._getFormatConfig( inst );
  7307. try {
  7308. date = this.parseDate( dateFormat, dates, settings ) || defaultDate;
  7309. } catch ( event ) {
  7310. dates = ( noDefault ? "" : dates );
  7311. }
  7312. inst.selectedDay = date.getDate();
  7313. inst.drawMonth = inst.selectedMonth = date.getMonth();
  7314. inst.drawYear = inst.selectedYear = date.getFullYear();
  7315. inst.currentDay = ( dates ? date.getDate() : 0 );
  7316. inst.currentMonth = ( dates ? date.getMonth() : 0 );
  7317. inst.currentYear = ( dates ? date.getFullYear() : 0 );
  7318. this._adjustInstDate( inst );
  7319. },
  7320. /* Retrieve the default date shown on opening. */
  7321. _getDefaultDate: function( inst ) {
  7322. return this._restrictMinMax( inst,
  7323. this._determineDate( inst, this._get( inst, "defaultDate" ), new Date() ) );
  7324. },
  7325. /* A date may be specified as an exact value or a relative one. */
  7326. _determineDate: function( inst, date, defaultDate ) {
  7327. var offsetNumeric = function( offset ) {
  7328. var date = new Date();
  7329. date.setDate( date.getDate() + offset );
  7330. return date;
  7331. },
  7332. offsetString = function( offset ) {
  7333. try {
  7334. return $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ),
  7335. offset, $.datepicker._getFormatConfig( inst ) );
  7336. }
  7337. catch ( e ) {
  7338. // Ignore
  7339. }
  7340. var date = ( offset.toLowerCase().match( /^c/ ) ?
  7341. $.datepicker._getDate( inst ) : null ) || new Date(),
  7342. year = date.getFullYear(),
  7343. month = date.getMonth(),
  7344. day = date.getDate(),
  7345. pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,
  7346. matches = pattern.exec( offset );
  7347. while ( matches ) {
  7348. switch ( matches[ 2 ] || "d" ) {
  7349. case "d" : case "D" :
  7350. day += parseInt( matches[ 1 ], 10 ); break;
  7351. case "w" : case "W" :
  7352. day += parseInt( matches[ 1 ], 10 ) * 7; break;
  7353. case "m" : case "M" :
  7354. month += parseInt( matches[ 1 ], 10 );
  7355. day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) );
  7356. break;
  7357. case "y": case "Y" :
  7358. year += parseInt( matches[ 1 ], 10 );
  7359. day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) );
  7360. break;
  7361. }
  7362. matches = pattern.exec( offset );
  7363. }
  7364. return new Date( year, month, day );
  7365. },
  7366. newDate = ( date == null || date === "" ? defaultDate : ( typeof date === "string" ? offsetString( date ) :
  7367. ( typeof date === "number" ? ( isNaN( date ) ? defaultDate : offsetNumeric( date ) ) : new Date( date.getTime() ) ) ) );
  7368. newDate = ( newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate );
  7369. if ( newDate ) {
  7370. newDate.setHours( 0 );
  7371. newDate.setMinutes( 0 );
  7372. newDate.setSeconds( 0 );
  7373. newDate.setMilliseconds( 0 );
  7374. }
  7375. return this._daylightSavingAdjust( newDate );
  7376. },
  7377. /* Handle switch to/from daylight saving.
  7378. * Hours may be non-zero on daylight saving cut-over:
  7379. * > 12 when midnight changeover, but then cannot generate
  7380. * midnight datetime, so jump to 1AM, otherwise reset.
  7381. * @param date (Date) the date to check
  7382. * @return (Date) the corrected date
  7383. */
  7384. _daylightSavingAdjust: function( date ) {
  7385. if ( !date ) {
  7386. return null;
  7387. }
  7388. date.setHours( date.getHours() > 12 ? date.getHours() + 2 : 0 );
  7389. return date;
  7390. },
  7391. /* Set the date(s) directly. */
  7392. _setDate: function( inst, date, noChange ) {
  7393. var clear = !date,
  7394. origMonth = inst.selectedMonth,
  7395. origYear = inst.selectedYear,
  7396. newDate = this._restrictMinMax( inst, this._determineDate( inst, date, new Date() ) );
  7397. inst.selectedDay = inst.currentDay = newDate.getDate();
  7398. inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
  7399. inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
  7400. if ( ( origMonth !== inst.selectedMonth || origYear !== inst.selectedYear ) && !noChange ) {
  7401. this._notifyChange( inst );
  7402. }
  7403. this._adjustInstDate( inst );
  7404. if ( inst.input ) {
  7405. inst.input.val( clear ? "" : this._formatDate( inst ) );
  7406. }
  7407. },
  7408. /* Retrieve the date(s) directly. */
  7409. _getDate: function( inst ) {
  7410. var startDate = ( !inst.currentYear || ( inst.input && inst.input.val() === "" ) ? null :
  7411. this._daylightSavingAdjust( new Date(
  7412. inst.currentYear, inst.currentMonth, inst.currentDay ) ) );
  7413. return startDate;
  7414. },
  7415. /* Attach the onxxx handlers. These are declared statically so
  7416. * they work with static code transformers like Caja.
  7417. */
  7418. _attachHandlers: function( inst ) {
  7419. var stepMonths = this._get( inst, "stepMonths" ),
  7420. id = "#" + inst.id.replace( /\\\\/g, "\\" );
  7421. inst.dpDiv.find( "[data-handler]" ).map( function() {
  7422. var handler = {
  7423. prev: function() {
  7424. $.datepicker._adjustDate( id, -stepMonths, "M" );
  7425. },
  7426. next: function() {
  7427. $.datepicker._adjustDate( id, +stepMonths, "M" );
  7428. },
  7429. hide: function() {
  7430. $.datepicker._hideDatepicker();
  7431. },
  7432. today: function() {
  7433. $.datepicker._gotoToday( id );
  7434. },
  7435. selectDay: function() {
  7436. $.datepicker._selectDay( id, +this.getAttribute( "data-month" ), +this.getAttribute( "data-year" ), this );
  7437. return false;
  7438. },
  7439. selectMonth: function() {
  7440. $.datepicker._selectMonthYear( id, this, "M" );
  7441. return false;
  7442. },
  7443. selectYear: function() {
  7444. $.datepicker._selectMonthYear( id, this, "Y" );
  7445. return false;
  7446. }
  7447. };
  7448. $( this ).on( this.getAttribute( "data-event" ), handler[ this.getAttribute( "data-handler" ) ] );
  7449. } );
  7450. },
  7451. /* Generate the HTML for the current state of the date picker. */
  7452. _generateHTML: function( inst ) {
  7453. var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
  7454. controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
  7455. monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
  7456. selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
  7457. cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows,
  7458. printDate, dRow, tbody, daySettings, otherMonth, unselectable,
  7459. tempDate = new Date(),
  7460. today = this._daylightSavingAdjust(
  7461. new Date( tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate() ) ), // clear time
  7462. isRTL = this._get( inst, "isRTL" ),
  7463. showButtonPanel = this._get( inst, "showButtonPanel" ),
  7464. hideIfNoPrevNext = this._get( inst, "hideIfNoPrevNext" ),
  7465. navigationAsDateFormat = this._get( inst, "navigationAsDateFormat" ),
  7466. numMonths = this._getNumberOfMonths( inst ),
  7467. showCurrentAtPos = this._get( inst, "showCurrentAtPos" ),
  7468. stepMonths = this._get( inst, "stepMonths" ),
  7469. isMultiMonth = ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ),
  7470. currentDate = this._daylightSavingAdjust( ( !inst.currentDay ? new Date( 9999, 9, 9 ) :
  7471. new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ),
  7472. minDate = this._getMinMaxDate( inst, "min" ),
  7473. maxDate = this._getMinMaxDate( inst, "max" ),
  7474. drawMonth = inst.drawMonth - showCurrentAtPos,
  7475. drawYear = inst.drawYear;
  7476. if ( drawMonth < 0 ) {
  7477. drawMonth += 12;
  7478. drawYear--;
  7479. }
  7480. if ( maxDate ) {
  7481. maxDraw = this._daylightSavingAdjust( new Date( maxDate.getFullYear(),
  7482. maxDate.getMonth() - ( numMonths[ 0 ] * numMonths[ 1 ] ) + 1, maxDate.getDate() ) );
  7483. maxDraw = ( minDate && maxDraw < minDate ? minDate : maxDraw );
  7484. while ( this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 ) ) > maxDraw ) {
  7485. drawMonth--;
  7486. if ( drawMonth < 0 ) {
  7487. drawMonth = 11;
  7488. drawYear--;
  7489. }
  7490. }
  7491. }
  7492. inst.drawMonth = drawMonth;
  7493. inst.drawYear = drawYear;
  7494. prevText = this._get( inst, "prevText" );
  7495. prevText = ( !navigationAsDateFormat ? prevText : this.formatDate( prevText,
  7496. this._daylightSavingAdjust( new Date( drawYear, drawMonth - stepMonths, 1 ) ),
  7497. this._getFormatConfig( inst ) ) );
  7498. prev = ( this._canAdjustMonth( inst, -1, drawYear, drawMonth ) ?
  7499. "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" +
  7500. " title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w" ) + "'>" + prevText + "</span></a>" :
  7501. ( hideIfNoPrevNext ? "" : "<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w" ) + "'>" + prevText + "</span></a>" ) );
  7502. nextText = this._get( inst, "nextText" );
  7503. nextText = ( !navigationAsDateFormat ? nextText : this.formatDate( nextText,
  7504. this._daylightSavingAdjust( new Date( drawYear, drawMonth + stepMonths, 1 ) ),
  7505. this._getFormatConfig( inst ) ) );
  7506. next = ( this._canAdjustMonth( inst, +1, drawYear, drawMonth ) ?
  7507. "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" +
  7508. " title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e" ) + "'>" + nextText + "</span></a>" :
  7509. ( hideIfNoPrevNext ? "" : "<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e" ) + "'>" + nextText + "</span></a>" ) );
  7510. currentText = this._get( inst, "currentText" );
  7511. gotoDate = ( this._get( inst, "gotoCurrent" ) && inst.currentDay ? currentDate : today );
  7512. currentText = ( !navigationAsDateFormat ? currentText :
  7513. this.formatDate( currentText, gotoDate, this._getFormatConfig( inst ) ) );
  7514. controls = ( !inst.inline ? "<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>" +
  7515. this._get( inst, "closeText" ) + "</button>" : "" );
  7516. buttonPanel = ( showButtonPanel ) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + ( isRTL ? controls : "" ) +
  7517. ( this._isInRange( inst, gotoDate ) ? "<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'" +
  7518. ">" + currentText + "</button>" : "" ) + ( isRTL ? "" : controls ) + "</div>" : "";
  7519. firstDay = parseInt( this._get( inst, "firstDay" ), 10 );
  7520. firstDay = ( isNaN( firstDay ) ? 0 : firstDay );
  7521. showWeek = this._get( inst, "showWeek" );
  7522. dayNames = this._get( inst, "dayNames" );
  7523. dayNamesMin = this._get( inst, "dayNamesMin" );
  7524. monthNames = this._get( inst, "monthNames" );
  7525. monthNamesShort = this._get( inst, "monthNamesShort" );
  7526. beforeShowDay = this._get( inst, "beforeShowDay" );
  7527. showOtherMonths = this._get( inst, "showOtherMonths" );
  7528. selectOtherMonths = this._get( inst, "selectOtherMonths" );
  7529. defaultDate = this._getDefaultDate( inst );
  7530. html = "";
  7531. for ( row = 0; row < numMonths[ 0 ]; row++ ) {
  7532. group = "";
  7533. this.maxRows = 4;
  7534. for ( col = 0; col < numMonths[ 1 ]; col++ ) {
  7535. selectedDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, inst.selectedDay ) );
  7536. cornerClass = " ui-corner-all";
  7537. calender = "";
  7538. if ( isMultiMonth ) {
  7539. calender += "<div class='ui-datepicker-group";
  7540. if ( numMonths[ 1 ] > 1 ) {
  7541. switch ( col ) {
  7542. case 0: calender += " ui-datepicker-group-first";
  7543. cornerClass = " ui-corner-" + ( isRTL ? "right" : "left" ); break;
  7544. case numMonths[ 1 ] - 1: calender += " ui-datepicker-group-last";
  7545. cornerClass = " ui-corner-" + ( isRTL ? "left" : "right" ); break;
  7546. default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break;
  7547. }
  7548. }
  7549. calender += "'>";
  7550. }
  7551. calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" +
  7552. ( /all|left/.test( cornerClass ) && row === 0 ? ( isRTL ? next : prev ) : "" ) +
  7553. ( /all|right/.test( cornerClass ) && row === 0 ? ( isRTL ? prev : next ) : "" ) +
  7554. this._generateMonthYearHeader( inst, drawMonth, drawYear, minDate, maxDate,
  7555. row > 0 || col > 0, monthNames, monthNamesShort ) + // draw month headers
  7556. "</div><table class='ui-datepicker-calendar'><thead>" +
  7557. "<tr>";
  7558. thead = ( showWeek ? "<th class='ui-datepicker-week-col'>" + this._get( inst, "weekHeader" ) + "</th>" : "" );
  7559. for ( dow = 0; dow < 7; dow++ ) { // days of the week
  7560. day = ( dow + firstDay ) % 7;
  7561. thead += "<th scope='col'" + ( ( dow + firstDay + 6 ) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "" ) + ">" +
  7562. "<span title='" + dayNames[ day ] + "'>" + dayNamesMin[ day ] + "</span></th>";
  7563. }
  7564. calender += thead + "</tr></thead><tbody>";
  7565. daysInMonth = this._getDaysInMonth( drawYear, drawMonth );
  7566. if ( drawYear === inst.selectedYear && drawMonth === inst.selectedMonth ) {
  7567. inst.selectedDay = Math.min( inst.selectedDay, daysInMonth );
  7568. }
  7569. leadDays = ( this._getFirstDayOfMonth( drawYear, drawMonth ) - firstDay + 7 ) % 7;
  7570. curRows = Math.ceil( ( leadDays + daysInMonth ) / 7 ); // calculate the number of rows to generate
  7571. numRows = ( isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows ); //If multiple months, use the higher number of rows (see #7043)
  7572. this.maxRows = numRows;
  7573. printDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 - leadDays ) );
  7574. for ( dRow = 0; dRow < numRows; dRow++ ) { // create date picker rows
  7575. calender += "<tr>";
  7576. tbody = ( !showWeek ? "" : "<td class='ui-datepicker-week-col'>" +
  7577. this._get( inst, "calculateWeek" )( printDate ) + "</td>" );
  7578. for ( dow = 0; dow < 7; dow++ ) { // create date picker days
  7579. daySettings = ( beforeShowDay ?
  7580. beforeShowDay.apply( ( inst.input ? inst.input[ 0 ] : null ), [ printDate ] ) : [ true, "" ] );
  7581. otherMonth = ( printDate.getMonth() !== drawMonth );
  7582. unselectable = ( otherMonth && !selectOtherMonths ) || !daySettings[ 0 ] ||
  7583. ( minDate && printDate < minDate ) || ( maxDate && printDate > maxDate );
  7584. tbody += "<td class='" +
  7585. ( ( dow + firstDay + 6 ) % 7 >= 5 ? " ui-datepicker-week-end" : "" ) + // highlight weekends
  7586. ( otherMonth ? " ui-datepicker-other-month" : "" ) + // highlight days from other months
  7587. ( ( printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent ) || // user pressed key
  7588. ( defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime() ) ?
  7589. // or defaultDate is current printedDate and defaultDate is selectedDate
  7590. " " + this._dayOverClass : "" ) + // highlight selected day
  7591. ( unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "" ) + // highlight unselectable days
  7592. ( otherMonth && !showOtherMonths ? "" : " " + daySettings[ 1 ] + // highlight custom dates
  7593. ( printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "" ) + // highlight selected day
  7594. ( printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "" ) ) + "'" + // highlight today (if different)
  7595. ( ( !otherMonth || showOtherMonths ) && daySettings[ 2 ] ? " title='" + daySettings[ 2 ].replace( /'/g, "&#39;" ) + "'" : "" ) + // cell title
  7596. ( unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'" ) + ">" + // actions
  7597. ( otherMonth && !showOtherMonths ? "&#xa0;" : // display for other months
  7598. ( unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" +
  7599. ( printDate.getTime() === today.getTime() ? " ui-state-highlight" : "" ) +
  7600. ( printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "" ) + // highlight selected day
  7601. ( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months
  7602. "' href='#'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date
  7603. printDate.setDate( printDate.getDate() + 1 );
  7604. printDate = this._daylightSavingAdjust( printDate );
  7605. }
  7606. calender += tbody + "</tr>";
  7607. }
  7608. drawMonth++;
  7609. if ( drawMonth > 11 ) {
  7610. drawMonth = 0;
  7611. drawYear++;
  7612. }
  7613. calender += "</tbody></table>" + ( isMultiMonth ? "</div>" +
  7614. ( ( numMonths[ 0 ] > 0 && col === numMonths[ 1 ] - 1 ) ? "<div class='ui-datepicker-row-break'></div>" : "" ) : "" );
  7615. group += calender;
  7616. }
  7617. html += group;
  7618. }
  7619. html += buttonPanel;
  7620. inst._keyEvent = false;
  7621. return html;
  7622. },
  7623. /* Generate the month and year header. */
  7624. _generateMonthYearHeader: function( inst, drawMonth, drawYear, minDate, maxDate,
  7625. secondary, monthNames, monthNamesShort ) {
  7626. var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,
  7627. changeMonth = this._get( inst, "changeMonth" ),
  7628. changeYear = this._get( inst, "changeYear" ),
  7629. showMonthAfterYear = this._get( inst, "showMonthAfterYear" ),
  7630. html = "<div class='ui-datepicker-title'>",
  7631. monthHtml = "";
  7632. // Month selection
  7633. if ( secondary || !changeMonth ) {
  7634. monthHtml += "<span class='ui-datepicker-month'>" + monthNames[ drawMonth ] + "</span>";
  7635. } else {
  7636. inMinYear = ( minDate && minDate.getFullYear() === drawYear );
  7637. inMaxYear = ( maxDate && maxDate.getFullYear() === drawYear );
  7638. monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";
  7639. for ( month = 0; month < 12; month++ ) {
  7640. if ( ( !inMinYear || month >= minDate.getMonth() ) && ( !inMaxYear || month <= maxDate.getMonth() ) ) {
  7641. monthHtml += "<option value='" + month + "'" +
  7642. ( month === drawMonth ? " selected='selected'" : "" ) +
  7643. ">" + monthNamesShort[ month ] + "</option>";
  7644. }
  7645. }
  7646. monthHtml += "</select>";
  7647. }
  7648. if ( !showMonthAfterYear ) {
  7649. html += monthHtml + ( secondary || !( changeMonth && changeYear ) ? "&#xa0;" : "" );
  7650. }
  7651. // Year selection
  7652. if ( !inst.yearshtml ) {
  7653. inst.yearshtml = "";
  7654. if ( secondary || !changeYear ) {
  7655. html += "<span class='ui-datepicker-year'>" + drawYear + "</span>";
  7656. } else {
  7657. // determine range of years to display
  7658. years = this._get( inst, "yearRange" ).split( ":" );
  7659. thisYear = new Date().getFullYear();
  7660. determineYear = function( value ) {
  7661. var year = ( value.match( /c[+\-].*/ ) ? drawYear + parseInt( value.substring( 1 ), 10 ) :
  7662. ( value.match( /[+\-].*/ ) ? thisYear + parseInt( value, 10 ) :
  7663. parseInt( value, 10 ) ) );
  7664. return ( isNaN( year ) ? thisYear : year );
  7665. };
  7666. year = determineYear( years[ 0 ] );
  7667. endYear = Math.max( year, determineYear( years[ 1 ] || "" ) );
  7668. year = ( minDate ? Math.max( year, minDate.getFullYear() ) : year );
  7669. endYear = ( maxDate ? Math.min( endYear, maxDate.getFullYear() ) : endYear );
  7670. inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";
  7671. for ( ; year <= endYear; year++ ) {
  7672. inst.yearshtml += "<option value='" + year + "'" +
  7673. ( year === drawYear ? " selected='selected'" : "" ) +
  7674. ">" + year + "</option>";
  7675. }
  7676. inst.yearshtml += "</select>";
  7677. html += inst.yearshtml;
  7678. inst.yearshtml = null;
  7679. }
  7680. }
  7681. html += this._get( inst, "yearSuffix" );
  7682. if ( showMonthAfterYear ) {
  7683. html += ( secondary || !( changeMonth && changeYear ) ? "&#xa0;" : "" ) + monthHtml;
  7684. }
  7685. html += "</div>"; // Close datepicker_header
  7686. return html;
  7687. },
  7688. /* Adjust one of the date sub-fields. */
  7689. _adjustInstDate: function( inst, offset, period ) {
  7690. var year = inst.selectedYear + ( period === "Y" ? offset : 0 ),
  7691. month = inst.selectedMonth + ( period === "M" ? offset : 0 ),
  7692. day = Math.min( inst.selectedDay, this._getDaysInMonth( year, month ) ) + ( period === "D" ? offset : 0 ),
  7693. date = this._restrictMinMax( inst, this._daylightSavingAdjust( new Date( year, month, day ) ) );
  7694. inst.selectedDay = date.getDate();
  7695. inst.drawMonth = inst.selectedMonth = date.getMonth();
  7696. inst.drawYear = inst.selectedYear = date.getFullYear();
  7697. if ( period === "M" || period === "Y" ) {
  7698. this._notifyChange( inst );
  7699. }
  7700. },
  7701. /* Ensure a date is within any min/max bounds. */
  7702. _restrictMinMax: function( inst, date ) {
  7703. var minDate = this._getMinMaxDate( inst, "min" ),
  7704. maxDate = this._getMinMaxDate( inst, "max" ),
  7705. newDate = ( minDate && date < minDate ? minDate : date );
  7706. return ( maxDate && newDate > maxDate ? maxDate : newDate );
  7707. },
  7708. /* Notify change of month/year. */
  7709. _notifyChange: function( inst ) {
  7710. var onChange = this._get( inst, "onChangeMonthYear" );
  7711. if ( onChange ) {
  7712. onChange.apply( ( inst.input ? inst.input[ 0 ] : null ),
  7713. [ inst.selectedYear, inst.selectedMonth + 1, inst ] );
  7714. }
  7715. },
  7716. /* Determine the number of months to show. */
  7717. _getNumberOfMonths: function( inst ) {
  7718. var numMonths = this._get( inst, "numberOfMonths" );
  7719. return ( numMonths == null ? [ 1, 1 ] : ( typeof numMonths === "number" ? [ 1, numMonths ] : numMonths ) );
  7720. },
  7721. /* Determine the current maximum date - ensure no time components are set. */
  7722. _getMinMaxDate: function( inst, minMax ) {
  7723. return this._determineDate( inst, this._get( inst, minMax + "Date" ), null );
  7724. },
  7725. /* Find the number of days in a given month. */
  7726. _getDaysInMonth: function( year, month ) {
  7727. return 32 - this._daylightSavingAdjust( new Date( year, month, 32 ) ).getDate();
  7728. },
  7729. /* Find the day of the week of the first of a month. */
  7730. _getFirstDayOfMonth: function( year, month ) {
  7731. return new Date( year, month, 1 ).getDay();
  7732. },
  7733. /* Determines if we should allow a "next/prev" month display change. */
  7734. _canAdjustMonth: function( inst, offset, curYear, curMonth ) {
  7735. var numMonths = this._getNumberOfMonths( inst ),
  7736. date = this._daylightSavingAdjust( new Date( curYear,
  7737. curMonth + ( offset < 0 ? offset : numMonths[ 0 ] * numMonths[ 1 ] ), 1 ) );
  7738. if ( offset < 0 ) {
  7739. date.setDate( this._getDaysInMonth( date.getFullYear(), date.getMonth() ) );
  7740. }
  7741. return this._isInRange( inst, date );
  7742. },
  7743. /* Is the given date in the accepted range? */
  7744. _isInRange: function( inst, date ) {
  7745. var yearSplit, currentYear,
  7746. minDate = this._getMinMaxDate( inst, "min" ),
  7747. maxDate = this._getMinMaxDate( inst, "max" ),
  7748. minYear = null,
  7749. maxYear = null,
  7750. years = this._get( inst, "yearRange" );
  7751. if ( years ) {
  7752. yearSplit = years.split( ":" );
  7753. currentYear = new Date().getFullYear();
  7754. minYear = parseInt( yearSplit[ 0 ], 10 );
  7755. maxYear = parseInt( yearSplit[ 1 ], 10 );
  7756. if ( yearSplit[ 0 ].match( /[+\-].*/ ) ) {
  7757. minYear += currentYear;
  7758. }
  7759. if ( yearSplit[ 1 ].match( /[+\-].*/ ) ) {
  7760. maxYear += currentYear;
  7761. }
  7762. }
  7763. return ( ( !minDate || date.getTime() >= minDate.getTime() ) &&
  7764. ( !maxDate || date.getTime() <= maxDate.getTime() ) &&
  7765. ( !minYear || date.getFullYear() >= minYear ) &&
  7766. ( !maxYear || date.getFullYear() <= maxYear ) );
  7767. },
  7768. /* Provide the configuration settings for formatting/parsing. */
  7769. _getFormatConfig: function( inst ) {
  7770. var shortYearCutoff = this._get( inst, "shortYearCutoff" );
  7771. shortYearCutoff = ( typeof shortYearCutoff !== "string" ? shortYearCutoff :
  7772. new Date().getFullYear() % 100 + parseInt( shortYearCutoff, 10 ) );
  7773. return { shortYearCutoff: shortYearCutoff,
  7774. dayNamesShort: this._get( inst, "dayNamesShort" ), dayNames: this._get( inst, "dayNames" ),
  7775. monthNamesShort: this._get( inst, "monthNamesShort" ), monthNames: this._get( inst, "monthNames" ) };
  7776. },
  7777. /* Format the given date for display. */
  7778. _formatDate: function( inst, day, month, year ) {
  7779. if ( !day ) {
  7780. inst.currentDay = inst.selectedDay;
  7781. inst.currentMonth = inst.selectedMonth;
  7782. inst.currentYear = inst.selectedYear;
  7783. }
  7784. var date = ( day ? ( typeof day === "object" ? day :
  7785. this._daylightSavingAdjust( new Date( year, month, day ) ) ) :
  7786. this._daylightSavingAdjust( new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) );
  7787. return this.formatDate( this._get( inst, "dateFormat" ), date, this._getFormatConfig( inst ) );
  7788. }
  7789. } );
  7790. /*
  7791. * Bind hover events for datepicker elements.
  7792. * Done via delegate so the binding only occurs once in the lifetime of the parent div.
  7793. * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
  7794. */
  7795. function datepicker_bindHover( dpDiv ) {
  7796. var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
  7797. return dpDiv.on( "mouseout", selector, function() {
  7798. $( this ).removeClass( "ui-state-hover" );
  7799. if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) {
  7800. $( this ).removeClass( "ui-datepicker-prev-hover" );
  7801. }
  7802. if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) {
  7803. $( this ).removeClass( "ui-datepicker-next-hover" );
  7804. }
  7805. } )
  7806. .on( "mouseover", selector, datepicker_handleMouseover );
  7807. }
  7808. function datepicker_handleMouseover() {
  7809. if ( !$.datepicker._isDisabledDatepicker( datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[ 0 ] : datepicker_instActive.input[ 0 ] ) ) {
  7810. $( this ).parents( ".ui-datepicker-calendar" ).find( "a" ).removeClass( "ui-state-hover" );
  7811. $( this ).addClass( "ui-state-hover" );
  7812. if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) {
  7813. $( this ).addClass( "ui-datepicker-prev-hover" );
  7814. }
  7815. if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) {
  7816. $( this ).addClass( "ui-datepicker-next-hover" );
  7817. }
  7818. }
  7819. }
  7820. /* jQuery extend now ignores nulls! */
  7821. function datepicker_extendRemove( target, props ) {
  7822. $.extend( target, props );
  7823. for ( var name in props ) {
  7824. if ( props[ name ] == null ) {
  7825. target[ name ] = props[ name ];
  7826. }
  7827. }
  7828. return target;
  7829. }
  7830. /* Invoke the datepicker functionality.
  7831. @param options string - a command, optionally followed by additional parameters or
  7832. Object - settings for attaching new datepicker functionality
  7833. @return jQuery object */
  7834. $.fn.datepicker = function( options ) {
  7835. /* Verify an empty collection wasn't passed - Fixes #6976 */
  7836. if ( !this.length ) {
  7837. return this;
  7838. }
  7839. /* Initialise the date picker. */
  7840. if ( !$.datepicker.initialized ) {
  7841. $( document ).on( "mousedown", $.datepicker._checkExternalClick );
  7842. $.datepicker.initialized = true;
  7843. }
  7844. /* Append datepicker main container to body if not exist. */
  7845. if ( $( "#" + $.datepicker._mainDivId ).length === 0 ) {
  7846. $( "body" ).append( $.datepicker.dpDiv );
  7847. }
  7848. var otherArgs = Array.prototype.slice.call( arguments, 1 );
  7849. if ( typeof options === "string" && ( options === "isDisabled" || options === "getDate" || options === "widget" ) ) {
  7850. return $.datepicker[ "_" + options + "Datepicker" ].
  7851. apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) );
  7852. }
  7853. if ( options === "option" && arguments.length === 2 && typeof arguments[ 1 ] === "string" ) {
  7854. return $.datepicker[ "_" + options + "Datepicker" ].
  7855. apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) );
  7856. }
  7857. return this.each( function() {
  7858. typeof options === "string" ?
  7859. $.datepicker[ "_" + options + "Datepicker" ].
  7860. apply( $.datepicker, [ this ].concat( otherArgs ) ) :
  7861. $.datepicker._attachDatepicker( this, options );
  7862. } );
  7863. };
  7864. $.datepicker = new Datepicker(); // singleton instance
  7865. $.datepicker.initialized = false;
  7866. $.datepicker.uuid = new Date().getTime();
  7867. $.datepicker.version = "1.12.1";
  7868. var widgetsDatepicker = $.datepicker;
  7869. // This file is deprecated
  7870. var ie = $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
  7871. /*!
  7872. * jQuery UI Mouse 1.12.1
  7873. * http://jqueryui.com
  7874. *
  7875. * Copyright jQuery Foundation and other contributors
  7876. * Released under the MIT license.
  7877. * http://jquery.org/license
  7878. */
  7879. //>>label: Mouse
  7880. //>>group: Widgets
  7881. //>>description: Abstracts mouse-based interactions to assist in creating certain widgets.
  7882. //>>docs: http://api.jqueryui.com/mouse/
  7883. var mouseHandled = false;
  7884. $( document ).on( "mouseup", function() {
  7885. mouseHandled = false;
  7886. } );
  7887. var widgetsMouse = $.widget( "ui.mouse", {
  7888. version: "1.12.1",
  7889. options: {
  7890. cancel: "input, textarea, button, select, option",
  7891. distance: 1,
  7892. delay: 0
  7893. },
  7894. _mouseInit: function() {
  7895. var that = this;
  7896. this.element
  7897. .on( "mousedown." + this.widgetName, function( event ) {
  7898. return that._mouseDown( event );
  7899. } )
  7900. .on( "click." + this.widgetName, function( event ) {
  7901. if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) {
  7902. $.removeData( event.target, that.widgetName + ".preventClickEvent" );
  7903. event.stopImmediatePropagation();
  7904. return false;
  7905. }
  7906. } );
  7907. this.started = false;
  7908. },
  7909. // TODO: make sure destroying one instance of mouse doesn't mess with
  7910. // other instances of mouse
  7911. _mouseDestroy: function() {
  7912. this.element.off( "." + this.widgetName );
  7913. if ( this._mouseMoveDelegate ) {
  7914. this.document
  7915. .off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  7916. .off( "mouseup." + this.widgetName, this._mouseUpDelegate );
  7917. }
  7918. },
  7919. _mouseDown: function( event ) {
  7920. // don't let more than one widget handle mouseStart
  7921. if ( mouseHandled ) {
  7922. return;
  7923. }
  7924. this._mouseMoved = false;
  7925. // We may have missed mouseup (out of window)
  7926. ( this._mouseStarted && this._mouseUp( event ) );
  7927. this._mouseDownEvent = event;
  7928. var that = this,
  7929. btnIsLeft = ( event.which === 1 ),
  7930. // event.target.nodeName works around a bug in IE 8 with
  7931. // disabled inputs (#7620)
  7932. elIsCancel = ( typeof this.options.cancel === "string" && event.target.nodeName ?
  7933. $( event.target ).closest( this.options.cancel ).length : false );
  7934. if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) {
  7935. return true;
  7936. }
  7937. this.mouseDelayMet = !this.options.delay;
  7938. if ( !this.mouseDelayMet ) {
  7939. this._mouseDelayTimer = setTimeout( function() {
  7940. that.mouseDelayMet = true;
  7941. }, this.options.delay );
  7942. }
  7943. if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
  7944. this._mouseStarted = ( this._mouseStart( event ) !== false );
  7945. if ( !this._mouseStarted ) {
  7946. event.preventDefault();
  7947. return true;
  7948. }
  7949. }
  7950. // Click event may never have fired (Gecko & Opera)
  7951. if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) {
  7952. $.removeData( event.target, this.widgetName + ".preventClickEvent" );
  7953. }
  7954. // These delegates are required to keep context
  7955. this._mouseMoveDelegate = function( event ) {
  7956. return that._mouseMove( event );
  7957. };
  7958. this._mouseUpDelegate = function( event ) {
  7959. return that._mouseUp( event );
  7960. };
  7961. this.document
  7962. .on( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  7963. .on( "mouseup." + this.widgetName, this._mouseUpDelegate );
  7964. event.preventDefault();
  7965. mouseHandled = true;
  7966. return true;
  7967. },
  7968. _mouseMove: function( event ) {
  7969. // Only check for mouseups outside the document if you've moved inside the document
  7970. // at least once. This prevents the firing of mouseup in the case of IE<9, which will
  7971. // fire a mousemove event if content is placed under the cursor. See #7778
  7972. // Support: IE <9
  7973. if ( this._mouseMoved ) {
  7974. // IE mouseup check - mouseup happened when mouse was out of window
  7975. if ( $.ui.ie && ( !document.documentMode || document.documentMode < 9 ) &&
  7976. !event.button ) {
  7977. return this._mouseUp( event );
  7978. // Iframe mouseup check - mouseup occurred in another document
  7979. } else if ( !event.which ) {
  7980. // Support: Safari <=8 - 9
  7981. // Safari sets which to 0 if you press any of the following keys
  7982. // during a drag (#14461)
  7983. if ( event.originalEvent.altKey || event.originalEvent.ctrlKey ||
  7984. event.originalEvent.metaKey || event.originalEvent.shiftKey ) {
  7985. this.ignoreMissingWhich = true;
  7986. } else if ( !this.ignoreMissingWhich ) {
  7987. return this._mouseUp( event );
  7988. }
  7989. }
  7990. }
  7991. if ( event.which || event.button ) {
  7992. this._mouseMoved = true;
  7993. }
  7994. if ( this._mouseStarted ) {
  7995. this._mouseDrag( event );
  7996. return event.preventDefault();
  7997. }
  7998. if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
  7999. this._mouseStarted =
  8000. ( this._mouseStart( this._mouseDownEvent, event ) !== false );
  8001. ( this._mouseStarted ? this._mouseDrag( event ) : this._mouseUp( event ) );
  8002. }
  8003. return !this._mouseStarted;
  8004. },
  8005. _mouseUp: function( event ) {
  8006. this.document
  8007. .off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  8008. .off( "mouseup." + this.widgetName, this._mouseUpDelegate );
  8009. if ( this._mouseStarted ) {
  8010. this._mouseStarted = false;
  8011. if ( event.target === this._mouseDownEvent.target ) {
  8012. $.data( event.target, this.widgetName + ".preventClickEvent", true );
  8013. }
  8014. this._mouseStop( event );
  8015. }
  8016. if ( this._mouseDelayTimer ) {
  8017. clearTimeout( this._mouseDelayTimer );
  8018. delete this._mouseDelayTimer;
  8019. }
  8020. this.ignoreMissingWhich = false;
  8021. mouseHandled = false;
  8022. event.preventDefault();
  8023. },
  8024. _mouseDistanceMet: function( event ) {
  8025. return ( Math.max(
  8026. Math.abs( this._mouseDownEvent.pageX - event.pageX ),
  8027. Math.abs( this._mouseDownEvent.pageY - event.pageY )
  8028. ) >= this.options.distance
  8029. );
  8030. },
  8031. _mouseDelayMet: function( /* event */ ) {
  8032. return this.mouseDelayMet;
  8033. },
  8034. // These are placeholder methods, to be overriden by extending plugin
  8035. _mouseStart: function( /* event */ ) {},
  8036. _mouseDrag: function( /* event */ ) {},
  8037. _mouseStop: function( /* event */ ) {},
  8038. _mouseCapture: function( /* event */ ) { return true; }
  8039. } );
  8040. // $.ui.plugin is deprecated. Use $.widget() extensions instead.
  8041. var plugin = $.ui.plugin = {
  8042. add: function( module, option, set ) {
  8043. var i,
  8044. proto = $.ui[ module ].prototype;
  8045. for ( i in set ) {
  8046. proto.plugins[ i ] = proto.plugins[ i ] || [];
  8047. proto.plugins[ i ].push( [ option, set[ i ] ] );
  8048. }
  8049. },
  8050. call: function( instance, name, args, allowDisconnected ) {
  8051. var i,
  8052. set = instance.plugins[ name ];
  8053. if ( !set ) {
  8054. return;
  8055. }
  8056. if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode ||
  8057. instance.element[ 0 ].parentNode.nodeType === 11 ) ) {
  8058. return;
  8059. }
  8060. for ( i = 0; i < set.length; i++ ) {
  8061. if ( instance.options[ set[ i ][ 0 ] ] ) {
  8062. set[ i ][ 1 ].apply( instance.element, args );
  8063. }
  8064. }
  8065. }
  8066. };
  8067. var safeBlur = $.ui.safeBlur = function( element ) {
  8068. // Support: IE9 - 10 only
  8069. // If the <body> is blurred, IE will switch windows, see #9420
  8070. if ( element && element.nodeName.toLowerCase() !== "body" ) {
  8071. $( element ).trigger( "blur" );
  8072. }
  8073. };
  8074. /*!
  8075. * jQuery UI Draggable 1.12.1
  8076. * http://jqueryui.com
  8077. *
  8078. * Copyright jQuery Foundation and other contributors
  8079. * Released under the MIT license.
  8080. * http://jquery.org/license
  8081. */
  8082. //>>label: Draggable
  8083. //>>group: Interactions
  8084. //>>description: Enables dragging functionality for any element.
  8085. //>>docs: http://api.jqueryui.com/draggable/
  8086. //>>demos: http://jqueryui.com/draggable/
  8087. //>>css.structure: ../../themes/base/draggable.css
  8088. $.widget( "ui.draggable", $.ui.mouse, {
  8089. version: "1.12.1",
  8090. widgetEventPrefix: "drag",
  8091. options: {
  8092. addClasses: true,
  8093. appendTo: "parent",
  8094. axis: false,
  8095. connectToSortable: false,
  8096. containment: false,
  8097. cursor: "auto",
  8098. cursorAt: false,
  8099. grid: false,
  8100. handle: false,
  8101. helper: "original",
  8102. iframeFix: false,
  8103. opacity: false,
  8104. refreshPositions: false,
  8105. revert: false,
  8106. revertDuration: 500,
  8107. scope: "default",
  8108. scroll: true,
  8109. scrollSensitivity: 20,
  8110. scrollSpeed: 20,
  8111. snap: false,
  8112. snapMode: "both",
  8113. snapTolerance: 20,
  8114. stack: false,
  8115. zIndex: false,
  8116. // Callbacks
  8117. drag: null,
  8118. start: null,
  8119. stop: null
  8120. },
  8121. _create: function() {
  8122. if ( this.options.helper === "original" ) {
  8123. this._setPositionRelative();
  8124. }
  8125. if ( this.options.addClasses ) {
  8126. this._addClass( "ui-draggable" );
  8127. }
  8128. this._setHandleClassName();
  8129. this._mouseInit();
  8130. },
  8131. _setOption: function( key, value ) {
  8132. this._super( key, value );
  8133. if ( key === "handle" ) {
  8134. this._removeHandleClassName();
  8135. this._setHandleClassName();
  8136. }
  8137. },
  8138. _destroy: function() {
  8139. if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) {
  8140. this.destroyOnClear = true;
  8141. return;
  8142. }
  8143. this._removeHandleClassName();
  8144. this._mouseDestroy();
  8145. },
  8146. _mouseCapture: function( event ) {
  8147. var o = this.options;
  8148. // Among others, prevent a drag on a resizable-handle
  8149. if ( this.helper || o.disabled ||
  8150. $( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) {
  8151. return false;
  8152. }
  8153. //Quit if we're not on a valid handle
  8154. this.handle = this._getHandle( event );
  8155. if ( !this.handle ) {
  8156. return false;
  8157. }
  8158. this._blurActiveElement( event );
  8159. this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix );
  8160. return true;
  8161. },
  8162. _blockFrames: function( selector ) {
  8163. this.iframeBlocks = this.document.find( selector ).map( function() {
  8164. var iframe = $( this );
  8165. return $( "<div>" )
  8166. .css( "position", "absolute" )
  8167. .appendTo( iframe.parent() )
  8168. .outerWidth( iframe.outerWidth() )
  8169. .outerHeight( iframe.outerHeight() )
  8170. .offset( iframe.offset() )[ 0 ];
  8171. } );
  8172. },
  8173. _unblockFrames: function() {
  8174. if ( this.iframeBlocks ) {
  8175. this.iframeBlocks.remove();
  8176. delete this.iframeBlocks;
  8177. }
  8178. },
  8179. _blurActiveElement: function( event ) {
  8180. var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ),
  8181. target = $( event.target );
  8182. // Don't blur if the event occurred on an element that is within
  8183. // the currently focused element
  8184. // See #10527, #12472
  8185. if ( target.closest( activeElement ).length ) {
  8186. return;
  8187. }
  8188. // Blur any element that currently has focus, see #4261
  8189. $.ui.safeBlur( activeElement );
  8190. },
  8191. _mouseStart: function( event ) {
  8192. var o = this.options;
  8193. //Create and append the visible helper
  8194. this.helper = this._createHelper( event );
  8195. this._addClass( this.helper, "ui-draggable-dragging" );
  8196. //Cache the helper size
  8197. this._cacheHelperProportions();
  8198. //If ddmanager is used for droppables, set the global draggable
  8199. if ( $.ui.ddmanager ) {
  8200. $.ui.ddmanager.current = this;
  8201. }
  8202. /*
  8203. * - Position generation -
  8204. * This block generates everything position related - it's the core of draggables.
  8205. */
  8206. //Cache the margins of the original element
  8207. this._cacheMargins();
  8208. //Store the helper's css position
  8209. this.cssPosition = this.helper.css( "position" );
  8210. this.scrollParent = this.helper.scrollParent( true );
  8211. this.offsetParent = this.helper.offsetParent();
  8212. this.hasFixedAncestor = this.helper.parents().filter( function() {
  8213. return $( this ).css( "position" ) === "fixed";
  8214. } ).length > 0;
  8215. //The element's absolute position on the page minus margins
  8216. this.positionAbs = this.element.offset();
  8217. this._refreshOffsets( event );
  8218. //Generate the original position
  8219. this.originalPosition = this.position = this._generatePosition( event, false );
  8220. this.originalPageX = event.pageX;
  8221. this.originalPageY = event.pageY;
  8222. //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
  8223. ( o.cursorAt && this._adjustOffsetFromHelper( o.cursorAt ) );
  8224. //Set a containment if given in the options
  8225. this._setContainment();
  8226. //Trigger event + callbacks
  8227. if ( this._trigger( "start", event ) === false ) {
  8228. this._clear();
  8229. return false;
  8230. }
  8231. //Recache the helper size
  8232. this._cacheHelperProportions();
  8233. //Prepare the droppable offsets
  8234. if ( $.ui.ddmanager && !o.dropBehaviour ) {
  8235. $.ui.ddmanager.prepareOffsets( this, event );
  8236. }
  8237. // Execute the drag once - this causes the helper not to be visible before getting its
  8238. // correct position
  8239. this._mouseDrag( event, true );
  8240. // If the ddmanager is used for droppables, inform the manager that dragging has started
  8241. // (see #5003)
  8242. if ( $.ui.ddmanager ) {
  8243. $.ui.ddmanager.dragStart( this, event );
  8244. }
  8245. return true;
  8246. },
  8247. _refreshOffsets: function( event ) {
  8248. this.offset = {
  8249. top: this.positionAbs.top - this.margins.top,
  8250. left: this.positionAbs.left - this.margins.left,
  8251. scroll: false,
  8252. parent: this._getParentOffset(),
  8253. relative: this._getRelativeOffset()
  8254. };
  8255. this.offset.click = {
  8256. left: event.pageX - this.offset.left,
  8257. top: event.pageY - this.offset.top
  8258. };
  8259. },
  8260. _mouseDrag: function( event, noPropagation ) {
  8261. // reset any necessary cached properties (see #5009)
  8262. if ( this.hasFixedAncestor ) {
  8263. this.offset.parent = this._getParentOffset();
  8264. }
  8265. //Compute the helpers position
  8266. this.position = this._generatePosition( event, true );
  8267. this.positionAbs = this._convertPositionTo( "absolute" );
  8268. //Call plugins and callbacks and use the resulting position if something is returned
  8269. if ( !noPropagation ) {
  8270. var ui = this._uiHash();
  8271. if ( this._trigger( "drag", event, ui ) === false ) {
  8272. this._mouseUp( new $.Event( "mouseup", event ) );
  8273. return false;
  8274. }
  8275. this.position = ui.position;
  8276. }
  8277. this.helper[ 0 ].style.left = this.position.left + "px";
  8278. this.helper[ 0 ].style.top = this.position.top + "px";
  8279. if ( $.ui.ddmanager ) {
  8280. $.ui.ddmanager.drag( this, event );
  8281. }
  8282. return false;
  8283. },
  8284. _mouseStop: function( event ) {
  8285. //If we are using droppables, inform the manager about the drop
  8286. var that = this,
  8287. dropped = false;
  8288. if ( $.ui.ddmanager && !this.options.dropBehaviour ) {
  8289. dropped = $.ui.ddmanager.drop( this, event );
  8290. }
  8291. //if a drop comes from outside (a sortable)
  8292. if ( this.dropped ) {
  8293. dropped = this.dropped;
  8294. this.dropped = false;
  8295. }
  8296. if ( ( this.options.revert === "invalid" && !dropped ) ||
  8297. ( this.options.revert === "valid" && dropped ) ||
  8298. this.options.revert === true || ( $.isFunction( this.options.revert ) &&
  8299. this.options.revert.call( this.element, dropped ) )
  8300. ) {
  8301. $( this.helper ).animate(
  8302. this.originalPosition,
  8303. parseInt( this.options.revertDuration, 10 ),
  8304. function() {
  8305. if ( that._trigger( "stop", event ) !== false ) {
  8306. that._clear();
  8307. }
  8308. }
  8309. );
  8310. } else {
  8311. if ( this._trigger( "stop", event ) !== false ) {
  8312. this._clear();
  8313. }
  8314. }
  8315. return false;
  8316. },
  8317. _mouseUp: function( event ) {
  8318. this._unblockFrames();
  8319. // If the ddmanager is used for droppables, inform the manager that dragging has stopped
  8320. // (see #5003)
  8321. if ( $.ui.ddmanager ) {
  8322. $.ui.ddmanager.dragStop( this, event );
  8323. }
  8324. // Only need to focus if the event occurred on the draggable itself, see #10527
  8325. if ( this.handleElement.is( event.target ) ) {
  8326. // The interaction is over; whether or not the click resulted in a drag,
  8327. // focus the element
  8328. this.element.trigger( "focus" );
  8329. }
  8330. return $.ui.mouse.prototype._mouseUp.call( this, event );
  8331. },
  8332. cancel: function() {
  8333. if ( this.helper.is( ".ui-draggable-dragging" ) ) {
  8334. this._mouseUp( new $.Event( "mouseup", { target: this.element[ 0 ] } ) );
  8335. } else {
  8336. this._clear();
  8337. }
  8338. return this;
  8339. },
  8340. _getHandle: function( event ) {
  8341. return this.options.handle ?
  8342. !!$( event.target ).closest( this.element.find( this.options.handle ) ).length :
  8343. true;
  8344. },
  8345. _setHandleClassName: function() {
  8346. this.handleElement = this.options.handle ?
  8347. this.element.find( this.options.handle ) : this.element;
  8348. this._addClass( this.handleElement, "ui-draggable-handle" );
  8349. },
  8350. _removeHandleClassName: function() {
  8351. this._removeClass( this.handleElement, "ui-draggable-handle" );
  8352. },
  8353. _createHelper: function( event ) {
  8354. var o = this.options,
  8355. helperIsFunction = $.isFunction( o.helper ),
  8356. helper = helperIsFunction ?
  8357. $( o.helper.apply( this.element[ 0 ], [ event ] ) ) :
  8358. ( o.helper === "clone" ?
  8359. this.element.clone().removeAttr( "id" ) :
  8360. this.element );
  8361. if ( !helper.parents( "body" ).length ) {
  8362. helper.appendTo( ( o.appendTo === "parent" ?
  8363. this.element[ 0 ].parentNode :
  8364. o.appendTo ) );
  8365. }
  8366. // Http://bugs.jqueryui.com/ticket/9446
  8367. // a helper function can return the original element
  8368. // which wouldn't have been set to relative in _create
  8369. if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) {
  8370. this._setPositionRelative();
  8371. }
  8372. if ( helper[ 0 ] !== this.element[ 0 ] &&
  8373. !( /(fixed|absolute)/ ).test( helper.css( "position" ) ) ) {
  8374. helper.css( "position", "absolute" );
  8375. }
  8376. return helper;
  8377. },
  8378. _setPositionRelative: function() {
  8379. if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) {
  8380. this.element[ 0 ].style.position = "relative";
  8381. }
  8382. },
  8383. _adjustOffsetFromHelper: function( obj ) {
  8384. if ( typeof obj === "string" ) {
  8385. obj = obj.split( " " );
  8386. }
  8387. if ( $.isArray( obj ) ) {
  8388. obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };
  8389. }
  8390. if ( "left" in obj ) {
  8391. this.offset.click.left = obj.left + this.margins.left;
  8392. }
  8393. if ( "right" in obj ) {
  8394. this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  8395. }
  8396. if ( "top" in obj ) {
  8397. this.offset.click.top = obj.top + this.margins.top;
  8398. }
  8399. if ( "bottom" in obj ) {
  8400. this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  8401. }
  8402. },
  8403. _isRootNode: function( element ) {
  8404. return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ];
  8405. },
  8406. _getParentOffset: function() {
  8407. //Get the offsetParent and cache its position
  8408. var po = this.offsetParent.offset(),
  8409. document = this.document[ 0 ];
  8410. // This is a special case where we need to modify a offset calculated on start, since the
  8411. // following happened:
  8412. // 1. The position of the helper is absolute, so it's position is calculated based on the
  8413. // next positioned parent
  8414. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
  8415. // the document, which means that the scroll is included in the initial calculation of the
  8416. // offset of the parent, and never recalculated upon drag
  8417. if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== document &&
  8418. $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) {
  8419. po.left += this.scrollParent.scrollLeft();
  8420. po.top += this.scrollParent.scrollTop();
  8421. }
  8422. if ( this._isRootNode( this.offsetParent[ 0 ] ) ) {
  8423. po = { top: 0, left: 0 };
  8424. }
  8425. return {
  8426. top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ),
  8427. left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 )
  8428. };
  8429. },
  8430. _getRelativeOffset: function() {
  8431. if ( this.cssPosition !== "relative" ) {
  8432. return { top: 0, left: 0 };
  8433. }
  8434. var p = this.element.position(),
  8435. scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
  8436. return {
  8437. top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) +
  8438. ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ),
  8439. left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) +
  8440. ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 )
  8441. };
  8442. },
  8443. _cacheMargins: function() {
  8444. this.margins = {
  8445. left: ( parseInt( this.element.css( "marginLeft" ), 10 ) || 0 ),
  8446. top: ( parseInt( this.element.css( "marginTop" ), 10 ) || 0 ),
  8447. right: ( parseInt( this.element.css( "marginRight" ), 10 ) || 0 ),
  8448. bottom: ( parseInt( this.element.css( "marginBottom" ), 10 ) || 0 )
  8449. };
  8450. },
  8451. _cacheHelperProportions: function() {
  8452. this.helperProportions = {
  8453. width: this.helper.outerWidth(),
  8454. height: this.helper.outerHeight()
  8455. };
  8456. },
  8457. _setContainment: function() {
  8458. var isUserScrollable, c, ce,
  8459. o = this.options,
  8460. document = this.document[ 0 ];
  8461. this.relativeContainer = null;
  8462. if ( !o.containment ) {
  8463. this.containment = null;
  8464. return;
  8465. }
  8466. if ( o.containment === "window" ) {
  8467. this.containment = [
  8468. $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
  8469. $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top,
  8470. $( window ).scrollLeft() + $( window ).width() -
  8471. this.helperProportions.width - this.margins.left,
  8472. $( window ).scrollTop() +
  8473. ( $( window ).height() || document.body.parentNode.scrollHeight ) -
  8474. this.helperProportions.height - this.margins.top
  8475. ];
  8476. return;
  8477. }
  8478. if ( o.containment === "document" ) {
  8479. this.containment = [
  8480. 0,
  8481. 0,
  8482. $( document ).width() - this.helperProportions.width - this.margins.left,
  8483. ( $( document ).height() || document.body.parentNode.scrollHeight ) -
  8484. this.helperProportions.height - this.margins.top
  8485. ];
  8486. return;
  8487. }
  8488. if ( o.containment.constructor === Array ) {
  8489. this.containment = o.containment;
  8490. return;
  8491. }
  8492. if ( o.containment === "parent" ) {
  8493. o.containment = this.helper[ 0 ].parentNode;
  8494. }
  8495. c = $( o.containment );
  8496. ce = c[ 0 ];
  8497. if ( !ce ) {
  8498. return;
  8499. }
  8500. isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) );
  8501. this.containment = [
  8502. ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) +
  8503. ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),
  8504. ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) +
  8505. ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ),
  8506. ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
  8507. ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) -
  8508. ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) -
  8509. this.helperProportions.width -
  8510. this.margins.left -
  8511. this.margins.right,
  8512. ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
  8513. ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) -
  8514. ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) -
  8515. this.helperProportions.height -
  8516. this.margins.top -
  8517. this.margins.bottom
  8518. ];
  8519. this.relativeContainer = c;
  8520. },
  8521. _convertPositionTo: function( d, pos ) {
  8522. if ( !pos ) {
  8523. pos = this.position;
  8524. }
  8525. var mod = d === "absolute" ? 1 : -1,
  8526. scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
  8527. return {
  8528. top: (
  8529. // The absolute mouse position
  8530. pos.top +
  8531. // Only for relative positioned nodes: Relative offset from element to offset parent
  8532. this.offset.relative.top * mod +
  8533. // The offsetParent's offset without borders (offset + border)
  8534. this.offset.parent.top * mod -
  8535. ( ( this.cssPosition === "fixed" ?
  8536. -this.offset.scroll.top :
  8537. ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod )
  8538. ),
  8539. left: (
  8540. // The absolute mouse position
  8541. pos.left +
  8542. // Only for relative positioned nodes: Relative offset from element to offset parent
  8543. this.offset.relative.left * mod +
  8544. // The offsetParent's offset without borders (offset + border)
  8545. this.offset.parent.left * mod -
  8546. ( ( this.cssPosition === "fixed" ?
  8547. -this.offset.scroll.left :
  8548. ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod )
  8549. )
  8550. };
  8551. },
  8552. _generatePosition: function( event, constrainPosition ) {
  8553. var containment, co, top, left,
  8554. o = this.options,
  8555. scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ),
  8556. pageX = event.pageX,
  8557. pageY = event.pageY;
  8558. // Cache the scroll
  8559. if ( !scrollIsRootNode || !this.offset.scroll ) {
  8560. this.offset.scroll = {
  8561. top: this.scrollParent.scrollTop(),
  8562. left: this.scrollParent.scrollLeft()
  8563. };
  8564. }
  8565. /*
  8566. * - Position constraining -
  8567. * Constrain the position to a mix of grid, containment.
  8568. */
  8569. // If we are not dragging yet, we won't check for options
  8570. if ( constrainPosition ) {
  8571. if ( this.containment ) {
  8572. if ( this.relativeContainer ) {
  8573. co = this.relativeContainer.offset();
  8574. containment = [
  8575. this.containment[ 0 ] + co.left,
  8576. this.containment[ 1 ] + co.top,
  8577. this.containment[ 2 ] + co.left,
  8578. this.containment[ 3 ] + co.top
  8579. ];
  8580. } else {
  8581. containment = this.containment;
  8582. }
  8583. if ( event.pageX - this.offset.click.left < containment[ 0 ] ) {
  8584. pageX = containment[ 0 ] + this.offset.click.left;
  8585. }
  8586. if ( event.pageY - this.offset.click.top < containment[ 1 ] ) {
  8587. pageY = containment[ 1 ] + this.offset.click.top;
  8588. }
  8589. if ( event.pageX - this.offset.click.left > containment[ 2 ] ) {
  8590. pageX = containment[ 2 ] + this.offset.click.left;
  8591. }
  8592. if ( event.pageY - this.offset.click.top > containment[ 3 ] ) {
  8593. pageY = containment[ 3 ] + this.offset.click.top;
  8594. }
  8595. }
  8596. if ( o.grid ) {
  8597. //Check for grid elements set to 0 to prevent divide by 0 error causing invalid
  8598. // argument errors in IE (see ticket #6950)
  8599. top = o.grid[ 1 ] ? this.originalPageY + Math.round( ( pageY -
  8600. this.originalPageY ) / o.grid[ 1 ] ) * o.grid[ 1 ] : this.originalPageY;
  8601. pageY = containment ? ( ( top - this.offset.click.top >= containment[ 1 ] ||
  8602. top - this.offset.click.top > containment[ 3 ] ) ?
  8603. top :
  8604. ( ( top - this.offset.click.top >= containment[ 1 ] ) ?
  8605. top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : top;
  8606. left = o.grid[ 0 ] ? this.originalPageX +
  8607. Math.round( ( pageX - this.originalPageX ) / o.grid[ 0 ] ) * o.grid[ 0 ] :
  8608. this.originalPageX;
  8609. pageX = containment ? ( ( left - this.offset.click.left >= containment[ 0 ] ||
  8610. left - this.offset.click.left > containment[ 2 ] ) ?
  8611. left :
  8612. ( ( left - this.offset.click.left >= containment[ 0 ] ) ?
  8613. left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : left;
  8614. }
  8615. if ( o.axis === "y" ) {
  8616. pageX = this.originalPageX;
  8617. }
  8618. if ( o.axis === "x" ) {
  8619. pageY = this.originalPageY;
  8620. }
  8621. }
  8622. return {
  8623. top: (
  8624. // The absolute mouse position
  8625. pageY -
  8626. // Click offset (relative to the element)
  8627. this.offset.click.top -
  8628. // Only for relative positioned nodes: Relative offset from element to offset parent
  8629. this.offset.relative.top -
  8630. // The offsetParent's offset without borders (offset + border)
  8631. this.offset.parent.top +
  8632. ( this.cssPosition === "fixed" ?
  8633. -this.offset.scroll.top :
  8634. ( scrollIsRootNode ? 0 : this.offset.scroll.top ) )
  8635. ),
  8636. left: (
  8637. // The absolute mouse position
  8638. pageX -
  8639. // Click offset (relative to the element)
  8640. this.offset.click.left -
  8641. // Only for relative positioned nodes: Relative offset from element to offset parent
  8642. this.offset.relative.left -
  8643. // The offsetParent's offset without borders (offset + border)
  8644. this.offset.parent.left +
  8645. ( this.cssPosition === "fixed" ?
  8646. -this.offset.scroll.left :
  8647. ( scrollIsRootNode ? 0 : this.offset.scroll.left ) )
  8648. )
  8649. };
  8650. },
  8651. _clear: function() {
  8652. this._removeClass( this.helper, "ui-draggable-dragging" );
  8653. if ( this.helper[ 0 ] !== this.element[ 0 ] && !this.cancelHelperRemoval ) {
  8654. this.helper.remove();
  8655. }
  8656. this.helper = null;
  8657. this.cancelHelperRemoval = false;
  8658. if ( this.destroyOnClear ) {
  8659. this.destroy();
  8660. }
  8661. },
  8662. // From now on bulk stuff - mainly helpers
  8663. _trigger: function( type, event, ui ) {
  8664. ui = ui || this._uiHash();
  8665. $.ui.plugin.call( this, type, [ event, ui, this ], true );
  8666. // Absolute position and offset (see #6884 ) have to be recalculated after plugins
  8667. if ( /^(drag|start|stop)/.test( type ) ) {
  8668. this.positionAbs = this._convertPositionTo( "absolute" );
  8669. ui.offset = this.positionAbs;
  8670. }
  8671. return $.Widget.prototype._trigger.call( this, type, event, ui );
  8672. },
  8673. plugins: {},
  8674. _uiHash: function() {
  8675. return {
  8676. helper: this.helper,
  8677. position: this.position,
  8678. originalPosition: this.originalPosition,
  8679. offset: this.positionAbs
  8680. };
  8681. }
  8682. } );
  8683. $.ui.plugin.add( "draggable", "connectToSortable", {
  8684. start: function( event, ui, draggable ) {
  8685. var uiSortable = $.extend( {}, ui, {
  8686. item: draggable.element
  8687. } );
  8688. draggable.sortables = [];
  8689. $( draggable.options.connectToSortable ).each( function() {
  8690. var sortable = $( this ).sortable( "instance" );
  8691. if ( sortable && !sortable.options.disabled ) {
  8692. draggable.sortables.push( sortable );
  8693. // RefreshPositions is called at drag start to refresh the containerCache
  8694. // which is used in drag. This ensures it's initialized and synchronized
  8695. // with any changes that might have happened on the page since initialization.
  8696. sortable.refreshPositions();
  8697. sortable._trigger( "activate", event, uiSortable );
  8698. }
  8699. } );
  8700. },
  8701. stop: function( event, ui, draggable ) {
  8702. var uiSortable = $.extend( {}, ui, {
  8703. item: draggable.element
  8704. } );
  8705. draggable.cancelHelperRemoval = false;
  8706. $.each( draggable.sortables, function() {
  8707. var sortable = this;
  8708. if ( sortable.isOver ) {
  8709. sortable.isOver = 0;
  8710. // Allow this sortable to handle removing the helper
  8711. draggable.cancelHelperRemoval = true;
  8712. sortable.cancelHelperRemoval = false;
  8713. // Use _storedCSS To restore properties in the sortable,
  8714. // as this also handles revert (#9675) since the draggable
  8715. // may have modified them in unexpected ways (#8809)
  8716. sortable._storedCSS = {
  8717. position: sortable.placeholder.css( "position" ),
  8718. top: sortable.placeholder.css( "top" ),
  8719. left: sortable.placeholder.css( "left" )
  8720. };
  8721. sortable._mouseStop( event );
  8722. // Once drag has ended, the sortable should return to using
  8723. // its original helper, not the shared helper from draggable
  8724. sortable.options.helper = sortable.options._helper;
  8725. } else {
  8726. // Prevent this Sortable from removing the helper.
  8727. // However, don't set the draggable to remove the helper
  8728. // either as another connected Sortable may yet handle the removal.
  8729. sortable.cancelHelperRemoval = true;
  8730. sortable._trigger( "deactivate", event, uiSortable );
  8731. }
  8732. } );
  8733. },
  8734. drag: function( event, ui, draggable ) {
  8735. $.each( draggable.sortables, function() {
  8736. var innermostIntersecting = false,
  8737. sortable = this;
  8738. // Copy over variables that sortable's _intersectsWith uses
  8739. sortable.positionAbs = draggable.positionAbs;
  8740. sortable.helperProportions = draggable.helperProportions;
  8741. sortable.offset.click = draggable.offset.click;
  8742. if ( sortable._intersectsWith( sortable.containerCache ) ) {
  8743. innermostIntersecting = true;
  8744. $.each( draggable.sortables, function() {
  8745. // Copy over variables that sortable's _intersectsWith uses
  8746. this.positionAbs = draggable.positionAbs;
  8747. this.helperProportions = draggable.helperProportions;
  8748. this.offset.click = draggable.offset.click;
  8749. if ( this !== sortable &&
  8750. this._intersectsWith( this.containerCache ) &&
  8751. $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) {
  8752. innermostIntersecting = false;
  8753. }
  8754. return innermostIntersecting;
  8755. } );
  8756. }
  8757. if ( innermostIntersecting ) {
  8758. // If it intersects, we use a little isOver variable and set it once,
  8759. // so that the move-in stuff gets fired only once.
  8760. if ( !sortable.isOver ) {
  8761. sortable.isOver = 1;
  8762. // Store draggable's parent in case we need to reappend to it later.
  8763. draggable._parent = ui.helper.parent();
  8764. sortable.currentItem = ui.helper
  8765. .appendTo( sortable.element )
  8766. .data( "ui-sortable-item", true );
  8767. // Store helper option to later restore it
  8768. sortable.options._helper = sortable.options.helper;
  8769. sortable.options.helper = function() {
  8770. return ui.helper[ 0 ];
  8771. };
  8772. // Fire the start events of the sortable with our passed browser event,
  8773. // and our own helper (so it doesn't create a new one)
  8774. event.target = sortable.currentItem[ 0 ];
  8775. sortable._mouseCapture( event, true );
  8776. sortable._mouseStart( event, true, true );
  8777. // Because the browser event is way off the new appended portlet,
  8778. // modify necessary variables to reflect the changes
  8779. sortable.offset.click.top = draggable.offset.click.top;
  8780. sortable.offset.click.left = draggable.offset.click.left;
  8781. sortable.offset.parent.left -= draggable.offset.parent.left -
  8782. sortable.offset.parent.left;
  8783. sortable.offset.parent.top -= draggable.offset.parent.top -
  8784. sortable.offset.parent.top;
  8785. draggable._trigger( "toSortable", event );
  8786. // Inform draggable that the helper is in a valid drop zone,
  8787. // used solely in the revert option to handle "valid/invalid".
  8788. draggable.dropped = sortable.element;
  8789. // Need to refreshPositions of all sortables in the case that
  8790. // adding to one sortable changes the location of the other sortables (#9675)
  8791. $.each( draggable.sortables, function() {
  8792. this.refreshPositions();
  8793. } );
  8794. // Hack so receive/update callbacks work (mostly)
  8795. draggable.currentItem = draggable.element;
  8796. sortable.fromOutside = draggable;
  8797. }
  8798. if ( sortable.currentItem ) {
  8799. sortable._mouseDrag( event );
  8800. // Copy the sortable's position because the draggable's can potentially reflect
  8801. // a relative position, while sortable is always absolute, which the dragged
  8802. // element has now become. (#8809)
  8803. ui.position = sortable.position;
  8804. }
  8805. } else {
  8806. // If it doesn't intersect with the sortable, and it intersected before,
  8807. // we fake the drag stop of the sortable, but make sure it doesn't remove
  8808. // the helper by using cancelHelperRemoval.
  8809. if ( sortable.isOver ) {
  8810. sortable.isOver = 0;
  8811. sortable.cancelHelperRemoval = true;
  8812. // Calling sortable's mouseStop would trigger a revert,
  8813. // so revert must be temporarily false until after mouseStop is called.
  8814. sortable.options._revert = sortable.options.revert;
  8815. sortable.options.revert = false;
  8816. sortable._trigger( "out", event, sortable._uiHash( sortable ) );
  8817. sortable._mouseStop( event, true );
  8818. // Restore sortable behaviors that were modfied
  8819. // when the draggable entered the sortable area (#9481)
  8820. sortable.options.revert = sortable.options._revert;
  8821. sortable.options.helper = sortable.options._helper;
  8822. if ( sortable.placeholder ) {
  8823. sortable.placeholder.remove();
  8824. }
  8825. // Restore and recalculate the draggable's offset considering the sortable
  8826. // may have modified them in unexpected ways. (#8809, #10669)
  8827. ui.helper.appendTo( draggable._parent );
  8828. draggable._refreshOffsets( event );
  8829. ui.position = draggable._generatePosition( event, true );
  8830. draggable._trigger( "fromSortable", event );
  8831. // Inform draggable that the helper is no longer in a valid drop zone
  8832. draggable.dropped = false;
  8833. // Need to refreshPositions of all sortables just in case removing
  8834. // from one sortable changes the location of other sortables (#9675)
  8835. $.each( draggable.sortables, function() {
  8836. this.refreshPositions();
  8837. } );
  8838. }
  8839. }
  8840. } );
  8841. }
  8842. } );
  8843. $.ui.plugin.add( "draggable", "cursor", {
  8844. start: function( event, ui, instance ) {
  8845. var t = $( "body" ),
  8846. o = instance.options;
  8847. if ( t.css( "cursor" ) ) {
  8848. o._cursor = t.css( "cursor" );
  8849. }
  8850. t.css( "cursor", o.cursor );
  8851. },
  8852. stop: function( event, ui, instance ) {
  8853. var o = instance.options;
  8854. if ( o._cursor ) {
  8855. $( "body" ).css( "cursor", o._cursor );
  8856. }
  8857. }
  8858. } );
  8859. $.ui.plugin.add( "draggable", "opacity", {
  8860. start: function( event, ui, instance ) {
  8861. var t = $( ui.helper ),
  8862. o = instance.options;
  8863. if ( t.css( "opacity" ) ) {
  8864. o._opacity = t.css( "opacity" );
  8865. }
  8866. t.css( "opacity", o.opacity );
  8867. },
  8868. stop: function( event, ui, instance ) {
  8869. var o = instance.options;
  8870. if ( o._opacity ) {
  8871. $( ui.helper ).css( "opacity", o._opacity );
  8872. }
  8873. }
  8874. } );
  8875. $.ui.plugin.add( "draggable", "scroll", {
  8876. start: function( event, ui, i ) {
  8877. if ( !i.scrollParentNotHidden ) {
  8878. i.scrollParentNotHidden = i.helper.scrollParent( false );
  8879. }
  8880. if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] &&
  8881. i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) {
  8882. i.overflowOffset = i.scrollParentNotHidden.offset();
  8883. }
  8884. },
  8885. drag: function( event, ui, i ) {
  8886. var o = i.options,
  8887. scrolled = false,
  8888. scrollParent = i.scrollParentNotHidden[ 0 ],
  8889. document = i.document[ 0 ];
  8890. if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) {
  8891. if ( !o.axis || o.axis !== "x" ) {
  8892. if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY <
  8893. o.scrollSensitivity ) {
  8894. scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed;
  8895. } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) {
  8896. scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed;
  8897. }
  8898. }
  8899. if ( !o.axis || o.axis !== "y" ) {
  8900. if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX <
  8901. o.scrollSensitivity ) {
  8902. scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed;
  8903. } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) {
  8904. scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed;
  8905. }
  8906. }
  8907. } else {
  8908. if ( !o.axis || o.axis !== "x" ) {
  8909. if ( event.pageY - $( document ).scrollTop() < o.scrollSensitivity ) {
  8910. scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed );
  8911. } else if ( $( window ).height() - ( event.pageY - $( document ).scrollTop() ) <
  8912. o.scrollSensitivity ) {
  8913. scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed );
  8914. }
  8915. }
  8916. if ( !o.axis || o.axis !== "y" ) {
  8917. if ( event.pageX - $( document ).scrollLeft() < o.scrollSensitivity ) {
  8918. scrolled = $( document ).scrollLeft(
  8919. $( document ).scrollLeft() - o.scrollSpeed
  8920. );
  8921. } else if ( $( window ).width() - ( event.pageX - $( document ).scrollLeft() ) <
  8922. o.scrollSensitivity ) {
  8923. scrolled = $( document ).scrollLeft(
  8924. $( document ).scrollLeft() + o.scrollSpeed
  8925. );
  8926. }
  8927. }
  8928. }
  8929. if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) {
  8930. $.ui.ddmanager.prepareOffsets( i, event );
  8931. }
  8932. }
  8933. } );
  8934. $.ui.plugin.add( "draggable", "snap", {
  8935. start: function( event, ui, i ) {
  8936. var o = i.options;
  8937. i.snapElements = [];
  8938. $( o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap )
  8939. .each( function() {
  8940. var $t = $( this ),
  8941. $o = $t.offset();
  8942. if ( this !== i.element[ 0 ] ) {
  8943. i.snapElements.push( {
  8944. item: this,
  8945. width: $t.outerWidth(), height: $t.outerHeight(),
  8946. top: $o.top, left: $o.left
  8947. } );
  8948. }
  8949. } );
  8950. },
  8951. drag: function( event, ui, inst ) {
  8952. var ts, bs, ls, rs, l, r, t, b, i, first,
  8953. o = inst.options,
  8954. d = o.snapTolerance,
  8955. x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
  8956. y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
  8957. for ( i = inst.snapElements.length - 1; i >= 0; i-- ) {
  8958. l = inst.snapElements[ i ].left - inst.margins.left;
  8959. r = l + inst.snapElements[ i ].width;
  8960. t = inst.snapElements[ i ].top - inst.margins.top;
  8961. b = t + inst.snapElements[ i ].height;
  8962. if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d ||
  8963. !$.contains( inst.snapElements[ i ].item.ownerDocument,
  8964. inst.snapElements[ i ].item ) ) {
  8965. if ( inst.snapElements[ i ].snapping ) {
  8966. ( inst.options.snap.release &&
  8967. inst.options.snap.release.call(
  8968. inst.element,
  8969. event,
  8970. $.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } )
  8971. ) );
  8972. }
  8973. inst.snapElements[ i ].snapping = false;
  8974. continue;
  8975. }
  8976. if ( o.snapMode !== "inner" ) {
  8977. ts = Math.abs( t - y2 ) <= d;
  8978. bs = Math.abs( b - y1 ) <= d;
  8979. ls = Math.abs( l - x2 ) <= d;
  8980. rs = Math.abs( r - x1 ) <= d;
  8981. if ( ts ) {
  8982. ui.position.top = inst._convertPositionTo( "relative", {
  8983. top: t - inst.helperProportions.height,
  8984. left: 0
  8985. } ).top;
  8986. }
  8987. if ( bs ) {
  8988. ui.position.top = inst._convertPositionTo( "relative", {
  8989. top: b,
  8990. left: 0
  8991. } ).top;
  8992. }
  8993. if ( ls ) {
  8994. ui.position.left = inst._convertPositionTo( "relative", {
  8995. top: 0,
  8996. left: l - inst.helperProportions.width
  8997. } ).left;
  8998. }
  8999. if ( rs ) {
  9000. ui.position.left = inst._convertPositionTo( "relative", {
  9001. top: 0,
  9002. left: r
  9003. } ).left;
  9004. }
  9005. }
  9006. first = ( ts || bs || ls || rs );
  9007. if ( o.snapMode !== "outer" ) {
  9008. ts = Math.abs( t - y1 ) <= d;
  9009. bs = Math.abs( b - y2 ) <= d;
  9010. ls = Math.abs( l - x1 ) <= d;
  9011. rs = Math.abs( r - x2 ) <= d;
  9012. if ( ts ) {
  9013. ui.position.top = inst._convertPositionTo( "relative", {
  9014. top: t,
  9015. left: 0
  9016. } ).top;
  9017. }
  9018. if ( bs ) {
  9019. ui.position.top = inst._convertPositionTo( "relative", {
  9020. top: b - inst.helperProportions.height,
  9021. left: 0
  9022. } ).top;
  9023. }
  9024. if ( ls ) {
  9025. ui.position.left = inst._convertPositionTo( "relative", {
  9026. top: 0,
  9027. left: l
  9028. } ).left;
  9029. }
  9030. if ( rs ) {
  9031. ui.position.left = inst._convertPositionTo( "relative", {
  9032. top: 0,
  9033. left: r - inst.helperProportions.width
  9034. } ).left;
  9035. }
  9036. }
  9037. if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) {
  9038. ( inst.options.snap.snap &&
  9039. inst.options.snap.snap.call(
  9040. inst.element,
  9041. event,
  9042. $.extend( inst._uiHash(), {
  9043. snapItem: inst.snapElements[ i ].item
  9044. } ) ) );
  9045. }
  9046. inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first );
  9047. }
  9048. }
  9049. } );
  9050. $.ui.plugin.add( "draggable", "stack", {
  9051. start: function( event, ui, instance ) {
  9052. var min,
  9053. o = instance.options,
  9054. group = $.makeArray( $( o.stack ) ).sort( function( a, b ) {
  9055. return ( parseInt( $( a ).css( "zIndex" ), 10 ) || 0 ) -
  9056. ( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 );
  9057. } );
  9058. if ( !group.length ) { return; }
  9059. min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0;
  9060. $( group ).each( function( i ) {
  9061. $( this ).css( "zIndex", min + i );
  9062. } );
  9063. this.css( "zIndex", ( min + group.length ) );
  9064. }
  9065. } );
  9066. $.ui.plugin.add( "draggable", "zIndex", {
  9067. start: function( event, ui, instance ) {
  9068. var t = $( ui.helper ),
  9069. o = instance.options;
  9070. if ( t.css( "zIndex" ) ) {
  9071. o._zIndex = t.css( "zIndex" );
  9072. }
  9073. t.css( "zIndex", o.zIndex );
  9074. },
  9075. stop: function( event, ui, instance ) {
  9076. var o = instance.options;
  9077. if ( o._zIndex ) {
  9078. $( ui.helper ).css( "zIndex", o._zIndex );
  9079. }
  9080. }
  9081. } );
  9082. var widgetsDraggable = $.ui.draggable;
  9083. /*!
  9084. * jQuery UI Resizable 1.12.1
  9085. * http://jqueryui.com
  9086. *
  9087. * Copyright jQuery Foundation and other contributors
  9088. * Released under the MIT license.
  9089. * http://jquery.org/license
  9090. */
  9091. //>>label: Resizable
  9092. //>>group: Interactions
  9093. //>>description: Enables resize functionality for any element.
  9094. //>>docs: http://api.jqueryui.com/resizable/
  9095. //>>demos: http://jqueryui.com/resizable/
  9096. //>>css.structure: ../../themes/base/core.css
  9097. //>>css.structure: ../../themes/base/resizable.css
  9098. //>>css.theme: ../../themes/base/theme.css
  9099. $.widget( "ui.resizable", $.ui.mouse, {
  9100. version: "1.12.1",
  9101. widgetEventPrefix: "resize",
  9102. options: {
  9103. alsoResize: false,
  9104. animate: false,
  9105. animateDuration: "slow",
  9106. animateEasing: "swing",
  9107. aspectRatio: false,
  9108. autoHide: false,
  9109. classes: {
  9110. "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se"
  9111. },
  9112. containment: false,
  9113. ghost: false,
  9114. grid: false,
  9115. handles: "e,s,se",
  9116. helper: false,
  9117. maxHeight: null,
  9118. maxWidth: null,
  9119. minHeight: 10,
  9120. minWidth: 10,
  9121. // See #7960
  9122. zIndex: 90,
  9123. // Callbacks
  9124. resize: null,
  9125. start: null,
  9126. stop: null
  9127. },
  9128. _num: function( value ) {
  9129. return parseFloat( value ) || 0;
  9130. },
  9131. _isNumber: function( value ) {
  9132. return !isNaN( parseFloat( value ) );
  9133. },
  9134. _hasScroll: function( el, a ) {
  9135. if ( $( el ).css( "overflow" ) === "hidden" ) {
  9136. return false;
  9137. }
  9138. var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
  9139. has = false;
  9140. if ( el[ scroll ] > 0 ) {
  9141. return true;
  9142. }
  9143. // TODO: determine which cases actually cause this to happen
  9144. // if the element doesn't have the scroll set, see if it's possible to
  9145. // set the scroll
  9146. el[ scroll ] = 1;
  9147. has = ( el[ scroll ] > 0 );
  9148. el[ scroll ] = 0;
  9149. return has;
  9150. },
  9151. _create: function() {
  9152. var margins,
  9153. o = this.options,
  9154. that = this;
  9155. this._addClass( "ui-resizable" );
  9156. $.extend( this, {
  9157. _aspectRatio: !!( o.aspectRatio ),
  9158. aspectRatio: o.aspectRatio,
  9159. originalElement: this.element,
  9160. _proportionallyResizeElements: [],
  9161. _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
  9162. } );
  9163. // Wrap the element if it cannot hold child nodes
  9164. if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) {
  9165. this.element.wrap(
  9166. $( "<div class='ui-wrapper' style='overflow: hidden;'></div>" ).css( {
  9167. position: this.element.css( "position" ),
  9168. width: this.element.outerWidth(),
  9169. height: this.element.outerHeight(),
  9170. top: this.element.css( "top" ),
  9171. left: this.element.css( "left" )
  9172. } )
  9173. );
  9174. this.element = this.element.parent().data(
  9175. "ui-resizable", this.element.resizable( "instance" )
  9176. );
  9177. this.elementIsWrapper = true;
  9178. margins = {
  9179. marginTop: this.originalElement.css( "marginTop" ),
  9180. marginRight: this.originalElement.css( "marginRight" ),
  9181. marginBottom: this.originalElement.css( "marginBottom" ),
  9182. marginLeft: this.originalElement.css( "marginLeft" )
  9183. };
  9184. this.element.css( margins );
  9185. this.originalElement.css( "margin", 0 );
  9186. // support: Safari
  9187. // Prevent Safari textarea resize
  9188. this.originalResizeStyle = this.originalElement.css( "resize" );
  9189. this.originalElement.css( "resize", "none" );
  9190. this._proportionallyResizeElements.push( this.originalElement.css( {
  9191. position: "static",
  9192. zoom: 1,
  9193. display: "block"
  9194. } ) );
  9195. // Support: IE9
  9196. // avoid IE jump (hard set the margin)
  9197. this.originalElement.css( margins );
  9198. this._proportionallyResize();
  9199. }
  9200. this._setupHandles();
  9201. if ( o.autoHide ) {
  9202. $( this.element )
  9203. .on( "mouseenter", function() {
  9204. if ( o.disabled ) {
  9205. return;
  9206. }
  9207. that._removeClass( "ui-resizable-autohide" );
  9208. that._handles.show();
  9209. } )
  9210. .on( "mouseleave", function() {
  9211. if ( o.disabled ) {
  9212. return;
  9213. }
  9214. if ( !that.resizing ) {
  9215. that._addClass( "ui-resizable-autohide" );
  9216. that._handles.hide();
  9217. }
  9218. } );
  9219. }
  9220. this._mouseInit();
  9221. },
  9222. _destroy: function() {
  9223. this._mouseDestroy();
  9224. var wrapper,
  9225. _destroy = function( exp ) {
  9226. $( exp )
  9227. .removeData( "resizable" )
  9228. .removeData( "ui-resizable" )
  9229. .off( ".resizable" )
  9230. .find( ".ui-resizable-handle" )
  9231. .remove();
  9232. };
  9233. // TODO: Unwrap at same DOM position
  9234. if ( this.elementIsWrapper ) {
  9235. _destroy( this.element );
  9236. wrapper = this.element;
  9237. this.originalElement.css( {
  9238. position: wrapper.css( "position" ),
  9239. width: wrapper.outerWidth(),
  9240. height: wrapper.outerHeight(),
  9241. top: wrapper.css( "top" ),
  9242. left: wrapper.css( "left" )
  9243. } ).insertAfter( wrapper );
  9244. wrapper.remove();
  9245. }
  9246. this.originalElement.css( "resize", this.originalResizeStyle );
  9247. _destroy( this.originalElement );
  9248. return this;
  9249. },
  9250. _setOption: function( key, value ) {
  9251. this._super( key, value );
  9252. switch ( key ) {
  9253. case "handles":
  9254. this._removeHandles();
  9255. this._setupHandles();
  9256. break;
  9257. default:
  9258. break;
  9259. }
  9260. },
  9261. _setupHandles: function() {
  9262. var o = this.options, handle, i, n, hname, axis, that = this;
  9263. this.handles = o.handles ||
  9264. ( !$( ".ui-resizable-handle", this.element ).length ?
  9265. "e,s,se" : {
  9266. n: ".ui-resizable-n",
  9267. e: ".ui-resizable-e",
  9268. s: ".ui-resizable-s",
  9269. w: ".ui-resizable-w",
  9270. se: ".ui-resizable-se",
  9271. sw: ".ui-resizable-sw",
  9272. ne: ".ui-resizable-ne",
  9273. nw: ".ui-resizable-nw"
  9274. } );
  9275. this._handles = $();
  9276. if ( this.handles.constructor === String ) {
  9277. if ( this.handles === "all" ) {
  9278. this.handles = "n,e,s,w,se,sw,ne,nw";
  9279. }
  9280. n = this.handles.split( "," );
  9281. this.handles = {};
  9282. for ( i = 0; i < n.length; i++ ) {
  9283. handle = $.trim( n[ i ] );
  9284. hname = "ui-resizable-" + handle;
  9285. axis = $( "<div>" );
  9286. this._addClass( axis, "ui-resizable-handle " + hname );
  9287. axis.css( { zIndex: o.zIndex } );
  9288. this.handles[ handle ] = ".ui-resizable-" + handle;
  9289. this.element.append( axis );
  9290. }
  9291. }
  9292. this._renderAxis = function( target ) {
  9293. var i, axis, padPos, padWrapper;
  9294. target = target || this.element;
  9295. for ( i in this.handles ) {
  9296. if ( this.handles[ i ].constructor === String ) {
  9297. this.handles[ i ] = this.element.children( this.handles[ i ] ).first().show();
  9298. } else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) {
  9299. this.handles[ i ] = $( this.handles[ i ] );
  9300. this._on( this.handles[ i ], { "mousedown": that._mouseDown } );
  9301. }
  9302. if ( this.elementIsWrapper &&
  9303. this.originalElement[ 0 ]
  9304. .nodeName
  9305. .match( /^(textarea|input|select|button)$/i ) ) {
  9306. axis = $( this.handles[ i ], this.element );
  9307. padWrapper = /sw|ne|nw|se|n|s/.test( i ) ?
  9308. axis.outerHeight() :
  9309. axis.outerWidth();
  9310. padPos = [ "padding",
  9311. /ne|nw|n/.test( i ) ? "Top" :
  9312. /se|sw|s/.test( i ) ? "Bottom" :
  9313. /^e$/.test( i ) ? "Right" : "Left" ].join( "" );
  9314. target.css( padPos, padWrapper );
  9315. this._proportionallyResize();
  9316. }
  9317. this._handles = this._handles.add( this.handles[ i ] );
  9318. }
  9319. };
  9320. // TODO: make renderAxis a prototype function
  9321. this._renderAxis( this.element );
  9322. this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) );
  9323. this._handles.disableSelection();
  9324. this._handles.on( "mouseover", function() {
  9325. if ( !that.resizing ) {
  9326. if ( this.className ) {
  9327. axis = this.className.match( /ui-resizable-(se|sw|ne|nw|n|e|s|w)/i );
  9328. }
  9329. that.axis = axis && axis[ 1 ] ? axis[ 1 ] : "se";
  9330. }
  9331. } );
  9332. if ( o.autoHide ) {
  9333. this._handles.hide();
  9334. this._addClass( "ui-resizable-autohide" );
  9335. }
  9336. },
  9337. _removeHandles: function() {
  9338. this._handles.remove();
  9339. },
  9340. _mouseCapture: function( event ) {
  9341. var i, handle,
  9342. capture = false;
  9343. for ( i in this.handles ) {
  9344. handle = $( this.handles[ i ] )[ 0 ];
  9345. if ( handle === event.target || $.contains( handle, event.target ) ) {
  9346. capture = true;
  9347. }
  9348. }
  9349. return !this.options.disabled && capture;
  9350. },
  9351. _mouseStart: function( event ) {
  9352. var curleft, curtop, cursor,
  9353. o = this.options,
  9354. el = this.element;
  9355. this.resizing = true;
  9356. this._renderProxy();
  9357. curleft = this._num( this.helper.css( "left" ) );
  9358. curtop = this._num( this.helper.css( "top" ) );
  9359. if ( o.containment ) {
  9360. curleft += $( o.containment ).scrollLeft() || 0;
  9361. curtop += $( o.containment ).scrollTop() || 0;
  9362. }
  9363. this.offset = this.helper.offset();
  9364. this.position = { left: curleft, top: curtop };
  9365. this.size = this._helper ? {
  9366. width: this.helper.width(),
  9367. height: this.helper.height()
  9368. } : {
  9369. width: el.width(),
  9370. height: el.height()
  9371. };
  9372. this.originalSize = this._helper ? {
  9373. width: el.outerWidth(),
  9374. height: el.outerHeight()
  9375. } : {
  9376. width: el.width(),
  9377. height: el.height()
  9378. };
  9379. this.sizeDiff = {
  9380. width: el.outerWidth() - el.width(),
  9381. height: el.outerHeight() - el.height()
  9382. };
  9383. this.originalPosition = { left: curleft, top: curtop };
  9384. this.originalMousePosition = { left: event.pageX, top: event.pageY };
  9385. this.aspectRatio = ( typeof o.aspectRatio === "number" ) ?
  9386. o.aspectRatio :
  9387. ( ( this.originalSize.width / this.originalSize.height ) || 1 );
  9388. cursor = $( ".ui-resizable-" + this.axis ).css( "cursor" );
  9389. $( "body" ).css( "cursor", cursor === "auto" ? this.axis + "-resize" : cursor );
  9390. this._addClass( "ui-resizable-resizing" );
  9391. this._propagate( "start", event );
  9392. return true;
  9393. },
  9394. _mouseDrag: function( event ) {
  9395. var data, props,
  9396. smp = this.originalMousePosition,
  9397. a = this.axis,
  9398. dx = ( event.pageX - smp.left ) || 0,
  9399. dy = ( event.pageY - smp.top ) || 0,
  9400. trigger = this._change[ a ];
  9401. this._updatePrevProperties();
  9402. if ( !trigger ) {
  9403. return false;
  9404. }
  9405. data = trigger.apply( this, [ event, dx, dy ] );
  9406. this._updateVirtualBoundaries( event.shiftKey );
  9407. if ( this._aspectRatio || event.shiftKey ) {
  9408. data = this._updateRatio( data, event );
  9409. }
  9410. data = this._respectSize( data, event );
  9411. this._updateCache( data );
  9412. this._propagate( "resize", event );
  9413. props = this._applyChanges();
  9414. if ( !this._helper && this._proportionallyResizeElements.length ) {
  9415. this._proportionallyResize();
  9416. }
  9417. if ( !$.isEmptyObject( props ) ) {
  9418. this._updatePrevProperties();
  9419. this._trigger( "resize", event, this.ui() );
  9420. this._applyChanges();
  9421. }
  9422. return false;
  9423. },
  9424. _mouseStop: function( event ) {
  9425. this.resizing = false;
  9426. var pr, ista, soffseth, soffsetw, s, left, top,
  9427. o = this.options, that = this;
  9428. if ( this._helper ) {
  9429. pr = this._proportionallyResizeElements;
  9430. ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName );
  9431. soffseth = ista && this._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height;
  9432. soffsetw = ista ? 0 : that.sizeDiff.width;
  9433. s = {
  9434. width: ( that.helper.width() - soffsetw ),
  9435. height: ( that.helper.height() - soffseth )
  9436. };
  9437. left = ( parseFloat( that.element.css( "left" ) ) +
  9438. ( that.position.left - that.originalPosition.left ) ) || null;
  9439. top = ( parseFloat( that.element.css( "top" ) ) +
  9440. ( that.position.top - that.originalPosition.top ) ) || null;
  9441. if ( !o.animate ) {
  9442. this.element.css( $.extend( s, { top: top, left: left } ) );
  9443. }
  9444. that.helper.height( that.size.height );
  9445. that.helper.width( that.size.width );
  9446. if ( this._helper && !o.animate ) {
  9447. this._proportionallyResize();
  9448. }
  9449. }
  9450. $( "body" ).css( "cursor", "auto" );
  9451. this._removeClass( "ui-resizable-resizing" );
  9452. this._propagate( "stop", event );
  9453. if ( this._helper ) {
  9454. this.helper.remove();
  9455. }
  9456. return false;
  9457. },
  9458. _updatePrevProperties: function() {
  9459. this.prevPosition = {
  9460. top: this.position.top,
  9461. left: this.position.left
  9462. };
  9463. this.prevSize = {
  9464. width: this.size.width,
  9465. height: this.size.height
  9466. };
  9467. },
  9468. _applyChanges: function() {
  9469. var props = {};
  9470. if ( this.position.top !== this.prevPosition.top ) {
  9471. props.top = this.position.top + "px";
  9472. }
  9473. if ( this.position.left !== this.prevPosition.left ) {
  9474. props.left = this.position.left + "px";
  9475. }
  9476. if ( this.size.width !== this.prevSize.width ) {
  9477. props.width = this.size.width + "px";
  9478. }
  9479. if ( this.size.height !== this.prevSize.height ) {
  9480. props.height = this.size.height + "px";
  9481. }
  9482. this.helper.css( props );
  9483. return props;
  9484. },
  9485. _updateVirtualBoundaries: function( forceAspectRatio ) {
  9486. var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
  9487. o = this.options;
  9488. b = {
  9489. minWidth: this._isNumber( o.minWidth ) ? o.minWidth : 0,
  9490. maxWidth: this._isNumber( o.maxWidth ) ? o.maxWidth : Infinity,
  9491. minHeight: this._isNumber( o.minHeight ) ? o.minHeight : 0,
  9492. maxHeight: this._isNumber( o.maxHeight ) ? o.maxHeight : Infinity
  9493. };
  9494. if ( this._aspectRatio || forceAspectRatio ) {
  9495. pMinWidth = b.minHeight * this.aspectRatio;
  9496. pMinHeight = b.minWidth / this.aspectRatio;
  9497. pMaxWidth = b.maxHeight * this.aspectRatio;
  9498. pMaxHeight = b.maxWidth / this.aspectRatio;
  9499. if ( pMinWidth > b.minWidth ) {
  9500. b.minWidth = pMinWidth;
  9501. }
  9502. if ( pMinHeight > b.minHeight ) {
  9503. b.minHeight = pMinHeight;
  9504. }
  9505. if ( pMaxWidth < b.maxWidth ) {
  9506. b.maxWidth = pMaxWidth;
  9507. }
  9508. if ( pMaxHeight < b.maxHeight ) {
  9509. b.maxHeight = pMaxHeight;
  9510. }
  9511. }
  9512. this._vBoundaries = b;
  9513. },
  9514. _updateCache: function( data ) {
  9515. this.offset = this.helper.offset();
  9516. if ( this._isNumber( data.left ) ) {
  9517. this.position.left = data.left;
  9518. }
  9519. if ( this._isNumber( data.top ) ) {
  9520. this.position.top = data.top;
  9521. }
  9522. if ( this._isNumber( data.height ) ) {
  9523. this.size.height = data.height;
  9524. }
  9525. if ( this._isNumber( data.width ) ) {
  9526. this.size.width = data.width;
  9527. }
  9528. },
  9529. _updateRatio: function( data ) {
  9530. var cpos = this.position,
  9531. csize = this.size,
  9532. a = this.axis;
  9533. if ( this._isNumber( data.height ) ) {
  9534. data.width = ( data.height * this.aspectRatio );
  9535. } else if ( this._isNumber( data.width ) ) {
  9536. data.height = ( data.width / this.aspectRatio );
  9537. }
  9538. if ( a === "sw" ) {
  9539. data.left = cpos.left + ( csize.width - data.width );
  9540. data.top = null;
  9541. }
  9542. if ( a === "nw" ) {
  9543. data.top = cpos.top + ( csize.height - data.height );
  9544. data.left = cpos.left + ( csize.width - data.width );
  9545. }
  9546. return data;
  9547. },
  9548. _respectSize: function( data ) {
  9549. var o = this._vBoundaries,
  9550. a = this.axis,
  9551. ismaxw = this._isNumber( data.width ) && o.maxWidth && ( o.maxWidth < data.width ),
  9552. ismaxh = this._isNumber( data.height ) && o.maxHeight && ( o.maxHeight < data.height ),
  9553. isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ),
  9554. isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ),
  9555. dw = this.originalPosition.left + this.originalSize.width,
  9556. dh = this.originalPosition.top + this.originalSize.height,
  9557. cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a );
  9558. if ( isminw ) {
  9559. data.width = o.minWidth;
  9560. }
  9561. if ( isminh ) {
  9562. data.height = o.minHeight;
  9563. }
  9564. if ( ismaxw ) {
  9565. data.width = o.maxWidth;
  9566. }
  9567. if ( ismaxh ) {
  9568. data.height = o.maxHeight;
  9569. }
  9570. if ( isminw && cw ) {
  9571. data.left = dw - o.minWidth;
  9572. }
  9573. if ( ismaxw && cw ) {
  9574. data.left = dw - o.maxWidth;
  9575. }
  9576. if ( isminh && ch ) {
  9577. data.top = dh - o.minHeight;
  9578. }
  9579. if ( ismaxh && ch ) {
  9580. data.top = dh - o.maxHeight;
  9581. }
  9582. // Fixing jump error on top/left - bug #2330
  9583. if ( !data.width && !data.height && !data.left && data.top ) {
  9584. data.top = null;
  9585. } else if ( !data.width && !data.height && !data.top && data.left ) {
  9586. data.left = null;
  9587. }
  9588. return data;
  9589. },
  9590. _getPaddingPlusBorderDimensions: function( element ) {
  9591. var i = 0,
  9592. widths = [],
  9593. borders = [
  9594. element.css( "borderTopWidth" ),
  9595. element.css( "borderRightWidth" ),
  9596. element.css( "borderBottomWidth" ),
  9597. element.css( "borderLeftWidth" )
  9598. ],
  9599. paddings = [
  9600. element.css( "paddingTop" ),
  9601. element.css( "paddingRight" ),
  9602. element.css( "paddingBottom" ),
  9603. element.css( "paddingLeft" )
  9604. ];
  9605. for ( ; i < 4; i++ ) {
  9606. widths[ i ] = ( parseFloat( borders[ i ] ) || 0 );
  9607. widths[ i ] += ( parseFloat( paddings[ i ] ) || 0 );
  9608. }
  9609. return {
  9610. height: widths[ 0 ] + widths[ 2 ],
  9611. width: widths[ 1 ] + widths[ 3 ]
  9612. };
  9613. },
  9614. _proportionallyResize: function() {
  9615. if ( !this._proportionallyResizeElements.length ) {
  9616. return;
  9617. }
  9618. var prel,
  9619. i = 0,
  9620. element = this.helper || this.element;
  9621. for ( ; i < this._proportionallyResizeElements.length; i++ ) {
  9622. prel = this._proportionallyResizeElements[ i ];
  9623. // TODO: Seems like a bug to cache this.outerDimensions
  9624. // considering that we are in a loop.
  9625. if ( !this.outerDimensions ) {
  9626. this.outerDimensions = this._getPaddingPlusBorderDimensions( prel );
  9627. }
  9628. prel.css( {
  9629. height: ( element.height() - this.outerDimensions.height ) || 0,
  9630. width: ( element.width() - this.outerDimensions.width ) || 0
  9631. } );
  9632. }
  9633. },
  9634. _renderProxy: function() {
  9635. var el = this.element, o = this.options;
  9636. this.elementOffset = el.offset();
  9637. if ( this._helper ) {
  9638. this.helper = this.helper || $( "<div style='overflow:hidden;'></div>" );
  9639. this._addClass( this.helper, this._helper );
  9640. this.helper.css( {
  9641. width: this.element.outerWidth(),
  9642. height: this.element.outerHeight(),
  9643. position: "absolute",
  9644. left: this.elementOffset.left + "px",
  9645. top: this.elementOffset.top + "px",
  9646. zIndex: ++o.zIndex //TODO: Don't modify option
  9647. } );
  9648. this.helper
  9649. .appendTo( "body" )
  9650. .disableSelection();
  9651. } else {
  9652. this.helper = this.element;
  9653. }
  9654. },
  9655. _change: {
  9656. e: function( event, dx ) {
  9657. return { width: this.originalSize.width + dx };
  9658. },
  9659. w: function( event, dx ) {
  9660. var cs = this.originalSize, sp = this.originalPosition;
  9661. return { left: sp.left + dx, width: cs.width - dx };
  9662. },
  9663. n: function( event, dx, dy ) {
  9664. var cs = this.originalSize, sp = this.originalPosition;
  9665. return { top: sp.top + dy, height: cs.height - dy };
  9666. },
  9667. s: function( event, dx, dy ) {
  9668. return { height: this.originalSize.height + dy };
  9669. },
  9670. se: function( event, dx, dy ) {
  9671. return $.extend( this._change.s.apply( this, arguments ),
  9672. this._change.e.apply( this, [ event, dx, dy ] ) );
  9673. },
  9674. sw: function( event, dx, dy ) {
  9675. return $.extend( this._change.s.apply( this, arguments ),
  9676. this._change.w.apply( this, [ event, dx, dy ] ) );
  9677. },
  9678. ne: function( event, dx, dy ) {
  9679. return $.extend( this._change.n.apply( this, arguments ),
  9680. this._change.e.apply( this, [ event, dx, dy ] ) );
  9681. },
  9682. nw: function( event, dx, dy ) {
  9683. return $.extend( this._change.n.apply( this, arguments ),
  9684. this._change.w.apply( this, [ event, dx, dy ] ) );
  9685. }
  9686. },
  9687. _propagate: function( n, event ) {
  9688. $.ui.plugin.call( this, n, [ event, this.ui() ] );
  9689. ( n !== "resize" && this._trigger( n, event, this.ui() ) );
  9690. },
  9691. plugins: {},
  9692. ui: function() {
  9693. return {
  9694. originalElement: this.originalElement,
  9695. element: this.element,
  9696. helper: this.helper,
  9697. position: this.position,
  9698. size: this.size,
  9699. originalSize: this.originalSize,
  9700. originalPosition: this.originalPosition
  9701. };
  9702. }
  9703. } );
  9704. /*
  9705. * Resizable Extensions
  9706. */
  9707. $.ui.plugin.add( "resizable", "animate", {
  9708. stop: function( event ) {
  9709. var that = $( this ).resizable( "instance" ),
  9710. o = that.options,
  9711. pr = that._proportionallyResizeElements,
  9712. ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ),
  9713. soffseth = ista && that._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height,
  9714. soffsetw = ista ? 0 : that.sizeDiff.width,
  9715. style = {
  9716. width: ( that.size.width - soffsetw ),
  9717. height: ( that.size.height - soffseth )
  9718. },
  9719. left = ( parseFloat( that.element.css( "left" ) ) +
  9720. ( that.position.left - that.originalPosition.left ) ) || null,
  9721. top = ( parseFloat( that.element.css( "top" ) ) +
  9722. ( that.position.top - that.originalPosition.top ) ) || null;
  9723. that.element.animate(
  9724. $.extend( style, top && left ? { top: top, left: left } : {} ), {
  9725. duration: o.animateDuration,
  9726. easing: o.animateEasing,
  9727. step: function() {
  9728. var data = {
  9729. width: parseFloat( that.element.css( "width" ) ),
  9730. height: parseFloat( that.element.css( "height" ) ),
  9731. top: parseFloat( that.element.css( "top" ) ),
  9732. left: parseFloat( that.element.css( "left" ) )
  9733. };
  9734. if ( pr && pr.length ) {
  9735. $( pr[ 0 ] ).css( { width: data.width, height: data.height } );
  9736. }
  9737. // Propagating resize, and updating values for each animation step
  9738. that._updateCache( data );
  9739. that._propagate( "resize", event );
  9740. }
  9741. }
  9742. );
  9743. }
  9744. } );
  9745. $.ui.plugin.add( "resizable", "containment", {
  9746. start: function() {
  9747. var element, p, co, ch, cw, width, height,
  9748. that = $( this ).resizable( "instance" ),
  9749. o = that.options,
  9750. el = that.element,
  9751. oc = o.containment,
  9752. ce = ( oc instanceof $ ) ?
  9753. oc.get( 0 ) :
  9754. ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc;
  9755. if ( !ce ) {
  9756. return;
  9757. }
  9758. that.containerElement = $( ce );
  9759. if ( /document/.test( oc ) || oc === document ) {
  9760. that.containerOffset = {
  9761. left: 0,
  9762. top: 0
  9763. };
  9764. that.containerPosition = {
  9765. left: 0,
  9766. top: 0
  9767. };
  9768. that.parentData = {
  9769. element: $( document ),
  9770. left: 0,
  9771. top: 0,
  9772. width: $( document ).width(),
  9773. height: $( document ).height() || document.body.parentNode.scrollHeight
  9774. };
  9775. } else {
  9776. element = $( ce );
  9777. p = [];
  9778. $( [ "Top", "Right", "Left", "Bottom" ] ).each( function( i, name ) {
  9779. p[ i ] = that._num( element.css( "padding" + name ) );
  9780. } );
  9781. that.containerOffset = element.offset();
  9782. that.containerPosition = element.position();
  9783. that.containerSize = {
  9784. height: ( element.innerHeight() - p[ 3 ] ),
  9785. width: ( element.innerWidth() - p[ 1 ] )
  9786. };
  9787. co = that.containerOffset;
  9788. ch = that.containerSize.height;
  9789. cw = that.containerSize.width;
  9790. width = ( that._hasScroll ( ce, "left" ) ? ce.scrollWidth : cw );
  9791. height = ( that._hasScroll ( ce ) ? ce.scrollHeight : ch ) ;
  9792. that.parentData = {
  9793. element: ce,
  9794. left: co.left,
  9795. top: co.top,
  9796. width: width,
  9797. height: height
  9798. };
  9799. }
  9800. },
  9801. resize: function( event ) {
  9802. var woset, hoset, isParent, isOffsetRelative,
  9803. that = $( this ).resizable( "instance" ),
  9804. o = that.options,
  9805. co = that.containerOffset,
  9806. cp = that.position,
  9807. pRatio = that._aspectRatio || event.shiftKey,
  9808. cop = {
  9809. top: 0,
  9810. left: 0
  9811. },
  9812. ce = that.containerElement,
  9813. continueResize = true;
  9814. if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) {
  9815. cop = co;
  9816. }
  9817. if ( cp.left < ( that._helper ? co.left : 0 ) ) {
  9818. that.size.width = that.size.width +
  9819. ( that._helper ?
  9820. ( that.position.left - co.left ) :
  9821. ( that.position.left - cop.left ) );
  9822. if ( pRatio ) {
  9823. that.size.height = that.size.width / that.aspectRatio;
  9824. continueResize = false;
  9825. }
  9826. that.position.left = o.helper ? co.left : 0;
  9827. }
  9828. if ( cp.top < ( that._helper ? co.top : 0 ) ) {
  9829. that.size.height = that.size.height +
  9830. ( that._helper ?
  9831. ( that.position.top - co.top ) :
  9832. that.position.top );
  9833. if ( pRatio ) {
  9834. that.size.width = that.size.height * that.aspectRatio;
  9835. continueResize = false;
  9836. }
  9837. that.position.top = that._helper ? co.top : 0;
  9838. }
  9839. isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 );
  9840. isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) );
  9841. if ( isParent && isOffsetRelative ) {
  9842. that.offset.left = that.parentData.left + that.position.left;
  9843. that.offset.top = that.parentData.top + that.position.top;
  9844. } else {
  9845. that.offset.left = that.element.offset().left;
  9846. that.offset.top = that.element.offset().top;
  9847. }
  9848. woset = Math.abs( that.sizeDiff.width +
  9849. ( that._helper ?
  9850. that.offset.left - cop.left :
  9851. ( that.offset.left - co.left ) ) );
  9852. hoset = Math.abs( that.sizeDiff.height +
  9853. ( that._helper ?
  9854. that.offset.top - cop.top :
  9855. ( that.offset.top - co.top ) ) );
  9856. if ( woset + that.size.width >= that.parentData.width ) {
  9857. that.size.width = that.parentData.width - woset;
  9858. if ( pRatio ) {
  9859. that.size.height = that.size.width / that.aspectRatio;
  9860. continueResize = false;
  9861. }
  9862. }
  9863. if ( hoset + that.size.height >= that.parentData.height ) {
  9864. that.size.height = that.parentData.height - hoset;
  9865. if ( pRatio ) {
  9866. that.size.width = that.size.height * that.aspectRatio;
  9867. continueResize = false;
  9868. }
  9869. }
  9870. if ( !continueResize ) {
  9871. that.position.left = that.prevPosition.left;
  9872. that.position.top = that.prevPosition.top;
  9873. that.size.width = that.prevSize.width;
  9874. that.size.height = that.prevSize.height;
  9875. }
  9876. },
  9877. stop: function() {
  9878. var that = $( this ).resizable( "instance" ),
  9879. o = that.options,
  9880. co = that.containerOffset,
  9881. cop = that.containerPosition,
  9882. ce = that.containerElement,
  9883. helper = $( that.helper ),
  9884. ho = helper.offset(),
  9885. w = helper.outerWidth() - that.sizeDiff.width,
  9886. h = helper.outerHeight() - that.sizeDiff.height;
  9887. if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) {
  9888. $( this ).css( {
  9889. left: ho.left - cop.left - co.left,
  9890. width: w,
  9891. height: h
  9892. } );
  9893. }
  9894. if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) {
  9895. $( this ).css( {
  9896. left: ho.left - cop.left - co.left,
  9897. width: w,
  9898. height: h
  9899. } );
  9900. }
  9901. }
  9902. } );
  9903. $.ui.plugin.add( "resizable", "alsoResize", {
  9904. start: function() {
  9905. var that = $( this ).resizable( "instance" ),
  9906. o = that.options;
  9907. $( o.alsoResize ).each( function() {
  9908. var el = $( this );
  9909. el.data( "ui-resizable-alsoresize", {
  9910. width: parseFloat( el.width() ), height: parseFloat( el.height() ),
  9911. left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) )
  9912. } );
  9913. } );
  9914. },
  9915. resize: function( event, ui ) {
  9916. var that = $( this ).resizable( "instance" ),
  9917. o = that.options,
  9918. os = that.originalSize,
  9919. op = that.originalPosition,
  9920. delta = {
  9921. height: ( that.size.height - os.height ) || 0,
  9922. width: ( that.size.width - os.width ) || 0,
  9923. top: ( that.position.top - op.top ) || 0,
  9924. left: ( that.position.left - op.left ) || 0
  9925. };
  9926. $( o.alsoResize ).each( function() {
  9927. var el = $( this ), start = $( this ).data( "ui-resizable-alsoresize" ), style = {},
  9928. css = el.parents( ui.originalElement[ 0 ] ).length ?
  9929. [ "width", "height" ] :
  9930. [ "width", "height", "top", "left" ];
  9931. $.each( css, function( i, prop ) {
  9932. var sum = ( start[ prop ] || 0 ) + ( delta[ prop ] || 0 );
  9933. if ( sum && sum >= 0 ) {
  9934. style[ prop ] = sum || null;
  9935. }
  9936. } );
  9937. el.css( style );
  9938. } );
  9939. },
  9940. stop: function() {
  9941. $( this ).removeData( "ui-resizable-alsoresize" );
  9942. }
  9943. } );
  9944. $.ui.plugin.add( "resizable", "ghost", {
  9945. start: function() {
  9946. var that = $( this ).resizable( "instance" ), cs = that.size;
  9947. that.ghost = that.originalElement.clone();
  9948. that.ghost.css( {
  9949. opacity: 0.25,
  9950. display: "block",
  9951. position: "relative",
  9952. height: cs.height,
  9953. width: cs.width,
  9954. margin: 0,
  9955. left: 0,
  9956. top: 0
  9957. } );
  9958. that._addClass( that.ghost, "ui-resizable-ghost" );
  9959. // DEPRECATED
  9960. // TODO: remove after 1.12
  9961. if ( $.uiBackCompat !== false && typeof that.options.ghost === "string" ) {
  9962. // Ghost option
  9963. that.ghost.addClass( this.options.ghost );
  9964. }
  9965. that.ghost.appendTo( that.helper );
  9966. },
  9967. resize: function() {
  9968. var that = $( this ).resizable( "instance" );
  9969. if ( that.ghost ) {
  9970. that.ghost.css( {
  9971. position: "relative",
  9972. height: that.size.height,
  9973. width: that.size.width
  9974. } );
  9975. }
  9976. },
  9977. stop: function() {
  9978. var that = $( this ).resizable( "instance" );
  9979. if ( that.ghost && that.helper ) {
  9980. that.helper.get( 0 ).removeChild( that.ghost.get( 0 ) );
  9981. }
  9982. }
  9983. } );
  9984. $.ui.plugin.add( "resizable", "grid", {
  9985. resize: function() {
  9986. var outerDimensions,
  9987. that = $( this ).resizable( "instance" ),
  9988. o = that.options,
  9989. cs = that.size,
  9990. os = that.originalSize,
  9991. op = that.originalPosition,
  9992. a = that.axis,
  9993. grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid,
  9994. gridX = ( grid[ 0 ] || 1 ),
  9995. gridY = ( grid[ 1 ] || 1 ),
  9996. ox = Math.round( ( cs.width - os.width ) / gridX ) * gridX,
  9997. oy = Math.round( ( cs.height - os.height ) / gridY ) * gridY,
  9998. newWidth = os.width + ox,
  9999. newHeight = os.height + oy,
  10000. isMaxWidth = o.maxWidth && ( o.maxWidth < newWidth ),
  10001. isMaxHeight = o.maxHeight && ( o.maxHeight < newHeight ),
  10002. isMinWidth = o.minWidth && ( o.minWidth > newWidth ),
  10003. isMinHeight = o.minHeight && ( o.minHeight > newHeight );
  10004. o.grid = grid;
  10005. if ( isMinWidth ) {
  10006. newWidth += gridX;
  10007. }
  10008. if ( isMinHeight ) {
  10009. newHeight += gridY;
  10010. }
  10011. if ( isMaxWidth ) {
  10012. newWidth -= gridX;
  10013. }
  10014. if ( isMaxHeight ) {
  10015. newHeight -= gridY;
  10016. }
  10017. if ( /^(se|s|e)$/.test( a ) ) {
  10018. that.size.width = newWidth;
  10019. that.size.height = newHeight;
  10020. } else if ( /^(ne)$/.test( a ) ) {
  10021. that.size.width = newWidth;
  10022. that.size.height = newHeight;
  10023. that.position.top = op.top - oy;
  10024. } else if ( /^(sw)$/.test( a ) ) {
  10025. that.size.width = newWidth;
  10026. that.size.height = newHeight;
  10027. that.position.left = op.left - ox;
  10028. } else {
  10029. if ( newHeight - gridY <= 0 || newWidth - gridX <= 0 ) {
  10030. outerDimensions = that._getPaddingPlusBorderDimensions( this );
  10031. }
  10032. if ( newHeight - gridY > 0 ) {
  10033. that.size.height = newHeight;
  10034. that.position.top = op.top - oy;
  10035. } else {
  10036. newHeight = gridY - outerDimensions.height;
  10037. that.size.height = newHeight;
  10038. that.position.top = op.top + os.height - newHeight;
  10039. }
  10040. if ( newWidth - gridX > 0 ) {
  10041. that.size.width = newWidth;
  10042. that.position.left = op.left - ox;
  10043. } else {
  10044. newWidth = gridX - outerDimensions.width;
  10045. that.size.width = newWidth;
  10046. that.position.left = op.left + os.width - newWidth;
  10047. }
  10048. }
  10049. }
  10050. } );
  10051. var widgetsResizable = $.ui.resizable;
  10052. /*!
  10053. * jQuery UI Dialog 1.12.1
  10054. * http://jqueryui.com
  10055. *
  10056. * Copyright jQuery Foundation and other contributors
  10057. * Released under the MIT license.
  10058. * http://jquery.org/license
  10059. */
  10060. //>>label: Dialog
  10061. //>>group: Widgets
  10062. //>>description: Displays customizable dialog windows.
  10063. //>>docs: http://api.jqueryui.com/dialog/
  10064. //>>demos: http://jqueryui.com/dialog/
  10065. //>>css.structure: ../../themes/base/core.css
  10066. //>>css.structure: ../../themes/base/dialog.css
  10067. //>>css.theme: ../../themes/base/theme.css
  10068. $.widget( "ui.dialog", {
  10069. version: "1.12.1",
  10070. options: {
  10071. appendTo: "body",
  10072. autoOpen: true,
  10073. buttons: [],
  10074. classes: {
  10075. "ui-dialog": "ui-corner-all",
  10076. "ui-dialog-titlebar": "ui-corner-all"
  10077. },
  10078. closeOnEscape: true,
  10079. closeText: "Close",
  10080. draggable: true,
  10081. hide: null,
  10082. height: "auto",
  10083. maxHeight: null,
  10084. maxWidth: null,
  10085. minHeight: 150,
  10086. minWidth: 150,
  10087. modal: false,
  10088. position: {
  10089. my: "center",
  10090. at: "center",
  10091. of: window,
  10092. collision: "fit",
  10093. // Ensure the titlebar is always visible
  10094. using: function( pos ) {
  10095. var topOffset = $( this ).css( pos ).offset().top;
  10096. if ( topOffset < 0 ) {
  10097. $( this ).css( "top", pos.top - topOffset );
  10098. }
  10099. }
  10100. },
  10101. resizable: true,
  10102. show: null,
  10103. title: null,
  10104. width: 300,
  10105. // Callbacks
  10106. beforeClose: null,
  10107. close: null,
  10108. drag: null,
  10109. dragStart: null,
  10110. dragStop: null,
  10111. focus: null,
  10112. open: null,
  10113. resize: null,
  10114. resizeStart: null,
  10115. resizeStop: null
  10116. },
  10117. sizeRelatedOptions: {
  10118. buttons: true,
  10119. height: true,
  10120. maxHeight: true,
  10121. maxWidth: true,
  10122. minHeight: true,
  10123. minWidth: true,
  10124. width: true
  10125. },
  10126. resizableRelatedOptions: {
  10127. maxHeight: true,
  10128. maxWidth: true,
  10129. minHeight: true,
  10130. minWidth: true
  10131. },
  10132. _create: function() {
  10133. this.originalCss = {
  10134. display: this.element[ 0 ].style.display,
  10135. width: this.element[ 0 ].style.width,
  10136. minHeight: this.element[ 0 ].style.minHeight,
  10137. maxHeight: this.element[ 0 ].style.maxHeight,
  10138. height: this.element[ 0 ].style.height
  10139. };
  10140. this.originalPosition = {
  10141. parent: this.element.parent(),
  10142. index: this.element.parent().children().index( this.element )
  10143. };
  10144. this.originalTitle = this.element.attr( "title" );
  10145. if ( this.options.title == null && this.originalTitle != null ) {
  10146. this.options.title = this.originalTitle;
  10147. }
  10148. // Dialogs can't be disabled
  10149. if ( this.options.disabled ) {
  10150. this.options.disabled = false;
  10151. }
  10152. this._createWrapper();
  10153. this.element
  10154. .show()
  10155. .removeAttr( "title" )
  10156. .appendTo( this.uiDialog );
  10157. this._addClass( "ui-dialog-content", "ui-widget-content" );
  10158. this._createTitlebar();
  10159. this._createButtonPane();
  10160. if ( this.options.draggable && $.fn.draggable ) {
  10161. this._makeDraggable();
  10162. }
  10163. if ( this.options.resizable && $.fn.resizable ) {
  10164. this._makeResizable();
  10165. }
  10166. this._isOpen = false;
  10167. this._trackFocus();
  10168. },
  10169. _init: function() {
  10170. if ( this.options.autoOpen ) {
  10171. this.open();
  10172. }
  10173. },
  10174. _appendTo: function() {
  10175. var element = this.options.appendTo;
  10176. if ( element && ( element.jquery || element.nodeType ) ) {
  10177. return $( element );
  10178. }
  10179. return this.document.find( element || "body" ).eq( 0 );
  10180. },
  10181. _destroy: function() {
  10182. var next,
  10183. originalPosition = this.originalPosition;
  10184. this._untrackInstance();
  10185. this._destroyOverlay();
  10186. this.element
  10187. .removeUniqueId()
  10188. .css( this.originalCss )
  10189. // Without detaching first, the following becomes really slow
  10190. .detach();
  10191. this.uiDialog.remove();
  10192. if ( this.originalTitle ) {
  10193. this.element.attr( "title", this.originalTitle );
  10194. }
  10195. next = originalPosition.parent.children().eq( originalPosition.index );
  10196. // Don't try to place the dialog next to itself (#8613)
  10197. if ( next.length && next[ 0 ] !== this.element[ 0 ] ) {
  10198. next.before( this.element );
  10199. } else {
  10200. originalPosition.parent.append( this.element );
  10201. }
  10202. },
  10203. widget: function() {
  10204. return this.uiDialog;
  10205. },
  10206. disable: $.noop,
  10207. enable: $.noop,
  10208. close: function( event ) {
  10209. var that = this;
  10210. if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) {
  10211. return;
  10212. }
  10213. this._isOpen = false;
  10214. this._focusedElement = null;
  10215. this._destroyOverlay();
  10216. this._untrackInstance();
  10217. if ( !this.opener.filter( ":focusable" ).trigger( "focus" ).length ) {
  10218. // Hiding a focused element doesn't trigger blur in WebKit
  10219. // so in case we have nothing to focus on, explicitly blur the active element
  10220. // https://bugs.webkit.org/show_bug.cgi?id=47182
  10221. $.ui.safeBlur( $.ui.safeActiveElement( this.document[ 0 ] ) );
  10222. }
  10223. this._hide( this.uiDialog, this.options.hide, function() {
  10224. that._trigger( "close", event );
  10225. } );
  10226. },
  10227. isOpen: function() {
  10228. return this._isOpen;
  10229. },
  10230. moveToTop: function() {
  10231. this._moveToTop();
  10232. },
  10233. _moveToTop: function( event, silent ) {
  10234. var moved = false,
  10235. zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map( function() {
  10236. return +$( this ).css( "z-index" );
  10237. } ).get(),
  10238. zIndexMax = Math.max.apply( null, zIndices );
  10239. if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) {
  10240. this.uiDialog.css( "z-index", zIndexMax + 1 );
  10241. moved = true;
  10242. }
  10243. if ( moved && !silent ) {
  10244. this._trigger( "focus", event );
  10245. }
  10246. return moved;
  10247. },
  10248. open: function() {
  10249. var that = this;
  10250. if ( this._isOpen ) {
  10251. if ( this._moveToTop() ) {
  10252. this._focusTabbable();
  10253. }
  10254. return;
  10255. }
  10256. this._isOpen = true;
  10257. this.opener = $( $.ui.safeActiveElement( this.document[ 0 ] ) );
  10258. this._size();
  10259. this._position();
  10260. this._createOverlay();
  10261. this._moveToTop( null, true );
  10262. // Ensure the overlay is moved to the top with the dialog, but only when
  10263. // opening. The overlay shouldn't move after the dialog is open so that
  10264. // modeless dialogs opened after the modal dialog stack properly.
  10265. if ( this.overlay ) {
  10266. this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 );
  10267. }
  10268. this._show( this.uiDialog, this.options.show, function() {
  10269. that._focusTabbable();
  10270. that._trigger( "focus" );
  10271. } );
  10272. // Track the dialog immediately upon openening in case a focus event
  10273. // somehow occurs outside of the dialog before an element inside the
  10274. // dialog is focused (#10152)
  10275. this._makeFocusTarget();
  10276. this._trigger( "open" );
  10277. },
  10278. _focusTabbable: function() {
  10279. // Set focus to the first match:
  10280. // 1. An element that was focused previously
  10281. // 2. First element inside the dialog matching [autofocus]
  10282. // 3. Tabbable element inside the content element
  10283. // 4. Tabbable element inside the buttonpane
  10284. // 5. The close button
  10285. // 6. The dialog itself
  10286. var hasFocus = this._focusedElement;
  10287. if ( !hasFocus ) {
  10288. hasFocus = this.element.find( "[autofocus]" );
  10289. }
  10290. if ( !hasFocus.length ) {
  10291. hasFocus = this.element.find( ":tabbable" );
  10292. }
  10293. if ( !hasFocus.length ) {
  10294. hasFocus = this.uiDialogButtonPane.find( ":tabbable" );
  10295. }
  10296. if ( !hasFocus.length ) {
  10297. hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" );
  10298. }
  10299. if ( !hasFocus.length ) {
  10300. hasFocus = this.uiDialog;
  10301. }
  10302. hasFocus.eq( 0 ).trigger( "focus" );
  10303. },
  10304. _keepFocus: function( event ) {
  10305. function checkFocus() {
  10306. var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ),
  10307. isActive = this.uiDialog[ 0 ] === activeElement ||
  10308. $.contains( this.uiDialog[ 0 ], activeElement );
  10309. if ( !isActive ) {
  10310. this._focusTabbable();
  10311. }
  10312. }
  10313. event.preventDefault();
  10314. checkFocus.call( this );
  10315. // support: IE
  10316. // IE <= 8 doesn't prevent moving focus even with event.preventDefault()
  10317. // so we check again later
  10318. this._delay( checkFocus );
  10319. },
  10320. _createWrapper: function() {
  10321. this.uiDialog = $( "<div>" )
  10322. .hide()
  10323. .attr( {
  10324. // Setting tabIndex makes the div focusable
  10325. tabIndex: -1,
  10326. role: "dialog"
  10327. } )
  10328. .appendTo( this._appendTo() );
  10329. this._addClass( this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front" );
  10330. this._on( this.uiDialog, {
  10331. keydown: function( event ) {
  10332. if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
  10333. event.keyCode === $.ui.keyCode.ESCAPE ) {
  10334. event.preventDefault();
  10335. this.close( event );
  10336. return;
  10337. }
  10338. // Prevent tabbing out of dialogs
  10339. if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) {
  10340. return;
  10341. }
  10342. var tabbables = this.uiDialog.find( ":tabbable" ),
  10343. first = tabbables.filter( ":first" ),
  10344. last = tabbables.filter( ":last" );
  10345. if ( ( event.target === last[ 0 ] || event.target === this.uiDialog[ 0 ] ) &&
  10346. !event.shiftKey ) {
  10347. this._delay( function() {
  10348. first.trigger( "focus" );
  10349. } );
  10350. event.preventDefault();
  10351. } else if ( ( event.target === first[ 0 ] ||
  10352. event.target === this.uiDialog[ 0 ] ) && event.shiftKey ) {
  10353. this._delay( function() {
  10354. last.trigger( "focus" );
  10355. } );
  10356. event.preventDefault();
  10357. }
  10358. },
  10359. mousedown: function( event ) {
  10360. if ( this._moveToTop( event ) ) {
  10361. this._focusTabbable();
  10362. }
  10363. }
  10364. } );
  10365. // We assume that any existing aria-describedby attribute means
  10366. // that the dialog content is marked up properly
  10367. // otherwise we brute force the content as the description
  10368. if ( !this.element.find( "[aria-describedby]" ).length ) {
  10369. this.uiDialog.attr( {
  10370. "aria-describedby": this.element.uniqueId().attr( "id" )
  10371. } );
  10372. }
  10373. },
  10374. _createTitlebar: function() {
  10375. var uiDialogTitle;
  10376. this.uiDialogTitlebar = $( "<div>" );
  10377. this._addClass( this.uiDialogTitlebar,
  10378. "ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix" );
  10379. this._on( this.uiDialogTitlebar, {
  10380. mousedown: function( event ) {
  10381. // Don't prevent click on close button (#8838)
  10382. // Focusing a dialog that is partially scrolled out of view
  10383. // causes the browser to scroll it into view, preventing the click event
  10384. if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) {
  10385. // Dialog isn't getting focus when dragging (#8063)
  10386. this.uiDialog.trigger( "focus" );
  10387. }
  10388. }
  10389. } );
  10390. // Support: IE
  10391. // Use type="button" to prevent enter keypresses in textboxes from closing the
  10392. // dialog in IE (#9312)
  10393. this.uiDialogTitlebarClose = $( "<button type='button'></button>" )
  10394. .button( {
  10395. label: $( "<a>" ).text( this.options.closeText ).html(),
  10396. icon: "ui-icon-closethick",
  10397. showLabel: false
  10398. } )
  10399. .appendTo( this.uiDialogTitlebar );
  10400. this._addClass( this.uiDialogTitlebarClose, "ui-dialog-titlebar-close" );
  10401. this._on( this.uiDialogTitlebarClose, {
  10402. click: function( event ) {
  10403. event.preventDefault();
  10404. this.close( event );
  10405. }
  10406. } );
  10407. uiDialogTitle = $( "<span>" ).uniqueId().prependTo( this.uiDialogTitlebar );
  10408. this._addClass( uiDialogTitle, "ui-dialog-title" );
  10409. this._title( uiDialogTitle );
  10410. this.uiDialogTitlebar.prependTo( this.uiDialog );
  10411. this.uiDialog.attr( {
  10412. "aria-labelledby": uiDialogTitle.attr( "id" )
  10413. } );
  10414. },
  10415. _title: function( title ) {
  10416. if ( this.options.title ) {
  10417. title.text( this.options.title );
  10418. } else {
  10419. title.html( "&#160;" );
  10420. }
  10421. },
  10422. _createButtonPane: function() {
  10423. this.uiDialogButtonPane = $( "<div>" );
  10424. this._addClass( this.uiDialogButtonPane, "ui-dialog-buttonpane",
  10425. "ui-widget-content ui-helper-clearfix" );
  10426. this.uiButtonSet = $( "<div>" )
  10427. .appendTo( this.uiDialogButtonPane );
  10428. this._addClass( this.uiButtonSet, "ui-dialog-buttonset" );
  10429. this._createButtons();
  10430. },
  10431. _createButtons: function() {
  10432. var that = this,
  10433. buttons = this.options.buttons;
  10434. // If we already have a button pane, remove it
  10435. this.uiDialogButtonPane.remove();
  10436. this.uiButtonSet.empty();
  10437. if ( $.isEmptyObject( buttons ) || ( $.isArray( buttons ) && !buttons.length ) ) {
  10438. this._removeClass( this.uiDialog, "ui-dialog-buttons" );
  10439. return;
  10440. }
  10441. $.each( buttons, function( name, props ) {
  10442. var click, buttonOptions;
  10443. props = $.isFunction( props ) ?
  10444. { click: props, text: name } :
  10445. props;
  10446. // Default to a non-submitting button
  10447. props = $.extend( { type: "button" }, props );
  10448. // Change the context for the click callback to be the main element
  10449. click = props.click;
  10450. buttonOptions = {
  10451. icon: props.icon,
  10452. iconPosition: props.iconPosition,
  10453. showLabel: props.showLabel,
  10454. // Deprecated options
  10455. icons: props.icons,
  10456. text: props.text
  10457. };
  10458. delete props.click;
  10459. delete props.icon;
  10460. delete props.iconPosition;
  10461. delete props.showLabel;
  10462. // Deprecated options
  10463. delete props.icons;
  10464. if ( typeof props.text === "boolean" ) {
  10465. delete props.text;
  10466. }
  10467. $( "<button></button>", props )
  10468. .button( buttonOptions )
  10469. .appendTo( that.uiButtonSet )
  10470. .on( "click", function() {
  10471. click.apply( that.element[ 0 ], arguments );
  10472. } );
  10473. } );
  10474. this._addClass( this.uiDialog, "ui-dialog-buttons" );
  10475. this.uiDialogButtonPane.appendTo( this.uiDialog );
  10476. },
  10477. _makeDraggable: function() {
  10478. var that = this,
  10479. options = this.options;
  10480. function filteredUi( ui ) {
  10481. return {
  10482. position: ui.position,
  10483. offset: ui.offset
  10484. };
  10485. }
  10486. this.uiDialog.draggable( {
  10487. cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
  10488. handle: ".ui-dialog-titlebar",
  10489. containment: "document",
  10490. start: function( event, ui ) {
  10491. that._addClass( $( this ), "ui-dialog-dragging" );
  10492. that._blockFrames();
  10493. that._trigger( "dragStart", event, filteredUi( ui ) );
  10494. },
  10495. drag: function( event, ui ) {
  10496. that._trigger( "drag", event, filteredUi( ui ) );
  10497. },
  10498. stop: function( event, ui ) {
  10499. var left = ui.offset.left - that.document.scrollLeft(),
  10500. top = ui.offset.top - that.document.scrollTop();
  10501. options.position = {
  10502. my: "left top",
  10503. at: "left" + ( left >= 0 ? "+" : "" ) + left + " " +
  10504. "top" + ( top >= 0 ? "+" : "" ) + top,
  10505. of: that.window
  10506. };
  10507. that._removeClass( $( this ), "ui-dialog-dragging" );
  10508. that._unblockFrames();
  10509. that._trigger( "dragStop", event, filteredUi( ui ) );
  10510. }
  10511. } );
  10512. },
  10513. _makeResizable: function() {
  10514. var that = this,
  10515. options = this.options,
  10516. handles = options.resizable,
  10517. // .ui-resizable has position: relative defined in the stylesheet
  10518. // but dialogs have to use absolute or fixed positioning
  10519. position = this.uiDialog.css( "position" ),
  10520. resizeHandles = typeof handles === "string" ?
  10521. handles :
  10522. "n,e,s,w,se,sw,ne,nw";
  10523. function filteredUi( ui ) {
  10524. return {
  10525. originalPosition: ui.originalPosition,
  10526. originalSize: ui.originalSize,
  10527. position: ui.position,
  10528. size: ui.size
  10529. };
  10530. }
  10531. this.uiDialog.resizable( {
  10532. cancel: ".ui-dialog-content",
  10533. containment: "document",
  10534. alsoResize: this.element,
  10535. maxWidth: options.maxWidth,
  10536. maxHeight: options.maxHeight,
  10537. minWidth: options.minWidth,
  10538. minHeight: this._minHeight(),
  10539. handles: resizeHandles,
  10540. start: function( event, ui ) {
  10541. that._addClass( $( this ), "ui-dialog-resizing" );
  10542. that._blockFrames();
  10543. that._trigger( "resizeStart", event, filteredUi( ui ) );
  10544. },
  10545. resize: function( event, ui ) {
  10546. that._trigger( "resize", event, filteredUi( ui ) );
  10547. },
  10548. stop: function( event, ui ) {
  10549. var offset = that.uiDialog.offset(),
  10550. left = offset.left - that.document.scrollLeft(),
  10551. top = offset.top - that.document.scrollTop();
  10552. options.height = that.uiDialog.height();
  10553. options.width = that.uiDialog.width();
  10554. options.position = {
  10555. my: "left top",
  10556. at: "left" + ( left >= 0 ? "+" : "" ) + left + " " +
  10557. "top" + ( top >= 0 ? "+" : "" ) + top,
  10558. of: that.window
  10559. };
  10560. that._removeClass( $( this ), "ui-dialog-resizing" );
  10561. that._unblockFrames();
  10562. that._trigger( "resizeStop", event, filteredUi( ui ) );
  10563. }
  10564. } )
  10565. .css( "position", position );
  10566. },
  10567. _trackFocus: function() {
  10568. this._on( this.widget(), {
  10569. focusin: function( event ) {
  10570. this._makeFocusTarget();
  10571. this._focusedElement = $( event.target );
  10572. }
  10573. } );
  10574. },
  10575. _makeFocusTarget: function() {
  10576. this._untrackInstance();
  10577. this._trackingInstances().unshift( this );
  10578. },
  10579. _untrackInstance: function() {
  10580. var instances = this._trackingInstances(),
  10581. exists = $.inArray( this, instances );
  10582. if ( exists !== -1 ) {
  10583. instances.splice( exists, 1 );
  10584. }
  10585. },
  10586. _trackingInstances: function() {
  10587. var instances = this.document.data( "ui-dialog-instances" );
  10588. if ( !instances ) {
  10589. instances = [];
  10590. this.document.data( "ui-dialog-instances", instances );
  10591. }
  10592. return instances;
  10593. },
  10594. _minHeight: function() {
  10595. var options = this.options;
  10596. return options.height === "auto" ?
  10597. options.minHeight :
  10598. Math.min( options.minHeight, options.height );
  10599. },
  10600. _position: function() {
  10601. // Need to show the dialog to get the actual offset in the position plugin
  10602. var isVisible = this.uiDialog.is( ":visible" );
  10603. if ( !isVisible ) {
  10604. this.uiDialog.show();
  10605. }
  10606. this.uiDialog.position( this.options.position );
  10607. if ( !isVisible ) {
  10608. this.uiDialog.hide();
  10609. }
  10610. },
  10611. _setOptions: function( options ) {
  10612. var that = this,
  10613. resize = false,
  10614. resizableOptions = {};
  10615. $.each( options, function( key, value ) {
  10616. that._setOption( key, value );
  10617. if ( key in that.sizeRelatedOptions ) {
  10618. resize = true;
  10619. }
  10620. if ( key in that.resizableRelatedOptions ) {
  10621. resizableOptions[ key ] = value;
  10622. }
  10623. } );
  10624. if ( resize ) {
  10625. this._size();
  10626. this._position();
  10627. }
  10628. if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
  10629. this.uiDialog.resizable( "option", resizableOptions );
  10630. }
  10631. },
  10632. _setOption: function( key, value ) {
  10633. var isDraggable, isResizable,
  10634. uiDialog = this.uiDialog;
  10635. if ( key === "disabled" ) {
  10636. return;
  10637. }
  10638. this._super( key, value );
  10639. if ( key === "appendTo" ) {
  10640. this.uiDialog.appendTo( this._appendTo() );
  10641. }
  10642. if ( key === "buttons" ) {
  10643. this._createButtons();
  10644. }
  10645. if ( key === "closeText" ) {
  10646. this.uiDialogTitlebarClose.button( {
  10647. // Ensure that we always pass a string
  10648. label: $( "<a>" ).text( "" + this.options.closeText ).html()
  10649. } );
  10650. }
  10651. if ( key === "draggable" ) {
  10652. isDraggable = uiDialog.is( ":data(ui-draggable)" );
  10653. if ( isDraggable && !value ) {
  10654. uiDialog.draggable( "destroy" );
  10655. }
  10656. if ( !isDraggable && value ) {
  10657. this._makeDraggable();
  10658. }
  10659. }
  10660. if ( key === "position" ) {
  10661. this._position();
  10662. }
  10663. if ( key === "resizable" ) {
  10664. // currently resizable, becoming non-resizable
  10665. isResizable = uiDialog.is( ":data(ui-resizable)" );
  10666. if ( isResizable && !value ) {
  10667. uiDialog.resizable( "destroy" );
  10668. }
  10669. // Currently resizable, changing handles
  10670. if ( isResizable && typeof value === "string" ) {
  10671. uiDialog.resizable( "option", "handles", value );
  10672. }
  10673. // Currently non-resizable, becoming resizable
  10674. if ( !isResizable && value !== false ) {
  10675. this._makeResizable();
  10676. }
  10677. }
  10678. if ( key === "title" ) {
  10679. this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) );
  10680. }
  10681. },
  10682. _size: function() {
  10683. // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
  10684. // divs will both have width and height set, so we need to reset them
  10685. var nonContentHeight, minContentHeight, maxContentHeight,
  10686. options = this.options;
  10687. // Reset content sizing
  10688. this.element.show().css( {
  10689. width: "auto",
  10690. minHeight: 0,
  10691. maxHeight: "none",
  10692. height: 0
  10693. } );
  10694. if ( options.minWidth > options.width ) {
  10695. options.width = options.minWidth;
  10696. }
  10697. // Reset wrapper sizing
  10698. // determine the height of all the non-content elements
  10699. nonContentHeight = this.uiDialog.css( {
  10700. height: "auto",
  10701. width: options.width
  10702. } )
  10703. .outerHeight();
  10704. minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
  10705. maxContentHeight = typeof options.maxHeight === "number" ?
  10706. Math.max( 0, options.maxHeight - nonContentHeight ) :
  10707. "none";
  10708. if ( options.height === "auto" ) {
  10709. this.element.css( {
  10710. minHeight: minContentHeight,
  10711. maxHeight: maxContentHeight,
  10712. height: "auto"
  10713. } );
  10714. } else {
  10715. this.element.height( Math.max( 0, options.height - nonContentHeight ) );
  10716. }
  10717. if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
  10718. this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
  10719. }
  10720. },
  10721. _blockFrames: function() {
  10722. this.iframeBlocks = this.document.find( "iframe" ).map( function() {
  10723. var iframe = $( this );
  10724. return $( "<div>" )
  10725. .css( {
  10726. position: "absolute",
  10727. width: iframe.outerWidth(),
  10728. height: iframe.outerHeight()
  10729. } )
  10730. .appendTo( iframe.parent() )
  10731. .offset( iframe.offset() )[ 0 ];
  10732. } );
  10733. },
  10734. _unblockFrames: function() {
  10735. if ( this.iframeBlocks ) {
  10736. this.iframeBlocks.remove();
  10737. delete this.iframeBlocks;
  10738. }
  10739. },
  10740. _allowInteraction: function( event ) {
  10741. if ( $( event.target ).closest( ".ui-dialog" ).length ) {
  10742. return true;
  10743. }
  10744. // TODO: Remove hack when datepicker implements
  10745. // the .ui-front logic (#8989)
  10746. return !!$( event.target ).closest( ".ui-datepicker" ).length;
  10747. },
  10748. _createOverlay: function() {
  10749. if ( !this.options.modal ) {
  10750. return;
  10751. }
  10752. // We use a delay in case the overlay is created from an
  10753. // event that we're going to be cancelling (#2804)
  10754. var isOpening = true;
  10755. this._delay( function() {
  10756. isOpening = false;
  10757. } );
  10758. if ( !this.document.data( "ui-dialog-overlays" ) ) {
  10759. // Prevent use of anchors and inputs
  10760. // Using _on() for an event handler shared across many instances is
  10761. // safe because the dialogs stack and must be closed in reverse order
  10762. this._on( this.document, {
  10763. focusin: function( event ) {
  10764. if ( isOpening ) {
  10765. return;
  10766. }
  10767. if ( !this._allowInteraction( event ) ) {
  10768. event.preventDefault();
  10769. this._trackingInstances()[ 0 ]._focusTabbable();
  10770. }
  10771. }
  10772. } );
  10773. }
  10774. this.overlay = $( "<div>" )
  10775. .appendTo( this._appendTo() );
  10776. this._addClass( this.overlay, null, "ui-widget-overlay ui-front" );
  10777. this._on( this.overlay, {
  10778. mousedown: "_keepFocus"
  10779. } );
  10780. this.document.data( "ui-dialog-overlays",
  10781. ( this.document.data( "ui-dialog-overlays" ) || 0 ) + 1 );
  10782. },
  10783. _destroyOverlay: function() {
  10784. if ( !this.options.modal ) {
  10785. return;
  10786. }
  10787. if ( this.overlay ) {
  10788. var overlays = this.document.data( "ui-dialog-overlays" ) - 1;
  10789. if ( !overlays ) {
  10790. this._off( this.document, "focusin" );
  10791. this.document.removeData( "ui-dialog-overlays" );
  10792. } else {
  10793. this.document.data( "ui-dialog-overlays", overlays );
  10794. }
  10795. this.overlay.remove();
  10796. this.overlay = null;
  10797. }
  10798. }
  10799. } );
  10800. // DEPRECATED
  10801. // TODO: switch return back to widget declaration at top of file when this is removed
  10802. if ( $.uiBackCompat !== false ) {
  10803. // Backcompat for dialogClass option
  10804. $.widget( "ui.dialog", $.ui.dialog, {
  10805. options: {
  10806. dialogClass: ""
  10807. },
  10808. _createWrapper: function() {
  10809. this._super();
  10810. this.uiDialog.addClass( this.options.dialogClass );
  10811. },
  10812. _setOption: function( key, value ) {
  10813. if ( key === "dialogClass" ) {
  10814. this.uiDialog
  10815. .removeClass( this.options.dialogClass )
  10816. .addClass( value );
  10817. }
  10818. this._superApply( arguments );
  10819. }
  10820. } );
  10821. }
  10822. var widgetsDialog = $.ui.dialog;
  10823. /*!
  10824. * jQuery UI Droppable 1.12.1
  10825. * http://jqueryui.com
  10826. *
  10827. * Copyright jQuery Foundation and other contributors
  10828. * Released under the MIT license.
  10829. * http://jquery.org/license
  10830. */
  10831. //>>label: Droppable
  10832. //>>group: Interactions
  10833. //>>description: Enables drop targets for draggable elements.
  10834. //>>docs: http://api.jqueryui.com/droppable/
  10835. //>>demos: http://jqueryui.com/droppable/
  10836. $.widget( "ui.droppable", {
  10837. version: "1.12.1",
  10838. widgetEventPrefix: "drop",
  10839. options: {
  10840. accept: "*",
  10841. addClasses: true,
  10842. greedy: false,
  10843. scope: "default",
  10844. tolerance: "intersect",
  10845. // Callbacks
  10846. activate: null,
  10847. deactivate: null,
  10848. drop: null,
  10849. out: null,
  10850. over: null
  10851. },
  10852. _create: function() {
  10853. var proportions,
  10854. o = this.options,
  10855. accept = o.accept;
  10856. this.isover = false;
  10857. this.isout = true;
  10858. this.accept = $.isFunction( accept ) ? accept : function( d ) {
  10859. return d.is( accept );
  10860. };
  10861. this.proportions = function( /* valueToWrite */ ) {
  10862. if ( arguments.length ) {
  10863. // Store the droppable's proportions
  10864. proportions = arguments[ 0 ];
  10865. } else {
  10866. // Retrieve or derive the droppable's proportions
  10867. return proportions ?
  10868. proportions :
  10869. proportions = {
  10870. width: this.element[ 0 ].offsetWidth,
  10871. height: this.element[ 0 ].offsetHeight
  10872. };
  10873. }
  10874. };
  10875. this._addToManager( o.scope );
  10876. o.addClasses && this._addClass( "ui-droppable" );
  10877. },
  10878. _addToManager: function( scope ) {
  10879. // Add the reference and positions to the manager
  10880. $.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || [];
  10881. $.ui.ddmanager.droppables[ scope ].push( this );
  10882. },
  10883. _splice: function( drop ) {
  10884. var i = 0;
  10885. for ( ; i < drop.length; i++ ) {
  10886. if ( drop[ i ] === this ) {
  10887. drop.splice( i, 1 );
  10888. }
  10889. }
  10890. },
  10891. _destroy: function() {
  10892. var drop = $.ui.ddmanager.droppables[ this.options.scope ];
  10893. this._splice( drop );
  10894. },
  10895. _setOption: function( key, value ) {
  10896. if ( key === "accept" ) {
  10897. this.accept = $.isFunction( value ) ? value : function( d ) {
  10898. return d.is( value );
  10899. };
  10900. } else if ( key === "scope" ) {
  10901. var drop = $.ui.ddmanager.droppables[ this.options.scope ];
  10902. this._splice( drop );
  10903. this._addToManager( value );
  10904. }
  10905. this._super( key, value );
  10906. },
  10907. _activate: function( event ) {
  10908. var draggable = $.ui.ddmanager.current;
  10909. this._addActiveClass();
  10910. if ( draggable ) {
  10911. this._trigger( "activate", event, this.ui( draggable ) );
  10912. }
  10913. },
  10914. _deactivate: function( event ) {
  10915. var draggable = $.ui.ddmanager.current;
  10916. this._removeActiveClass();
  10917. if ( draggable ) {
  10918. this._trigger( "deactivate", event, this.ui( draggable ) );
  10919. }
  10920. },
  10921. _over: function( event ) {
  10922. var draggable = $.ui.ddmanager.current;
  10923. // Bail if draggable and droppable are same element
  10924. if ( !draggable || ( draggable.currentItem ||
  10925. draggable.element )[ 0 ] === this.element[ 0 ] ) {
  10926. return;
  10927. }
  10928. if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem ||
  10929. draggable.element ) ) ) {
  10930. this._addHoverClass();
  10931. this._trigger( "over", event, this.ui( draggable ) );
  10932. }
  10933. },
  10934. _out: function( event ) {
  10935. var draggable = $.ui.ddmanager.current;
  10936. // Bail if draggable and droppable are same element
  10937. if ( !draggable || ( draggable.currentItem ||
  10938. draggable.element )[ 0 ] === this.element[ 0 ] ) {
  10939. return;
  10940. }
  10941. if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem ||
  10942. draggable.element ) ) ) {
  10943. this._removeHoverClass();
  10944. this._trigger( "out", event, this.ui( draggable ) );
  10945. }
  10946. },
  10947. _drop: function( event, custom ) {
  10948. var draggable = custom || $.ui.ddmanager.current,
  10949. childrenIntersection = false;
  10950. // Bail if draggable and droppable are same element
  10951. if ( !draggable || ( draggable.currentItem ||
  10952. draggable.element )[ 0 ] === this.element[ 0 ] ) {
  10953. return false;
  10954. }
  10955. this.element
  10956. .find( ":data(ui-droppable)" )
  10957. .not( ".ui-draggable-dragging" )
  10958. .each( function() {
  10959. var inst = $( this ).droppable( "instance" );
  10960. if (
  10961. inst.options.greedy &&
  10962. !inst.options.disabled &&
  10963. inst.options.scope === draggable.options.scope &&
  10964. inst.accept.call(
  10965. inst.element[ 0 ], ( draggable.currentItem || draggable.element )
  10966. ) &&
  10967. intersect(
  10968. draggable,
  10969. $.extend( inst, { offset: inst.element.offset() } ),
  10970. inst.options.tolerance, event
  10971. )
  10972. ) {
  10973. childrenIntersection = true;
  10974. return false; }
  10975. } );
  10976. if ( childrenIntersection ) {
  10977. return false;
  10978. }
  10979. if ( this.accept.call( this.element[ 0 ],
  10980. ( draggable.currentItem || draggable.element ) ) ) {
  10981. this._removeActiveClass();
  10982. this._removeHoverClass();
  10983. this._trigger( "drop", event, this.ui( draggable ) );
  10984. return this.element;
  10985. }
  10986. return false;
  10987. },
  10988. ui: function( c ) {
  10989. return {
  10990. draggable: ( c.currentItem || c.element ),
  10991. helper: c.helper,
  10992. position: c.position,
  10993. offset: c.positionAbs
  10994. };
  10995. },
  10996. // Extension points just to make backcompat sane and avoid duplicating logic
  10997. // TODO: Remove in 1.13 along with call to it below
  10998. _addHoverClass: function() {
  10999. this._addClass( "ui-droppable-hover" );
  11000. },
  11001. _removeHoverClass: function() {
  11002. this._removeClass( "ui-droppable-hover" );
  11003. },
  11004. _addActiveClass: function() {
  11005. this._addClass( "ui-droppable-active" );
  11006. },
  11007. _removeActiveClass: function() {
  11008. this._removeClass( "ui-droppable-active" );
  11009. }
  11010. } );
  11011. var intersect = $.ui.intersect = ( function() {
  11012. function isOverAxis( x, reference, size ) {
  11013. return ( x >= reference ) && ( x < ( reference + size ) );
  11014. }
  11015. return function( draggable, droppable, toleranceMode, event ) {
  11016. if ( !droppable.offset ) {
  11017. return false;
  11018. }
  11019. var x1 = ( draggable.positionAbs ||
  11020. draggable.position.absolute ).left + draggable.margins.left,
  11021. y1 = ( draggable.positionAbs ||
  11022. draggable.position.absolute ).top + draggable.margins.top,
  11023. x2 = x1 + draggable.helperProportions.width,
  11024. y2 = y1 + draggable.helperProportions.height,
  11025. l = droppable.offset.left,
  11026. t = droppable.offset.top,
  11027. r = l + droppable.proportions().width,
  11028. b = t + droppable.proportions().height;
  11029. switch ( toleranceMode ) {
  11030. case "fit":
  11031. return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b );
  11032. case "intersect":
  11033. return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half
  11034. x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half
  11035. t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half
  11036. y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half
  11037. case "pointer":
  11038. return isOverAxis( event.pageY, t, droppable.proportions().height ) &&
  11039. isOverAxis( event.pageX, l, droppable.proportions().width );
  11040. case "touch":
  11041. return (
  11042. ( y1 >= t && y1 <= b ) || // Top edge touching
  11043. ( y2 >= t && y2 <= b ) || // Bottom edge touching
  11044. ( y1 < t && y2 > b ) // Surrounded vertically
  11045. ) && (
  11046. ( x1 >= l && x1 <= r ) || // Left edge touching
  11047. ( x2 >= l && x2 <= r ) || // Right edge touching
  11048. ( x1 < l && x2 > r ) // Surrounded horizontally
  11049. );
  11050. default:
  11051. return false;
  11052. }
  11053. };
  11054. } )();
  11055. /*
  11056. This manager tracks offsets of draggables and droppables
  11057. */
  11058. $.ui.ddmanager = {
  11059. current: null,
  11060. droppables: { "default": [] },
  11061. prepareOffsets: function( t, event ) {
  11062. var i, j,
  11063. m = $.ui.ddmanager.droppables[ t.options.scope ] || [],
  11064. type = event ? event.type : null, // workaround for #2317
  11065. list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack();
  11066. droppablesLoop: for ( i = 0; i < m.length; i++ ) {
  11067. // No disabled and non-accepted
  11068. if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ],
  11069. ( t.currentItem || t.element ) ) ) ) {
  11070. continue;
  11071. }
  11072. // Filter out elements in the current dragged item
  11073. for ( j = 0; j < list.length; j++ ) {
  11074. if ( list[ j ] === m[ i ].element[ 0 ] ) {
  11075. m[ i ].proportions().height = 0;
  11076. continue droppablesLoop;
  11077. }
  11078. }
  11079. m[ i ].visible = m[ i ].element.css( "display" ) !== "none";
  11080. if ( !m[ i ].visible ) {
  11081. continue;
  11082. }
  11083. // Activate the droppable if used directly from draggables
  11084. if ( type === "mousedown" ) {
  11085. m[ i ]._activate.call( m[ i ], event );
  11086. }
  11087. m[ i ].offset = m[ i ].element.offset();
  11088. m[ i ].proportions( {
  11089. width: m[ i ].element[ 0 ].offsetWidth,
  11090. height: m[ i ].element[ 0 ].offsetHeight
  11091. } );
  11092. }
  11093. },
  11094. drop: function( draggable, event ) {
  11095. var dropped = false;
  11096. // Create a copy of the droppables in case the list changes during the drop (#9116)
  11097. $.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() {
  11098. if ( !this.options ) {
  11099. return;
  11100. }
  11101. if ( !this.options.disabled && this.visible &&
  11102. intersect( draggable, this, this.options.tolerance, event ) ) {
  11103. dropped = this._drop.call( this, event ) || dropped;
  11104. }
  11105. if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ],
  11106. ( draggable.currentItem || draggable.element ) ) ) {
  11107. this.isout = true;
  11108. this.isover = false;
  11109. this._deactivate.call( this, event );
  11110. }
  11111. } );
  11112. return dropped;
  11113. },
  11114. dragStart: function( draggable, event ) {
  11115. // Listen for scrolling so that if the dragging causes scrolling the position of the
  11116. // droppables can be recalculated (see #5003)
  11117. draggable.element.parentsUntil( "body" ).on( "scroll.droppable", function() {
  11118. if ( !draggable.options.refreshPositions ) {
  11119. $.ui.ddmanager.prepareOffsets( draggable, event );
  11120. }
  11121. } );
  11122. },
  11123. drag: function( draggable, event ) {
  11124. // If you have a highly dynamic page, you might try this option. It renders positions
  11125. // every time you move the mouse.
  11126. if ( draggable.options.refreshPositions ) {
  11127. $.ui.ddmanager.prepareOffsets( draggable, event );
  11128. }
  11129. // Run through all droppables and check their positions based on specific tolerance options
  11130. $.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() {
  11131. if ( this.options.disabled || this.greedyChild || !this.visible ) {
  11132. return;
  11133. }
  11134. var parentInstance, scope, parent,
  11135. intersects = intersect( draggable, this, this.options.tolerance, event ),
  11136. c = !intersects && this.isover ?
  11137. "isout" :
  11138. ( intersects && !this.isover ? "isover" : null );
  11139. if ( !c ) {
  11140. return;
  11141. }
  11142. if ( this.options.greedy ) {
  11143. // find droppable parents with same scope
  11144. scope = this.options.scope;
  11145. parent = this.element.parents( ":data(ui-droppable)" ).filter( function() {
  11146. return $( this ).droppable( "instance" ).options.scope === scope;
  11147. } );
  11148. if ( parent.length ) {
  11149. parentInstance = $( parent[ 0 ] ).droppable( "instance" );
  11150. parentInstance.greedyChild = ( c === "isover" );
  11151. }
  11152. }
  11153. // We just moved into a greedy child
  11154. if ( parentInstance && c === "isover" ) {
  11155. parentInstance.isover = false;
  11156. parentInstance.isout = true;
  11157. parentInstance._out.call( parentInstance, event );
  11158. }
  11159. this[ c ] = true;
  11160. this[ c === "isout" ? "isover" : "isout" ] = false;
  11161. this[ c === "isover" ? "_over" : "_out" ].call( this, event );
  11162. // We just moved out of a greedy child
  11163. if ( parentInstance && c === "isout" ) {
  11164. parentInstance.isout = false;
  11165. parentInstance.isover = true;
  11166. parentInstance._over.call( parentInstance, event );
  11167. }
  11168. } );
  11169. },
  11170. dragStop: function( draggable, event ) {
  11171. draggable.element.parentsUntil( "body" ).off( "scroll.droppable" );
  11172. // Call prepareOffsets one final time since IE does not fire return scroll events when
  11173. // overflow was caused by drag (see #5003)
  11174. if ( !draggable.options.refreshPositions ) {
  11175. $.ui.ddmanager.prepareOffsets( draggable, event );
  11176. }
  11177. }
  11178. };
  11179. // DEPRECATED
  11180. // TODO: switch return back to widget declaration at top of file when this is removed
  11181. if ( $.uiBackCompat !== false ) {
  11182. // Backcompat for activeClass and hoverClass options
  11183. $.widget( "ui.droppable", $.ui.droppable, {
  11184. options: {
  11185. hoverClass: false,
  11186. activeClass: false
  11187. },
  11188. _addActiveClass: function() {
  11189. this._super();
  11190. if ( this.options.activeClass ) {
  11191. this.element.addClass( this.options.activeClass );
  11192. }
  11193. },
  11194. _removeActiveClass: function() {
  11195. this._super();
  11196. if ( this.options.activeClass ) {
  11197. this.element.removeClass( this.options.activeClass );
  11198. }
  11199. },
  11200. _addHoverClass: function() {
  11201. this._super();
  11202. if ( this.options.hoverClass ) {
  11203. this.element.addClass( this.options.hoverClass );
  11204. }
  11205. },
  11206. _removeHoverClass: function() {
  11207. this._super();
  11208. if ( this.options.hoverClass ) {
  11209. this.element.removeClass( this.options.hoverClass );
  11210. }
  11211. }
  11212. } );
  11213. }
  11214. var widgetsDroppable = $.ui.droppable;
  11215. /*!
  11216. * jQuery UI Progressbar 1.12.1
  11217. * http://jqueryui.com
  11218. *
  11219. * Copyright jQuery Foundation and other contributors
  11220. * Released under the MIT license.
  11221. * http://jquery.org/license
  11222. */
  11223. //>>label: Progressbar
  11224. //>>group: Widgets
  11225. // jscs:disable maximumLineLength
  11226. //>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators.
  11227. // jscs:enable maximumLineLength
  11228. //>>docs: http://api.jqueryui.com/progressbar/
  11229. //>>demos: http://jqueryui.com/progressbar/
  11230. //>>css.structure: ../../themes/base/core.css
  11231. //>>css.structure: ../../themes/base/progressbar.css
  11232. //>>css.theme: ../../themes/base/theme.css
  11233. var widgetsProgressbar = $.widget( "ui.progressbar", {
  11234. version: "1.12.1",
  11235. options: {
  11236. classes: {
  11237. "ui-progressbar": "ui-corner-all",
  11238. "ui-progressbar-value": "ui-corner-left",
  11239. "ui-progressbar-complete": "ui-corner-right"
  11240. },
  11241. max: 100,
  11242. value: 0,
  11243. change: null,
  11244. complete: null
  11245. },
  11246. min: 0,
  11247. _create: function() {
  11248. // Constrain initial value
  11249. this.oldValue = this.options.value = this._constrainedValue();
  11250. this.element.attr( {
  11251. // Only set static values; aria-valuenow and aria-valuemax are
  11252. // set inside _refreshValue()
  11253. role: "progressbar",
  11254. "aria-valuemin": this.min
  11255. } );
  11256. this._addClass( "ui-progressbar", "ui-widget ui-widget-content" );
  11257. this.valueDiv = $( "<div>" ).appendTo( this.element );
  11258. this._addClass( this.valueDiv, "ui-progressbar-value", "ui-widget-header" );
  11259. this._refreshValue();
  11260. },
  11261. _destroy: function() {
  11262. this.element.removeAttr( "role aria-valuemin aria-valuemax aria-valuenow" );
  11263. this.valueDiv.remove();
  11264. },
  11265. value: function( newValue ) {
  11266. if ( newValue === undefined ) {
  11267. return this.options.value;
  11268. }
  11269. this.options.value = this._constrainedValue( newValue );
  11270. this._refreshValue();
  11271. },
  11272. _constrainedValue: function( newValue ) {
  11273. if ( newValue === undefined ) {
  11274. newValue = this.options.value;
  11275. }
  11276. this.indeterminate = newValue === false;
  11277. // Sanitize value
  11278. if ( typeof newValue !== "number" ) {
  11279. newValue = 0;
  11280. }
  11281. return this.indeterminate ? false :
  11282. Math.min( this.options.max, Math.max( this.min, newValue ) );
  11283. },
  11284. _setOptions: function( options ) {
  11285. // Ensure "value" option is set after other values (like max)
  11286. var value = options.value;
  11287. delete options.value;
  11288. this._super( options );
  11289. this.options.value = this._constrainedValue( value );
  11290. this._refreshValue();
  11291. },
  11292. _setOption: function( key, value ) {
  11293. if ( key === "max" ) {
  11294. // Don't allow a max less than min
  11295. value = Math.max( this.min, value );
  11296. }
  11297. this._super( key, value );
  11298. },
  11299. _setOptionDisabled: function( value ) {
  11300. this._super( value );
  11301. this.element.attr( "aria-disabled", value );
  11302. this._toggleClass( null, "ui-state-disabled", !!value );
  11303. },
  11304. _percentage: function() {
  11305. return this.indeterminate ?
  11306. 100 :
  11307. 100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
  11308. },
  11309. _refreshValue: function() {
  11310. var value = this.options.value,
  11311. percentage = this._percentage();
  11312. this.valueDiv
  11313. .toggle( this.indeterminate || value > this.min )
  11314. .width( percentage.toFixed( 0 ) + "%" );
  11315. this
  11316. ._toggleClass( this.valueDiv, "ui-progressbar-complete", null,
  11317. value === this.options.max )
  11318. ._toggleClass( "ui-progressbar-indeterminate", null, this.indeterminate );
  11319. if ( this.indeterminate ) {
  11320. this.element.removeAttr( "aria-valuenow" );
  11321. if ( !this.overlayDiv ) {
  11322. this.overlayDiv = $( "<div>" ).appendTo( this.valueDiv );
  11323. this._addClass( this.overlayDiv, "ui-progressbar-overlay" );
  11324. }
  11325. } else {
  11326. this.element.attr( {
  11327. "aria-valuemax": this.options.max,
  11328. "aria-valuenow": value
  11329. } );
  11330. if ( this.overlayDiv ) {
  11331. this.overlayDiv.remove();
  11332. this.overlayDiv = null;
  11333. }
  11334. }
  11335. if ( this.oldValue !== value ) {
  11336. this.oldValue = value;
  11337. this._trigger( "change" );
  11338. }
  11339. if ( value === this.options.max ) {
  11340. this._trigger( "complete" );
  11341. }
  11342. }
  11343. } );
  11344. /*!
  11345. * jQuery UI Selectable 1.12.1
  11346. * http://jqueryui.com
  11347. *
  11348. * Copyright jQuery Foundation and other contributors
  11349. * Released under the MIT license.
  11350. * http://jquery.org/license
  11351. */
  11352. //>>label: Selectable
  11353. //>>group: Interactions
  11354. //>>description: Allows groups of elements to be selected with the mouse.
  11355. //>>docs: http://api.jqueryui.com/selectable/
  11356. //>>demos: http://jqueryui.com/selectable/
  11357. //>>css.structure: ../../themes/base/selectable.css
  11358. var widgetsSelectable = $.widget( "ui.selectable", $.ui.mouse, {
  11359. version: "1.12.1",
  11360. options: {
  11361. appendTo: "body",
  11362. autoRefresh: true,
  11363. distance: 0,
  11364. filter: "*",
  11365. tolerance: "touch",
  11366. // Callbacks
  11367. selected: null,
  11368. selecting: null,
  11369. start: null,
  11370. stop: null,
  11371. unselected: null,
  11372. unselecting: null
  11373. },
  11374. _create: function() {
  11375. var that = this;
  11376. this._addClass( "ui-selectable" );
  11377. this.dragged = false;
  11378. // Cache selectee children based on filter
  11379. this.refresh = function() {
  11380. that.elementPos = $( that.element[ 0 ] ).offset();
  11381. that.selectees = $( that.options.filter, that.element[ 0 ] );
  11382. that._addClass( that.selectees, "ui-selectee" );
  11383. that.selectees.each( function() {
  11384. var $this = $( this ),
  11385. selecteeOffset = $this.offset(),
  11386. pos = {
  11387. left: selecteeOffset.left - that.elementPos.left,
  11388. top: selecteeOffset.top - that.elementPos.top
  11389. };
  11390. $.data( this, "selectable-item", {
  11391. element: this,
  11392. $element: $this,
  11393. left: pos.left,
  11394. top: pos.top,
  11395. right: pos.left + $this.outerWidth(),
  11396. bottom: pos.top + $this.outerHeight(),
  11397. startselected: false,
  11398. selected: $this.hasClass( "ui-selected" ),
  11399. selecting: $this.hasClass( "ui-selecting" ),
  11400. unselecting: $this.hasClass( "ui-unselecting" )
  11401. } );
  11402. } );
  11403. };
  11404. this.refresh();
  11405. this._mouseInit();
  11406. this.helper = $( "<div>" );
  11407. this._addClass( this.helper, "ui-selectable-helper" );
  11408. },
  11409. _destroy: function() {
  11410. this.selectees.removeData( "selectable-item" );
  11411. this._mouseDestroy();
  11412. },
  11413. _mouseStart: function( event ) {
  11414. var that = this,
  11415. options = this.options;
  11416. this.opos = [ event.pageX, event.pageY ];
  11417. this.elementPos = $( this.element[ 0 ] ).offset();
  11418. if ( this.options.disabled ) {
  11419. return;
  11420. }
  11421. this.selectees = $( options.filter, this.element[ 0 ] );
  11422. this._trigger( "start", event );
  11423. $( options.appendTo ).append( this.helper );
  11424. // position helper (lasso)
  11425. this.helper.css( {
  11426. "left": event.pageX,
  11427. "top": event.pageY,
  11428. "width": 0,
  11429. "height": 0
  11430. } );
  11431. if ( options.autoRefresh ) {
  11432. this.refresh();
  11433. }
  11434. this.selectees.filter( ".ui-selected" ).each( function() {
  11435. var selectee = $.data( this, "selectable-item" );
  11436. selectee.startselected = true;
  11437. if ( !event.metaKey && !event.ctrlKey ) {
  11438. that._removeClass( selectee.$element, "ui-selected" );
  11439. selectee.selected = false;
  11440. that._addClass( selectee.$element, "ui-unselecting" );
  11441. selectee.unselecting = true;
  11442. // selectable UNSELECTING callback
  11443. that._trigger( "unselecting", event, {
  11444. unselecting: selectee.element
  11445. } );
  11446. }
  11447. } );
  11448. $( event.target ).parents().addBack().each( function() {
  11449. var doSelect,
  11450. selectee = $.data( this, "selectable-item" );
  11451. if ( selectee ) {
  11452. doSelect = ( !event.metaKey && !event.ctrlKey ) ||
  11453. !selectee.$element.hasClass( "ui-selected" );
  11454. that._removeClass( selectee.$element, doSelect ? "ui-unselecting" : "ui-selected" )
  11455. ._addClass( selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting" );
  11456. selectee.unselecting = !doSelect;
  11457. selectee.selecting = doSelect;
  11458. selectee.selected = doSelect;
  11459. // selectable (UN)SELECTING callback
  11460. if ( doSelect ) {
  11461. that._trigger( "selecting", event, {
  11462. selecting: selectee.element
  11463. } );
  11464. } else {
  11465. that._trigger( "unselecting", event, {
  11466. unselecting: selectee.element
  11467. } );
  11468. }
  11469. return false;
  11470. }
  11471. } );
  11472. },
  11473. _mouseDrag: function( event ) {
  11474. this.dragged = true;
  11475. if ( this.options.disabled ) {
  11476. return;
  11477. }
  11478. var tmp,
  11479. that = this,
  11480. options = this.options,
  11481. x1 = this.opos[ 0 ],
  11482. y1 = this.opos[ 1 ],
  11483. x2 = event.pageX,
  11484. y2 = event.pageY;
  11485. if ( x1 > x2 ) { tmp = x2; x2 = x1; x1 = tmp; }
  11486. if ( y1 > y2 ) { tmp = y2; y2 = y1; y1 = tmp; }
  11487. this.helper.css( { left: x1, top: y1, width: x2 - x1, height: y2 - y1 } );
  11488. this.selectees.each( function() {
  11489. var selectee = $.data( this, "selectable-item" ),
  11490. hit = false,
  11491. offset = {};
  11492. //prevent helper from being selected if appendTo: selectable
  11493. if ( !selectee || selectee.element === that.element[ 0 ] ) {
  11494. return;
  11495. }
  11496. offset.left = selectee.left + that.elementPos.left;
  11497. offset.right = selectee.right + that.elementPos.left;
  11498. offset.top = selectee.top + that.elementPos.top;
  11499. offset.bottom = selectee.bottom + that.elementPos.top;
  11500. if ( options.tolerance === "touch" ) {
  11501. hit = ( !( offset.left > x2 || offset.right < x1 || offset.top > y2 ||
  11502. offset.bottom < y1 ) );
  11503. } else if ( options.tolerance === "fit" ) {
  11504. hit = ( offset.left > x1 && offset.right < x2 && offset.top > y1 &&
  11505. offset.bottom < y2 );
  11506. }
  11507. if ( hit ) {
  11508. // SELECT
  11509. if ( selectee.selected ) {
  11510. that._removeClass( selectee.$element, "ui-selected" );
  11511. selectee.selected = false;
  11512. }
  11513. if ( selectee.unselecting ) {
  11514. that._removeClass( selectee.$element, "ui-unselecting" );
  11515. selectee.unselecting = false;
  11516. }
  11517. if ( !selectee.selecting ) {
  11518. that._addClass( selectee.$element, "ui-selecting" );
  11519. selectee.selecting = true;
  11520. // selectable SELECTING callback
  11521. that._trigger( "selecting", event, {
  11522. selecting: selectee.element
  11523. } );
  11524. }
  11525. } else {
  11526. // UNSELECT
  11527. if ( selectee.selecting ) {
  11528. if ( ( event.metaKey || event.ctrlKey ) && selectee.startselected ) {
  11529. that._removeClass( selectee.$element, "ui-selecting" );
  11530. selectee.selecting = false;
  11531. that._addClass( selectee.$element, "ui-selected" );
  11532. selectee.selected = true;
  11533. } else {
  11534. that._removeClass( selectee.$element, "ui-selecting" );
  11535. selectee.selecting = false;
  11536. if ( selectee.startselected ) {
  11537. that._addClass( selectee.$element, "ui-unselecting" );
  11538. selectee.unselecting = true;
  11539. }
  11540. // selectable UNSELECTING callback
  11541. that._trigger( "unselecting", event, {
  11542. unselecting: selectee.element
  11543. } );
  11544. }
  11545. }
  11546. if ( selectee.selected ) {
  11547. if ( !event.metaKey && !event.ctrlKey && !selectee.startselected ) {
  11548. that._removeClass( selectee.$element, "ui-selected" );
  11549. selectee.selected = false;
  11550. that._addClass( selectee.$element, "ui-unselecting" );
  11551. selectee.unselecting = true;
  11552. // selectable UNSELECTING callback
  11553. that._trigger( "unselecting", event, {
  11554. unselecting: selectee.element
  11555. } );
  11556. }
  11557. }
  11558. }
  11559. } );
  11560. return false;
  11561. },
  11562. _mouseStop: function( event ) {
  11563. var that = this;
  11564. this.dragged = false;
  11565. $( ".ui-unselecting", this.element[ 0 ] ).each( function() {
  11566. var selectee = $.data( this, "selectable-item" );
  11567. that._removeClass( selectee.$element, "ui-unselecting" );
  11568. selectee.unselecting = false;
  11569. selectee.startselected = false;
  11570. that._trigger( "unselected", event, {
  11571. unselected: selectee.element
  11572. } );
  11573. } );
  11574. $( ".ui-selecting", this.element[ 0 ] ).each( function() {
  11575. var selectee = $.data( this, "selectable-item" );
  11576. that._removeClass( selectee.$element, "ui-selecting" )
  11577. ._addClass( selectee.$element, "ui-selected" );
  11578. selectee.selecting = false;
  11579. selectee.selected = true;
  11580. selectee.startselected = true;
  11581. that._trigger( "selected", event, {
  11582. selected: selectee.element
  11583. } );
  11584. } );
  11585. this._trigger( "stop", event );
  11586. this.helper.remove();
  11587. return false;
  11588. }
  11589. } );
  11590. /*!
  11591. * jQuery UI Selectmenu 1.12.1
  11592. * http://jqueryui.com
  11593. *
  11594. * Copyright jQuery Foundation and other contributors
  11595. * Released under the MIT license.
  11596. * http://jquery.org/license
  11597. */
  11598. //>>label: Selectmenu
  11599. //>>group: Widgets
  11600. // jscs:disable maximumLineLength
  11601. //>>description: Duplicates and extends the functionality of a native HTML select element, allowing it to be customizable in behavior and appearance far beyond the limitations of a native select.
  11602. // jscs:enable maximumLineLength
  11603. //>>docs: http://api.jqueryui.com/selectmenu/
  11604. //>>demos: http://jqueryui.com/selectmenu/
  11605. //>>css.structure: ../../themes/base/core.css
  11606. //>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css
  11607. //>>css.theme: ../../themes/base/theme.css
  11608. var widgetsSelectmenu = $.widget( "ui.selectmenu", [ $.ui.formResetMixin, {
  11609. version: "1.12.1",
  11610. defaultElement: "<select>",
  11611. options: {
  11612. appendTo: null,
  11613. classes: {
  11614. "ui-selectmenu-button-open": "ui-corner-top",
  11615. "ui-selectmenu-button-closed": "ui-corner-all"
  11616. },
  11617. disabled: null,
  11618. icons: {
  11619. button: "ui-icon-triangle-1-s"
  11620. },
  11621. position: {
  11622. my: "left top",
  11623. at: "left bottom",
  11624. collision: "none"
  11625. },
  11626. width: false,
  11627. // Callbacks
  11628. change: null,
  11629. close: null,
  11630. focus: null,
  11631. open: null,
  11632. select: null
  11633. },
  11634. _create: function() {
  11635. var selectmenuId = this.element.uniqueId().attr( "id" );
  11636. this.ids = {
  11637. element: selectmenuId,
  11638. button: selectmenuId + "-button",
  11639. menu: selectmenuId + "-menu"
  11640. };
  11641. this._drawButton();
  11642. this._drawMenu();
  11643. this._bindFormResetHandler();
  11644. this._rendered = false;
  11645. this.menuItems = $();
  11646. },
  11647. _drawButton: function() {
  11648. var icon,
  11649. that = this,
  11650. item = this._parseOption(
  11651. this.element.find( "option:selected" ),
  11652. this.element[ 0 ].selectedIndex
  11653. );
  11654. // Associate existing label with the new button
  11655. this.labels = this.element.labels().attr( "for", this.ids.button );
  11656. this._on( this.labels, {
  11657. click: function( event ) {
  11658. this.button.focus();
  11659. event.preventDefault();
  11660. }
  11661. } );
  11662. // Hide original select element
  11663. this.element.hide();
  11664. // Create button
  11665. this.button = $( "<span>", {
  11666. tabindex: this.options.disabled ? -1 : 0,
  11667. id: this.ids.button,
  11668. role: "combobox",
  11669. "aria-expanded": "false",
  11670. "aria-autocomplete": "list",
  11671. "aria-owns": this.ids.menu,
  11672. "aria-haspopup": "true",
  11673. title: this.element.attr( "title" )
  11674. } )
  11675. .insertAfter( this.element );
  11676. this._addClass( this.button, "ui-selectmenu-button ui-selectmenu-button-closed",
  11677. "ui-button ui-widget" );
  11678. icon = $( "<span>" ).appendTo( this.button );
  11679. this._addClass( icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button );
  11680. this.buttonItem = this._renderButtonItem( item )
  11681. .appendTo( this.button );
  11682. if ( this.options.width !== false ) {
  11683. this._resizeButton();
  11684. }
  11685. this._on( this.button, this._buttonEvents );
  11686. this.button.one( "focusin", function() {
  11687. // Delay rendering the menu items until the button receives focus.
  11688. // The menu may have already been rendered via a programmatic open.
  11689. if ( !that._rendered ) {
  11690. that._refreshMenu();
  11691. }
  11692. } );
  11693. },
  11694. _drawMenu: function() {
  11695. var that = this;
  11696. // Create menu
  11697. this.menu = $( "<ul>", {
  11698. "aria-hidden": "true",
  11699. "aria-labelledby": this.ids.button,
  11700. id: this.ids.menu
  11701. } );
  11702. // Wrap menu
  11703. this.menuWrap = $( "<div>" ).append( this.menu );
  11704. this._addClass( this.menuWrap, "ui-selectmenu-menu", "ui-front" );
  11705. this.menuWrap.appendTo( this._appendTo() );
  11706. // Initialize menu widget
  11707. this.menuInstance = this.menu
  11708. .menu( {
  11709. classes: {
  11710. "ui-menu": "ui-corner-bottom"
  11711. },
  11712. role: "listbox",
  11713. select: function( event, ui ) {
  11714. event.preventDefault();
  11715. // Support: IE8
  11716. // If the item was selected via a click, the text selection
  11717. // will be destroyed in IE
  11718. that._setSelection();
  11719. that._select( ui.item.data( "ui-selectmenu-item" ), event );
  11720. },
  11721. focus: function( event, ui ) {
  11722. var item = ui.item.data( "ui-selectmenu-item" );
  11723. // Prevent inital focus from firing and check if its a newly focused item
  11724. if ( that.focusIndex != null && item.index !== that.focusIndex ) {
  11725. that._trigger( "focus", event, { item: item } );
  11726. if ( !that.isOpen ) {
  11727. that._select( item, event );
  11728. }
  11729. }
  11730. that.focusIndex = item.index;
  11731. that.button.attr( "aria-activedescendant",
  11732. that.menuItems.eq( item.index ).attr( "id" ) );
  11733. }
  11734. } )
  11735. .menu( "instance" );
  11736. // Don't close the menu on mouseleave
  11737. this.menuInstance._off( this.menu, "mouseleave" );
  11738. // Cancel the menu's collapseAll on document click
  11739. this.menuInstance._closeOnDocumentClick = function() {
  11740. return false;
  11741. };
  11742. // Selects often contain empty items, but never contain dividers
  11743. this.menuInstance._isDivider = function() {
  11744. return false;
  11745. };
  11746. },
  11747. refresh: function() {
  11748. this._refreshMenu();
  11749. this.buttonItem.replaceWith(
  11750. this.buttonItem = this._renderButtonItem(
  11751. // Fall back to an empty object in case there are no options
  11752. this._getSelectedItem().data( "ui-selectmenu-item" ) || {}
  11753. )
  11754. );
  11755. if ( this.options.width === null ) {
  11756. this._resizeButton();
  11757. }
  11758. },
  11759. _refreshMenu: function() {
  11760. var item,
  11761. options = this.element.find( "option" );
  11762. this.menu.empty();
  11763. this._parseOptions( options );
  11764. this._renderMenu( this.menu, this.items );
  11765. this.menuInstance.refresh();
  11766. this.menuItems = this.menu.find( "li" )
  11767. .not( ".ui-selectmenu-optgroup" )
  11768. .find( ".ui-menu-item-wrapper" );
  11769. this._rendered = true;
  11770. if ( !options.length ) {
  11771. return;
  11772. }
  11773. item = this._getSelectedItem();
  11774. // Update the menu to have the correct item focused
  11775. this.menuInstance.focus( null, item );
  11776. this._setAria( item.data( "ui-selectmenu-item" ) );
  11777. // Set disabled state
  11778. this._setOption( "disabled", this.element.prop( "disabled" ) );
  11779. },
  11780. open: function( event ) {
  11781. if ( this.options.disabled ) {
  11782. return;
  11783. }
  11784. // If this is the first time the menu is being opened, render the items
  11785. if ( !this._rendered ) {
  11786. this._refreshMenu();
  11787. } else {
  11788. // Menu clears focus on close, reset focus to selected item
  11789. this._removeClass( this.menu.find( ".ui-state-active" ), null, "ui-state-active" );
  11790. this.menuInstance.focus( null, this._getSelectedItem() );
  11791. }
  11792. // If there are no options, don't open the menu
  11793. if ( !this.menuItems.length ) {
  11794. return;
  11795. }
  11796. this.isOpen = true;
  11797. this._toggleAttr();
  11798. this._resizeMenu();
  11799. this._position();
  11800. this._on( this.document, this._documentClick );
  11801. this._trigger( "open", event );
  11802. },
  11803. _position: function() {
  11804. this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) );
  11805. },
  11806. close: function( event ) {
  11807. if ( !this.isOpen ) {
  11808. return;
  11809. }
  11810. this.isOpen = false;
  11811. this._toggleAttr();
  11812. this.range = null;
  11813. this._off( this.document );
  11814. this._trigger( "close", event );
  11815. },
  11816. widget: function() {
  11817. return this.button;
  11818. },
  11819. menuWidget: function() {
  11820. return this.menu;
  11821. },
  11822. _renderButtonItem: function( item ) {
  11823. var buttonItem = $( "<span>" );
  11824. this._setText( buttonItem, item.label );
  11825. this._addClass( buttonItem, "ui-selectmenu-text" );
  11826. return buttonItem;
  11827. },
  11828. _renderMenu: function( ul, items ) {
  11829. var that = this,
  11830. currentOptgroup = "";
  11831. $.each( items, function( index, item ) {
  11832. var li;
  11833. if ( item.optgroup !== currentOptgroup ) {
  11834. li = $( "<li>", {
  11835. text: item.optgroup
  11836. } );
  11837. that._addClass( li, "ui-selectmenu-optgroup", "ui-menu-divider" +
  11838. ( item.element.parent( "optgroup" ).prop( "disabled" ) ?
  11839. " ui-state-disabled" :
  11840. "" ) );
  11841. li.appendTo( ul );
  11842. currentOptgroup = item.optgroup;
  11843. }
  11844. that._renderItemData( ul, item );
  11845. } );
  11846. },
  11847. _renderItemData: function( ul, item ) {
  11848. return this._renderItem( ul, item ).data( "ui-selectmenu-item", item );
  11849. },
  11850. _renderItem: function( ul, item ) {
  11851. var li = $( "<li>" ),
  11852. wrapper = $( "<div>", {
  11853. title: item.element.attr( "title" )
  11854. } );
  11855. if ( item.disabled ) {
  11856. this._addClass( li, null, "ui-state-disabled" );
  11857. }
  11858. this._setText( wrapper, item.label );
  11859. return li.append( wrapper ).appendTo( ul );
  11860. },
  11861. _setText: function( element, value ) {
  11862. if ( value ) {
  11863. element.text( value );
  11864. } else {
  11865. element.html( "&#160;" );
  11866. }
  11867. },
  11868. _move: function( direction, event ) {
  11869. var item, next,
  11870. filter = ".ui-menu-item";
  11871. if ( this.isOpen ) {
  11872. item = this.menuItems.eq( this.focusIndex ).parent( "li" );
  11873. } else {
  11874. item = this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" );
  11875. filter += ":not(.ui-state-disabled)";
  11876. }
  11877. if ( direction === "first" || direction === "last" ) {
  11878. next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 );
  11879. } else {
  11880. next = item[ direction + "All" ]( filter ).eq( 0 );
  11881. }
  11882. if ( next.length ) {
  11883. this.menuInstance.focus( event, next );
  11884. }
  11885. },
  11886. _getSelectedItem: function() {
  11887. return this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" );
  11888. },
  11889. _toggle: function( event ) {
  11890. this[ this.isOpen ? "close" : "open" ]( event );
  11891. },
  11892. _setSelection: function() {
  11893. var selection;
  11894. if ( !this.range ) {
  11895. return;
  11896. }
  11897. if ( window.getSelection ) {
  11898. selection = window.getSelection();
  11899. selection.removeAllRanges();
  11900. selection.addRange( this.range );
  11901. // Support: IE8
  11902. } else {
  11903. this.range.select();
  11904. }
  11905. // Support: IE
  11906. // Setting the text selection kills the button focus in IE, but
  11907. // restoring the focus doesn't kill the selection.
  11908. this.button.focus();
  11909. },
  11910. _documentClick: {
  11911. mousedown: function( event ) {
  11912. if ( !this.isOpen ) {
  11913. return;
  11914. }
  11915. if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" +
  11916. $.ui.escapeSelector( this.ids.button ) ).length ) {
  11917. this.close( event );
  11918. }
  11919. }
  11920. },
  11921. _buttonEvents: {
  11922. // Prevent text selection from being reset when interacting with the selectmenu (#10144)
  11923. mousedown: function() {
  11924. var selection;
  11925. if ( window.getSelection ) {
  11926. selection = window.getSelection();
  11927. if ( selection.rangeCount ) {
  11928. this.range = selection.getRangeAt( 0 );
  11929. }
  11930. // Support: IE8
  11931. } else {
  11932. this.range = document.selection.createRange();
  11933. }
  11934. },
  11935. click: function( event ) {
  11936. this._setSelection();
  11937. this._toggle( event );
  11938. },
  11939. keydown: function( event ) {
  11940. var preventDefault = true;
  11941. switch ( event.keyCode ) {
  11942. case $.ui.keyCode.TAB:
  11943. case $.ui.keyCode.ESCAPE:
  11944. this.close( event );
  11945. preventDefault = false;
  11946. break;
  11947. case $.ui.keyCode.ENTER:
  11948. if ( this.isOpen ) {
  11949. this._selectFocusedItem( event );
  11950. }
  11951. break;
  11952. case $.ui.keyCode.UP:
  11953. if ( event.altKey ) {
  11954. this._toggle( event );
  11955. } else {
  11956. this._move( "prev", event );
  11957. }
  11958. break;
  11959. case $.ui.keyCode.DOWN:
  11960. if ( event.altKey ) {
  11961. this._toggle( event );
  11962. } else {
  11963. this._move( "next", event );
  11964. }
  11965. break;
  11966. case $.ui.keyCode.SPACE:
  11967. if ( this.isOpen ) {
  11968. this._selectFocusedItem( event );
  11969. } else {
  11970. this._toggle( event );
  11971. }
  11972. break;
  11973. case $.ui.keyCode.LEFT:
  11974. this._move( "prev", event );
  11975. break;
  11976. case $.ui.keyCode.RIGHT:
  11977. this._move( "next", event );
  11978. break;
  11979. case $.ui.keyCode.HOME:
  11980. case $.ui.keyCode.PAGE_UP:
  11981. this._move( "first", event );
  11982. break;
  11983. case $.ui.keyCode.END:
  11984. case $.ui.keyCode.PAGE_DOWN:
  11985. this._move( "last", event );
  11986. break;
  11987. default:
  11988. this.menu.trigger( event );
  11989. preventDefault = false;
  11990. }
  11991. if ( preventDefault ) {
  11992. event.preventDefault();
  11993. }
  11994. }
  11995. },
  11996. _selectFocusedItem: function( event ) {
  11997. var item = this.menuItems.eq( this.focusIndex ).parent( "li" );
  11998. if ( !item.hasClass( "ui-state-disabled" ) ) {
  11999. this._select( item.data( "ui-selectmenu-item" ), event );
  12000. }
  12001. },
  12002. _select: function( item, event ) {
  12003. var oldIndex = this.element[ 0 ].selectedIndex;
  12004. // Change native select element
  12005. this.element[ 0 ].selectedIndex = item.index;
  12006. this.buttonItem.replaceWith( this.buttonItem = this._renderButtonItem( item ) );
  12007. this._setAria( item );
  12008. this._trigger( "select", event, { item: item } );
  12009. if ( item.index !== oldIndex ) {
  12010. this._trigger( "change", event, { item: item } );
  12011. }
  12012. this.close( event );
  12013. },
  12014. _setAria: function( item ) {
  12015. var id = this.menuItems.eq( item.index ).attr( "id" );
  12016. this.button.attr( {
  12017. "aria-labelledby": id,
  12018. "aria-activedescendant": id
  12019. } );
  12020. this.menu.attr( "aria-activedescendant", id );
  12021. },
  12022. _setOption: function( key, value ) {
  12023. if ( key === "icons" ) {
  12024. var icon = this.button.find( "span.ui-icon" );
  12025. this._removeClass( icon, null, this.options.icons.button )
  12026. ._addClass( icon, null, value.button );
  12027. }
  12028. this._super( key, value );
  12029. if ( key === "appendTo" ) {
  12030. this.menuWrap.appendTo( this._appendTo() );
  12031. }
  12032. if ( key === "width" ) {
  12033. this._resizeButton();
  12034. }
  12035. },
  12036. _setOptionDisabled: function( value ) {
  12037. this._super( value );
  12038. this.menuInstance.option( "disabled", value );
  12039. this.button.attr( "aria-disabled", value );
  12040. this._toggleClass( this.button, null, "ui-state-disabled", value );
  12041. this.element.prop( "disabled", value );
  12042. if ( value ) {
  12043. this.button.attr( "tabindex", -1 );
  12044. this.close();
  12045. } else {
  12046. this.button.attr( "tabindex", 0 );
  12047. }
  12048. },
  12049. _appendTo: function() {
  12050. var element = this.options.appendTo;
  12051. if ( element ) {
  12052. element = element.jquery || element.nodeType ?
  12053. $( element ) :
  12054. this.document.find( element ).eq( 0 );
  12055. }
  12056. if ( !element || !element[ 0 ] ) {
  12057. element = this.element.closest( ".ui-front, dialog" );
  12058. }
  12059. if ( !element.length ) {
  12060. element = this.document[ 0 ].body;
  12061. }
  12062. return element;
  12063. },
  12064. _toggleAttr: function() {
  12065. this.button.attr( "aria-expanded", this.isOpen );
  12066. // We can't use two _toggleClass() calls here, because we need to make sure
  12067. // we always remove classes first and add them second, otherwise if both classes have the
  12068. // same theme class, it will be removed after we add it.
  12069. this._removeClass( this.button, "ui-selectmenu-button-" +
  12070. ( this.isOpen ? "closed" : "open" ) )
  12071. ._addClass( this.button, "ui-selectmenu-button-" +
  12072. ( this.isOpen ? "open" : "closed" ) )
  12073. ._toggleClass( this.menuWrap, "ui-selectmenu-open", null, this.isOpen );
  12074. this.menu.attr( "aria-hidden", !this.isOpen );
  12075. },
  12076. _resizeButton: function() {
  12077. var width = this.options.width;
  12078. // For `width: false`, just remove inline style and stop
  12079. if ( width === false ) {
  12080. this.button.css( "width", "" );
  12081. return;
  12082. }
  12083. // For `width: null`, match the width of the original element
  12084. if ( width === null ) {
  12085. width = this.element.show().outerWidth();
  12086. this.element.hide();
  12087. }
  12088. this.button.outerWidth( width );
  12089. },
  12090. _resizeMenu: function() {
  12091. this.menu.outerWidth( Math.max(
  12092. this.button.outerWidth(),
  12093. // Support: IE10
  12094. // IE10 wraps long text (possibly a rounding bug)
  12095. // so we add 1px to avoid the wrapping
  12096. this.menu.width( "" ).outerWidth() + 1
  12097. ) );
  12098. },
  12099. _getCreateOptions: function() {
  12100. var options = this._super();
  12101. options.disabled = this.element.prop( "disabled" );
  12102. return options;
  12103. },
  12104. _parseOptions: function( options ) {
  12105. var that = this,
  12106. data = [];
  12107. options.each( function( index, item ) {
  12108. data.push( that._parseOption( $( item ), index ) );
  12109. } );
  12110. this.items = data;
  12111. },
  12112. _parseOption: function( option, index ) {
  12113. var optgroup = option.parent( "optgroup" );
  12114. return {
  12115. element: option,
  12116. index: index,
  12117. value: option.val(),
  12118. label: option.text(),
  12119. optgroup: optgroup.attr( "label" ) || "",
  12120. disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" )
  12121. };
  12122. },
  12123. _destroy: function() {
  12124. this._unbindFormResetHandler();
  12125. this.menuWrap.remove();
  12126. this.button.remove();
  12127. this.element.show();
  12128. this.element.removeUniqueId();
  12129. this.labels.attr( "for", this.ids.element );
  12130. }
  12131. } ] );
  12132. /*!
  12133. * jQuery UI Slider 1.12.1
  12134. * http://jqueryui.com
  12135. *
  12136. * Copyright jQuery Foundation and other contributors
  12137. * Released under the MIT license.
  12138. * http://jquery.org/license
  12139. */
  12140. //>>label: Slider
  12141. //>>group: Widgets
  12142. //>>description: Displays a flexible slider with ranges and accessibility via keyboard.
  12143. //>>docs: http://api.jqueryui.com/slider/
  12144. //>>demos: http://jqueryui.com/slider/
  12145. //>>css.structure: ../../themes/base/core.css
  12146. //>>css.structure: ../../themes/base/slider.css
  12147. //>>css.theme: ../../themes/base/theme.css
  12148. var widgetsSlider = $.widget( "ui.slider", $.ui.mouse, {
  12149. version: "1.12.1",
  12150. widgetEventPrefix: "slide",
  12151. options: {
  12152. animate: false,
  12153. classes: {
  12154. "ui-slider": "ui-corner-all",
  12155. "ui-slider-handle": "ui-corner-all",
  12156. // Note: ui-widget-header isn't the most fittingly semantic framework class for this
  12157. // element, but worked best visually with a variety of themes
  12158. "ui-slider-range": "ui-corner-all ui-widget-header"
  12159. },
  12160. distance: 0,
  12161. max: 100,
  12162. min: 0,
  12163. orientation: "horizontal",
  12164. range: false,
  12165. step: 1,
  12166. value: 0,
  12167. values: null,
  12168. // Callbacks
  12169. change: null,
  12170. slide: null,
  12171. start: null,
  12172. stop: null
  12173. },
  12174. // Number of pages in a slider
  12175. // (how many times can you page up/down to go through the whole range)
  12176. numPages: 5,
  12177. _create: function() {
  12178. this._keySliding = false;
  12179. this._mouseSliding = false;
  12180. this._animateOff = true;
  12181. this._handleIndex = null;
  12182. this._detectOrientation();
  12183. this._mouseInit();
  12184. this._calculateNewMax();
  12185. this._addClass( "ui-slider ui-slider-" + this.orientation,
  12186. "ui-widget ui-widget-content" );
  12187. this._refresh();
  12188. this._animateOff = false;
  12189. },
  12190. _refresh: function() {
  12191. this._createRange();
  12192. this._createHandles();
  12193. this._setupEvents();
  12194. this._refreshValue();
  12195. },
  12196. _createHandles: function() {
  12197. var i, handleCount,
  12198. options = this.options,
  12199. existingHandles = this.element.find( ".ui-slider-handle" ),
  12200. handle = "<span tabindex='0'></span>",
  12201. handles = [];
  12202. handleCount = ( options.values && options.values.length ) || 1;
  12203. if ( existingHandles.length > handleCount ) {
  12204. existingHandles.slice( handleCount ).remove();
  12205. existingHandles = existingHandles.slice( 0, handleCount );
  12206. }
  12207. for ( i = existingHandles.length; i < handleCount; i++ ) {
  12208. handles.push( handle );
  12209. }
  12210. this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );
  12211. this._addClass( this.handles, "ui-slider-handle", "ui-state-default" );
  12212. this.handle = this.handles.eq( 0 );
  12213. this.handles.each( function( i ) {
  12214. $( this )
  12215. .data( "ui-slider-handle-index", i )
  12216. .attr( "tabIndex", 0 );
  12217. } );
  12218. },
  12219. _createRange: function() {
  12220. var options = this.options;
  12221. if ( options.range ) {
  12222. if ( options.range === true ) {
  12223. if ( !options.values ) {
  12224. options.values = [ this._valueMin(), this._valueMin() ];
  12225. } else if ( options.values.length && options.values.length !== 2 ) {
  12226. options.values = [ options.values[ 0 ], options.values[ 0 ] ];
  12227. } else if ( $.isArray( options.values ) ) {
  12228. options.values = options.values.slice( 0 );
  12229. }
  12230. }
  12231. if ( !this.range || !this.range.length ) {
  12232. this.range = $( "<div>" )
  12233. .appendTo( this.element );
  12234. this._addClass( this.range, "ui-slider-range" );
  12235. } else {
  12236. this._removeClass( this.range, "ui-slider-range-min ui-slider-range-max" );
  12237. // Handle range switching from true to min/max
  12238. this.range.css( {
  12239. "left": "",
  12240. "bottom": ""
  12241. } );
  12242. }
  12243. if ( options.range === "min" || options.range === "max" ) {
  12244. this._addClass( this.range, "ui-slider-range-" + options.range );
  12245. }
  12246. } else {
  12247. if ( this.range ) {
  12248. this.range.remove();
  12249. }
  12250. this.range = null;
  12251. }
  12252. },
  12253. _setupEvents: function() {
  12254. this._off( this.handles );
  12255. this._on( this.handles, this._handleEvents );
  12256. this._hoverable( this.handles );
  12257. this._focusable( this.handles );
  12258. },
  12259. _destroy: function() {
  12260. this.handles.remove();
  12261. if ( this.range ) {
  12262. this.range.remove();
  12263. }
  12264. this._mouseDestroy();
  12265. },
  12266. _mouseCapture: function( event ) {
  12267. var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
  12268. that = this,
  12269. o = this.options;
  12270. if ( o.disabled ) {
  12271. return false;
  12272. }
  12273. this.elementSize = {
  12274. width: this.element.outerWidth(),
  12275. height: this.element.outerHeight()
  12276. };
  12277. this.elementOffset = this.element.offset();
  12278. position = { x: event.pageX, y: event.pageY };
  12279. normValue = this._normValueFromMouse( position );
  12280. distance = this._valueMax() - this._valueMin() + 1;
  12281. this.handles.each( function( i ) {
  12282. var thisDistance = Math.abs( normValue - that.values( i ) );
  12283. if ( ( distance > thisDistance ) ||
  12284. ( distance === thisDistance &&
  12285. ( i === that._lastChangedValue || that.values( i ) === o.min ) ) ) {
  12286. distance = thisDistance;
  12287. closestHandle = $( this );
  12288. index = i;
  12289. }
  12290. } );
  12291. allowed = this._start( event, index );
  12292. if ( allowed === false ) {
  12293. return false;
  12294. }
  12295. this._mouseSliding = true;
  12296. this._handleIndex = index;
  12297. this._addClass( closestHandle, null, "ui-state-active" );
  12298. closestHandle.trigger( "focus" );
  12299. offset = closestHandle.offset();
  12300. mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" );
  12301. this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
  12302. left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
  12303. top: event.pageY - offset.top -
  12304. ( closestHandle.height() / 2 ) -
  12305. ( parseInt( closestHandle.css( "borderTopWidth" ), 10 ) || 0 ) -
  12306. ( parseInt( closestHandle.css( "borderBottomWidth" ), 10 ) || 0 ) +
  12307. ( parseInt( closestHandle.css( "marginTop" ), 10 ) || 0 )
  12308. };
  12309. if ( !this.handles.hasClass( "ui-state-hover" ) ) {
  12310. this._slide( event, index, normValue );
  12311. }
  12312. this._animateOff = true;
  12313. return true;
  12314. },
  12315. _mouseStart: function() {
  12316. return true;
  12317. },
  12318. _mouseDrag: function( event ) {
  12319. var position = { x: event.pageX, y: event.pageY },
  12320. normValue = this._normValueFromMouse( position );
  12321. this._slide( event, this._handleIndex, normValue );
  12322. return false;
  12323. },
  12324. _mouseStop: function( event ) {
  12325. this._removeClass( this.handles, null, "ui-state-active" );
  12326. this._mouseSliding = false;
  12327. this._stop( event, this._handleIndex );
  12328. this._change( event, this._handleIndex );
  12329. this._handleIndex = null;
  12330. this._clickOffset = null;
  12331. this._animateOff = false;
  12332. return false;
  12333. },
  12334. _detectOrientation: function() {
  12335. this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
  12336. },
  12337. _normValueFromMouse: function( position ) {
  12338. var pixelTotal,
  12339. pixelMouse,
  12340. percentMouse,
  12341. valueTotal,
  12342. valueMouse;
  12343. if ( this.orientation === "horizontal" ) {
  12344. pixelTotal = this.elementSize.width;
  12345. pixelMouse = position.x - this.elementOffset.left -
  12346. ( this._clickOffset ? this._clickOffset.left : 0 );
  12347. } else {
  12348. pixelTotal = this.elementSize.height;
  12349. pixelMouse = position.y - this.elementOffset.top -
  12350. ( this._clickOffset ? this._clickOffset.top : 0 );
  12351. }
  12352. percentMouse = ( pixelMouse / pixelTotal );
  12353. if ( percentMouse > 1 ) {
  12354. percentMouse = 1;
  12355. }
  12356. if ( percentMouse < 0 ) {
  12357. percentMouse = 0;
  12358. }
  12359. if ( this.orientation === "vertical" ) {
  12360. percentMouse = 1 - percentMouse;
  12361. }
  12362. valueTotal = this._valueMax() - this._valueMin();
  12363. valueMouse = this._valueMin() + percentMouse * valueTotal;
  12364. return this._trimAlignValue( valueMouse );
  12365. },
  12366. _uiHash: function( index, value, values ) {
  12367. var uiHash = {
  12368. handle: this.handles[ index ],
  12369. handleIndex: index,
  12370. value: value !== undefined ? value : this.value()
  12371. };
  12372. if ( this._hasMultipleValues() ) {
  12373. uiHash.value = value !== undefined ? value : this.values( index );
  12374. uiHash.values = values || this.values();
  12375. }
  12376. return uiHash;
  12377. },
  12378. _hasMultipleValues: function() {
  12379. return this.options.values && this.options.values.length;
  12380. },
  12381. _start: function( event, index ) {
  12382. return this._trigger( "start", event, this._uiHash( index ) );
  12383. },
  12384. _slide: function( event, index, newVal ) {
  12385. var allowed, otherVal,
  12386. currentValue = this.value(),
  12387. newValues = this.values();
  12388. if ( this._hasMultipleValues() ) {
  12389. otherVal = this.values( index ? 0 : 1 );
  12390. currentValue = this.values( index );
  12391. if ( this.options.values.length === 2 && this.options.range === true ) {
  12392. newVal = index === 0 ? Math.min( otherVal, newVal ) : Math.max( otherVal, newVal );
  12393. }
  12394. newValues[ index ] = newVal;
  12395. }
  12396. if ( newVal === currentValue ) {
  12397. return;
  12398. }
  12399. allowed = this._trigger( "slide", event, this._uiHash( index, newVal, newValues ) );
  12400. // A slide can be canceled by returning false from the slide callback
  12401. if ( allowed === false ) {
  12402. return;
  12403. }
  12404. if ( this._hasMultipleValues() ) {
  12405. this.values( index, newVal );
  12406. } else {
  12407. this.value( newVal );
  12408. }
  12409. },
  12410. _stop: function( event, index ) {
  12411. this._trigger( "stop", event, this._uiHash( index ) );
  12412. },
  12413. _change: function( event, index ) {
  12414. if ( !this._keySliding && !this._mouseSliding ) {
  12415. //store the last changed value index for reference when handles overlap
  12416. this._lastChangedValue = index;
  12417. this._trigger( "change", event, this._uiHash( index ) );
  12418. }
  12419. },
  12420. value: function( newValue ) {
  12421. if ( arguments.length ) {
  12422. this.options.value = this._trimAlignValue( newValue );
  12423. this._refreshValue();
  12424. this._change( null, 0 );
  12425. return;
  12426. }
  12427. return this._value();
  12428. },
  12429. values: function( index, newValue ) {
  12430. var vals,
  12431. newValues,
  12432. i;
  12433. if ( arguments.length > 1 ) {
  12434. this.options.values[ index ] = this._trimAlignValue( newValue );
  12435. this._refreshValue();
  12436. this._change( null, index );
  12437. return;
  12438. }
  12439. if ( arguments.length ) {
  12440. if ( $.isArray( arguments[ 0 ] ) ) {
  12441. vals = this.options.values;
  12442. newValues = arguments[ 0 ];
  12443. for ( i = 0; i < vals.length; i += 1 ) {
  12444. vals[ i ] = this._trimAlignValue( newValues[ i ] );
  12445. this._change( null, i );
  12446. }
  12447. this._refreshValue();
  12448. } else {
  12449. if ( this._hasMultipleValues() ) {
  12450. return this._values( index );
  12451. } else {
  12452. return this.value();
  12453. }
  12454. }
  12455. } else {
  12456. return this._values();
  12457. }
  12458. },
  12459. _setOption: function( key, value ) {
  12460. var i,
  12461. valsLength = 0;
  12462. if ( key === "range" && this.options.range === true ) {
  12463. if ( value === "min" ) {
  12464. this.options.value = this._values( 0 );
  12465. this.options.values = null;
  12466. } else if ( value === "max" ) {
  12467. this.options.value = this._values( this.options.values.length - 1 );
  12468. this.options.values = null;
  12469. }
  12470. }
  12471. if ( $.isArray( this.options.values ) ) {
  12472. valsLength = this.options.values.length;
  12473. }
  12474. this._super( key, value );
  12475. switch ( key ) {
  12476. case "orientation":
  12477. this._detectOrientation();
  12478. this._removeClass( "ui-slider-horizontal ui-slider-vertical" )
  12479. ._addClass( "ui-slider-" + this.orientation );
  12480. this._refreshValue();
  12481. if ( this.options.range ) {
  12482. this._refreshRange( value );
  12483. }
  12484. // Reset positioning from previous orientation
  12485. this.handles.css( value === "horizontal" ? "bottom" : "left", "" );
  12486. break;
  12487. case "value":
  12488. this._animateOff = true;
  12489. this._refreshValue();
  12490. this._change( null, 0 );
  12491. this._animateOff = false;
  12492. break;
  12493. case "values":
  12494. this._animateOff = true;
  12495. this._refreshValue();
  12496. // Start from the last handle to prevent unreachable handles (#9046)
  12497. for ( i = valsLength - 1; i >= 0; i-- ) {
  12498. this._change( null, i );
  12499. }
  12500. this._animateOff = false;
  12501. break;
  12502. case "step":
  12503. case "min":
  12504. case "max":
  12505. this._animateOff = true;
  12506. this._calculateNewMax();
  12507. this._refreshValue();
  12508. this._animateOff = false;
  12509. break;
  12510. case "range":
  12511. this._animateOff = true;
  12512. this._refresh();
  12513. this._animateOff = false;
  12514. break;
  12515. }
  12516. },
  12517. _setOptionDisabled: function( value ) {
  12518. this._super( value );
  12519. this._toggleClass( null, "ui-state-disabled", !!value );
  12520. },
  12521. //internal value getter
  12522. // _value() returns value trimmed by min and max, aligned by step
  12523. _value: function() {
  12524. var val = this.options.value;
  12525. val = this._trimAlignValue( val );
  12526. return val;
  12527. },
  12528. //internal values getter
  12529. // _values() returns array of values trimmed by min and max, aligned by step
  12530. // _values( index ) returns single value trimmed by min and max, aligned by step
  12531. _values: function( index ) {
  12532. var val,
  12533. vals,
  12534. i;
  12535. if ( arguments.length ) {
  12536. val = this.options.values[ index ];
  12537. val = this._trimAlignValue( val );
  12538. return val;
  12539. } else if ( this._hasMultipleValues() ) {
  12540. // .slice() creates a copy of the array
  12541. // this copy gets trimmed by min and max and then returned
  12542. vals = this.options.values.slice();
  12543. for ( i = 0; i < vals.length; i += 1 ) {
  12544. vals[ i ] = this._trimAlignValue( vals[ i ] );
  12545. }
  12546. return vals;
  12547. } else {
  12548. return [];
  12549. }
  12550. },
  12551. // Returns the step-aligned value that val is closest to, between (inclusive) min and max
  12552. _trimAlignValue: function( val ) {
  12553. if ( val <= this._valueMin() ) {
  12554. return this._valueMin();
  12555. }
  12556. if ( val >= this._valueMax() ) {
  12557. return this._valueMax();
  12558. }
  12559. var step = ( this.options.step > 0 ) ? this.options.step : 1,
  12560. valModStep = ( val - this._valueMin() ) % step,
  12561. alignValue = val - valModStep;
  12562. if ( Math.abs( valModStep ) * 2 >= step ) {
  12563. alignValue += ( valModStep > 0 ) ? step : ( -step );
  12564. }
  12565. // Since JavaScript has problems with large floats, round
  12566. // the final value to 5 digits after the decimal point (see #4124)
  12567. return parseFloat( alignValue.toFixed( 5 ) );
  12568. },
  12569. _calculateNewMax: function() {
  12570. var max = this.options.max,
  12571. min = this._valueMin(),
  12572. step = this.options.step,
  12573. aboveMin = Math.round( ( max - min ) / step ) * step;
  12574. max = aboveMin + min;
  12575. if ( max > this.options.max ) {
  12576. //If max is not divisible by step, rounding off may increase its value
  12577. max -= step;
  12578. }
  12579. this.max = parseFloat( max.toFixed( this._precision() ) );
  12580. },
  12581. _precision: function() {
  12582. var precision = this._precisionOf( this.options.step );
  12583. if ( this.options.min !== null ) {
  12584. precision = Math.max( precision, this._precisionOf( this.options.min ) );
  12585. }
  12586. return precision;
  12587. },
  12588. _precisionOf: function( num ) {
  12589. var str = num.toString(),
  12590. decimal = str.indexOf( "." );
  12591. return decimal === -1 ? 0 : str.length - decimal - 1;
  12592. },
  12593. _valueMin: function() {
  12594. return this.options.min;
  12595. },
  12596. _valueMax: function() {
  12597. return this.max;
  12598. },
  12599. _refreshRange: function( orientation ) {
  12600. if ( orientation === "vertical" ) {
  12601. this.range.css( { "width": "", "left": "" } );
  12602. }
  12603. if ( orientation === "horizontal" ) {
  12604. this.range.css( { "height": "", "bottom": "" } );
  12605. }
  12606. },
  12607. _refreshValue: function() {
  12608. var lastValPercent, valPercent, value, valueMin, valueMax,
  12609. oRange = this.options.range,
  12610. o = this.options,
  12611. that = this,
  12612. animate = ( !this._animateOff ) ? o.animate : false,
  12613. _set = {};
  12614. if ( this._hasMultipleValues() ) {
  12615. this.handles.each( function( i ) {
  12616. valPercent = ( that.values( i ) - that._valueMin() ) / ( that._valueMax() -
  12617. that._valueMin() ) * 100;
  12618. _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
  12619. $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
  12620. if ( that.options.range === true ) {
  12621. if ( that.orientation === "horizontal" ) {
  12622. if ( i === 0 ) {
  12623. that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  12624. left: valPercent + "%"
  12625. }, o.animate );
  12626. }
  12627. if ( i === 1 ) {
  12628. that.range[ animate ? "animate" : "css" ]( {
  12629. width: ( valPercent - lastValPercent ) + "%"
  12630. }, {
  12631. queue: false,
  12632. duration: o.animate
  12633. } );
  12634. }
  12635. } else {
  12636. if ( i === 0 ) {
  12637. that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  12638. bottom: ( valPercent ) + "%"
  12639. }, o.animate );
  12640. }
  12641. if ( i === 1 ) {
  12642. that.range[ animate ? "animate" : "css" ]( {
  12643. height: ( valPercent - lastValPercent ) + "%"
  12644. }, {
  12645. queue: false,
  12646. duration: o.animate
  12647. } );
  12648. }
  12649. }
  12650. }
  12651. lastValPercent = valPercent;
  12652. } );
  12653. } else {
  12654. value = this.value();
  12655. valueMin = this._valueMin();
  12656. valueMax = this._valueMax();
  12657. valPercent = ( valueMax !== valueMin ) ?
  12658. ( value - valueMin ) / ( valueMax - valueMin ) * 100 :
  12659. 0;
  12660. _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
  12661. this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
  12662. if ( oRange === "min" && this.orientation === "horizontal" ) {
  12663. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  12664. width: valPercent + "%"
  12665. }, o.animate );
  12666. }
  12667. if ( oRange === "max" && this.orientation === "horizontal" ) {
  12668. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  12669. width: ( 100 - valPercent ) + "%"
  12670. }, o.animate );
  12671. }
  12672. if ( oRange === "min" && this.orientation === "vertical" ) {
  12673. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  12674. height: valPercent + "%"
  12675. }, o.animate );
  12676. }
  12677. if ( oRange === "max" && this.orientation === "vertical" ) {
  12678. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  12679. height: ( 100 - valPercent ) + "%"
  12680. }, o.animate );
  12681. }
  12682. }
  12683. },
  12684. _handleEvents: {
  12685. keydown: function( event ) {
  12686. var allowed, curVal, newVal, step,
  12687. index = $( event.target ).data( "ui-slider-handle-index" );
  12688. switch ( event.keyCode ) {
  12689. case $.ui.keyCode.HOME:
  12690. case $.ui.keyCode.END:
  12691. case $.ui.keyCode.PAGE_UP:
  12692. case $.ui.keyCode.PAGE_DOWN:
  12693. case $.ui.keyCode.UP:
  12694. case $.ui.keyCode.RIGHT:
  12695. case $.ui.keyCode.DOWN:
  12696. case $.ui.keyCode.LEFT:
  12697. event.preventDefault();
  12698. if ( !this._keySliding ) {
  12699. this._keySliding = true;
  12700. this._addClass( $( event.target ), null, "ui-state-active" );
  12701. allowed = this._start( event, index );
  12702. if ( allowed === false ) {
  12703. return;
  12704. }
  12705. }
  12706. break;
  12707. }
  12708. step = this.options.step;
  12709. if ( this._hasMultipleValues() ) {
  12710. curVal = newVal = this.values( index );
  12711. } else {
  12712. curVal = newVal = this.value();
  12713. }
  12714. switch ( event.keyCode ) {
  12715. case $.ui.keyCode.HOME:
  12716. newVal = this._valueMin();
  12717. break;
  12718. case $.ui.keyCode.END:
  12719. newVal = this._valueMax();
  12720. break;
  12721. case $.ui.keyCode.PAGE_UP:
  12722. newVal = this._trimAlignValue(
  12723. curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages )
  12724. );
  12725. break;
  12726. case $.ui.keyCode.PAGE_DOWN:
  12727. newVal = this._trimAlignValue(
  12728. curVal - ( ( this._valueMax() - this._valueMin() ) / this.numPages ) );
  12729. break;
  12730. case $.ui.keyCode.UP:
  12731. case $.ui.keyCode.RIGHT:
  12732. if ( curVal === this._valueMax() ) {
  12733. return;
  12734. }
  12735. newVal = this._trimAlignValue( curVal + step );
  12736. break;
  12737. case $.ui.keyCode.DOWN:
  12738. case $.ui.keyCode.LEFT:
  12739. if ( curVal === this._valueMin() ) {
  12740. return;
  12741. }
  12742. newVal = this._trimAlignValue( curVal - step );
  12743. break;
  12744. }
  12745. this._slide( event, index, newVal );
  12746. },
  12747. keyup: function( event ) {
  12748. var index = $( event.target ).data( "ui-slider-handle-index" );
  12749. if ( this._keySliding ) {
  12750. this._keySliding = false;
  12751. this._stop( event, index );
  12752. this._change( event, index );
  12753. this._removeClass( $( event.target ), null, "ui-state-active" );
  12754. }
  12755. }
  12756. }
  12757. } );
  12758. /*!
  12759. * jQuery UI Sortable 1.12.1
  12760. * http://jqueryui.com
  12761. *
  12762. * Copyright jQuery Foundation and other contributors
  12763. * Released under the MIT license.
  12764. * http://jquery.org/license
  12765. */
  12766. //>>label: Sortable
  12767. //>>group: Interactions
  12768. //>>description: Enables items in a list to be sorted using the mouse.
  12769. //>>docs: http://api.jqueryui.com/sortable/
  12770. //>>demos: http://jqueryui.com/sortable/
  12771. //>>css.structure: ../../themes/base/sortable.css
  12772. var widgetsSortable = $.widget( "ui.sortable", $.ui.mouse, {
  12773. version: "1.12.1",
  12774. widgetEventPrefix: "sort",
  12775. ready: false,
  12776. options: {
  12777. appendTo: "parent",
  12778. axis: false,
  12779. connectWith: false,
  12780. containment: false,
  12781. cursor: "auto",
  12782. cursorAt: false,
  12783. dropOnEmpty: true,
  12784. forcePlaceholderSize: false,
  12785. forceHelperSize: false,
  12786. grid: false,
  12787. handle: false,
  12788. helper: "original",
  12789. items: "> *",
  12790. opacity: false,
  12791. placeholder: false,
  12792. revert: false,
  12793. scroll: true,
  12794. scrollSensitivity: 20,
  12795. scrollSpeed: 20,
  12796. scope: "default",
  12797. tolerance: "intersect",
  12798. zIndex: 1000,
  12799. // Callbacks
  12800. activate: null,
  12801. beforeStop: null,
  12802. change: null,
  12803. deactivate: null,
  12804. out: null,
  12805. over: null,
  12806. receive: null,
  12807. remove: null,
  12808. sort: null,
  12809. start: null,
  12810. stop: null,
  12811. update: null
  12812. },
  12813. _isOverAxis: function( x, reference, size ) {
  12814. return ( x >= reference ) && ( x < ( reference + size ) );
  12815. },
  12816. _isFloating: function( item ) {
  12817. return ( /left|right/ ).test( item.css( "float" ) ) ||
  12818. ( /inline|table-cell/ ).test( item.css( "display" ) );
  12819. },
  12820. _create: function() {
  12821. this.containerCache = {};
  12822. this._addClass( "ui-sortable" );
  12823. //Get the items
  12824. this.refresh();
  12825. //Let's determine the parent's offset
  12826. this.offset = this.element.offset();
  12827. //Initialize mouse events for interaction
  12828. this._mouseInit();
  12829. this._setHandleClassName();
  12830. //We're ready to go
  12831. this.ready = true;
  12832. },
  12833. _setOption: function( key, value ) {
  12834. this._super( key, value );
  12835. if ( key === "handle" ) {
  12836. this._setHandleClassName();
  12837. }
  12838. },
  12839. _setHandleClassName: function() {
  12840. var that = this;
  12841. this._removeClass( this.element.find( ".ui-sortable-handle" ), "ui-sortable-handle" );
  12842. $.each( this.items, function() {
  12843. that._addClass(
  12844. this.instance.options.handle ?
  12845. this.item.find( this.instance.options.handle ) :
  12846. this.item,
  12847. "ui-sortable-handle"
  12848. );
  12849. } );
  12850. },
  12851. _destroy: function() {
  12852. this._mouseDestroy();
  12853. for ( var i = this.items.length - 1; i >= 0; i-- ) {
  12854. this.items[ i ].item.removeData( this.widgetName + "-item" );
  12855. }
  12856. return this;
  12857. },
  12858. _mouseCapture: function( event, overrideHandle ) {
  12859. var currentItem = null,
  12860. validHandle = false,
  12861. that = this;
  12862. if ( this.reverting ) {
  12863. return false;
  12864. }
  12865. if ( this.options.disabled || this.options.type === "static" ) {
  12866. return false;
  12867. }
  12868. //We have to refresh the items data once first
  12869. this._refreshItems( event );
  12870. //Find out if the clicked node (or one of its parents) is a actual item in this.items
  12871. $( event.target ).parents().each( function() {
  12872. if ( $.data( this, that.widgetName + "-item" ) === that ) {
  12873. currentItem = $( this );
  12874. return false;
  12875. }
  12876. } );
  12877. if ( $.data( event.target, that.widgetName + "-item" ) === that ) {
  12878. currentItem = $( event.target );
  12879. }
  12880. if ( !currentItem ) {
  12881. return false;
  12882. }
  12883. if ( this.options.handle && !overrideHandle ) {
  12884. $( this.options.handle, currentItem ).find( "*" ).addBack().each( function() {
  12885. if ( this === event.target ) {
  12886. validHandle = true;
  12887. }
  12888. } );
  12889. if ( !validHandle ) {
  12890. return false;
  12891. }
  12892. }
  12893. this.currentItem = currentItem;
  12894. this._removeCurrentsFromItems();
  12895. return true;
  12896. },
  12897. _mouseStart: function( event, overrideHandle, noActivation ) {
  12898. var i, body,
  12899. o = this.options;
  12900. this.currentContainer = this;
  12901. //We only need to call refreshPositions, because the refreshItems call has been moved to
  12902. // mouseCapture
  12903. this.refreshPositions();
  12904. //Create and append the visible helper
  12905. this.helper = this._createHelper( event );
  12906. //Cache the helper size
  12907. this._cacheHelperProportions();
  12908. /*
  12909. * - Position generation -
  12910. * This block generates everything position related - it's the core of draggables.
  12911. */
  12912. //Cache the margins of the original element
  12913. this._cacheMargins();
  12914. //Get the next scrolling parent
  12915. this.scrollParent = this.helper.scrollParent();
  12916. //The element's absolute position on the page minus margins
  12917. this.offset = this.currentItem.offset();
  12918. this.offset = {
  12919. top: this.offset.top - this.margins.top,
  12920. left: this.offset.left - this.margins.left
  12921. };
  12922. $.extend( this.offset, {
  12923. click: { //Where the click happened, relative to the element
  12924. left: event.pageX - this.offset.left,
  12925. top: event.pageY - this.offset.top
  12926. },
  12927. parent: this._getParentOffset(),
  12928. // This is a relative to absolute position minus the actual position calculation -
  12929. // only used for relative positioned helper
  12930. relative: this._getRelativeOffset()
  12931. } );
  12932. // Only after we got the offset, we can change the helper's position to absolute
  12933. // TODO: Still need to figure out a way to make relative sorting possible
  12934. this.helper.css( "position", "absolute" );
  12935. this.cssPosition = this.helper.css( "position" );
  12936. //Generate the original position
  12937. this.originalPosition = this._generatePosition( event );
  12938. this.originalPageX = event.pageX;
  12939. this.originalPageY = event.pageY;
  12940. //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
  12941. ( o.cursorAt && this._adjustOffsetFromHelper( o.cursorAt ) );
  12942. //Cache the former DOM position
  12943. this.domPosition = {
  12944. prev: this.currentItem.prev()[ 0 ],
  12945. parent: this.currentItem.parent()[ 0 ]
  12946. };
  12947. // If the helper is not the original, hide the original so it's not playing any role during
  12948. // the drag, won't cause anything bad this way
  12949. if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
  12950. this.currentItem.hide();
  12951. }
  12952. //Create the placeholder
  12953. this._createPlaceholder();
  12954. //Set a containment if given in the options
  12955. if ( o.containment ) {
  12956. this._setContainment();
  12957. }
  12958. if ( o.cursor && o.cursor !== "auto" ) { // cursor option
  12959. body = this.document.find( "body" );
  12960. // Support: IE
  12961. this.storedCursor = body.css( "cursor" );
  12962. body.css( "cursor", o.cursor );
  12963. this.storedStylesheet =
  12964. $( "<style>*{ cursor: " + o.cursor + " !important; }</style>" ).appendTo( body );
  12965. }
  12966. if ( o.opacity ) { // opacity option
  12967. if ( this.helper.css( "opacity" ) ) {
  12968. this._storedOpacity = this.helper.css( "opacity" );
  12969. }
  12970. this.helper.css( "opacity", o.opacity );
  12971. }
  12972. if ( o.zIndex ) { // zIndex option
  12973. if ( this.helper.css( "zIndex" ) ) {
  12974. this._storedZIndex = this.helper.css( "zIndex" );
  12975. }
  12976. this.helper.css( "zIndex", o.zIndex );
  12977. }
  12978. //Prepare scrolling
  12979. if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  12980. this.scrollParent[ 0 ].tagName !== "HTML" ) {
  12981. this.overflowOffset = this.scrollParent.offset();
  12982. }
  12983. //Call callbacks
  12984. this._trigger( "start", event, this._uiHash() );
  12985. //Recache the helper size
  12986. if ( !this._preserveHelperProportions ) {
  12987. this._cacheHelperProportions();
  12988. }
  12989. //Post "activate" events to possible containers
  12990. if ( !noActivation ) {
  12991. for ( i = this.containers.length - 1; i >= 0; i-- ) {
  12992. this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
  12993. }
  12994. }
  12995. //Prepare possible droppables
  12996. if ( $.ui.ddmanager ) {
  12997. $.ui.ddmanager.current = this;
  12998. }
  12999. if ( $.ui.ddmanager && !o.dropBehaviour ) {
  13000. $.ui.ddmanager.prepareOffsets( this, event );
  13001. }
  13002. this.dragging = true;
  13003. this._addClass( this.helper, "ui-sortable-helper" );
  13004. // Execute the drag once - this causes the helper not to be visiblebefore getting its
  13005. // correct position
  13006. this._mouseDrag( event );
  13007. return true;
  13008. },
  13009. _mouseDrag: function( event ) {
  13010. var i, item, itemElement, intersection,
  13011. o = this.options,
  13012. scrolled = false;
  13013. //Compute the helpers position
  13014. this.position = this._generatePosition( event );
  13015. this.positionAbs = this._convertPositionTo( "absolute" );
  13016. if ( !this.lastPositionAbs ) {
  13017. this.lastPositionAbs = this.positionAbs;
  13018. }
  13019. //Do scrolling
  13020. if ( this.options.scroll ) {
  13021. if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  13022. this.scrollParent[ 0 ].tagName !== "HTML" ) {
  13023. if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) -
  13024. event.pageY < o.scrollSensitivity ) {
  13025. this.scrollParent[ 0 ].scrollTop =
  13026. scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed;
  13027. } else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) {
  13028. this.scrollParent[ 0 ].scrollTop =
  13029. scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed;
  13030. }
  13031. if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) -
  13032. event.pageX < o.scrollSensitivity ) {
  13033. this.scrollParent[ 0 ].scrollLeft = scrolled =
  13034. this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed;
  13035. } else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) {
  13036. this.scrollParent[ 0 ].scrollLeft = scrolled =
  13037. this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed;
  13038. }
  13039. } else {
  13040. if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) {
  13041. scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed );
  13042. } else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) <
  13043. o.scrollSensitivity ) {
  13044. scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed );
  13045. }
  13046. if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) {
  13047. scrolled = this.document.scrollLeft(
  13048. this.document.scrollLeft() - o.scrollSpeed
  13049. );
  13050. } else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) <
  13051. o.scrollSensitivity ) {
  13052. scrolled = this.document.scrollLeft(
  13053. this.document.scrollLeft() + o.scrollSpeed
  13054. );
  13055. }
  13056. }
  13057. if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) {
  13058. $.ui.ddmanager.prepareOffsets( this, event );
  13059. }
  13060. }
  13061. //Regenerate the absolute position used for position checks
  13062. this.positionAbs = this._convertPositionTo( "absolute" );
  13063. //Set the helper position
  13064. if ( !this.options.axis || this.options.axis !== "y" ) {
  13065. this.helper[ 0 ].style.left = this.position.left + "px";
  13066. }
  13067. if ( !this.options.axis || this.options.axis !== "x" ) {
  13068. this.helper[ 0 ].style.top = this.position.top + "px";
  13069. }
  13070. //Rearrange
  13071. for ( i = this.items.length - 1; i >= 0; i-- ) {
  13072. //Cache variables and intersection, continue if no intersection
  13073. item = this.items[ i ];
  13074. itemElement = item.item[ 0 ];
  13075. intersection = this._intersectsWithPointer( item );
  13076. if ( !intersection ) {
  13077. continue;
  13078. }
  13079. // Only put the placeholder inside the current Container, skip all
  13080. // items from other containers. This works because when moving
  13081. // an item from one container to another the
  13082. // currentContainer is switched before the placeholder is moved.
  13083. //
  13084. // Without this, moving items in "sub-sortables" can cause
  13085. // the placeholder to jitter between the outer and inner container.
  13086. if ( item.instance !== this.currentContainer ) {
  13087. continue;
  13088. }
  13089. // Cannot intersect with itself
  13090. // no useless actions that have been done before
  13091. // no action if the item moved is the parent of the item checked
  13092. if ( itemElement !== this.currentItem[ 0 ] &&
  13093. this.placeholder[ intersection === 1 ? "next" : "prev" ]()[ 0 ] !== itemElement &&
  13094. !$.contains( this.placeholder[ 0 ], itemElement ) &&
  13095. ( this.options.type === "semi-dynamic" ?
  13096. !$.contains( this.element[ 0 ], itemElement ) :
  13097. true
  13098. )
  13099. ) {
  13100. this.direction = intersection === 1 ? "down" : "up";
  13101. if ( this.options.tolerance === "pointer" || this._intersectsWithSides( item ) ) {
  13102. this._rearrange( event, item );
  13103. } else {
  13104. break;
  13105. }
  13106. this._trigger( "change", event, this._uiHash() );
  13107. break;
  13108. }
  13109. }
  13110. //Post events to containers
  13111. this._contactContainers( event );
  13112. //Interconnect with droppables
  13113. if ( $.ui.ddmanager ) {
  13114. $.ui.ddmanager.drag( this, event );
  13115. }
  13116. //Call callbacks
  13117. this._trigger( "sort", event, this._uiHash() );
  13118. this.lastPositionAbs = this.positionAbs;
  13119. return false;
  13120. },
  13121. _mouseStop: function( event, noPropagation ) {
  13122. if ( !event ) {
  13123. return;
  13124. }
  13125. //If we are using droppables, inform the manager about the drop
  13126. if ( $.ui.ddmanager && !this.options.dropBehaviour ) {
  13127. $.ui.ddmanager.drop( this, event );
  13128. }
  13129. if ( this.options.revert ) {
  13130. var that = this,
  13131. cur = this.placeholder.offset(),
  13132. axis = this.options.axis,
  13133. animation = {};
  13134. if ( !axis || axis === "x" ) {
  13135. animation.left = cur.left - this.offset.parent.left - this.margins.left +
  13136. ( this.offsetParent[ 0 ] === this.document[ 0 ].body ?
  13137. 0 :
  13138. this.offsetParent[ 0 ].scrollLeft
  13139. );
  13140. }
  13141. if ( !axis || axis === "y" ) {
  13142. animation.top = cur.top - this.offset.parent.top - this.margins.top +
  13143. ( this.offsetParent[ 0 ] === this.document[ 0 ].body ?
  13144. 0 :
  13145. this.offsetParent[ 0 ].scrollTop
  13146. );
  13147. }
  13148. this.reverting = true;
  13149. $( this.helper ).animate(
  13150. animation,
  13151. parseInt( this.options.revert, 10 ) || 500,
  13152. function() {
  13153. that._clear( event );
  13154. }
  13155. );
  13156. } else {
  13157. this._clear( event, noPropagation );
  13158. }
  13159. return false;
  13160. },
  13161. cancel: function() {
  13162. if ( this.dragging ) {
  13163. this._mouseUp( new $.Event( "mouseup", { target: null } ) );
  13164. if ( this.options.helper === "original" ) {
  13165. this.currentItem.css( this._storedCSS );
  13166. this._removeClass( this.currentItem, "ui-sortable-helper" );
  13167. } else {
  13168. this.currentItem.show();
  13169. }
  13170. //Post deactivating events to containers
  13171. for ( var i = this.containers.length - 1; i >= 0; i-- ) {
  13172. this.containers[ i ]._trigger( "deactivate", null, this._uiHash( this ) );
  13173. if ( this.containers[ i ].containerCache.over ) {
  13174. this.containers[ i ]._trigger( "out", null, this._uiHash( this ) );
  13175. this.containers[ i ].containerCache.over = 0;
  13176. }
  13177. }
  13178. }
  13179. if ( this.placeholder ) {
  13180. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
  13181. // it unbinds ALL events from the original node!
  13182. if ( this.placeholder[ 0 ].parentNode ) {
  13183. this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] );
  13184. }
  13185. if ( this.options.helper !== "original" && this.helper &&
  13186. this.helper[ 0 ].parentNode ) {
  13187. this.helper.remove();
  13188. }
  13189. $.extend( this, {
  13190. helper: null,
  13191. dragging: false,
  13192. reverting: false,
  13193. _noFinalSort: null
  13194. } );
  13195. if ( this.domPosition.prev ) {
  13196. $( this.domPosition.prev ).after( this.currentItem );
  13197. } else {
  13198. $( this.domPosition.parent ).prepend( this.currentItem );
  13199. }
  13200. }
  13201. return this;
  13202. },
  13203. serialize: function( o ) {
  13204. var items = this._getItemsAsjQuery( o && o.connected ),
  13205. str = [];
  13206. o = o || {};
  13207. $( items ).each( function() {
  13208. var res = ( $( o.item || this ).attr( o.attribute || "id" ) || "" )
  13209. .match( o.expression || ( /(.+)[\-=_](.+)/ ) );
  13210. if ( res ) {
  13211. str.push(
  13212. ( o.key || res[ 1 ] + "[]" ) +
  13213. "=" + ( o.key && o.expression ? res[ 1 ] : res[ 2 ] ) );
  13214. }
  13215. } );
  13216. if ( !str.length && o.key ) {
  13217. str.push( o.key + "=" );
  13218. }
  13219. return str.join( "&" );
  13220. },
  13221. toArray: function( o ) {
  13222. var items = this._getItemsAsjQuery( o && o.connected ),
  13223. ret = [];
  13224. o = o || {};
  13225. items.each( function() {
  13226. ret.push( $( o.item || this ).attr( o.attribute || "id" ) || "" );
  13227. } );
  13228. return ret;
  13229. },
  13230. /* Be careful with the following core functions */
  13231. _intersectsWith: function( item ) {
  13232. var x1 = this.positionAbs.left,
  13233. x2 = x1 + this.helperProportions.width,
  13234. y1 = this.positionAbs.top,
  13235. y2 = y1 + this.helperProportions.height,
  13236. l = item.left,
  13237. r = l + item.width,
  13238. t = item.top,
  13239. b = t + item.height,
  13240. dyClick = this.offset.click.top,
  13241. dxClick = this.offset.click.left,
  13242. isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t &&
  13243. ( y1 + dyClick ) < b ),
  13244. isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l &&
  13245. ( x1 + dxClick ) < r ),
  13246. isOverElement = isOverElementHeight && isOverElementWidth;
  13247. if ( this.options.tolerance === "pointer" ||
  13248. this.options.forcePointerForContainers ||
  13249. ( this.options.tolerance !== "pointer" &&
  13250. this.helperProportions[ this.floating ? "width" : "height" ] >
  13251. item[ this.floating ? "width" : "height" ] )
  13252. ) {
  13253. return isOverElement;
  13254. } else {
  13255. return ( l < x1 + ( this.helperProportions.width / 2 ) && // Right Half
  13256. x2 - ( this.helperProportions.width / 2 ) < r && // Left Half
  13257. t < y1 + ( this.helperProportions.height / 2 ) && // Bottom Half
  13258. y2 - ( this.helperProportions.height / 2 ) < b ); // Top Half
  13259. }
  13260. },
  13261. _intersectsWithPointer: function( item ) {
  13262. var verticalDirection, horizontalDirection,
  13263. isOverElementHeight = ( this.options.axis === "x" ) ||
  13264. this._isOverAxis(
  13265. this.positionAbs.top + this.offset.click.top, item.top, item.height ),
  13266. isOverElementWidth = ( this.options.axis === "y" ) ||
  13267. this._isOverAxis(
  13268. this.positionAbs.left + this.offset.click.left, item.left, item.width ),
  13269. isOverElement = isOverElementHeight && isOverElementWidth;
  13270. if ( !isOverElement ) {
  13271. return false;
  13272. }
  13273. verticalDirection = this._getDragVerticalDirection();
  13274. horizontalDirection = this._getDragHorizontalDirection();
  13275. return this.floating ?
  13276. ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 )
  13277. : ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) );
  13278. },
  13279. _intersectsWithSides: function( item ) {
  13280. var isOverBottomHalf = this._isOverAxis( this.positionAbs.top +
  13281. this.offset.click.top, item.top + ( item.height / 2 ), item.height ),
  13282. isOverRightHalf = this._isOverAxis( this.positionAbs.left +
  13283. this.offset.click.left, item.left + ( item.width / 2 ), item.width ),
  13284. verticalDirection = this._getDragVerticalDirection(),
  13285. horizontalDirection = this._getDragHorizontalDirection();
  13286. if ( this.floating && horizontalDirection ) {
  13287. return ( ( horizontalDirection === "right" && isOverRightHalf ) ||
  13288. ( horizontalDirection === "left" && !isOverRightHalf ) );
  13289. } else {
  13290. return verticalDirection && ( ( verticalDirection === "down" && isOverBottomHalf ) ||
  13291. ( verticalDirection === "up" && !isOverBottomHalf ) );
  13292. }
  13293. },
  13294. _getDragVerticalDirection: function() {
  13295. var delta = this.positionAbs.top - this.lastPositionAbs.top;
  13296. return delta !== 0 && ( delta > 0 ? "down" : "up" );
  13297. },
  13298. _getDragHorizontalDirection: function() {
  13299. var delta = this.positionAbs.left - this.lastPositionAbs.left;
  13300. return delta !== 0 && ( delta > 0 ? "right" : "left" );
  13301. },
  13302. refresh: function( event ) {
  13303. this._refreshItems( event );
  13304. this._setHandleClassName();
  13305. this.refreshPositions();
  13306. return this;
  13307. },
  13308. _connectWith: function() {
  13309. var options = this.options;
  13310. return options.connectWith.constructor === String ?
  13311. [ options.connectWith ] :
  13312. options.connectWith;
  13313. },
  13314. _getItemsAsjQuery: function( connected ) {
  13315. var i, j, cur, inst,
  13316. items = [],
  13317. queries = [],
  13318. connectWith = this._connectWith();
  13319. if ( connectWith && connected ) {
  13320. for ( i = connectWith.length - 1; i >= 0; i-- ) {
  13321. cur = $( connectWith[ i ], this.document[ 0 ] );
  13322. for ( j = cur.length - 1; j >= 0; j-- ) {
  13323. inst = $.data( cur[ j ], this.widgetFullName );
  13324. if ( inst && inst !== this && !inst.options.disabled ) {
  13325. queries.push( [ $.isFunction( inst.options.items ) ?
  13326. inst.options.items.call( inst.element ) :
  13327. $( inst.options.items, inst.element )
  13328. .not( ".ui-sortable-helper" )
  13329. .not( ".ui-sortable-placeholder" ), inst ] );
  13330. }
  13331. }
  13332. }
  13333. }
  13334. queries.push( [ $.isFunction( this.options.items ) ?
  13335. this.options.items
  13336. .call( this.element, null, { options: this.options, item: this.currentItem } ) :
  13337. $( this.options.items, this.element )
  13338. .not( ".ui-sortable-helper" )
  13339. .not( ".ui-sortable-placeholder" ), this ] );
  13340. function addItems() {
  13341. items.push( this );
  13342. }
  13343. for ( i = queries.length - 1; i >= 0; i-- ) {
  13344. queries[ i ][ 0 ].each( addItems );
  13345. }
  13346. return $( items );
  13347. },
  13348. _removeCurrentsFromItems: function() {
  13349. var list = this.currentItem.find( ":data(" + this.widgetName + "-item)" );
  13350. this.items = $.grep( this.items, function( item ) {
  13351. for ( var j = 0; j < list.length; j++ ) {
  13352. if ( list[ j ] === item.item[ 0 ] ) {
  13353. return false;
  13354. }
  13355. }
  13356. return true;
  13357. } );
  13358. },
  13359. _refreshItems: function( event ) {
  13360. this.items = [];
  13361. this.containers = [ this ];
  13362. var i, j, cur, inst, targetData, _queries, item, queriesLength,
  13363. items = this.items,
  13364. queries = [ [ $.isFunction( this.options.items ) ?
  13365. this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) :
  13366. $( this.options.items, this.element ), this ] ],
  13367. connectWith = this._connectWith();
  13368. //Shouldn't be run the first time through due to massive slow-down
  13369. if ( connectWith && this.ready ) {
  13370. for ( i = connectWith.length - 1; i >= 0; i-- ) {
  13371. cur = $( connectWith[ i ], this.document[ 0 ] );
  13372. for ( j = cur.length - 1; j >= 0; j-- ) {
  13373. inst = $.data( cur[ j ], this.widgetFullName );
  13374. if ( inst && inst !== this && !inst.options.disabled ) {
  13375. queries.push( [ $.isFunction( inst.options.items ) ?
  13376. inst.options.items
  13377. .call( inst.element[ 0 ], event, { item: this.currentItem } ) :
  13378. $( inst.options.items, inst.element ), inst ] );
  13379. this.containers.push( inst );
  13380. }
  13381. }
  13382. }
  13383. }
  13384. for ( i = queries.length - 1; i >= 0; i-- ) {
  13385. targetData = queries[ i ][ 1 ];
  13386. _queries = queries[ i ][ 0 ];
  13387. for ( j = 0, queriesLength = _queries.length; j < queriesLength; j++ ) {
  13388. item = $( _queries[ j ] );
  13389. // Data for target checking (mouse manager)
  13390. item.data( this.widgetName + "-item", targetData );
  13391. items.push( {
  13392. item: item,
  13393. instance: targetData,
  13394. width: 0, height: 0,
  13395. left: 0, top: 0
  13396. } );
  13397. }
  13398. }
  13399. },
  13400. refreshPositions: function( fast ) {
  13401. // Determine whether items are being displayed horizontally
  13402. this.floating = this.items.length ?
  13403. this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
  13404. false;
  13405. //This has to be redone because due to the item being moved out/into the offsetParent,
  13406. // the offsetParent's position will change
  13407. if ( this.offsetParent && this.helper ) {
  13408. this.offset.parent = this._getParentOffset();
  13409. }
  13410. var i, item, t, p;
  13411. for ( i = this.items.length - 1; i >= 0; i-- ) {
  13412. item = this.items[ i ];
  13413. //We ignore calculating positions of all connected containers when we're not over them
  13414. if ( item.instance !== this.currentContainer && this.currentContainer &&
  13415. item.item[ 0 ] !== this.currentItem[ 0 ] ) {
  13416. continue;
  13417. }
  13418. t = this.options.toleranceElement ?
  13419. $( this.options.toleranceElement, item.item ) :
  13420. item.item;
  13421. if ( !fast ) {
  13422. item.width = t.outerWidth();
  13423. item.height = t.outerHeight();
  13424. }
  13425. p = t.offset();
  13426. item.left = p.left;
  13427. item.top = p.top;
  13428. }
  13429. if ( this.options.custom && this.options.custom.refreshContainers ) {
  13430. this.options.custom.refreshContainers.call( this );
  13431. } else {
  13432. for ( i = this.containers.length - 1; i >= 0; i-- ) {
  13433. p = this.containers[ i ].element.offset();
  13434. this.containers[ i ].containerCache.left = p.left;
  13435. this.containers[ i ].containerCache.top = p.top;
  13436. this.containers[ i ].containerCache.width =
  13437. this.containers[ i ].element.outerWidth();
  13438. this.containers[ i ].containerCache.height =
  13439. this.containers[ i ].element.outerHeight();
  13440. }
  13441. }
  13442. return this;
  13443. },
  13444. _createPlaceholder: function( that ) {
  13445. that = that || this;
  13446. var className,
  13447. o = that.options;
  13448. if ( !o.placeholder || o.placeholder.constructor === String ) {
  13449. className = o.placeholder;
  13450. o.placeholder = {
  13451. element: function() {
  13452. var nodeName = that.currentItem[ 0 ].nodeName.toLowerCase(),
  13453. element = $( "<" + nodeName + ">", that.document[ 0 ] );
  13454. that._addClass( element, "ui-sortable-placeholder",
  13455. className || that.currentItem[ 0 ].className )
  13456. ._removeClass( element, "ui-sortable-helper" );
  13457. if ( nodeName === "tbody" ) {
  13458. that._createTrPlaceholder(
  13459. that.currentItem.find( "tr" ).eq( 0 ),
  13460. $( "<tr>", that.document[ 0 ] ).appendTo( element )
  13461. );
  13462. } else if ( nodeName === "tr" ) {
  13463. that._createTrPlaceholder( that.currentItem, element );
  13464. } else if ( nodeName === "img" ) {
  13465. element.attr( "src", that.currentItem.attr( "src" ) );
  13466. }
  13467. if ( !className ) {
  13468. element.css( "visibility", "hidden" );
  13469. }
  13470. return element;
  13471. },
  13472. update: function( container, p ) {
  13473. // 1. If a className is set as 'placeholder option, we don't force sizes -
  13474. // the class is responsible for that
  13475. // 2. The option 'forcePlaceholderSize can be enabled to force it even if a
  13476. // class name is specified
  13477. if ( className && !o.forcePlaceholderSize ) {
  13478. return;
  13479. }
  13480. //If the element doesn't have a actual height by itself (without styles coming
  13481. // from a stylesheet), it receives the inline height from the dragged item
  13482. if ( !p.height() ) {
  13483. p.height(
  13484. that.currentItem.innerHeight() -
  13485. parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) -
  13486. parseInt( that.currentItem.css( "paddingBottom" ) || 0, 10 ) );
  13487. }
  13488. if ( !p.width() ) {
  13489. p.width(
  13490. that.currentItem.innerWidth() -
  13491. parseInt( that.currentItem.css( "paddingLeft" ) || 0, 10 ) -
  13492. parseInt( that.currentItem.css( "paddingRight" ) || 0, 10 ) );
  13493. }
  13494. }
  13495. };
  13496. }
  13497. //Create the placeholder
  13498. that.placeholder = $( o.placeholder.element.call( that.element, that.currentItem ) );
  13499. //Append it after the actual current item
  13500. that.currentItem.after( that.placeholder );
  13501. //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
  13502. o.placeholder.update( that, that.placeholder );
  13503. },
  13504. _createTrPlaceholder: function( sourceTr, targetTr ) {
  13505. var that = this;
  13506. sourceTr.children().each( function() {
  13507. $( "<td>&#160;</td>", that.document[ 0 ] )
  13508. .attr( "colspan", $( this ).attr( "colspan" ) || 1 )
  13509. .appendTo( targetTr );
  13510. } );
  13511. },
  13512. _contactContainers: function( event ) {
  13513. var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom,
  13514. floating, axis,
  13515. innermostContainer = null,
  13516. innermostIndex = null;
  13517. // Get innermost container that intersects with item
  13518. for ( i = this.containers.length - 1; i >= 0; i-- ) {
  13519. // Never consider a container that's located within the item itself
  13520. if ( $.contains( this.currentItem[ 0 ], this.containers[ i ].element[ 0 ] ) ) {
  13521. continue;
  13522. }
  13523. if ( this._intersectsWith( this.containers[ i ].containerCache ) ) {
  13524. // If we've already found a container and it's more "inner" than this, then continue
  13525. if ( innermostContainer &&
  13526. $.contains(
  13527. this.containers[ i ].element[ 0 ],
  13528. innermostContainer.element[ 0 ] ) ) {
  13529. continue;
  13530. }
  13531. innermostContainer = this.containers[ i ];
  13532. innermostIndex = i;
  13533. } else {
  13534. // container doesn't intersect. trigger "out" event if necessary
  13535. if ( this.containers[ i ].containerCache.over ) {
  13536. this.containers[ i ]._trigger( "out", event, this._uiHash( this ) );
  13537. this.containers[ i ].containerCache.over = 0;
  13538. }
  13539. }
  13540. }
  13541. // If no intersecting containers found, return
  13542. if ( !innermostContainer ) {
  13543. return;
  13544. }
  13545. // Move the item into the container if it's not there already
  13546. if ( this.containers.length === 1 ) {
  13547. if ( !this.containers[ innermostIndex ].containerCache.over ) {
  13548. this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );
  13549. this.containers[ innermostIndex ].containerCache.over = 1;
  13550. }
  13551. } else {
  13552. // When entering a new container, we will find the item with the least distance and
  13553. // append our item near it
  13554. dist = 10000;
  13555. itemWithLeastDistance = null;
  13556. floating = innermostContainer.floating || this._isFloating( this.currentItem );
  13557. posProperty = floating ? "left" : "top";
  13558. sizeProperty = floating ? "width" : "height";
  13559. axis = floating ? "pageX" : "pageY";
  13560. for ( j = this.items.length - 1; j >= 0; j-- ) {
  13561. if ( !$.contains(
  13562. this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ] )
  13563. ) {
  13564. continue;
  13565. }
  13566. if ( this.items[ j ].item[ 0 ] === this.currentItem[ 0 ] ) {
  13567. continue;
  13568. }
  13569. cur = this.items[ j ].item.offset()[ posProperty ];
  13570. nearBottom = false;
  13571. if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) {
  13572. nearBottom = true;
  13573. }
  13574. if ( Math.abs( event[ axis ] - cur ) < dist ) {
  13575. dist = Math.abs( event[ axis ] - cur );
  13576. itemWithLeastDistance = this.items[ j ];
  13577. this.direction = nearBottom ? "up" : "down";
  13578. }
  13579. }
  13580. //Check if dropOnEmpty is enabled
  13581. if ( !itemWithLeastDistance && !this.options.dropOnEmpty ) {
  13582. return;
  13583. }
  13584. if ( this.currentContainer === this.containers[ innermostIndex ] ) {
  13585. if ( !this.currentContainer.containerCache.over ) {
  13586. this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() );
  13587. this.currentContainer.containerCache.over = 1;
  13588. }
  13589. return;
  13590. }
  13591. itemWithLeastDistance ?
  13592. this._rearrange( event, itemWithLeastDistance, null, true ) :
  13593. this._rearrange( event, null, this.containers[ innermostIndex ].element, true );
  13594. this._trigger( "change", event, this._uiHash() );
  13595. this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) );
  13596. this.currentContainer = this.containers[ innermostIndex ];
  13597. //Update the placeholder
  13598. this.options.placeholder.update( this.currentContainer, this.placeholder );
  13599. this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );
  13600. this.containers[ innermostIndex ].containerCache.over = 1;
  13601. }
  13602. },
  13603. _createHelper: function( event ) {
  13604. var o = this.options,
  13605. helper = $.isFunction( o.helper ) ?
  13606. $( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) :
  13607. ( o.helper === "clone" ? this.currentItem.clone() : this.currentItem );
  13608. //Add the helper to the DOM if that didn't happen already
  13609. if ( !helper.parents( "body" ).length ) {
  13610. $( o.appendTo !== "parent" ?
  13611. o.appendTo :
  13612. this.currentItem[ 0 ].parentNode )[ 0 ].appendChild( helper[ 0 ] );
  13613. }
  13614. if ( helper[ 0 ] === this.currentItem[ 0 ] ) {
  13615. this._storedCSS = {
  13616. width: this.currentItem[ 0 ].style.width,
  13617. height: this.currentItem[ 0 ].style.height,
  13618. position: this.currentItem.css( "position" ),
  13619. top: this.currentItem.css( "top" ),
  13620. left: this.currentItem.css( "left" )
  13621. };
  13622. }
  13623. if ( !helper[ 0 ].style.width || o.forceHelperSize ) {
  13624. helper.width( this.currentItem.width() );
  13625. }
  13626. if ( !helper[ 0 ].style.height || o.forceHelperSize ) {
  13627. helper.height( this.currentItem.height() );
  13628. }
  13629. return helper;
  13630. },
  13631. _adjustOffsetFromHelper: function( obj ) {
  13632. if ( typeof obj === "string" ) {
  13633. obj = obj.split( " " );
  13634. }
  13635. if ( $.isArray( obj ) ) {
  13636. obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };
  13637. }
  13638. if ( "left" in obj ) {
  13639. this.offset.click.left = obj.left + this.margins.left;
  13640. }
  13641. if ( "right" in obj ) {
  13642. this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  13643. }
  13644. if ( "top" in obj ) {
  13645. this.offset.click.top = obj.top + this.margins.top;
  13646. }
  13647. if ( "bottom" in obj ) {
  13648. this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  13649. }
  13650. },
  13651. _getParentOffset: function() {
  13652. //Get the offsetParent and cache its position
  13653. this.offsetParent = this.helper.offsetParent();
  13654. var po = this.offsetParent.offset();
  13655. // This is a special case where we need to modify a offset calculated on start, since the
  13656. // following happened:
  13657. // 1. The position of the helper is absolute, so it's position is calculated based on the
  13658. // next positioned parent
  13659. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
  13660. // the document, which means that the scroll is included in the initial calculation of the
  13661. // offset of the parent, and never recalculated upon drag
  13662. if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  13663. $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) {
  13664. po.left += this.scrollParent.scrollLeft();
  13665. po.top += this.scrollParent.scrollTop();
  13666. }
  13667. // This needs to be actually done for all browsers, since pageX/pageY includes this
  13668. // information with an ugly IE fix
  13669. if ( this.offsetParent[ 0 ] === this.document[ 0 ].body ||
  13670. ( this.offsetParent[ 0 ].tagName &&
  13671. this.offsetParent[ 0 ].tagName.toLowerCase() === "html" && $.ui.ie ) ) {
  13672. po = { top: 0, left: 0 };
  13673. }
  13674. return {
  13675. top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ),
  13676. left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 )
  13677. };
  13678. },
  13679. _getRelativeOffset: function() {
  13680. if ( this.cssPosition === "relative" ) {
  13681. var p = this.currentItem.position();
  13682. return {
  13683. top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) +
  13684. this.scrollParent.scrollTop(),
  13685. left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) +
  13686. this.scrollParent.scrollLeft()
  13687. };
  13688. } else {
  13689. return { top: 0, left: 0 };
  13690. }
  13691. },
  13692. _cacheMargins: function() {
  13693. this.margins = {
  13694. left: ( parseInt( this.currentItem.css( "marginLeft" ), 10 ) || 0 ),
  13695. top: ( parseInt( this.currentItem.css( "marginTop" ), 10 ) || 0 )
  13696. };
  13697. },
  13698. _cacheHelperProportions: function() {
  13699. this.helperProportions = {
  13700. width: this.helper.outerWidth(),
  13701. height: this.helper.outerHeight()
  13702. };
  13703. },
  13704. _setContainment: function() {
  13705. var ce, co, over,
  13706. o = this.options;
  13707. if ( o.containment === "parent" ) {
  13708. o.containment = this.helper[ 0 ].parentNode;
  13709. }
  13710. if ( o.containment === "document" || o.containment === "window" ) {
  13711. this.containment = [
  13712. 0 - this.offset.relative.left - this.offset.parent.left,
  13713. 0 - this.offset.relative.top - this.offset.parent.top,
  13714. o.containment === "document" ?
  13715. this.document.width() :
  13716. this.window.width() - this.helperProportions.width - this.margins.left,
  13717. ( o.containment === "document" ?
  13718. ( this.document.height() || document.body.parentNode.scrollHeight ) :
  13719. this.window.height() || this.document[ 0 ].body.parentNode.scrollHeight
  13720. ) - this.helperProportions.height - this.margins.top
  13721. ];
  13722. }
  13723. if ( !( /^(document|window|parent)$/ ).test( o.containment ) ) {
  13724. ce = $( o.containment )[ 0 ];
  13725. co = $( o.containment ).offset();
  13726. over = ( $( ce ).css( "overflow" ) !== "hidden" );
  13727. this.containment = [
  13728. co.left + ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) +
  13729. ( parseInt( $( ce ).css( "paddingLeft" ), 10 ) || 0 ) - this.margins.left,
  13730. co.top + ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) +
  13731. ( parseInt( $( ce ).css( "paddingTop" ), 10 ) || 0 ) - this.margins.top,
  13732. co.left + ( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
  13733. ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) -
  13734. ( parseInt( $( ce ).css( "paddingRight" ), 10 ) || 0 ) -
  13735. this.helperProportions.width - this.margins.left,
  13736. co.top + ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
  13737. ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) -
  13738. ( parseInt( $( ce ).css( "paddingBottom" ), 10 ) || 0 ) -
  13739. this.helperProportions.height - this.margins.top
  13740. ];
  13741. }
  13742. },
  13743. _convertPositionTo: function( d, pos ) {
  13744. if ( !pos ) {
  13745. pos = this.position;
  13746. }
  13747. var mod = d === "absolute" ? 1 : -1,
  13748. scroll = this.cssPosition === "absolute" &&
  13749. !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  13750. $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ?
  13751. this.offsetParent :
  13752. this.scrollParent,
  13753. scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );
  13754. return {
  13755. top: (
  13756. // The absolute mouse position
  13757. pos.top +
  13758. // Only for relative positioned nodes: Relative offset from element to offset parent
  13759. this.offset.relative.top * mod +
  13760. // The offsetParent's offset without borders (offset + border)
  13761. this.offset.parent.top * mod -
  13762. ( ( this.cssPosition === "fixed" ?
  13763. -this.scrollParent.scrollTop() :
  13764. ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod )
  13765. ),
  13766. left: (
  13767. // The absolute mouse position
  13768. pos.left +
  13769. // Only for relative positioned nodes: Relative offset from element to offset parent
  13770. this.offset.relative.left * mod +
  13771. // The offsetParent's offset without borders (offset + border)
  13772. this.offset.parent.left * mod -
  13773. ( ( this.cssPosition === "fixed" ?
  13774. -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
  13775. scroll.scrollLeft() ) * mod )
  13776. )
  13777. };
  13778. },
  13779. _generatePosition: function( event ) {
  13780. var top, left,
  13781. o = this.options,
  13782. pageX = event.pageX,
  13783. pageY = event.pageY,
  13784. scroll = this.cssPosition === "absolute" &&
  13785. !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  13786. $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ?
  13787. this.offsetParent :
  13788. this.scrollParent,
  13789. scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );
  13790. // This is another very weird special case that only happens for relative elements:
  13791. // 1. If the css position is relative
  13792. // 2. and the scroll parent is the document or similar to the offset parent
  13793. // we have to refresh the relative offset during the scroll so there are no jumps
  13794. if ( this.cssPosition === "relative" && !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  13795. this.scrollParent[ 0 ] !== this.offsetParent[ 0 ] ) ) {
  13796. this.offset.relative = this._getRelativeOffset();
  13797. }
  13798. /*
  13799. * - Position constraining -
  13800. * Constrain the position to a mix of grid, containment.
  13801. */
  13802. if ( this.originalPosition ) { //If we are not dragging yet, we won't check for options
  13803. if ( this.containment ) {
  13804. if ( event.pageX - this.offset.click.left < this.containment[ 0 ] ) {
  13805. pageX = this.containment[ 0 ] + this.offset.click.left;
  13806. }
  13807. if ( event.pageY - this.offset.click.top < this.containment[ 1 ] ) {
  13808. pageY = this.containment[ 1 ] + this.offset.click.top;
  13809. }
  13810. if ( event.pageX - this.offset.click.left > this.containment[ 2 ] ) {
  13811. pageX = this.containment[ 2 ] + this.offset.click.left;
  13812. }
  13813. if ( event.pageY - this.offset.click.top > this.containment[ 3 ] ) {
  13814. pageY = this.containment[ 3 ] + this.offset.click.top;
  13815. }
  13816. }
  13817. if ( o.grid ) {
  13818. top = this.originalPageY + Math.round( ( pageY - this.originalPageY ) /
  13819. o.grid[ 1 ] ) * o.grid[ 1 ];
  13820. pageY = this.containment ?
  13821. ( ( top - this.offset.click.top >= this.containment[ 1 ] &&
  13822. top - this.offset.click.top <= this.containment[ 3 ] ) ?
  13823. top :
  13824. ( ( top - this.offset.click.top >= this.containment[ 1 ] ) ?
  13825. top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) :
  13826. top;
  13827. left = this.originalPageX + Math.round( ( pageX - this.originalPageX ) /
  13828. o.grid[ 0 ] ) * o.grid[ 0 ];
  13829. pageX = this.containment ?
  13830. ( ( left - this.offset.click.left >= this.containment[ 0 ] &&
  13831. left - this.offset.click.left <= this.containment[ 2 ] ) ?
  13832. left :
  13833. ( ( left - this.offset.click.left >= this.containment[ 0 ] ) ?
  13834. left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) :
  13835. left;
  13836. }
  13837. }
  13838. return {
  13839. top: (
  13840. // The absolute mouse position
  13841. pageY -
  13842. // Click offset (relative to the element)
  13843. this.offset.click.top -
  13844. // Only for relative positioned nodes: Relative offset from element to offset parent
  13845. this.offset.relative.top -
  13846. // The offsetParent's offset without borders (offset + border)
  13847. this.offset.parent.top +
  13848. ( ( this.cssPosition === "fixed" ?
  13849. -this.scrollParent.scrollTop() :
  13850. ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) )
  13851. ),
  13852. left: (
  13853. // The absolute mouse position
  13854. pageX -
  13855. // Click offset (relative to the element)
  13856. this.offset.click.left -
  13857. // Only for relative positioned nodes: Relative offset from element to offset parent
  13858. this.offset.relative.left -
  13859. // The offsetParent's offset without borders (offset + border)
  13860. this.offset.parent.left +
  13861. ( ( this.cssPosition === "fixed" ?
  13862. -this.scrollParent.scrollLeft() :
  13863. scrollIsRootNode ? 0 : scroll.scrollLeft() ) )
  13864. )
  13865. };
  13866. },
  13867. _rearrange: function( event, i, a, hardRefresh ) {
  13868. a ? a[ 0 ].appendChild( this.placeholder[ 0 ] ) :
  13869. i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ],
  13870. ( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) );
  13871. //Various things done here to improve the performance:
  13872. // 1. we create a setTimeout, that calls refreshPositions
  13873. // 2. on the instance, we have a counter variable, that get's higher after every append
  13874. // 3. on the local scope, we copy the counter variable, and check in the timeout,
  13875. // if it's still the same
  13876. // 4. this lets only the last addition to the timeout stack through
  13877. this.counter = this.counter ? ++this.counter : 1;
  13878. var counter = this.counter;
  13879. this._delay( function() {
  13880. if ( counter === this.counter ) {
  13881. //Precompute after each DOM insertion, NOT on mousemove
  13882. this.refreshPositions( !hardRefresh );
  13883. }
  13884. } );
  13885. },
  13886. _clear: function( event, noPropagation ) {
  13887. this.reverting = false;
  13888. // We delay all events that have to be triggered to after the point where the placeholder
  13889. // has been removed and everything else normalized again
  13890. var i,
  13891. delayedTriggers = [];
  13892. // We first have to update the dom position of the actual currentItem
  13893. // Note: don't do it if the current item is already removed (by a user), or it gets
  13894. // reappended (see #4088)
  13895. if ( !this._noFinalSort && this.currentItem.parent().length ) {
  13896. this.placeholder.before( this.currentItem );
  13897. }
  13898. this._noFinalSort = null;
  13899. if ( this.helper[ 0 ] === this.currentItem[ 0 ] ) {
  13900. for ( i in this._storedCSS ) {
  13901. if ( this._storedCSS[ i ] === "auto" || this._storedCSS[ i ] === "static" ) {
  13902. this._storedCSS[ i ] = "";
  13903. }
  13904. }
  13905. this.currentItem.css( this._storedCSS );
  13906. this._removeClass( this.currentItem, "ui-sortable-helper" );
  13907. } else {
  13908. this.currentItem.show();
  13909. }
  13910. if ( this.fromOutside && !noPropagation ) {
  13911. delayedTriggers.push( function( event ) {
  13912. this._trigger( "receive", event, this._uiHash( this.fromOutside ) );
  13913. } );
  13914. }
  13915. if ( ( this.fromOutside ||
  13916. this.domPosition.prev !==
  13917. this.currentItem.prev().not( ".ui-sortable-helper" )[ 0 ] ||
  13918. this.domPosition.parent !== this.currentItem.parent()[ 0 ] ) && !noPropagation ) {
  13919. // Trigger update callback if the DOM position has changed
  13920. delayedTriggers.push( function( event ) {
  13921. this._trigger( "update", event, this._uiHash() );
  13922. } );
  13923. }
  13924. // Check if the items Container has Changed and trigger appropriate
  13925. // events.
  13926. if ( this !== this.currentContainer ) {
  13927. if ( !noPropagation ) {
  13928. delayedTriggers.push( function( event ) {
  13929. this._trigger( "remove", event, this._uiHash() );
  13930. } );
  13931. delayedTriggers.push( ( function( c ) {
  13932. return function( event ) {
  13933. c._trigger( "receive", event, this._uiHash( this ) );
  13934. };
  13935. } ).call( this, this.currentContainer ) );
  13936. delayedTriggers.push( ( function( c ) {
  13937. return function( event ) {
  13938. c._trigger( "update", event, this._uiHash( this ) );
  13939. };
  13940. } ).call( this, this.currentContainer ) );
  13941. }
  13942. }
  13943. //Post events to containers
  13944. function delayEvent( type, instance, container ) {
  13945. return function( event ) {
  13946. container._trigger( type, event, instance._uiHash( instance ) );
  13947. };
  13948. }
  13949. for ( i = this.containers.length - 1; i >= 0; i-- ) {
  13950. if ( !noPropagation ) {
  13951. delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
  13952. }
  13953. if ( this.containers[ i ].containerCache.over ) {
  13954. delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
  13955. this.containers[ i ].containerCache.over = 0;
  13956. }
  13957. }
  13958. //Do what was originally in plugins
  13959. if ( this.storedCursor ) {
  13960. this.document.find( "body" ).css( "cursor", this.storedCursor );
  13961. this.storedStylesheet.remove();
  13962. }
  13963. if ( this._storedOpacity ) {
  13964. this.helper.css( "opacity", this._storedOpacity );
  13965. }
  13966. if ( this._storedZIndex ) {
  13967. this.helper.css( "zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex );
  13968. }
  13969. this.dragging = false;
  13970. if ( !noPropagation ) {
  13971. this._trigger( "beforeStop", event, this._uiHash() );
  13972. }
  13973. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
  13974. // it unbinds ALL events from the original node!
  13975. this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] );
  13976. if ( !this.cancelHelperRemoval ) {
  13977. if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
  13978. this.helper.remove();
  13979. }
  13980. this.helper = null;
  13981. }
  13982. if ( !noPropagation ) {
  13983. for ( i = 0; i < delayedTriggers.length; i++ ) {
  13984. // Trigger all delayed events
  13985. delayedTriggers[ i ].call( this, event );
  13986. }
  13987. this._trigger( "stop", event, this._uiHash() );
  13988. }
  13989. this.fromOutside = false;
  13990. return !this.cancelHelperRemoval;
  13991. },
  13992. _trigger: function() {
  13993. if ( $.Widget.prototype._trigger.apply( this, arguments ) === false ) {
  13994. this.cancel();
  13995. }
  13996. },
  13997. _uiHash: function( _inst ) {
  13998. var inst = _inst || this;
  13999. return {
  14000. helper: inst.helper,
  14001. placeholder: inst.placeholder || $( [] ),
  14002. position: inst.position,
  14003. originalPosition: inst.originalPosition,
  14004. offset: inst.positionAbs,
  14005. item: inst.currentItem,
  14006. sender: _inst ? _inst.element : null
  14007. };
  14008. }
  14009. } );
  14010. /*!
  14011. * jQuery UI Spinner 1.12.1
  14012. * http://jqueryui.com
  14013. *
  14014. * Copyright jQuery Foundation and other contributors
  14015. * Released under the MIT license.
  14016. * http://jquery.org/license
  14017. */
  14018. //>>label: Spinner
  14019. //>>group: Widgets
  14020. //>>description: Displays buttons to easily input numbers via the keyboard or mouse.
  14021. //>>docs: http://api.jqueryui.com/spinner/
  14022. //>>demos: http://jqueryui.com/spinner/
  14023. //>>css.structure: ../../themes/base/core.css
  14024. //>>css.structure: ../../themes/base/spinner.css
  14025. //>>css.theme: ../../themes/base/theme.css
  14026. function spinnerModifer( fn ) {
  14027. return function() {
  14028. var previous = this.element.val();
  14029. fn.apply( this, arguments );
  14030. this._refresh();
  14031. if ( previous !== this.element.val() ) {
  14032. this._trigger( "change" );
  14033. }
  14034. };
  14035. }
  14036. $.widget( "ui.spinner", {
  14037. version: "1.12.1",
  14038. defaultElement: "<input>",
  14039. widgetEventPrefix: "spin",
  14040. options: {
  14041. classes: {
  14042. "ui-spinner": "ui-corner-all",
  14043. "ui-spinner-down": "ui-corner-br",
  14044. "ui-spinner-up": "ui-corner-tr"
  14045. },
  14046. culture: null,
  14047. icons: {
  14048. down: "ui-icon-triangle-1-s",
  14049. up: "ui-icon-triangle-1-n"
  14050. },
  14051. incremental: true,
  14052. max: null,
  14053. min: null,
  14054. numberFormat: null,
  14055. page: 10,
  14056. step: 1,
  14057. change: null,
  14058. spin: null,
  14059. start: null,
  14060. stop: null
  14061. },
  14062. _create: function() {
  14063. // handle string values that need to be parsed
  14064. this._setOption( "max", this.options.max );
  14065. this._setOption( "min", this.options.min );
  14066. this._setOption( "step", this.options.step );
  14067. // Only format if there is a value, prevents the field from being marked
  14068. // as invalid in Firefox, see #9573.
  14069. if ( this.value() !== "" ) {
  14070. // Format the value, but don't constrain.
  14071. this._value( this.element.val(), true );
  14072. }
  14073. this._draw();
  14074. this._on( this._events );
  14075. this._refresh();
  14076. // Turning off autocomplete prevents the browser from remembering the
  14077. // value when navigating through history, so we re-enable autocomplete
  14078. // if the page is unloaded before the widget is destroyed. #7790
  14079. this._on( this.window, {
  14080. beforeunload: function() {
  14081. this.element.removeAttr( "autocomplete" );
  14082. }
  14083. } );
  14084. },
  14085. _getCreateOptions: function() {
  14086. var options = this._super();
  14087. var element = this.element;
  14088. $.each( [ "min", "max", "step" ], function( i, option ) {
  14089. var value = element.attr( option );
  14090. if ( value != null && value.length ) {
  14091. options[ option ] = value;
  14092. }
  14093. } );
  14094. return options;
  14095. },
  14096. _events: {
  14097. keydown: function( event ) {
  14098. if ( this._start( event ) && this._keydown( event ) ) {
  14099. event.preventDefault();
  14100. }
  14101. },
  14102. keyup: "_stop",
  14103. focus: function() {
  14104. this.previous = this.element.val();
  14105. },
  14106. blur: function( event ) {
  14107. if ( this.cancelBlur ) {
  14108. delete this.cancelBlur;
  14109. return;
  14110. }
  14111. this._stop();
  14112. this._refresh();
  14113. if ( this.previous !== this.element.val() ) {
  14114. this._trigger( "change", event );
  14115. }
  14116. },
  14117. mousewheel: function( event, delta ) {
  14118. if ( !delta ) {
  14119. return;
  14120. }
  14121. if ( !this.spinning && !this._start( event ) ) {
  14122. return false;
  14123. }
  14124. this._spin( ( delta > 0 ? 1 : -1 ) * this.options.step, event );
  14125. clearTimeout( this.mousewheelTimer );
  14126. this.mousewheelTimer = this._delay( function() {
  14127. if ( this.spinning ) {
  14128. this._stop( event );
  14129. }
  14130. }, 100 );
  14131. event.preventDefault();
  14132. },
  14133. "mousedown .ui-spinner-button": function( event ) {
  14134. var previous;
  14135. // We never want the buttons to have focus; whenever the user is
  14136. // interacting with the spinner, the focus should be on the input.
  14137. // If the input is focused then this.previous is properly set from
  14138. // when the input first received focus. If the input is not focused
  14139. // then we need to set this.previous based on the value before spinning.
  14140. previous = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] ) ?
  14141. this.previous : this.element.val();
  14142. function checkFocus() {
  14143. var isActive = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] );
  14144. if ( !isActive ) {
  14145. this.element.trigger( "focus" );
  14146. this.previous = previous;
  14147. // support: IE
  14148. // IE sets focus asynchronously, so we need to check if focus
  14149. // moved off of the input because the user clicked on the button.
  14150. this._delay( function() {
  14151. this.previous = previous;
  14152. } );
  14153. }
  14154. }
  14155. // Ensure focus is on (or stays on) the text field
  14156. event.preventDefault();
  14157. checkFocus.call( this );
  14158. // Support: IE
  14159. // IE doesn't prevent moving focus even with event.preventDefault()
  14160. // so we set a flag to know when we should ignore the blur event
  14161. // and check (again) if focus moved off of the input.
  14162. this.cancelBlur = true;
  14163. this._delay( function() {
  14164. delete this.cancelBlur;
  14165. checkFocus.call( this );
  14166. } );
  14167. if ( this._start( event ) === false ) {
  14168. return;
  14169. }
  14170. this._repeat( null, $( event.currentTarget )
  14171. .hasClass( "ui-spinner-up" ) ? 1 : -1, event );
  14172. },
  14173. "mouseup .ui-spinner-button": "_stop",
  14174. "mouseenter .ui-spinner-button": function( event ) {
  14175. // button will add ui-state-active if mouse was down while mouseleave and kept down
  14176. if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) {
  14177. return;
  14178. }
  14179. if ( this._start( event ) === false ) {
  14180. return false;
  14181. }
  14182. this._repeat( null, $( event.currentTarget )
  14183. .hasClass( "ui-spinner-up" ) ? 1 : -1, event );
  14184. },
  14185. // TODO: do we really want to consider this a stop?
  14186. // shouldn't we just stop the repeater and wait until mouseup before
  14187. // we trigger the stop event?
  14188. "mouseleave .ui-spinner-button": "_stop"
  14189. },
  14190. // Support mobile enhanced option and make backcompat more sane
  14191. _enhance: function() {
  14192. this.uiSpinner = this.element
  14193. .attr( "autocomplete", "off" )
  14194. .wrap( "<span>" )
  14195. .parent()
  14196. // Add buttons
  14197. .append(
  14198. "<a></a><a></a>"
  14199. );
  14200. },
  14201. _draw: function() {
  14202. this._enhance();
  14203. this._addClass( this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content" );
  14204. this._addClass( "ui-spinner-input" );
  14205. this.element.attr( "role", "spinbutton" );
  14206. // Button bindings
  14207. this.buttons = this.uiSpinner.children( "a" )
  14208. .attr( "tabIndex", -1 )
  14209. .attr( "aria-hidden", true )
  14210. .button( {
  14211. classes: {
  14212. "ui-button": ""
  14213. }
  14214. } );
  14215. // TODO: Right now button does not support classes this is already updated in button PR
  14216. this._removeClass( this.buttons, "ui-corner-all" );
  14217. this._addClass( this.buttons.first(), "ui-spinner-button ui-spinner-up" );
  14218. this._addClass( this.buttons.last(), "ui-spinner-button ui-spinner-down" );
  14219. this.buttons.first().button( {
  14220. "icon": this.options.icons.up,
  14221. "showLabel": false
  14222. } );
  14223. this.buttons.last().button( {
  14224. "icon": this.options.icons.down,
  14225. "showLabel": false
  14226. } );
  14227. // IE 6 doesn't understand height: 50% for the buttons
  14228. // unless the wrapper has an explicit height
  14229. if ( this.buttons.height() > Math.ceil( this.uiSpinner.height() * 0.5 ) &&
  14230. this.uiSpinner.height() > 0 ) {
  14231. this.uiSpinner.height( this.uiSpinner.height() );
  14232. }
  14233. },
  14234. _keydown: function( event ) {
  14235. var options = this.options,
  14236. keyCode = $.ui.keyCode;
  14237. switch ( event.keyCode ) {
  14238. case keyCode.UP:
  14239. this._repeat( null, 1, event );
  14240. return true;
  14241. case keyCode.DOWN:
  14242. this._repeat( null, -1, event );
  14243. return true;
  14244. case keyCode.PAGE_UP:
  14245. this._repeat( null, options.page, event );
  14246. return true;
  14247. case keyCode.PAGE_DOWN:
  14248. this._repeat( null, -options.page, event );
  14249. return true;
  14250. }
  14251. return false;
  14252. },
  14253. _start: function( event ) {
  14254. if ( !this.spinning && this._trigger( "start", event ) === false ) {
  14255. return false;
  14256. }
  14257. if ( !this.counter ) {
  14258. this.counter = 1;
  14259. }
  14260. this.spinning = true;
  14261. return true;
  14262. },
  14263. _repeat: function( i, steps, event ) {
  14264. i = i || 500;
  14265. clearTimeout( this.timer );
  14266. this.timer = this._delay( function() {
  14267. this._repeat( 40, steps, event );
  14268. }, i );
  14269. this._spin( steps * this.options.step, event );
  14270. },
  14271. _spin: function( step, event ) {
  14272. var value = this.value() || 0;
  14273. if ( !this.counter ) {
  14274. this.counter = 1;
  14275. }
  14276. value = this._adjustValue( value + step * this._increment( this.counter ) );
  14277. if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false ) {
  14278. this._value( value );
  14279. this.counter++;
  14280. }
  14281. },
  14282. _increment: function( i ) {
  14283. var incremental = this.options.incremental;
  14284. if ( incremental ) {
  14285. return $.isFunction( incremental ) ?
  14286. incremental( i ) :
  14287. Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 );
  14288. }
  14289. return 1;
  14290. },
  14291. _precision: function() {
  14292. var precision = this._precisionOf( this.options.step );
  14293. if ( this.options.min !== null ) {
  14294. precision = Math.max( precision, this._precisionOf( this.options.min ) );
  14295. }
  14296. return precision;
  14297. },
  14298. _precisionOf: function( num ) {
  14299. var str = num.toString(),
  14300. decimal = str.indexOf( "." );
  14301. return decimal === -1 ? 0 : str.length - decimal - 1;
  14302. },
  14303. _adjustValue: function( value ) {
  14304. var base, aboveMin,
  14305. options = this.options;
  14306. // Make sure we're at a valid step
  14307. // - find out where we are relative to the base (min or 0)
  14308. base = options.min !== null ? options.min : 0;
  14309. aboveMin = value - base;
  14310. // - round to the nearest step
  14311. aboveMin = Math.round( aboveMin / options.step ) * options.step;
  14312. // - rounding is based on 0, so adjust back to our base
  14313. value = base + aboveMin;
  14314. // Fix precision from bad JS floating point math
  14315. value = parseFloat( value.toFixed( this._precision() ) );
  14316. // Clamp the value
  14317. if ( options.max !== null && value > options.max ) {
  14318. return options.max;
  14319. }
  14320. if ( options.min !== null && value < options.min ) {
  14321. return options.min;
  14322. }
  14323. return value;
  14324. },
  14325. _stop: function( event ) {
  14326. if ( !this.spinning ) {
  14327. return;
  14328. }
  14329. clearTimeout( this.timer );
  14330. clearTimeout( this.mousewheelTimer );
  14331. this.counter = 0;
  14332. this.spinning = false;
  14333. this._trigger( "stop", event );
  14334. },
  14335. _setOption: function( key, value ) {
  14336. var prevValue, first, last;
  14337. if ( key === "culture" || key === "numberFormat" ) {
  14338. prevValue = this._parse( this.element.val() );
  14339. this.options[ key ] = value;
  14340. this.element.val( this._format( prevValue ) );
  14341. return;
  14342. }
  14343. if ( key === "max" || key === "min" || key === "step" ) {
  14344. if ( typeof value === "string" ) {
  14345. value = this._parse( value );
  14346. }
  14347. }
  14348. if ( key === "icons" ) {
  14349. first = this.buttons.first().find( ".ui-icon" );
  14350. this._removeClass( first, null, this.options.icons.up );
  14351. this._addClass( first, null, value.up );
  14352. last = this.buttons.last().find( ".ui-icon" );
  14353. this._removeClass( last, null, this.options.icons.down );
  14354. this._addClass( last, null, value.down );
  14355. }
  14356. this._super( key, value );
  14357. },
  14358. _setOptionDisabled: function( value ) {
  14359. this._super( value );
  14360. this._toggleClass( this.uiSpinner, null, "ui-state-disabled", !!value );
  14361. this.element.prop( "disabled", !!value );
  14362. this.buttons.button( value ? "disable" : "enable" );
  14363. },
  14364. _setOptions: spinnerModifer( function( options ) {
  14365. this._super( options );
  14366. } ),
  14367. _parse: function( val ) {
  14368. if ( typeof val === "string" && val !== "" ) {
  14369. val = window.Globalize && this.options.numberFormat ?
  14370. Globalize.parseFloat( val, 10, this.options.culture ) : +val;
  14371. }
  14372. return val === "" || isNaN( val ) ? null : val;
  14373. },
  14374. _format: function( value ) {
  14375. if ( value === "" ) {
  14376. return "";
  14377. }
  14378. return window.Globalize && this.options.numberFormat ?
  14379. Globalize.format( value, this.options.numberFormat, this.options.culture ) :
  14380. value;
  14381. },
  14382. _refresh: function() {
  14383. this.element.attr( {
  14384. "aria-valuemin": this.options.min,
  14385. "aria-valuemax": this.options.max,
  14386. // TODO: what should we do with values that can't be parsed?
  14387. "aria-valuenow": this._parse( this.element.val() )
  14388. } );
  14389. },
  14390. isValid: function() {
  14391. var value = this.value();
  14392. // Null is invalid
  14393. if ( value === null ) {
  14394. return false;
  14395. }
  14396. // If value gets adjusted, it's invalid
  14397. return value === this._adjustValue( value );
  14398. },
  14399. // Update the value without triggering change
  14400. _value: function( value, allowAny ) {
  14401. var parsed;
  14402. if ( value !== "" ) {
  14403. parsed = this._parse( value );
  14404. if ( parsed !== null ) {
  14405. if ( !allowAny ) {
  14406. parsed = this._adjustValue( parsed );
  14407. }
  14408. value = this._format( parsed );
  14409. }
  14410. }
  14411. this.element.val( value );
  14412. this._refresh();
  14413. },
  14414. _destroy: function() {
  14415. this.element
  14416. .prop( "disabled", false )
  14417. .removeAttr( "autocomplete role aria-valuemin aria-valuemax aria-valuenow" );
  14418. this.uiSpinner.replaceWith( this.element );
  14419. },
  14420. stepUp: spinnerModifer( function( steps ) {
  14421. this._stepUp( steps );
  14422. } ),
  14423. _stepUp: function( steps ) {
  14424. if ( this._start() ) {
  14425. this._spin( ( steps || 1 ) * this.options.step );
  14426. this._stop();
  14427. }
  14428. },
  14429. stepDown: spinnerModifer( function( steps ) {
  14430. this._stepDown( steps );
  14431. } ),
  14432. _stepDown: function( steps ) {
  14433. if ( this._start() ) {
  14434. this._spin( ( steps || 1 ) * -this.options.step );
  14435. this._stop();
  14436. }
  14437. },
  14438. pageUp: spinnerModifer( function( pages ) {
  14439. this._stepUp( ( pages || 1 ) * this.options.page );
  14440. } ),
  14441. pageDown: spinnerModifer( function( pages ) {
  14442. this._stepDown( ( pages || 1 ) * this.options.page );
  14443. } ),
  14444. value: function( newVal ) {
  14445. if ( !arguments.length ) {
  14446. return this._parse( this.element.val() );
  14447. }
  14448. spinnerModifer( this._value ).call( this, newVal );
  14449. },
  14450. widget: function() {
  14451. return this.uiSpinner;
  14452. }
  14453. } );
  14454. // DEPRECATED
  14455. // TODO: switch return back to widget declaration at top of file when this is removed
  14456. if ( $.uiBackCompat !== false ) {
  14457. // Backcompat for spinner html extension points
  14458. $.widget( "ui.spinner", $.ui.spinner, {
  14459. _enhance: function() {
  14460. this.uiSpinner = this.element
  14461. .attr( "autocomplete", "off" )
  14462. .wrap( this._uiSpinnerHtml() )
  14463. .parent()
  14464. // Add buttons
  14465. .append( this._buttonHtml() );
  14466. },
  14467. _uiSpinnerHtml: function() {
  14468. return "<span>";
  14469. },
  14470. _buttonHtml: function() {
  14471. return "<a></a><a></a>";
  14472. }
  14473. } );
  14474. }
  14475. var widgetsSpinner = $.ui.spinner;
  14476. /*!
  14477. * jQuery UI Tabs 1.12.1
  14478. * http://jqueryui.com
  14479. *
  14480. * Copyright jQuery Foundation and other contributors
  14481. * Released under the MIT license.
  14482. * http://jquery.org/license
  14483. */
  14484. //>>label: Tabs
  14485. //>>group: Widgets
  14486. //>>description: Transforms a set of container elements into a tab structure.
  14487. //>>docs: http://api.jqueryui.com/tabs/
  14488. //>>demos: http://jqueryui.com/tabs/
  14489. //>>css.structure: ../../themes/base/core.css
  14490. //>>css.structure: ../../themes/base/tabs.css
  14491. //>>css.theme: ../../themes/base/theme.css
  14492. $.widget( "ui.tabs", {
  14493. version: "1.12.1",
  14494. delay: 300,
  14495. options: {
  14496. active: null,
  14497. classes: {
  14498. "ui-tabs": "ui-corner-all",
  14499. "ui-tabs-nav": "ui-corner-all",
  14500. "ui-tabs-panel": "ui-corner-bottom",
  14501. "ui-tabs-tab": "ui-corner-top"
  14502. },
  14503. collapsible: false,
  14504. event: "click",
  14505. heightStyle: "content",
  14506. hide: null,
  14507. show: null,
  14508. // Callbacks
  14509. activate: null,
  14510. beforeActivate: null,
  14511. beforeLoad: null,
  14512. load: null
  14513. },
  14514. _isLocal: ( function() {
  14515. var rhash = /#.*$/;
  14516. return function( anchor ) {
  14517. var anchorUrl, locationUrl;
  14518. anchorUrl = anchor.href.replace( rhash, "" );
  14519. locationUrl = location.href.replace( rhash, "" );
  14520. // Decoding may throw an error if the URL isn't UTF-8 (#9518)
  14521. try {
  14522. anchorUrl = decodeURIComponent( anchorUrl );
  14523. } catch ( error ) {}
  14524. try {
  14525. locationUrl = decodeURIComponent( locationUrl );
  14526. } catch ( error ) {}
  14527. return anchor.hash.length > 1 && anchorUrl === locationUrl;
  14528. };
  14529. } )(),
  14530. _create: function() {
  14531. var that = this,
  14532. options = this.options;
  14533. this.running = false;
  14534. this._addClass( "ui-tabs", "ui-widget ui-widget-content" );
  14535. this._toggleClass( "ui-tabs-collapsible", null, options.collapsible );
  14536. this._processTabs();
  14537. options.active = this._initialActive();
  14538. // Take disabling tabs via class attribute from HTML
  14539. // into account and update option properly.
  14540. if ( $.isArray( options.disabled ) ) {
  14541. options.disabled = $.unique( options.disabled.concat(
  14542. $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {
  14543. return that.tabs.index( li );
  14544. } )
  14545. ) ).sort();
  14546. }
  14547. // Check for length avoids error when initializing empty list
  14548. if ( this.options.active !== false && this.anchors.length ) {
  14549. this.active = this._findActive( options.active );
  14550. } else {
  14551. this.active = $();
  14552. }
  14553. this._refresh();
  14554. if ( this.active.length ) {
  14555. this.load( options.active );
  14556. }
  14557. },
  14558. _initialActive: function() {
  14559. var active = this.options.active,
  14560. collapsible = this.options.collapsible,
  14561. locationHash = location.hash.substring( 1 );
  14562. if ( active === null ) {
  14563. // check the fragment identifier in the URL
  14564. if ( locationHash ) {
  14565. this.tabs.each( function( i, tab ) {
  14566. if ( $( tab ).attr( "aria-controls" ) === locationHash ) {
  14567. active = i;
  14568. return false;
  14569. }
  14570. } );
  14571. }
  14572. // Check for a tab marked active via a class
  14573. if ( active === null ) {
  14574. active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) );
  14575. }
  14576. // No active tab, set to false
  14577. if ( active === null || active === -1 ) {
  14578. active = this.tabs.length ? 0 : false;
  14579. }
  14580. }
  14581. // Handle numbers: negative, out of range
  14582. if ( active !== false ) {
  14583. active = this.tabs.index( this.tabs.eq( active ) );
  14584. if ( active === -1 ) {
  14585. active = collapsible ? false : 0;
  14586. }
  14587. }
  14588. // Don't allow collapsible: false and active: false
  14589. if ( !collapsible && active === false && this.anchors.length ) {
  14590. active = 0;
  14591. }
  14592. return active;
  14593. },
  14594. _getCreateEventData: function() {
  14595. return {
  14596. tab: this.active,
  14597. panel: !this.active.length ? $() : this._getPanelForTab( this.active )
  14598. };
  14599. },
  14600. _tabKeydown: function( event ) {
  14601. var focusedTab = $( $.ui.safeActiveElement( this.document[ 0 ] ) ).closest( "li" ),
  14602. selectedIndex = this.tabs.index( focusedTab ),
  14603. goingForward = true;
  14604. if ( this._handlePageNav( event ) ) {
  14605. return;
  14606. }
  14607. switch ( event.keyCode ) {
  14608. case $.ui.keyCode.RIGHT:
  14609. case $.ui.keyCode.DOWN:
  14610. selectedIndex++;
  14611. break;
  14612. case $.ui.keyCode.UP:
  14613. case $.ui.keyCode.LEFT:
  14614. goingForward = false;
  14615. selectedIndex--;
  14616. break;
  14617. case $.ui.keyCode.END:
  14618. selectedIndex = this.anchors.length - 1;
  14619. break;
  14620. case $.ui.keyCode.HOME:
  14621. selectedIndex = 0;
  14622. break;
  14623. case $.ui.keyCode.SPACE:
  14624. // Activate only, no collapsing
  14625. event.preventDefault();
  14626. clearTimeout( this.activating );
  14627. this._activate( selectedIndex );
  14628. return;
  14629. case $.ui.keyCode.ENTER:
  14630. // Toggle (cancel delayed activation, allow collapsing)
  14631. event.preventDefault();
  14632. clearTimeout( this.activating );
  14633. // Determine if we should collapse or activate
  14634. this._activate( selectedIndex === this.options.active ? false : selectedIndex );
  14635. return;
  14636. default:
  14637. return;
  14638. }
  14639. // Focus the appropriate tab, based on which key was pressed
  14640. event.preventDefault();
  14641. clearTimeout( this.activating );
  14642. selectedIndex = this._focusNextTab( selectedIndex, goingForward );
  14643. // Navigating with control/command key will prevent automatic activation
  14644. if ( !event.ctrlKey && !event.metaKey ) {
  14645. // Update aria-selected immediately so that AT think the tab is already selected.
  14646. // Otherwise AT may confuse the user by stating that they need to activate the tab,
  14647. // but the tab will already be activated by the time the announcement finishes.
  14648. focusedTab.attr( "aria-selected", "false" );
  14649. this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" );
  14650. this.activating = this._delay( function() {
  14651. this.option( "active", selectedIndex );
  14652. }, this.delay );
  14653. }
  14654. },
  14655. _panelKeydown: function( event ) {
  14656. if ( this._handlePageNav( event ) ) {
  14657. return;
  14658. }
  14659. // Ctrl+up moves focus to the current tab
  14660. if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) {
  14661. event.preventDefault();
  14662. this.active.trigger( "focus" );
  14663. }
  14664. },
  14665. // Alt+page up/down moves focus to the previous/next tab (and activates)
  14666. _handlePageNav: function( event ) {
  14667. if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) {
  14668. this._activate( this._focusNextTab( this.options.active - 1, false ) );
  14669. return true;
  14670. }
  14671. if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) {
  14672. this._activate( this._focusNextTab( this.options.active + 1, true ) );
  14673. return true;
  14674. }
  14675. },
  14676. _findNextTab: function( index, goingForward ) {
  14677. var lastTabIndex = this.tabs.length - 1;
  14678. function constrain() {
  14679. if ( index > lastTabIndex ) {
  14680. index = 0;
  14681. }
  14682. if ( index < 0 ) {
  14683. index = lastTabIndex;
  14684. }
  14685. return index;
  14686. }
  14687. while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) {
  14688. index = goingForward ? index + 1 : index - 1;
  14689. }
  14690. return index;
  14691. },
  14692. _focusNextTab: function( index, goingForward ) {
  14693. index = this._findNextTab( index, goingForward );
  14694. this.tabs.eq( index ).trigger( "focus" );
  14695. return index;
  14696. },
  14697. _setOption: function( key, value ) {
  14698. if ( key === "active" ) {
  14699. // _activate() will handle invalid values and update this.options
  14700. this._activate( value );
  14701. return;
  14702. }
  14703. this._super( key, value );
  14704. if ( key === "collapsible" ) {
  14705. this._toggleClass( "ui-tabs-collapsible", null, value );
  14706. // Setting collapsible: false while collapsed; open first panel
  14707. if ( !value && this.options.active === false ) {
  14708. this._activate( 0 );
  14709. }
  14710. }
  14711. if ( key === "event" ) {
  14712. this._setupEvents( value );
  14713. }
  14714. if ( key === "heightStyle" ) {
  14715. this._setupHeightStyle( value );
  14716. }
  14717. },
  14718. _sanitizeSelector: function( hash ) {
  14719. return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : "";
  14720. },
  14721. refresh: function() {
  14722. var options = this.options,
  14723. lis = this.tablist.children( ":has(a[href])" );
  14724. // Get disabled tabs from class attribute from HTML
  14725. // this will get converted to a boolean if needed in _refresh()
  14726. options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) {
  14727. return lis.index( tab );
  14728. } );
  14729. this._processTabs();
  14730. // Was collapsed or no tabs
  14731. if ( options.active === false || !this.anchors.length ) {
  14732. options.active = false;
  14733. this.active = $();
  14734. // was active, but active tab is gone
  14735. } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) {
  14736. // all remaining tabs are disabled
  14737. if ( this.tabs.length === options.disabled.length ) {
  14738. options.active = false;
  14739. this.active = $();
  14740. // activate previous tab
  14741. } else {
  14742. this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) );
  14743. }
  14744. // was active, active tab still exists
  14745. } else {
  14746. // make sure active index is correct
  14747. options.active = this.tabs.index( this.active );
  14748. }
  14749. this._refresh();
  14750. },
  14751. _refresh: function() {
  14752. this._setOptionDisabled( this.options.disabled );
  14753. this._setupEvents( this.options.event );
  14754. this._setupHeightStyle( this.options.heightStyle );
  14755. this.tabs.not( this.active ).attr( {
  14756. "aria-selected": "false",
  14757. "aria-expanded": "false",
  14758. tabIndex: -1
  14759. } );
  14760. this.panels.not( this._getPanelForTab( this.active ) )
  14761. .hide()
  14762. .attr( {
  14763. "aria-hidden": "true"
  14764. } );
  14765. // Make sure one tab is in the tab order
  14766. if ( !this.active.length ) {
  14767. this.tabs.eq( 0 ).attr( "tabIndex", 0 );
  14768. } else {
  14769. this.active
  14770. .attr( {
  14771. "aria-selected": "true",
  14772. "aria-expanded": "true",
  14773. tabIndex: 0
  14774. } );
  14775. this._addClass( this.active, "ui-tabs-active", "ui-state-active" );
  14776. this._getPanelForTab( this.active )
  14777. .show()
  14778. .attr( {
  14779. "aria-hidden": "false"
  14780. } );
  14781. }
  14782. },
  14783. _processTabs: function() {
  14784. var that = this,
  14785. prevTabs = this.tabs,
  14786. prevAnchors = this.anchors,
  14787. prevPanels = this.panels;
  14788. this.tablist = this._getList().attr( "role", "tablist" );
  14789. this._addClass( this.tablist, "ui-tabs-nav",
  14790. "ui-helper-reset ui-helper-clearfix ui-widget-header" );
  14791. // Prevent users from focusing disabled tabs via click
  14792. this.tablist
  14793. .on( "mousedown" + this.eventNamespace, "> li", function( event ) {
  14794. if ( $( this ).is( ".ui-state-disabled" ) ) {
  14795. event.preventDefault();
  14796. }
  14797. } )
  14798. // Support: IE <9
  14799. // Preventing the default action in mousedown doesn't prevent IE
  14800. // from focusing the element, so if the anchor gets focused, blur.
  14801. // We don't have to worry about focusing the previously focused
  14802. // element since clicking on a non-focusable element should focus
  14803. // the body anyway.
  14804. .on( "focus" + this.eventNamespace, ".ui-tabs-anchor", function() {
  14805. if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
  14806. this.blur();
  14807. }
  14808. } );
  14809. this.tabs = this.tablist.find( "> li:has(a[href])" )
  14810. .attr( {
  14811. role: "tab",
  14812. tabIndex: -1
  14813. } );
  14814. this._addClass( this.tabs, "ui-tabs-tab", "ui-state-default" );
  14815. this.anchors = this.tabs.map( function() {
  14816. return $( "a", this )[ 0 ];
  14817. } )
  14818. .attr( {
  14819. role: "presentation",
  14820. tabIndex: -1
  14821. } );
  14822. this._addClass( this.anchors, "ui-tabs-anchor" );
  14823. this.panels = $();
  14824. this.anchors.each( function( i, anchor ) {
  14825. var selector, panel, panelId,
  14826. anchorId = $( anchor ).uniqueId().attr( "id" ),
  14827. tab = $( anchor ).closest( "li" ),
  14828. originalAriaControls = tab.attr( "aria-controls" );
  14829. // Inline tab
  14830. if ( that._isLocal( anchor ) ) {
  14831. selector = anchor.hash;
  14832. panelId = selector.substring( 1 );
  14833. panel = that.element.find( that._sanitizeSelector( selector ) );
  14834. // remote tab
  14835. } else {
  14836. // If the tab doesn't already have aria-controls,
  14837. // generate an id by using a throw-away element
  14838. panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id;
  14839. selector = "#" + panelId;
  14840. panel = that.element.find( selector );
  14841. if ( !panel.length ) {
  14842. panel = that._createPanel( panelId );
  14843. panel.insertAfter( that.panels[ i - 1 ] || that.tablist );
  14844. }
  14845. panel.attr( "aria-live", "polite" );
  14846. }
  14847. if ( panel.length ) {
  14848. that.panels = that.panels.add( panel );
  14849. }
  14850. if ( originalAriaControls ) {
  14851. tab.data( "ui-tabs-aria-controls", originalAriaControls );
  14852. }
  14853. tab.attr( {
  14854. "aria-controls": panelId,
  14855. "aria-labelledby": anchorId
  14856. } );
  14857. panel.attr( "aria-labelledby", anchorId );
  14858. } );
  14859. this.panels.attr( "role", "tabpanel" );
  14860. this._addClass( this.panels, "ui-tabs-panel", "ui-widget-content" );
  14861. // Avoid memory leaks (#10056)
  14862. if ( prevTabs ) {
  14863. this._off( prevTabs.not( this.tabs ) );
  14864. this._off( prevAnchors.not( this.anchors ) );
  14865. this._off( prevPanels.not( this.panels ) );
  14866. }
  14867. },
  14868. // Allow overriding how to find the list for rare usage scenarios (#7715)
  14869. _getList: function() {
  14870. return this.tablist || this.element.find( "ol, ul" ).eq( 0 );
  14871. },
  14872. _createPanel: function( id ) {
  14873. return $( "<div>" )
  14874. .attr( "id", id )
  14875. .data( "ui-tabs-destroy", true );
  14876. },
  14877. _setOptionDisabled: function( disabled ) {
  14878. var currentItem, li, i;
  14879. if ( $.isArray( disabled ) ) {
  14880. if ( !disabled.length ) {
  14881. disabled = false;
  14882. } else if ( disabled.length === this.anchors.length ) {
  14883. disabled = true;
  14884. }
  14885. }
  14886. // Disable tabs
  14887. for ( i = 0; ( li = this.tabs[ i ] ); i++ ) {
  14888. currentItem = $( li );
  14889. if ( disabled === true || $.inArray( i, disabled ) !== -1 ) {
  14890. currentItem.attr( "aria-disabled", "true" );
  14891. this._addClass( currentItem, null, "ui-state-disabled" );
  14892. } else {
  14893. currentItem.removeAttr( "aria-disabled" );
  14894. this._removeClass( currentItem, null, "ui-state-disabled" );
  14895. }
  14896. }
  14897. this.options.disabled = disabled;
  14898. this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null,
  14899. disabled === true );
  14900. },
  14901. _setupEvents: function( event ) {
  14902. var events = {};
  14903. if ( event ) {
  14904. $.each( event.split( " " ), function( index, eventName ) {
  14905. events[ eventName ] = "_eventHandler";
  14906. } );
  14907. }
  14908. this._off( this.anchors.add( this.tabs ).add( this.panels ) );
  14909. // Always prevent the default action, even when disabled
  14910. this._on( true, this.anchors, {
  14911. click: function( event ) {
  14912. event.preventDefault();
  14913. }
  14914. } );
  14915. this._on( this.anchors, events );
  14916. this._on( this.tabs, { keydown: "_tabKeydown" } );
  14917. this._on( this.panels, { keydown: "_panelKeydown" } );
  14918. this._focusable( this.tabs );
  14919. this._hoverable( this.tabs );
  14920. },
  14921. _setupHeightStyle: function( heightStyle ) {
  14922. var maxHeight,
  14923. parent = this.element.parent();
  14924. if ( heightStyle === "fill" ) {
  14925. maxHeight = parent.height();
  14926. maxHeight -= this.element.outerHeight() - this.element.height();
  14927. this.element.siblings( ":visible" ).each( function() {
  14928. var elem = $( this ),
  14929. position = elem.css( "position" );
  14930. if ( position === "absolute" || position === "fixed" ) {
  14931. return;
  14932. }
  14933. maxHeight -= elem.outerHeight( true );
  14934. } );
  14935. this.element.children().not( this.panels ).each( function() {
  14936. maxHeight -= $( this ).outerHeight( true );
  14937. } );
  14938. this.panels.each( function() {
  14939. $( this ).height( Math.max( 0, maxHeight -
  14940. $( this ).innerHeight() + $( this ).height() ) );
  14941. } )
  14942. .css( "overflow", "auto" );
  14943. } else if ( heightStyle === "auto" ) {
  14944. maxHeight = 0;
  14945. this.panels.each( function() {
  14946. maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
  14947. } ).height( maxHeight );
  14948. }
  14949. },
  14950. _eventHandler: function( event ) {
  14951. var options = this.options,
  14952. active = this.active,
  14953. anchor = $( event.currentTarget ),
  14954. tab = anchor.closest( "li" ),
  14955. clickedIsActive = tab[ 0 ] === active[ 0 ],
  14956. collapsing = clickedIsActive && options.collapsible,
  14957. toShow = collapsing ? $() : this._getPanelForTab( tab ),
  14958. toHide = !active.length ? $() : this._getPanelForTab( active ),
  14959. eventData = {
  14960. oldTab: active,
  14961. oldPanel: toHide,
  14962. newTab: collapsing ? $() : tab,
  14963. newPanel: toShow
  14964. };
  14965. event.preventDefault();
  14966. if ( tab.hasClass( "ui-state-disabled" ) ||
  14967. // tab is already loading
  14968. tab.hasClass( "ui-tabs-loading" ) ||
  14969. // can't switch durning an animation
  14970. this.running ||
  14971. // click on active header, but not collapsible
  14972. ( clickedIsActive && !options.collapsible ) ||
  14973. // allow canceling activation
  14974. ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
  14975. return;
  14976. }
  14977. options.active = collapsing ? false : this.tabs.index( tab );
  14978. this.active = clickedIsActive ? $() : tab;
  14979. if ( this.xhr ) {
  14980. this.xhr.abort();
  14981. }
  14982. if ( !toHide.length && !toShow.length ) {
  14983. $.error( "jQuery UI Tabs: Mismatching fragment identifier." );
  14984. }
  14985. if ( toShow.length ) {
  14986. this.load( this.tabs.index( tab ), event );
  14987. }
  14988. this._toggle( event, eventData );
  14989. },
  14990. // Handles show/hide for selecting tabs
  14991. _toggle: function( event, eventData ) {
  14992. var that = this,
  14993. toShow = eventData.newPanel,
  14994. toHide = eventData.oldPanel;
  14995. this.running = true;
  14996. function complete() {
  14997. that.running = false;
  14998. that._trigger( "activate", event, eventData );
  14999. }
  15000. function show() {
  15001. that._addClass( eventData.newTab.closest( "li" ), "ui-tabs-active", "ui-state-active" );
  15002. if ( toShow.length && that.options.show ) {
  15003. that._show( toShow, that.options.show, complete );
  15004. } else {
  15005. toShow.show();
  15006. complete();
  15007. }
  15008. }
  15009. // Start out by hiding, then showing, then completing
  15010. if ( toHide.length && this.options.hide ) {
  15011. this._hide( toHide, this.options.hide, function() {
  15012. that._removeClass( eventData.oldTab.closest( "li" ),
  15013. "ui-tabs-active", "ui-state-active" );
  15014. show();
  15015. } );
  15016. } else {
  15017. this._removeClass( eventData.oldTab.closest( "li" ),
  15018. "ui-tabs-active", "ui-state-active" );
  15019. toHide.hide();
  15020. show();
  15021. }
  15022. toHide.attr( "aria-hidden", "true" );
  15023. eventData.oldTab.attr( {
  15024. "aria-selected": "false",
  15025. "aria-expanded": "false"
  15026. } );
  15027. // If we're switching tabs, remove the old tab from the tab order.
  15028. // If we're opening from collapsed state, remove the previous tab from the tab order.
  15029. // If we're collapsing, then keep the collapsing tab in the tab order.
  15030. if ( toShow.length && toHide.length ) {
  15031. eventData.oldTab.attr( "tabIndex", -1 );
  15032. } else if ( toShow.length ) {
  15033. this.tabs.filter( function() {
  15034. return $( this ).attr( "tabIndex" ) === 0;
  15035. } )
  15036. .attr( "tabIndex", -1 );
  15037. }
  15038. toShow.attr( "aria-hidden", "false" );
  15039. eventData.newTab.attr( {
  15040. "aria-selected": "true",
  15041. "aria-expanded": "true",
  15042. tabIndex: 0
  15043. } );
  15044. },
  15045. _activate: function( index ) {
  15046. var anchor,
  15047. active = this._findActive( index );
  15048. // Trying to activate the already active panel
  15049. if ( active[ 0 ] === this.active[ 0 ] ) {
  15050. return;
  15051. }
  15052. // Trying to collapse, simulate a click on the current active header
  15053. if ( !active.length ) {
  15054. active = this.active;
  15055. }
  15056. anchor = active.find( ".ui-tabs-anchor" )[ 0 ];
  15057. this._eventHandler( {
  15058. target: anchor,
  15059. currentTarget: anchor,
  15060. preventDefault: $.noop
  15061. } );
  15062. },
  15063. _findActive: function( index ) {
  15064. return index === false ? $() : this.tabs.eq( index );
  15065. },
  15066. _getIndex: function( index ) {
  15067. // meta-function to give users option to provide a href string instead of a numerical index.
  15068. if ( typeof index === "string" ) {
  15069. index = this.anchors.index( this.anchors.filter( "[href$='" +
  15070. $.ui.escapeSelector( index ) + "']" ) );
  15071. }
  15072. return index;
  15073. },
  15074. _destroy: function() {
  15075. if ( this.xhr ) {
  15076. this.xhr.abort();
  15077. }
  15078. this.tablist
  15079. .removeAttr( "role" )
  15080. .off( this.eventNamespace );
  15081. this.anchors
  15082. .removeAttr( "role tabIndex" )
  15083. .removeUniqueId();
  15084. this.tabs.add( this.panels ).each( function() {
  15085. if ( $.data( this, "ui-tabs-destroy" ) ) {
  15086. $( this ).remove();
  15087. } else {
  15088. $( this ).removeAttr( "role tabIndex " +
  15089. "aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded" );
  15090. }
  15091. } );
  15092. this.tabs.each( function() {
  15093. var li = $( this ),
  15094. prev = li.data( "ui-tabs-aria-controls" );
  15095. if ( prev ) {
  15096. li
  15097. .attr( "aria-controls", prev )
  15098. .removeData( "ui-tabs-aria-controls" );
  15099. } else {
  15100. li.removeAttr( "aria-controls" );
  15101. }
  15102. } );
  15103. this.panels.show();
  15104. if ( this.options.heightStyle !== "content" ) {
  15105. this.panels.css( "height", "" );
  15106. }
  15107. },
  15108. enable: function( index ) {
  15109. var disabled = this.options.disabled;
  15110. if ( disabled === false ) {
  15111. return;
  15112. }
  15113. if ( index === undefined ) {
  15114. disabled = false;
  15115. } else {
  15116. index = this._getIndex( index );
  15117. if ( $.isArray( disabled ) ) {
  15118. disabled = $.map( disabled, function( num ) {
  15119. return num !== index ? num : null;
  15120. } );
  15121. } else {
  15122. disabled = $.map( this.tabs, function( li, num ) {
  15123. return num !== index ? num : null;
  15124. } );
  15125. }
  15126. }
  15127. this._setOptionDisabled( disabled );
  15128. },
  15129. disable: function( index ) {
  15130. var disabled = this.options.disabled;
  15131. if ( disabled === true ) {
  15132. return;
  15133. }
  15134. if ( index === undefined ) {
  15135. disabled = true;
  15136. } else {
  15137. index = this._getIndex( index );
  15138. if ( $.inArray( index, disabled ) !== -1 ) {
  15139. return;
  15140. }
  15141. if ( $.isArray( disabled ) ) {
  15142. disabled = $.merge( [ index ], disabled ).sort();
  15143. } else {
  15144. disabled = [ index ];
  15145. }
  15146. }
  15147. this._setOptionDisabled( disabled );
  15148. },
  15149. load: function( index, event ) {
  15150. index = this._getIndex( index );
  15151. var that = this,
  15152. tab = this.tabs.eq( index ),
  15153. anchor = tab.find( ".ui-tabs-anchor" ),
  15154. panel = this._getPanelForTab( tab ),
  15155. eventData = {
  15156. tab: tab,
  15157. panel: panel
  15158. },
  15159. complete = function( jqXHR, status ) {
  15160. if ( status === "abort" ) {
  15161. that.panels.stop( false, true );
  15162. }
  15163. that._removeClass( tab, "ui-tabs-loading" );
  15164. panel.removeAttr( "aria-busy" );
  15165. if ( jqXHR === that.xhr ) {
  15166. delete that.xhr;
  15167. }
  15168. };
  15169. // Not remote
  15170. if ( this._isLocal( anchor[ 0 ] ) ) {
  15171. return;
  15172. }
  15173. this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) );
  15174. // Support: jQuery <1.8
  15175. // jQuery <1.8 returns false if the request is canceled in beforeSend,
  15176. // but as of 1.8, $.ajax() always returns a jqXHR object.
  15177. if ( this.xhr && this.xhr.statusText !== "canceled" ) {
  15178. this._addClass( tab, "ui-tabs-loading" );
  15179. panel.attr( "aria-busy", "true" );
  15180. this.xhr
  15181. .done( function( response, status, jqXHR ) {
  15182. // support: jQuery <1.8
  15183. // http://bugs.jquery.com/ticket/11778
  15184. setTimeout( function() {
  15185. panel.html( response );
  15186. that._trigger( "load", event, eventData );
  15187. complete( jqXHR, status );
  15188. }, 1 );
  15189. } )
  15190. .fail( function( jqXHR, status ) {
  15191. // support: jQuery <1.8
  15192. // http://bugs.jquery.com/ticket/11778
  15193. setTimeout( function() {
  15194. complete( jqXHR, status );
  15195. }, 1 );
  15196. } );
  15197. }
  15198. },
  15199. _ajaxSettings: function( anchor, event, eventData ) {
  15200. var that = this;
  15201. return {
  15202. // Support: IE <11 only
  15203. // Strip any hash that exists to prevent errors with the Ajax request
  15204. url: anchor.attr( "href" ).replace( /#.*$/, "" ),
  15205. beforeSend: function( jqXHR, settings ) {
  15206. return that._trigger( "beforeLoad", event,
  15207. $.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) );
  15208. }
  15209. };
  15210. },
  15211. _getPanelForTab: function( tab ) {
  15212. var id = $( tab ).attr( "aria-controls" );
  15213. return this.element.find( this._sanitizeSelector( "#" + id ) );
  15214. }
  15215. } );
  15216. // DEPRECATED
  15217. // TODO: Switch return back to widget declaration at top of file when this is removed
  15218. if ( $.uiBackCompat !== false ) {
  15219. // Backcompat for ui-tab class (now ui-tabs-tab)
  15220. $.widget( "ui.tabs", $.ui.tabs, {
  15221. _processTabs: function() {
  15222. this._superApply( arguments );
  15223. this._addClass( this.tabs, "ui-tab" );
  15224. }
  15225. } );
  15226. }
  15227. var widgetsTabs = $.ui.tabs;
  15228. /*!
  15229. * jQuery UI Tooltip 1.12.1
  15230. * http://jqueryui.com
  15231. *
  15232. * Copyright jQuery Foundation and other contributors
  15233. * Released under the MIT license.
  15234. * http://jquery.org/license
  15235. */
  15236. //>>label: Tooltip
  15237. //>>group: Widgets
  15238. //>>description: Shows additional information for any element on hover or focus.
  15239. //>>docs: http://api.jqueryui.com/tooltip/
  15240. //>>demos: http://jqueryui.com/tooltip/
  15241. //>>css.structure: ../../themes/base/core.css
  15242. //>>css.structure: ../../themes/base/tooltip.css
  15243. //>>css.theme: ../../themes/base/theme.css
  15244. $.widget( "ui.tooltip", {
  15245. version: "1.12.1",
  15246. options: {
  15247. classes: {
  15248. "ui-tooltip": "ui-corner-all ui-widget-shadow"
  15249. },
  15250. content: function() {
  15251. // support: IE<9, Opera in jQuery <1.7
  15252. // .text() can't accept undefined, so coerce to a string
  15253. var title = $( this ).attr( "title" ) || "";
  15254. // Escape title, since we're going from an attribute to raw HTML
  15255. return $( "<a>" ).text( title ).html();
  15256. },
  15257. hide: true,
  15258. // Disabled elements have inconsistent behavior across browsers (#8661)
  15259. items: "[title]:not([disabled])",
  15260. position: {
  15261. my: "left top+15",
  15262. at: "left bottom",
  15263. collision: "flipfit flip"
  15264. },
  15265. show: true,
  15266. track: false,
  15267. // Callbacks
  15268. close: null,
  15269. open: null
  15270. },
  15271. _addDescribedBy: function( elem, id ) {
  15272. var describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ );
  15273. describedby.push( id );
  15274. elem
  15275. .data( "ui-tooltip-id", id )
  15276. .attr( "aria-describedby", $.trim( describedby.join( " " ) ) );
  15277. },
  15278. _removeDescribedBy: function( elem ) {
  15279. var id = elem.data( "ui-tooltip-id" ),
  15280. describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ ),
  15281. index = $.inArray( id, describedby );
  15282. if ( index !== -1 ) {
  15283. describedby.splice( index, 1 );
  15284. }
  15285. elem.removeData( "ui-tooltip-id" );
  15286. describedby = $.trim( describedby.join( " " ) );
  15287. if ( describedby ) {
  15288. elem.attr( "aria-describedby", describedby );
  15289. } else {
  15290. elem.removeAttr( "aria-describedby" );
  15291. }
  15292. },
  15293. _create: function() {
  15294. this._on( {
  15295. mouseover: "open",
  15296. focusin: "open"
  15297. } );
  15298. // IDs of generated tooltips, needed for destroy
  15299. this.tooltips = {};
  15300. // IDs of parent tooltips where we removed the title attribute
  15301. this.parents = {};
  15302. // Append the aria-live region so tooltips announce correctly
  15303. this.liveRegion = $( "<div>" )
  15304. .attr( {
  15305. role: "log",
  15306. "aria-live": "assertive",
  15307. "aria-relevant": "additions"
  15308. } )
  15309. .appendTo( this.document[ 0 ].body );
  15310. this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" );
  15311. this.disabledTitles = $( [] );
  15312. },
  15313. _setOption: function( key, value ) {
  15314. var that = this;
  15315. this._super( key, value );
  15316. if ( key === "content" ) {
  15317. $.each( this.tooltips, function( id, tooltipData ) {
  15318. that._updateContent( tooltipData.element );
  15319. } );
  15320. }
  15321. },
  15322. _setOptionDisabled: function( value ) {
  15323. this[ value ? "_disable" : "_enable" ]();
  15324. },
  15325. _disable: function() {
  15326. var that = this;
  15327. // Close open tooltips
  15328. $.each( this.tooltips, function( id, tooltipData ) {
  15329. var event = $.Event( "blur" );
  15330. event.target = event.currentTarget = tooltipData.element[ 0 ];
  15331. that.close( event, true );
  15332. } );
  15333. // Remove title attributes to prevent native tooltips
  15334. this.disabledTitles = this.disabledTitles.add(
  15335. this.element.find( this.options.items ).addBack()
  15336. .filter( function() {
  15337. var element = $( this );
  15338. if ( element.is( "[title]" ) ) {
  15339. return element
  15340. .data( "ui-tooltip-title", element.attr( "title" ) )
  15341. .removeAttr( "title" );
  15342. }
  15343. } )
  15344. );
  15345. },
  15346. _enable: function() {
  15347. // restore title attributes
  15348. this.disabledTitles.each( function() {
  15349. var element = $( this );
  15350. if ( element.data( "ui-tooltip-title" ) ) {
  15351. element.attr( "title", element.data( "ui-tooltip-title" ) );
  15352. }
  15353. } );
  15354. this.disabledTitles = $( [] );
  15355. },
  15356. open: function( event ) {
  15357. var that = this,
  15358. target = $( event ? event.target : this.element )
  15359. // we need closest here due to mouseover bubbling,
  15360. // but always pointing at the same event target
  15361. .closest( this.options.items );
  15362. // No element to show a tooltip for or the tooltip is already open
  15363. if ( !target.length || target.data( "ui-tooltip-id" ) ) {
  15364. return;
  15365. }
  15366. if ( target.attr( "title" ) ) {
  15367. target.data( "ui-tooltip-title", target.attr( "title" ) );
  15368. }
  15369. target.data( "ui-tooltip-open", true );
  15370. // Kill parent tooltips, custom or native, for hover
  15371. if ( event && event.type === "mouseover" ) {
  15372. target.parents().each( function() {
  15373. var parent = $( this ),
  15374. blurEvent;
  15375. if ( parent.data( "ui-tooltip-open" ) ) {
  15376. blurEvent = $.Event( "blur" );
  15377. blurEvent.target = blurEvent.currentTarget = this;
  15378. that.close( blurEvent, true );
  15379. }
  15380. if ( parent.attr( "title" ) ) {
  15381. parent.uniqueId();
  15382. that.parents[ this.id ] = {
  15383. element: this,
  15384. title: parent.attr( "title" )
  15385. };
  15386. parent.attr( "title", "" );
  15387. }
  15388. } );
  15389. }
  15390. this._registerCloseHandlers( event, target );
  15391. this._updateContent( target, event );
  15392. },
  15393. _updateContent: function( target, event ) {
  15394. var content,
  15395. contentOption = this.options.content,
  15396. that = this,
  15397. eventType = event ? event.type : null;
  15398. if ( typeof contentOption === "string" || contentOption.nodeType ||
  15399. contentOption.jquery ) {
  15400. return this._open( event, target, contentOption );
  15401. }
  15402. content = contentOption.call( target[ 0 ], function( response ) {
  15403. // IE may instantly serve a cached response for ajax requests
  15404. // delay this call to _open so the other call to _open runs first
  15405. that._delay( function() {
  15406. // Ignore async response if tooltip was closed already
  15407. if ( !target.data( "ui-tooltip-open" ) ) {
  15408. return;
  15409. }
  15410. // JQuery creates a special event for focusin when it doesn't
  15411. // exist natively. To improve performance, the native event
  15412. // object is reused and the type is changed. Therefore, we can't
  15413. // rely on the type being correct after the event finished
  15414. // bubbling, so we set it back to the previous value. (#8740)
  15415. if ( event ) {
  15416. event.type = eventType;
  15417. }
  15418. this._open( event, target, response );
  15419. } );
  15420. } );
  15421. if ( content ) {
  15422. this._open( event, target, content );
  15423. }
  15424. },
  15425. _open: function( event, target, content ) {
  15426. var tooltipData, tooltip, delayedShow, a11yContent,
  15427. positionOption = $.extend( {}, this.options.position );
  15428. if ( !content ) {
  15429. return;
  15430. }
  15431. // Content can be updated multiple times. If the tooltip already
  15432. // exists, then just update the content and bail.
  15433. tooltipData = this._find( target );
  15434. if ( tooltipData ) {
  15435. tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content );
  15436. return;
  15437. }
  15438. // If we have a title, clear it to prevent the native tooltip
  15439. // we have to check first to avoid defining a title if none exists
  15440. // (we don't want to cause an element to start matching [title])
  15441. //
  15442. // We use removeAttr only for key events, to allow IE to export the correct
  15443. // accessible attributes. For mouse events, set to empty string to avoid
  15444. // native tooltip showing up (happens only when removing inside mouseover).
  15445. if ( target.is( "[title]" ) ) {
  15446. if ( event && event.type === "mouseover" ) {
  15447. target.attr( "title", "" );
  15448. } else {
  15449. target.removeAttr( "title" );
  15450. }
  15451. }
  15452. tooltipData = this._tooltip( target );
  15453. tooltip = tooltipData.tooltip;
  15454. this._addDescribedBy( target, tooltip.attr( "id" ) );
  15455. tooltip.find( ".ui-tooltip-content" ).html( content );
  15456. // Support: Voiceover on OS X, JAWS on IE <= 9
  15457. // JAWS announces deletions even when aria-relevant="additions"
  15458. // Voiceover will sometimes re-read the entire log region's contents from the beginning
  15459. this.liveRegion.children().hide();
  15460. a11yContent = $( "<div>" ).html( tooltip.find( ".ui-tooltip-content" ).html() );
  15461. a11yContent.removeAttr( "name" ).find( "[name]" ).removeAttr( "name" );
  15462. a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" );
  15463. a11yContent.appendTo( this.liveRegion );
  15464. function position( event ) {
  15465. positionOption.of = event;
  15466. if ( tooltip.is( ":hidden" ) ) {
  15467. return;
  15468. }
  15469. tooltip.position( positionOption );
  15470. }
  15471. if ( this.options.track && event && /^mouse/.test( event.type ) ) {
  15472. this._on( this.document, {
  15473. mousemove: position
  15474. } );
  15475. // trigger once to override element-relative positioning
  15476. position( event );
  15477. } else {
  15478. tooltip.position( $.extend( {
  15479. of: target
  15480. }, this.options.position ) );
  15481. }
  15482. tooltip.hide();
  15483. this._show( tooltip, this.options.show );
  15484. // Handle tracking tooltips that are shown with a delay (#8644). As soon
  15485. // as the tooltip is visible, position the tooltip using the most recent
  15486. // event.
  15487. // Adds the check to add the timers only when both delay and track options are set (#14682)
  15488. if ( this.options.track && this.options.show && this.options.show.delay ) {
  15489. delayedShow = this.delayedShow = setInterval( function() {
  15490. if ( tooltip.is( ":visible" ) ) {
  15491. position( positionOption.of );
  15492. clearInterval( delayedShow );
  15493. }
  15494. }, $.fx.interval );
  15495. }
  15496. this._trigger( "open", event, { tooltip: tooltip } );
  15497. },
  15498. _registerCloseHandlers: function( event, target ) {
  15499. var events = {
  15500. keyup: function( event ) {
  15501. if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
  15502. var fakeEvent = $.Event( event );
  15503. fakeEvent.currentTarget = target[ 0 ];
  15504. this.close( fakeEvent, true );
  15505. }
  15506. }
  15507. };
  15508. // Only bind remove handler for delegated targets. Non-delegated
  15509. // tooltips will handle this in destroy.
  15510. if ( target[ 0 ] !== this.element[ 0 ] ) {
  15511. events.remove = function() {
  15512. this._removeTooltip( this._find( target ).tooltip );
  15513. };
  15514. }
  15515. if ( !event || event.type === "mouseover" ) {
  15516. events.mouseleave = "close";
  15517. }
  15518. if ( !event || event.type === "focusin" ) {
  15519. events.focusout = "close";
  15520. }
  15521. this._on( true, target, events );
  15522. },
  15523. close: function( event ) {
  15524. var tooltip,
  15525. that = this,
  15526. target = $( event ? event.currentTarget : this.element ),
  15527. tooltipData = this._find( target );
  15528. // The tooltip may already be closed
  15529. if ( !tooltipData ) {
  15530. // We set ui-tooltip-open immediately upon open (in open()), but only set the
  15531. // additional data once there's actually content to show (in _open()). So even if the
  15532. // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in
  15533. // the period between open() and _open().
  15534. target.removeData( "ui-tooltip-open" );
  15535. return;
  15536. }
  15537. tooltip = tooltipData.tooltip;
  15538. // Disabling closes the tooltip, so we need to track when we're closing
  15539. // to avoid an infinite loop in case the tooltip becomes disabled on close
  15540. if ( tooltipData.closing ) {
  15541. return;
  15542. }
  15543. // Clear the interval for delayed tracking tooltips
  15544. clearInterval( this.delayedShow );
  15545. // Only set title if we had one before (see comment in _open())
  15546. // If the title attribute has changed since open(), don't restore
  15547. if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) {
  15548. target.attr( "title", target.data( "ui-tooltip-title" ) );
  15549. }
  15550. this._removeDescribedBy( target );
  15551. tooltipData.hiding = true;
  15552. tooltip.stop( true );
  15553. this._hide( tooltip, this.options.hide, function() {
  15554. that._removeTooltip( $( this ) );
  15555. } );
  15556. target.removeData( "ui-tooltip-open" );
  15557. this._off( target, "mouseleave focusout keyup" );
  15558. // Remove 'remove' binding only on delegated targets
  15559. if ( target[ 0 ] !== this.element[ 0 ] ) {
  15560. this._off( target, "remove" );
  15561. }
  15562. this._off( this.document, "mousemove" );
  15563. if ( event && event.type === "mouseleave" ) {
  15564. $.each( this.parents, function( id, parent ) {
  15565. $( parent.element ).attr( "title", parent.title );
  15566. delete that.parents[ id ];
  15567. } );
  15568. }
  15569. tooltipData.closing = true;
  15570. this._trigger( "close", event, { tooltip: tooltip } );
  15571. if ( !tooltipData.hiding ) {
  15572. tooltipData.closing = false;
  15573. }
  15574. },
  15575. _tooltip: function( element ) {
  15576. var tooltip = $( "<div>" ).attr( "role", "tooltip" ),
  15577. content = $( "<div>" ).appendTo( tooltip ),
  15578. id = tooltip.uniqueId().attr( "id" );
  15579. this._addClass( content, "ui-tooltip-content" );
  15580. this._addClass( tooltip, "ui-tooltip", "ui-widget ui-widget-content" );
  15581. tooltip.appendTo( this._appendTo( element ) );
  15582. return this.tooltips[ id ] = {
  15583. element: element,
  15584. tooltip: tooltip
  15585. };
  15586. },
  15587. _find: function( target ) {
  15588. var id = target.data( "ui-tooltip-id" );
  15589. return id ? this.tooltips[ id ] : null;
  15590. },
  15591. _removeTooltip: function( tooltip ) {
  15592. tooltip.remove();
  15593. delete this.tooltips[ tooltip.attr( "id" ) ];
  15594. },
  15595. _appendTo: function( target ) {
  15596. var element = target.closest( ".ui-front, dialog" );
  15597. if ( !element.length ) {
  15598. element = this.document[ 0 ].body;
  15599. }
  15600. return element;
  15601. },
  15602. _destroy: function() {
  15603. var that = this;
  15604. // Close open tooltips
  15605. $.each( this.tooltips, function( id, tooltipData ) {
  15606. // Delegate to close method to handle common cleanup
  15607. var event = $.Event( "blur" ),
  15608. element = tooltipData.element;
  15609. event.target = event.currentTarget = element[ 0 ];
  15610. that.close( event, true );
  15611. // Remove immediately; destroying an open tooltip doesn't use the
  15612. // hide animation
  15613. $( "#" + id ).remove();
  15614. // Restore the title
  15615. if ( element.data( "ui-tooltip-title" ) ) {
  15616. // If the title attribute has changed since open(), don't restore
  15617. if ( !element.attr( "title" ) ) {
  15618. element.attr( "title", element.data( "ui-tooltip-title" ) );
  15619. }
  15620. element.removeData( "ui-tooltip-title" );
  15621. }
  15622. } );
  15623. this.liveRegion.remove();
  15624. }
  15625. } );
  15626. // DEPRECATED
  15627. // TODO: Switch return back to widget declaration at top of file when this is removed
  15628. if ( $.uiBackCompat !== false ) {
  15629. // Backcompat for tooltipClass option
  15630. $.widget( "ui.tooltip", $.ui.tooltip, {
  15631. options: {
  15632. tooltipClass: null
  15633. },
  15634. _tooltip: function() {
  15635. var tooltipData = this._superApply( arguments );
  15636. if ( this.options.tooltipClass ) {
  15637. tooltipData.tooltip.addClass( this.options.tooltipClass );
  15638. }
  15639. return tooltipData;
  15640. }
  15641. } );
  15642. }
  15643. var widgetsTooltip = $.ui.tooltip;
  15644. }));
  15645. /***/ })
  15646. }]);
  15647. //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvanF1ZXJ5LXVpLWRpc3QvanF1ZXJ5LXVpLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O0FBQUE7QUFDQTtBQUNBO0FBQ0EscURBQXFEOztBQUVyRDtBQUNBLE1BQU0sSUFBMEM7O0FBRWhEO0FBQ0EsRUFBRSxpQ0FBTyxFQUFFLHdFQUFRLEVBQUUsb0NBQUUsT0FBTztBQUFBO0FBQUE7QUFBQSxrR0FBRTtBQUNoQyxFQUFFLE1BQU0sRUFJTjtBQUNGLENBQUM7O0FBRUQ7O0FBRUE7OztBQUdBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0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W5zcGFyZW50XCIgY29sb3Iga2V5d29yZFxuXHR0cmFuc3BhcmVudDogWyBudWxsLCBudWxsLCBudWxsLCAwIF0sXG5cblx0X2RlZmF1bHQ6IFwiI2ZmZmZmZlwiXG59O1xuXG59ICkoIGpRdWVyeSApO1xuXG4vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqL1xuLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiBDTEFTUyBBTklNQVRJT05TICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi9cbi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovXG4oIGZ1bmN0aW9uKCkge1xuXG52YXIgY2xhc3NBbmltYXRpb25BY3Rpb25zID0gWyBcImFkZFwiLCBcInJlbW92ZVwiLCBcInRvZ2dsZVwiIF0sXG5cdHNob3J0aGFuZFN0eWxlcyA9IHtcblx0XHRib3JkZXI6IDEsXG5cdFx0Ym9yZGVyQm90dG9tOiAxLFxuXHRcdGJvcmRlckNvbG9yOiAxLFxuXHRcdGJvcmRlckxlZnQ6IDEsXG5cdFx0Ym9yZGVyUmlnaHQ6IDEsXG5cdFx0Ym9yZGVyVG9wOiAxLFxuXHRcdGJvcmRlcldpZHRoOiAxLFxuXHRcdG1hcmdpbjogMSxcblx0XHRwYWRkaW5nOiAxXG5cdH07XG5cbiQuZWFjaChcblx0WyBcImJvcmRlckxlZnRTdHlsZVwiLCBcImJvcmRlclJpZ2h0U3R5bGVcIiwgXCJib3JkZXJCb3R0b21TdHlsZVwiLCBcImJvcmRlclRvcFN0eWxlXCIgXSxcblx0ZnVuY3Rpb24oIF8sIHByb3AgKSB7XG5cdFx0JC5meC5zdGVwWyBwcm9wIF0gPSBmdW5jdGlvbiggZnggKSB7XG5cdFx0XHRpZiAoIGZ4LmVuZCAhPT0gXCJub25lX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RcdHNwZWVkLCBlYXNpbmcsIGNhbGxiYWNrICk7XG5cdFx0XHRcdH1cblx0XHRcdH0gZWxzZSB7XG5cblx0XHRcdFx0Ly8gV2l0aG91dCBmb3JjZSBwYXJhbWV0ZXJcblx0XHRcdFx0cmV0dXJuICQuZWZmZWN0cy5hbmltYXRlQ2xhc3MuY2FsbCggdGhpcyxcblx0XHRcdFx0XHR7IHRvZ2dsZTogY2xhc3NOYW1lcyB9LCBmb3JjZSwgc3BlZWQsIGVhc2luZyApO1xuXHRcdFx0fVxuXHRcdH07XG5cdH0gKSggJC5mbi50b2dnbGVDbGFzcyApLFxuXG5cdHN3aXRjaENsYXNzOiBmdW5jdGlvbiggcmVtb3ZlLCBhZGQsIHNwZWVkLCBlYXNpbmcsIGNhbGxiYWNrICkge1xuXHRcdHJldHVybiAkLmVmZmVjdHMuYW5pbWF0ZUNsYXNzLmNhbGwoIHRoaXMsIHtcblx0XHRcdGFkZDogYWRkLFxuXHRcdFx0cmVtb3ZlOiByZW1vdmVcblx0XHR9LCBzcGVlZCwgZWFzaW5nLCBjYWxsYmFjayApO1xuXHR9XG59ICk7XG5cbn0gKSgpO1xuXG4vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqL1xuLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqIEVGRkVDVFMgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi9cbi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovXG5cbiggZnVuY3Rpb24oKSB7XG5cbmlmICggJC5leHByICYmICQuZXhwci5maWx0ZXJzICYmICQuZXhwci5maWx0ZXJzLmFuaW1hdGVkICkge1xuXHQkLmV4cHIuZmlsdGVycy5hbmltYXRlZCA9ICggZnVuY3Rpb24oIG9yaWcgKSB7XG5cdFx0cmV0dX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ogKCBmeC5lbmQucmlnaHQgLSBmeC5zdGFydC5yaWdodCApICsgZnguc3RhcnQucmlnaHQsXG5cdFx0Ym90dG9tOiBmeC5wb3MgKiAoIGZ4LmVuZC5ib3R0b20gLSBmeC5zdGFydC5ib3R0b20gKSArIGZ4LnN0YXJ0LmJvdHRvbSxcblx0XHRsZWZ0OiBmeC5wb3MgKiAoIGZ4LmVuZC5sZWZ0IC0gZnguc3RhcnQubGVmdCApICsgZnguc3RhcnQubGVmdFxuXHR9ICk7XG59O1xuXG59ICkoKTtcblxuLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi9cbi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiBFQVNJTkcgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovXG4vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqL1xuXG4oIGZ1bmN0aW9uKCkge1xuXG4vLyBCYXNlZCBvbiBlYXNpbmcgZXF1YXRpb25zIGZyb20gUm9iZXJ0IFBlbm5lciAoaHR0cDovL3d3dy5yb2JlcnRwZW5uZXIuY29tL2Vhc2luZylcblxudmFyIGJhc2VFYXNpbmdzID0ge307XG5cbiQuZWFjaCggWyBcIlF1YWRcIiwgXCJDdWJpY1wiLCBcIlF1YXJ0XCIsIFwiUXVpbnRcIiwgXCJFeHBvXCIgXSwgZnVuY3Rpb24oIGksIG5hbWUgKSB7XG5cdGJhc2VFYXNpbmdzWyBuYW1lIF0gPSBmdW5jdGlvbiggcCApIHtcblx0XHRyZXR1cm4gTWF0aC5wb3coIHAsIGkgKyAyICk7XG5cdH07XG59ICk7XG5cbiQuZXh0ZW5kKCBiYXNlRWFzaW5ncywge1xuXHRTaW5lOiBmdW5jdGlvbiggcCApIHtcblx0XHRyZXR1cm4gMSAtIE1hdGguY29z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