--- /dev/null
+/*! jQuery UI - v1.13.1 - 2022-03-30\r
+* http://jqueryui.com\r
+* Includes: widget.js, position.js, data.js, disable-selection.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/draggable.js, widgets/droppable.js, widgets/resizable.js, widgets/selectable.js, widgets/sortable.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/selectmenu.js, widgets/slider.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.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\r
+* Copyright jQuery Foundation and other contributors; Licensed MIT */\r
+\r
+( function( factory ) {\r
+ "use strict";\r
+ \r
+ if ( typeof define === "function" && define.amd ) {\r
+\r
+ // AMD. Register as an anonymous module.\r
+ define( [ "jquery" ], factory );\r
+ } else {\r
+\r
+ // Browser globals\r
+ factory( jQuery );\r
+ }\r
+} )( function( $ ) {\r
+"use strict";\r
+\r
+$.ui = $.ui || {};\r
+\r
+var version = $.ui.version = "1.13.1";\r
+\r
+\r
+/*!\r
+ * jQuery UI Widget 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Widget\r
+//>>group: Core\r
+//>>description: Provides a factory for creating stateful widgets with a common API.\r
+//>>docs: http://api.jqueryui.com/jQuery.widget/\r
+//>>demos: http://jqueryui.com/widget/\r
+\r
+\r
+var widgetUuid = 0;\r
+var widgetHasOwnProperty = Array.prototype.hasOwnProperty;\r
+var widgetSlice = Array.prototype.slice;\r
+\r
+$.cleanData = ( function( orig ) {\r
+ return function( elems ) {\r
+ var events, elem, i;\r
+ for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {\r
+\r
+ // Only trigger remove when necessary to save time\r
+ events = $._data( elem, "events" );\r
+ if ( events && events.remove ) {\r
+ $( elem ).triggerHandler( "remove" );\r
+ }\r
+ }\r
+ orig( elems );\r
+ };\r
+} )( $.cleanData );\r
+\r
+$.widget = function( name, base, prototype ) {\r
+ var existingConstructor, constructor, basePrototype;\r
+\r
+ // ProxiedPrototype allows the provided prototype to remain unmodified\r
+ // so that it can be used as a mixin for multiple widgets (#8876)\r
+ var proxiedPrototype = {};\r
+\r
+ var namespace = name.split( "." )[ 0 ];\r
+ name = name.split( "." )[ 1 ];\r
+ var fullName = namespace + "-" + name;\r
+\r
+ if ( !prototype ) {\r
+ prototype = base;\r
+ base = $.Widget;\r
+ }\r
+\r
+ if ( Array.isArray( prototype ) ) {\r
+ prototype = $.extend.apply( null, [ {} ].concat( prototype ) );\r
+ }\r
+\r
+ // Create selector for plugin\r
+ $.expr.pseudos[ fullName.toLowerCase() ] = function( elem ) {\r
+ return !!$.data( elem, fullName );\r
+ };\r
+\r
+ $[ namespace ] = $[ namespace ] || {};\r
+ existingConstructor = $[ namespace ][ name ];\r
+ constructor = $[ namespace ][ name ] = function( options, element ) {\r
+\r
+ // Allow instantiation without "new" keyword\r
+ if ( !this || !this._createWidget ) {\r
+ return new constructor( options, element );\r
+ }\r
+\r
+ // Allow instantiation without initializing for simple inheritance\r
+ // must use "new" keyword (the code above always passes args)\r
+ if ( arguments.length ) {\r
+ this._createWidget( options, element );\r
+ }\r
+ };\r
+\r
+ // Extend with the existing constructor to carry over any static properties\r
+ $.extend( constructor, existingConstructor, {\r
+ version: prototype.version,\r
+\r
+ // Copy the object used to create the prototype in case we need to\r
+ // redefine the widget later\r
+ _proto: $.extend( {}, prototype ),\r
+\r
+ // Track widgets that inherit from this widget in case this widget is\r
+ // redefined after a widget inherits from it\r
+ _childConstructors: []\r
+ } );\r
+\r
+ basePrototype = new base();\r
+\r
+ // We need to make the options hash a property directly on the new instance\r
+ // otherwise we'll modify the options hash on the prototype that we're\r
+ // inheriting from\r
+ basePrototype.options = $.widget.extend( {}, basePrototype.options );\r
+ $.each( prototype, function( prop, value ) {\r
+ if ( typeof value !== "function" ) {\r
+ proxiedPrototype[ prop ] = value;\r
+ return;\r
+ }\r
+ proxiedPrototype[ prop ] = ( function() {\r
+ function _super() {\r
+ return base.prototype[ prop ].apply( this, arguments );\r
+ }\r
+\r
+ function _superApply( args ) {\r
+ return base.prototype[ prop ].apply( this, args );\r
+ }\r
+\r
+ return function() {\r
+ var __super = this._super;\r
+ var __superApply = this._superApply;\r
+ var returnValue;\r
+\r
+ this._super = _super;\r
+ this._superApply = _superApply;\r
+\r
+ returnValue = value.apply( this, arguments );\r
+\r
+ this._super = __super;\r
+ this._superApply = __superApply;\r
+\r
+ return returnValue;\r
+ };\r
+ } )();\r
+ } );\r
+ constructor.prototype = $.widget.extend( basePrototype, {\r
+\r
+ // TODO: remove support for widgetEventPrefix\r
+ // always use the name + a colon as the prefix, e.g., draggable:start\r
+ // don't prefix for widgets that aren't DOM-based\r
+ widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name\r
+ }, proxiedPrototype, {\r
+ constructor: constructor,\r
+ namespace: namespace,\r
+ widgetName: name,\r
+ widgetFullName: fullName\r
+ } );\r
+\r
+ // If this widget is being redefined then we need to find all widgets that\r
+ // are inheriting from it and redefine all of them so that they inherit from\r
+ // the new version of this widget. We're essentially trying to replace one\r
+ // level in the prototype chain.\r
+ if ( existingConstructor ) {\r
+ $.each( existingConstructor._childConstructors, function( i, child ) {\r
+ var childPrototype = child.prototype;\r
+\r
+ // Redefine the child widget using the same prototype that was\r
+ // originally used, but inherit from the new version of the base\r
+ $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor,\r
+ child._proto );\r
+ } );\r
+\r
+ // Remove the list of existing child constructors from the old constructor\r
+ // so the old child constructors can be garbage collected\r
+ delete existingConstructor._childConstructors;\r
+ } else {\r
+ base._childConstructors.push( constructor );\r
+ }\r
+\r
+ $.widget.bridge( name, constructor );\r
+\r
+ return constructor;\r
+};\r
+\r
+$.widget.extend = function( target ) {\r
+ var input = widgetSlice.call( arguments, 1 );\r
+ var inputIndex = 0;\r
+ var inputLength = input.length;\r
+ var key;\r
+ var value;\r
+\r
+ for ( ; inputIndex < inputLength; inputIndex++ ) {\r
+ for ( key in input[ inputIndex ] ) {\r
+ value = input[ inputIndex ][ key ];\r
+ if ( widgetHasOwnProperty.call( input[ inputIndex ], key ) && value !== undefined ) {\r
+\r
+ // Clone objects\r
+ if ( $.isPlainObject( value ) ) {\r
+ target[ key ] = $.isPlainObject( target[ key ] ) ?\r
+ $.widget.extend( {}, target[ key ], value ) :\r
+\r
+ // Don't extend strings, arrays, etc. with objects\r
+ $.widget.extend( {}, value );\r
+\r
+ // Copy everything else by reference\r
+ } else {\r
+ target[ key ] = value;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ return target;\r
+};\r
+\r
+$.widget.bridge = function( name, object ) {\r
+ var fullName = object.prototype.widgetFullName || name;\r
+ $.fn[ name ] = function( options ) {\r
+ var isMethodCall = typeof options === "string";\r
+ var args = widgetSlice.call( arguments, 1 );\r
+ var returnValue = this;\r
+\r
+ if ( isMethodCall ) {\r
+\r
+ // If this is an empty collection, we need to have the instance method\r
+ // return undefined instead of the jQuery instance\r
+ if ( !this.length && options === "instance" ) {\r
+ returnValue = undefined;\r
+ } else {\r
+ this.each( function() {\r
+ var methodValue;\r
+ var instance = $.data( this, fullName );\r
+\r
+ if ( options === "instance" ) {\r
+ returnValue = instance;\r
+ return false;\r
+ }\r
+\r
+ if ( !instance ) {\r
+ return $.error( "cannot call methods on " + name +\r
+ " prior to initialization; " +\r
+ "attempted to call method '" + options + "'" );\r
+ }\r
+\r
+ if ( typeof instance[ options ] !== "function" ||\r
+ options.charAt( 0 ) === "_" ) {\r
+ return $.error( "no such method '" + options + "' for " + name +\r
+ " widget instance" );\r
+ }\r
+\r
+ methodValue = instance[ options ].apply( instance, args );\r
+\r
+ if ( methodValue !== instance && methodValue !== undefined ) {\r
+ returnValue = methodValue && methodValue.jquery ?\r
+ returnValue.pushStack( methodValue.get() ) :\r
+ methodValue;\r
+ return false;\r
+ }\r
+ } );\r
+ }\r
+ } else {\r
+\r
+ // Allow multiple hashes to be passed on init\r
+ if ( args.length ) {\r
+ options = $.widget.extend.apply( null, [ options ].concat( args ) );\r
+ }\r
+\r
+ this.each( function() {\r
+ var instance = $.data( this, fullName );\r
+ if ( instance ) {\r
+ instance.option( options || {} );\r
+ if ( instance._init ) {\r
+ instance._init();\r
+ }\r
+ } else {\r
+ $.data( this, fullName, new object( options, this ) );\r
+ }\r
+ } );\r
+ }\r
+\r
+ return returnValue;\r
+ };\r
+};\r
+\r
+$.Widget = function( /* options, element */ ) {};\r
+$.Widget._childConstructors = [];\r
+\r
+$.Widget.prototype = {\r
+ widgetName: "widget",\r
+ widgetEventPrefix: "",\r
+ defaultElement: "<div>",\r
+\r
+ options: {\r
+ classes: {},\r
+ disabled: false,\r
+\r
+ // Callbacks\r
+ create: null\r
+ },\r
+\r
+ _createWidget: function( options, element ) {\r
+ element = $( element || this.defaultElement || this )[ 0 ];\r
+ this.element = $( element );\r
+ this.uuid = widgetUuid++;\r
+ this.eventNamespace = "." + this.widgetName + this.uuid;\r
+\r
+ this.bindings = $();\r
+ this.hoverable = $();\r
+ this.focusable = $();\r
+ this.classesElementLookup = {};\r
+\r
+ if ( element !== this ) {\r
+ $.data( element, this.widgetFullName, this );\r
+ this._on( true, this.element, {\r
+ remove: function( event ) {\r
+ if ( event.target === element ) {\r
+ this.destroy();\r
+ }\r
+ }\r
+ } );\r
+ this.document = $( element.style ?\r
+\r
+ // Element within the document\r
+ element.ownerDocument :\r
+\r
+ // Element is window or document\r
+ element.document || element );\r
+ this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow );\r
+ }\r
+\r
+ this.options = $.widget.extend( {},\r
+ this.options,\r
+ this._getCreateOptions(),\r
+ options );\r
+\r
+ this._create();\r
+\r
+ if ( this.options.disabled ) {\r
+ this._setOptionDisabled( this.options.disabled );\r
+ }\r
+\r
+ this._trigger( "create", null, this._getCreateEventData() );\r
+ this._init();\r
+ },\r
+\r
+ _getCreateOptions: function() {\r
+ return {};\r
+ },\r
+\r
+ _getCreateEventData: $.noop,\r
+\r
+ _create: $.noop,\r
+\r
+ _init: $.noop,\r
+\r
+ destroy: function() {\r
+ var that = this;\r
+\r
+ this._destroy();\r
+ $.each( this.classesElementLookup, function( key, value ) {\r
+ that._removeClass( value, key );\r
+ } );\r
+\r
+ // We can probably remove the unbind calls in 2.0\r
+ // all event bindings should go through this._on()\r
+ this.element\r
+ .off( this.eventNamespace )\r
+ .removeData( this.widgetFullName );\r
+ this.widget()\r
+ .off( this.eventNamespace )\r
+ .removeAttr( "aria-disabled" );\r
+\r
+ // Clean up events and states\r
+ this.bindings.off( this.eventNamespace );\r
+ },\r
+\r
+ _destroy: $.noop,\r
+\r
+ widget: function() {\r
+ return this.element;\r
+ },\r
+\r
+ option: function( key, value ) {\r
+ var options = key;\r
+ var parts;\r
+ var curOption;\r
+ var i;\r
+\r
+ if ( arguments.length === 0 ) {\r
+\r
+ // Don't return a reference to the internal hash\r
+ return $.widget.extend( {}, this.options );\r
+ }\r
+\r
+ if ( typeof key === "string" ) {\r
+\r
+ // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }\r
+ options = {};\r
+ parts = key.split( "." );\r
+ key = parts.shift();\r
+ if ( parts.length ) {\r
+ curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );\r
+ for ( i = 0; i < parts.length - 1; i++ ) {\r
+ curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};\r
+ curOption = curOption[ parts[ i ] ];\r
+ }\r
+ key = parts.pop();\r
+ if ( arguments.length === 1 ) {\r
+ return curOption[ key ] === undefined ? null : curOption[ key ];\r
+ }\r
+ curOption[ key ] = value;\r
+ } else {\r
+ if ( arguments.length === 1 ) {\r
+ return this.options[ key ] === undefined ? null : this.options[ key ];\r
+ }\r
+ options[ key ] = value;\r
+ }\r
+ }\r
+\r
+ this._setOptions( options );\r
+\r
+ return this;\r
+ },\r
+\r
+ _setOptions: function( options ) {\r
+ var key;\r
+\r
+ for ( key in options ) {\r
+ this._setOption( key, options[ key ] );\r
+ }\r
+\r
+ return this;\r
+ },\r
+\r
+ _setOption: function( key, value ) {\r
+ if ( key === "classes" ) {\r
+ this._setOptionClasses( value );\r
+ }\r
+\r
+ this.options[ key ] = value;\r
+\r
+ if ( key === "disabled" ) {\r
+ this._setOptionDisabled( value );\r
+ }\r
+\r
+ return this;\r
+ },\r
+\r
+ _setOptionClasses: function( value ) {\r
+ var classKey, elements, currentElements;\r
+\r
+ for ( classKey in value ) {\r
+ currentElements = this.classesElementLookup[ classKey ];\r
+ if ( value[ classKey ] === this.options.classes[ classKey ] ||\r
+ !currentElements ||\r
+ !currentElements.length ) {\r
+ continue;\r
+ }\r
+\r
+ // We are doing this to create a new jQuery object because the _removeClass() call\r
+ // on the next line is going to destroy the reference to the current elements being\r
+ // tracked. We need to save a copy of this collection so that we can add the new classes\r
+ // below.\r
+ elements = $( currentElements.get() );\r
+ this._removeClass( currentElements, classKey );\r
+\r
+ // We don't use _addClass() here, because that uses this.options.classes\r
+ // for generating the string of classes. We want to use the value passed in from\r
+ // _setOption(), this is the new value of the classes option which was passed to\r
+ // _setOption(). We pass this value directly to _classes().\r
+ elements.addClass( this._classes( {\r
+ element: elements,\r
+ keys: classKey,\r
+ classes: value,\r
+ add: true\r
+ } ) );\r
+ }\r
+ },\r
+\r
+ _setOptionDisabled: function( value ) {\r
+ this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value );\r
+\r
+ // If the widget is becoming disabled, then nothing is interactive\r
+ if ( value ) {\r
+ this._removeClass( this.hoverable, null, "ui-state-hover" );\r
+ this._removeClass( this.focusable, null, "ui-state-focus" );\r
+ }\r
+ },\r
+\r
+ enable: function() {\r
+ return this._setOptions( { disabled: false } );\r
+ },\r
+\r
+ disable: function() {\r
+ return this._setOptions( { disabled: true } );\r
+ },\r
+\r
+ _classes: function( options ) {\r
+ var full = [];\r
+ var that = this;\r
+\r
+ options = $.extend( {\r
+ element: this.element,\r
+ classes: this.options.classes || {}\r
+ }, options );\r
+\r
+ function bindRemoveEvent() {\r
+ var nodesToBind = [];\r
+\r
+ options.element.each( function( _, element ) {\r
+ var isTracked = $.map( that.classesElementLookup, function( elements ) {\r
+ return elements;\r
+ } )\r
+ .some( function( elements ) {\r
+ return elements.is( element );\r
+ } );\r
+\r
+ if ( !isTracked ) {\r
+ nodesToBind.push( element );\r
+ }\r
+ } );\r
+\r
+ that._on( $( nodesToBind ), {\r
+ remove: "_untrackClassesElement"\r
+ } );\r
+ }\r
+\r
+ function processClassString( classes, checkOption ) {\r
+ var current, i;\r
+ for ( i = 0; i < classes.length; i++ ) {\r
+ current = that.classesElementLookup[ classes[ i ] ] || $();\r
+ if ( options.add ) {\r
+ bindRemoveEvent();\r
+ current = $( $.uniqueSort( current.get().concat( options.element.get() ) ) );\r
+ } else {\r
+ current = $( current.not( options.element ).get() );\r
+ }\r
+ that.classesElementLookup[ classes[ i ] ] = current;\r
+ full.push( classes[ i ] );\r
+ if ( checkOption && options.classes[ classes[ i ] ] ) {\r
+ full.push( options.classes[ classes[ i ] ] );\r
+ }\r
+ }\r
+ }\r
+\r
+ if ( options.keys ) {\r
+ processClassString( options.keys.match( /\S+/g ) || [], true );\r
+ }\r
+ if ( options.extra ) {\r
+ processClassString( options.extra.match( /\S+/g ) || [] );\r
+ }\r
+\r
+ return full.join( " " );\r
+ },\r
+\r
+ _untrackClassesElement: function( event ) {\r
+ var that = this;\r
+ $.each( that.classesElementLookup, function( key, value ) {\r
+ if ( $.inArray( event.target, value ) !== -1 ) {\r
+ that.classesElementLookup[ key ] = $( value.not( event.target ).get() );\r
+ }\r
+ } );\r
+\r
+ this._off( $( event.target ) );\r
+ },\r
+\r
+ _removeClass: function( element, keys, extra ) {\r
+ return this._toggleClass( element, keys, extra, false );\r
+ },\r
+\r
+ _addClass: function( element, keys, extra ) {\r
+ return this._toggleClass( element, keys, extra, true );\r
+ },\r
+\r
+ _toggleClass: function( element, keys, extra, add ) {\r
+ add = ( typeof add === "boolean" ) ? add : extra;\r
+ var shift = ( typeof element === "string" || element === null ),\r
+ options = {\r
+ extra: shift ? keys : extra,\r
+ keys: shift ? element : keys,\r
+ element: shift ? this.element : element,\r
+ add: add\r
+ };\r
+ options.element.toggleClass( this._classes( options ), add );\r
+ return this;\r
+ },\r
+\r
+ _on: function( suppressDisabledCheck, element, handlers ) {\r
+ var delegateElement;\r
+ var instance = this;\r
+\r
+ // No suppressDisabledCheck flag, shuffle arguments\r
+ if ( typeof suppressDisabledCheck !== "boolean" ) {\r
+ handlers = element;\r
+ element = suppressDisabledCheck;\r
+ suppressDisabledCheck = false;\r
+ }\r
+\r
+ // No element argument, shuffle and use this.element\r
+ if ( !handlers ) {\r
+ handlers = element;\r
+ element = this.element;\r
+ delegateElement = this.widget();\r
+ } else {\r
+ element = delegateElement = $( element );\r
+ this.bindings = this.bindings.add( element );\r
+ }\r
+\r
+ $.each( handlers, function( event, handler ) {\r
+ function handlerProxy() {\r
+\r
+ // Allow widgets to customize the disabled handling\r
+ // - disabled as an array instead of boolean\r
+ // - disabled class as method for disabling individual parts\r
+ if ( !suppressDisabledCheck &&\r
+ ( instance.options.disabled === true ||\r
+ $( this ).hasClass( "ui-state-disabled" ) ) ) {\r
+ return;\r
+ }\r
+ return ( typeof handler === "string" ? instance[ handler ] : handler )\r
+ .apply( instance, arguments );\r
+ }\r
+\r
+ // Copy the guid so direct unbinding works\r
+ if ( typeof handler !== "string" ) {\r
+ handlerProxy.guid = handler.guid =\r
+ handler.guid || handlerProxy.guid || $.guid++;\r
+ }\r
+\r
+ var match = event.match( /^([\w:-]*)\s*(.*)$/ );\r
+ var eventName = match[ 1 ] + instance.eventNamespace;\r
+ var selector = match[ 2 ];\r
+\r
+ if ( selector ) {\r
+ delegateElement.on( eventName, selector, handlerProxy );\r
+ } else {\r
+ element.on( eventName, handlerProxy );\r
+ }\r
+ } );\r
+ },\r
+\r
+ _off: function( element, eventName ) {\r
+ eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) +\r
+ this.eventNamespace;\r
+ element.off( eventName );\r
+\r
+ // Clear the stack to avoid memory leaks (#10056)\r
+ this.bindings = $( this.bindings.not( element ).get() );\r
+ this.focusable = $( this.focusable.not( element ).get() );\r
+ this.hoverable = $( this.hoverable.not( element ).get() );\r
+ },\r
+\r
+ _delay: function( handler, delay ) {\r
+ function handlerProxy() {\r
+ return ( typeof handler === "string" ? instance[ handler ] : handler )\r
+ .apply( instance, arguments );\r
+ }\r
+ var instance = this;\r
+ return setTimeout( handlerProxy, delay || 0 );\r
+ },\r
+\r
+ _hoverable: function( element ) {\r
+ this.hoverable = this.hoverable.add( element );\r
+ this._on( element, {\r
+ mouseenter: function( event ) {\r
+ this._addClass( $( event.currentTarget ), null, "ui-state-hover" );\r
+ },\r
+ mouseleave: function( event ) {\r
+ this._removeClass( $( event.currentTarget ), null, "ui-state-hover" );\r
+ }\r
+ } );\r
+ },\r
+\r
+ _focusable: function( element ) {\r
+ this.focusable = this.focusable.add( element );\r
+ this._on( element, {\r
+ focusin: function( event ) {\r
+ this._addClass( $( event.currentTarget ), null, "ui-state-focus" );\r
+ },\r
+ focusout: function( event ) {\r
+ this._removeClass( $( event.currentTarget ), null, "ui-state-focus" );\r
+ }\r
+ } );\r
+ },\r
+\r
+ _trigger: function( type, event, data ) {\r
+ var prop, orig;\r
+ var callback = this.options[ type ];\r
+\r
+ data = data || {};\r
+ event = $.Event( event );\r
+ event.type = ( type === this.widgetEventPrefix ?\r
+ type :\r
+ this.widgetEventPrefix + type ).toLowerCase();\r
+\r
+ // The original event may come from any element\r
+ // so we need to reset the target on the new event\r
+ event.target = this.element[ 0 ];\r
+\r
+ // Copy original event properties over to the new event\r
+ orig = event.originalEvent;\r
+ if ( orig ) {\r
+ for ( prop in orig ) {\r
+ if ( !( prop in event ) ) {\r
+ event[ prop ] = orig[ prop ];\r
+ }\r
+ }\r
+ }\r
+\r
+ this.element.trigger( event, data );\r
+ return !( typeof callback === "function" &&\r
+ callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false ||\r
+ event.isDefaultPrevented() );\r
+ }\r
+};\r
+\r
+$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {\r
+ $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {\r
+ if ( typeof options === "string" ) {\r
+ options = { effect: options };\r
+ }\r
+\r
+ var hasOptions;\r
+ var effectName = !options ?\r
+ method :\r
+ options === true || typeof options === "number" ?\r
+ defaultEffect :\r
+ options.effect || defaultEffect;\r
+\r
+ options = options || {};\r
+ if ( typeof options === "number" ) {\r
+ options = { duration: options };\r
+ } else if ( options === true ) {\r
+ options = {};\r
+ }\r
+\r
+ hasOptions = !$.isEmptyObject( options );\r
+ options.complete = callback;\r
+\r
+ if ( options.delay ) {\r
+ element.delay( options.delay );\r
+ }\r
+\r
+ if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {\r
+ element[ method ]( options );\r
+ } else if ( effectName !== method && element[ effectName ] ) {\r
+ element[ effectName ]( options.duration, options.easing, callback );\r
+ } else {\r
+ element.queue( function( next ) {\r
+ $( this )[ method ]();\r
+ if ( callback ) {\r
+ callback.call( element[ 0 ] );\r
+ }\r
+ next();\r
+ } );\r
+ }\r
+ };\r
+} );\r
+\r
+var widget = $.widget;\r
+\r
+\r
+/*!\r
+ * jQuery UI Position 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ *\r
+ * http://api.jqueryui.com/position/\r
+ */\r
+\r
+//>>label: Position\r
+//>>group: Core\r
+//>>description: Positions elements relative to other elements.\r
+//>>docs: http://api.jqueryui.com/position/\r
+//>>demos: http://jqueryui.com/position/\r
+\r
+\r
+( function() {\r
+var cachedScrollbarWidth,\r
+ max = Math.max,\r
+ abs = Math.abs,\r
+ rhorizontal = /left|center|right/,\r
+ rvertical = /top|center|bottom/,\r
+ roffset = /[\+\-]\d+(\.[\d]+)?%?/,\r
+ rposition = /^\w+/,\r
+ rpercent = /%$/,\r
+ _position = $.fn.position;\r
+\r
+function getOffsets( offsets, width, height ) {\r
+ return [\r
+ parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),\r
+ parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )\r
+ ];\r
+}\r
+\r
+function parseCss( element, property ) {\r
+ return parseInt( $.css( element, property ), 10 ) || 0;\r
+}\r
+\r
+function isWindow( obj ) {\r
+ return obj != null && obj === obj.window;\r
+}\r
+\r
+function getDimensions( elem ) {\r
+ var raw = elem[ 0 ];\r
+ if ( raw.nodeType === 9 ) {\r
+ return {\r
+ width: elem.width(),\r
+ height: elem.height(),\r
+ offset: { top: 0, left: 0 }\r
+ };\r
+ }\r
+ if ( isWindow( raw ) ) {\r
+ return {\r
+ width: elem.width(),\r
+ height: elem.height(),\r
+ offset: { top: elem.scrollTop(), left: elem.scrollLeft() }\r
+ };\r
+ }\r
+ if ( raw.preventDefault ) {\r
+ return {\r
+ width: 0,\r
+ height: 0,\r
+ offset: { top: raw.pageY, left: raw.pageX }\r
+ };\r
+ }\r
+ return {\r
+ width: elem.outerWidth(),\r
+ height: elem.outerHeight(),\r
+ offset: elem.offset()\r
+ };\r
+}\r
+\r
+$.position = {\r
+ scrollbarWidth: function() {\r
+ if ( cachedScrollbarWidth !== undefined ) {\r
+ return cachedScrollbarWidth;\r
+ }\r
+ var w1, w2,\r
+ div = $( "<div style=" +\r
+ "'display:block;position:absolute;width:200px;height:200px;overflow:hidden;'>" +\r
+ "<div style='height:300px;width:auto;'></div></div>" ),\r
+ innerDiv = div.children()[ 0 ];\r
+\r
+ $( "body" ).append( div );\r
+ w1 = innerDiv.offsetWidth;\r
+ div.css( "overflow", "scroll" );\r
+\r
+ w2 = innerDiv.offsetWidth;\r
+\r
+ if ( w1 === w2 ) {\r
+ w2 = div[ 0 ].clientWidth;\r
+ }\r
+\r
+ div.remove();\r
+\r
+ return ( cachedScrollbarWidth = w1 - w2 );\r
+ },\r
+ getScrollInfo: function( within ) {\r
+ var overflowX = within.isWindow || within.isDocument ? "" :\r
+ within.element.css( "overflow-x" ),\r
+ overflowY = within.isWindow || within.isDocument ? "" :\r
+ within.element.css( "overflow-y" ),\r
+ hasOverflowX = overflowX === "scroll" ||\r
+ ( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ),\r
+ hasOverflowY = overflowY === "scroll" ||\r
+ ( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight );\r
+ return {\r
+ width: hasOverflowY ? $.position.scrollbarWidth() : 0,\r
+ height: hasOverflowX ? $.position.scrollbarWidth() : 0\r
+ };\r
+ },\r
+ getWithinInfo: function( element ) {\r
+ var withinElement = $( element || window ),\r
+ isElemWindow = isWindow( withinElement[ 0 ] ),\r
+ isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9,\r
+ hasOffset = !isElemWindow && !isDocument;\r
+ return {\r
+ element: withinElement,\r
+ isWindow: isElemWindow,\r
+ isDocument: isDocument,\r
+ offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 },\r
+ scrollLeft: withinElement.scrollLeft(),\r
+ scrollTop: withinElement.scrollTop(),\r
+ width: withinElement.outerWidth(),\r
+ height: withinElement.outerHeight()\r
+ };\r
+ }\r
+};\r
+\r
+$.fn.position = function( options ) {\r
+ if ( !options || !options.of ) {\r
+ return _position.apply( this, arguments );\r
+ }\r
+\r
+ // Make a copy, we don't want to modify arguments\r
+ options = $.extend( {}, options );\r
+\r
+ var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,\r
+\r
+ // Make sure string options are treated as CSS selectors\r
+ target = typeof options.of === "string" ?\r
+ $( document ).find( options.of ) :\r
+ $( options.of ),\r
+\r
+ within = $.position.getWithinInfo( options.within ),\r
+ scrollInfo = $.position.getScrollInfo( within ),\r
+ collision = ( options.collision || "flip" ).split( " " ),\r
+ offsets = {};\r
+\r
+ dimensions = getDimensions( target );\r
+ if ( target[ 0 ].preventDefault ) {\r
+\r
+ // Force left top to allow flipping\r
+ options.at = "left top";\r
+ }\r
+ targetWidth = dimensions.width;\r
+ targetHeight = dimensions.height;\r
+ targetOffset = dimensions.offset;\r
+\r
+ // Clone to reuse original targetOffset later\r
+ basePosition = $.extend( {}, targetOffset );\r
+\r
+ // Force my and at to have valid horizontal and vertical positions\r
+ // if a value is missing or invalid, it will be converted to center\r
+ $.each( [ "my", "at" ], function() {\r
+ var pos = ( options[ this ] || "" ).split( " " ),\r
+ horizontalOffset,\r
+ verticalOffset;\r
+\r
+ if ( pos.length === 1 ) {\r
+ pos = rhorizontal.test( pos[ 0 ] ) ?\r
+ pos.concat( [ "center" ] ) :\r
+ rvertical.test( pos[ 0 ] ) ?\r
+ [ "center" ].concat( pos ) :\r
+ [ "center", "center" ];\r
+ }\r
+ pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";\r
+ pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";\r
+\r
+ // Calculate offsets\r
+ horizontalOffset = roffset.exec( pos[ 0 ] );\r
+ verticalOffset = roffset.exec( pos[ 1 ] );\r
+ offsets[ this ] = [\r
+ horizontalOffset ? horizontalOffset[ 0 ] : 0,\r
+ verticalOffset ? verticalOffset[ 0 ] : 0\r
+ ];\r
+\r
+ // Reduce to just the positions without the offsets\r
+ options[ this ] = [\r
+ rposition.exec( pos[ 0 ] )[ 0 ],\r
+ rposition.exec( pos[ 1 ] )[ 0 ]\r
+ ];\r
+ } );\r
+\r
+ // Normalize collision option\r
+ if ( collision.length === 1 ) {\r
+ collision[ 1 ] = collision[ 0 ];\r
+ }\r
+\r
+ if ( options.at[ 0 ] === "right" ) {\r
+ basePosition.left += targetWidth;\r
+ } else if ( options.at[ 0 ] === "center" ) {\r
+ basePosition.left += targetWidth / 2;\r
+ }\r
+\r
+ if ( options.at[ 1 ] === "bottom" ) {\r
+ basePosition.top += targetHeight;\r
+ } else if ( options.at[ 1 ] === "center" ) {\r
+ basePosition.top += targetHeight / 2;\r
+ }\r
+\r
+ atOffset = getOffsets( offsets.at, targetWidth, targetHeight );\r
+ basePosition.left += atOffset[ 0 ];\r
+ basePosition.top += atOffset[ 1 ];\r
+\r
+ return this.each( function() {\r
+ var collisionPosition, using,\r
+ elem = $( this ),\r
+ elemWidth = elem.outerWidth(),\r
+ elemHeight = elem.outerHeight(),\r
+ marginLeft = parseCss( this, "marginLeft" ),\r
+ marginTop = parseCss( this, "marginTop" ),\r
+ collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) +\r
+ scrollInfo.width,\r
+ collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) +\r
+ scrollInfo.height,\r
+ position = $.extend( {}, basePosition ),\r
+ myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );\r
+\r
+ if ( options.my[ 0 ] === "right" ) {\r
+ position.left -= elemWidth;\r
+ } else if ( options.my[ 0 ] === "center" ) {\r
+ position.left -= elemWidth / 2;\r
+ }\r
+\r
+ if ( options.my[ 1 ] === "bottom" ) {\r
+ position.top -= elemHeight;\r
+ } else if ( options.my[ 1 ] === "center" ) {\r
+ position.top -= elemHeight / 2;\r
+ }\r
+\r
+ position.left += myOffset[ 0 ];\r
+ position.top += myOffset[ 1 ];\r
+\r
+ collisionPosition = {\r
+ marginLeft: marginLeft,\r
+ marginTop: marginTop\r
+ };\r
+\r
+ $.each( [ "left", "top" ], function( i, dir ) {\r
+ if ( $.ui.position[ collision[ i ] ] ) {\r
+ $.ui.position[ collision[ i ] ][ dir ]( position, {\r
+ targetWidth: targetWidth,\r
+ targetHeight: targetHeight,\r
+ elemWidth: elemWidth,\r
+ elemHeight: elemHeight,\r
+ collisionPosition: collisionPosition,\r
+ collisionWidth: collisionWidth,\r
+ collisionHeight: collisionHeight,\r
+ offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],\r
+ my: options.my,\r
+ at: options.at,\r
+ within: within,\r
+ elem: elem\r
+ } );\r
+ }\r
+ } );\r
+\r
+ if ( options.using ) {\r
+\r
+ // Adds feedback as second argument to using callback, if present\r
+ using = function( props ) {\r
+ var left = targetOffset.left - position.left,\r
+ right = left + targetWidth - elemWidth,\r
+ top = targetOffset.top - position.top,\r
+ bottom = top + targetHeight - elemHeight,\r
+ feedback = {\r
+ target: {\r
+ element: target,\r
+ left: targetOffset.left,\r
+ top: targetOffset.top,\r
+ width: targetWidth,\r
+ height: targetHeight\r
+ },\r
+ element: {\r
+ element: elem,\r
+ left: position.left,\r
+ top: position.top,\r
+ width: elemWidth,\r
+ height: elemHeight\r
+ },\r
+ horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",\r
+ vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"\r
+ };\r
+ if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {\r
+ feedback.horizontal = "center";\r
+ }\r
+ if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {\r
+ feedback.vertical = "middle";\r
+ }\r
+ if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {\r
+ feedback.important = "horizontal";\r
+ } else {\r
+ feedback.important = "vertical";\r
+ }\r
+ options.using.call( this, props, feedback );\r
+ };\r
+ }\r
+\r
+ elem.offset( $.extend( position, { using: using } ) );\r
+ } );\r
+};\r
+\r
+$.ui.position = {\r
+ fit: {\r
+ left: function( position, data ) {\r
+ var within = data.within,\r
+ withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,\r
+ outerWidth = within.width,\r
+ collisionPosLeft = position.left - data.collisionPosition.marginLeft,\r
+ overLeft = withinOffset - collisionPosLeft,\r
+ overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,\r
+ newOverRight;\r
+\r
+ // Element is wider than within\r
+ if ( data.collisionWidth > outerWidth ) {\r
+\r
+ // Element is initially over the left side of within\r
+ if ( overLeft > 0 && overRight <= 0 ) {\r
+ newOverRight = position.left + overLeft + data.collisionWidth - outerWidth -\r
+ withinOffset;\r
+ position.left += overLeft - newOverRight;\r
+\r
+ // Element is initially over right side of within\r
+ } else if ( overRight > 0 && overLeft <= 0 ) {\r
+ position.left = withinOffset;\r
+\r
+ // Element is initially over both left and right sides of within\r
+ } else {\r
+ if ( overLeft > overRight ) {\r
+ position.left = withinOffset + outerWidth - data.collisionWidth;\r
+ } else {\r
+ position.left = withinOffset;\r
+ }\r
+ }\r
+\r
+ // Too far left -> align with left edge\r
+ } else if ( overLeft > 0 ) {\r
+ position.left += overLeft;\r
+\r
+ // Too far right -> align with right edge\r
+ } else if ( overRight > 0 ) {\r
+ position.left -= overRight;\r
+\r
+ // Adjust based on position and margin\r
+ } else {\r
+ position.left = max( position.left - collisionPosLeft, position.left );\r
+ }\r
+ },\r
+ top: function( position, data ) {\r
+ var within = data.within,\r
+ withinOffset = within.isWindow ? within.scrollTop : within.offset.top,\r
+ outerHeight = data.within.height,\r
+ collisionPosTop = position.top - data.collisionPosition.marginTop,\r
+ overTop = withinOffset - collisionPosTop,\r
+ overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,\r
+ newOverBottom;\r
+\r
+ // Element is taller than within\r
+ if ( data.collisionHeight > outerHeight ) {\r
+\r
+ // Element is initially over the top of within\r
+ if ( overTop > 0 && overBottom <= 0 ) {\r
+ newOverBottom = position.top + overTop + data.collisionHeight - outerHeight -\r
+ withinOffset;\r
+ position.top += overTop - newOverBottom;\r
+\r
+ // Element is initially over bottom of within\r
+ } else if ( overBottom > 0 && overTop <= 0 ) {\r
+ position.top = withinOffset;\r
+\r
+ // Element is initially over both top and bottom of within\r
+ } else {\r
+ if ( overTop > overBottom ) {\r
+ position.top = withinOffset + outerHeight - data.collisionHeight;\r
+ } else {\r
+ position.top = withinOffset;\r
+ }\r
+ }\r
+\r
+ // Too far up -> align with top\r
+ } else if ( overTop > 0 ) {\r
+ position.top += overTop;\r
+\r
+ // Too far down -> align with bottom edge\r
+ } else if ( overBottom > 0 ) {\r
+ position.top -= overBottom;\r
+\r
+ // Adjust based on position and margin\r
+ } else {\r
+ position.top = max( position.top - collisionPosTop, position.top );\r
+ }\r
+ }\r
+ },\r
+ flip: {\r
+ left: function( position, data ) {\r
+ var within = data.within,\r
+ withinOffset = within.offset.left + within.scrollLeft,\r
+ outerWidth = within.width,\r
+ offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,\r
+ collisionPosLeft = position.left - data.collisionPosition.marginLeft,\r
+ overLeft = collisionPosLeft - offsetLeft,\r
+ overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,\r
+ myOffset = data.my[ 0 ] === "left" ?\r
+ -data.elemWidth :\r
+ data.my[ 0 ] === "right" ?\r
+ data.elemWidth :\r
+ 0,\r
+ atOffset = data.at[ 0 ] === "left" ?\r
+ data.targetWidth :\r
+ data.at[ 0 ] === "right" ?\r
+ -data.targetWidth :\r
+ 0,\r
+ offset = -2 * data.offset[ 0 ],\r
+ newOverRight,\r
+ newOverLeft;\r
+\r
+ if ( overLeft < 0 ) {\r
+ newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth -\r
+ outerWidth - withinOffset;\r
+ if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {\r
+ position.left += myOffset + atOffset + offset;\r
+ }\r
+ } else if ( overRight > 0 ) {\r
+ newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset +\r
+ atOffset + offset - offsetLeft;\r
+ if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {\r
+ position.left += myOffset + atOffset + offset;\r
+ }\r
+ }\r
+ },\r
+ top: function( position, data ) {\r
+ var within = data.within,\r
+ withinOffset = within.offset.top + within.scrollTop,\r
+ outerHeight = within.height,\r
+ offsetTop = within.isWindow ? within.scrollTop : within.offset.top,\r
+ collisionPosTop = position.top - data.collisionPosition.marginTop,\r
+ overTop = collisionPosTop - offsetTop,\r
+ overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,\r
+ top = data.my[ 1 ] === "top",\r
+ myOffset = top ?\r
+ -data.elemHeight :\r
+ data.my[ 1 ] === "bottom" ?\r
+ data.elemHeight :\r
+ 0,\r
+ atOffset = data.at[ 1 ] === "top" ?\r
+ data.targetHeight :\r
+ data.at[ 1 ] === "bottom" ?\r
+ -data.targetHeight :\r
+ 0,\r
+ offset = -2 * data.offset[ 1 ],\r
+ newOverTop,\r
+ newOverBottom;\r
+ if ( overTop < 0 ) {\r
+ newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight -\r
+ outerHeight - withinOffset;\r
+ if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {\r
+ position.top += myOffset + atOffset + offset;\r
+ }\r
+ } else if ( overBottom > 0 ) {\r
+ newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset +\r
+ offset - offsetTop;\r
+ if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {\r
+ position.top += myOffset + atOffset + offset;\r
+ }\r
+ }\r
+ }\r
+ },\r
+ flipfit: {\r
+ left: function() {\r
+ $.ui.position.flip.left.apply( this, arguments );\r
+ $.ui.position.fit.left.apply( this, arguments );\r
+ },\r
+ top: function() {\r
+ $.ui.position.flip.top.apply( this, arguments );\r
+ $.ui.position.fit.top.apply( this, arguments );\r
+ }\r
+ }\r
+};\r
+\r
+} )();\r
+\r
+var position = $.ui.position;\r
+\r
+\r
+/*!\r
+ * jQuery UI :data 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: :data Selector\r
+//>>group: Core\r
+//>>description: Selects elements which have data stored under the specified key.\r
+//>>docs: http://api.jqueryui.com/data-selector/\r
+\r
+\r
+var data = $.extend( $.expr.pseudos, {\r
+ data: $.expr.createPseudo ?\r
+ $.expr.createPseudo( function( dataName ) {\r
+ return function( elem ) {\r
+ return !!$.data( elem, dataName );\r
+ };\r
+ } ) :\r
+\r
+ // Support: jQuery <1.8\r
+ function( elem, i, match ) {\r
+ return !!$.data( elem, match[ 3 ] );\r
+ }\r
+} );\r
+\r
+/*!\r
+ * jQuery UI Disable Selection 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: disableSelection\r
+//>>group: Core\r
+//>>description: Disable selection of text content within the set of matched elements.\r
+//>>docs: http://api.jqueryui.com/disableSelection/\r
+\r
+// This file is deprecated\r
+\r
+var disableSelection = $.fn.extend( {\r
+ disableSelection: ( function() {\r
+ var eventType = "onselectstart" in document.createElement( "div" ) ?\r
+ "selectstart" :\r
+ "mousedown";\r
+\r
+ return function() {\r
+ return this.on( eventType + ".ui-disableSelection", function( event ) {\r
+ event.preventDefault();\r
+ } );\r
+ };\r
+ } )(),\r
+\r
+ enableSelection: function() {\r
+ return this.off( ".ui-disableSelection" );\r
+ }\r
+} );\r
+\r
+\r
+/*!\r
+ * jQuery UI Focusable 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: :focusable Selector\r
+//>>group: Core\r
+//>>description: Selects elements which can be focused.\r
+//>>docs: http://api.jqueryui.com/focusable-selector/\r
+\r
+\r
+// Selectors\r
+$.ui.focusable = function( element, hasTabindex ) {\r
+ var map, mapName, img, focusableIfVisible, fieldset,\r
+ nodeName = element.nodeName.toLowerCase();\r
+\r
+ if ( "area" === nodeName ) {\r
+ map = element.parentNode;\r
+ mapName = map.name;\r
+ if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {\r
+ return false;\r
+ }\r
+ img = $( "img[usemap='#" + mapName + "']" );\r
+ return img.length > 0 && img.is( ":visible" );\r
+ }\r
+\r
+ if ( /^(input|select|textarea|button|object)$/.test( nodeName ) ) {\r
+ focusableIfVisible = !element.disabled;\r
+\r
+ if ( focusableIfVisible ) {\r
+\r
+ // Form controls within a disabled fieldset are disabled.\r
+ // However, controls within the fieldset's legend do not get disabled.\r
+ // Since controls generally aren't placed inside legends, we skip\r
+ // this portion of the check.\r
+ fieldset = $( element ).closest( "fieldset" )[ 0 ];\r
+ if ( fieldset ) {\r
+ focusableIfVisible = !fieldset.disabled;\r
+ }\r
+ }\r
+ } else if ( "a" === nodeName ) {\r
+ focusableIfVisible = element.href || hasTabindex;\r
+ } else {\r
+ focusableIfVisible = hasTabindex;\r
+ }\r
+\r
+ return focusableIfVisible && $( element ).is( ":visible" ) && visible( $( element ) );\r
+};\r
+\r
+// Support: IE 8 only\r
+// IE 8 doesn't resolve inherit to visible/hidden for computed values\r
+function visible( element ) {\r
+ var visibility = element.css( "visibility" );\r
+ while ( visibility === "inherit" ) {\r
+ element = element.parent();\r
+ visibility = element.css( "visibility" );\r
+ }\r
+ return visibility === "visible";\r
+}\r
+\r
+$.extend( $.expr.pseudos, {\r
+ focusable: function( element ) {\r
+ return $.ui.focusable( element, $.attr( element, "tabindex" ) != null );\r
+ }\r
+} );\r
+\r
+var focusable = $.ui.focusable;\r
+\r
+\r
+\r
+// Support: IE8 Only\r
+// IE8 does not support the form attribute and when it is supplied. It overwrites the form prop\r
+// with a string, so we need to find the proper form.\r
+var form = $.fn._form = function() {\r
+ return typeof this[ 0 ].form === "string" ? this.closest( "form" ) : $( this[ 0 ].form );\r
+};\r
+\r
+\r
+/*!\r
+ * jQuery UI Form Reset Mixin 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Form Reset Mixin\r
+//>>group: Core\r
+//>>description: Refresh input widgets when their form is reset\r
+//>>docs: http://api.jqueryui.com/form-reset-mixin/\r
+\r
+\r
+var formResetMixin = $.ui.formResetMixin = {\r
+ _formResetHandler: function() {\r
+ var form = $( this );\r
+\r
+ // Wait for the form reset to actually happen before refreshing\r
+ setTimeout( function() {\r
+ var instances = form.data( "ui-form-reset-instances" );\r
+ $.each( instances, function() {\r
+ this.refresh();\r
+ } );\r
+ } );\r
+ },\r
+\r
+ _bindFormResetHandler: function() {\r
+ this.form = this.element._form();\r
+ if ( !this.form.length ) {\r
+ return;\r
+ }\r
+\r
+ var instances = this.form.data( "ui-form-reset-instances" ) || [];\r
+ if ( !instances.length ) {\r
+\r
+ // We don't use _on() here because we use a single event handler per form\r
+ this.form.on( "reset.ui-form-reset", this._formResetHandler );\r
+ }\r
+ instances.push( this );\r
+ this.form.data( "ui-form-reset-instances", instances );\r
+ },\r
+\r
+ _unbindFormResetHandler: function() {\r
+ if ( !this.form.length ) {\r
+ return;\r
+ }\r
+\r
+ var instances = this.form.data( "ui-form-reset-instances" );\r
+ instances.splice( $.inArray( this, instances ), 1 );\r
+ if ( instances.length ) {\r
+ this.form.data( "ui-form-reset-instances", instances );\r
+ } else {\r
+ this.form\r
+ .removeData( "ui-form-reset-instances" )\r
+ .off( "reset.ui-form-reset" );\r
+ }\r
+ }\r
+};\r
+\r
+\r
+/*!\r
+ * jQuery UI Support for jQuery core 1.8.x and newer 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ *\r
+ */\r
+\r
+//>>label: jQuery 1.8+ Support\r
+//>>group: Core\r
+//>>description: Support version 1.8.x and newer of jQuery core\r
+\r
+\r
+// Support: jQuery 1.9.x or older\r
+// $.expr[ ":" ] is deprecated.\r
+if ( !$.expr.pseudos ) {\r
+ $.expr.pseudos = $.expr[ ":" ];\r
+}\r
+\r
+// Support: jQuery 1.11.x or older\r
+// $.unique has been renamed to $.uniqueSort\r
+if ( !$.uniqueSort ) {\r
+ $.uniqueSort = $.unique;\r
+}\r
+\r
+// Support: jQuery 2.2.x or older.\r
+// This method has been defined in jQuery 3.0.0.\r
+// Code from https://github.com/jquery/jquery/blob/e539bac79e666bba95bba86d690b4e609dca2286/src/selector/escapeSelector.js\r
+if ( !$.escapeSelector ) {\r
+\r
+ // CSS string/identifier serialization\r
+ // https://drafts.csswg.org/cssom/#common-serializing-idioms\r
+ var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;\r
+\r
+ var fcssescape = function( ch, asCodePoint ) {\r
+ if ( asCodePoint ) {\r
+\r
+ // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER\r
+ if ( ch === "\0" ) {\r
+ return "\uFFFD";\r
+ }\r
+\r
+ // Control characters and (dependent upon position) numbers get escaped as code points\r
+ return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";\r
+ }\r
+\r
+ // Other potentially-special ASCII characters get backslash-escaped\r
+ return "\\" + ch;\r
+ };\r
+\r
+ $.escapeSelector = function( sel ) {\r
+ return ( sel + "" ).replace( rcssescape, fcssescape );\r
+ };\r
+}\r
+\r
+// Support: jQuery 3.4.x or older\r
+// These methods have been defined in jQuery 3.5.0.\r
+if ( !$.fn.even || !$.fn.odd ) {\r
+ $.fn.extend( {\r
+ even: function() {\r
+ return this.filter( function( i ) {\r
+ return i % 2 === 0;\r
+ } );\r
+ },\r
+ odd: function() {\r
+ return this.filter( function( i ) {\r
+ return i % 2 === 1;\r
+ } );\r
+ }\r
+ } );\r
+}\r
+\r
+;\r
+/*!\r
+ * jQuery UI Keycode 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Keycode\r
+//>>group: Core\r
+//>>description: Provide keycodes as keynames\r
+//>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/\r
+\r
+\r
+var keycode = $.ui.keyCode = {\r
+ BACKSPACE: 8,\r
+ COMMA: 188,\r
+ DELETE: 46,\r
+ DOWN: 40,\r
+ END: 35,\r
+ ENTER: 13,\r
+ ESCAPE: 27,\r
+ HOME: 36,\r
+ LEFT: 37,\r
+ PAGE_DOWN: 34,\r
+ PAGE_UP: 33,\r
+ PERIOD: 190,\r
+ RIGHT: 39,\r
+ SPACE: 32,\r
+ TAB: 9,\r
+ UP: 38\r
+};\r
+\r
+\r
+/*!\r
+ * jQuery UI Labels 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: labels\r
+//>>group: Core\r
+//>>description: Find all the labels associated with a given input\r
+//>>docs: http://api.jqueryui.com/labels/\r
+\r
+\r
+var labels = $.fn.labels = function() {\r
+ var ancestor, selector, id, labels, ancestors;\r
+\r
+ if ( !this.length ) {\r
+ return this.pushStack( [] );\r
+ }\r
+\r
+ // Check control.labels first\r
+ if ( this[ 0 ].labels && this[ 0 ].labels.length ) {\r
+ return this.pushStack( this[ 0 ].labels );\r
+ }\r
+\r
+ // Support: IE <= 11, FF <= 37, Android <= 2.3 only\r
+ // Above browsers do not support control.labels. Everything below is to support them\r
+ // as well as document fragments. control.labels does not work on document fragments\r
+ labels = this.eq( 0 ).parents( "label" );\r
+\r
+ // Look for the label based on the id\r
+ id = this.attr( "id" );\r
+ if ( id ) {\r
+\r
+ // We don't search against the document in case the element\r
+ // is disconnected from the DOM\r
+ ancestor = this.eq( 0 ).parents().last();\r
+\r
+ // Get a full set of top level ancestors\r
+ ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() );\r
+\r
+ // Create a selector for the label based on the id\r
+ selector = "label[for='" + $.escapeSelector( id ) + "']";\r
+\r
+ labels = labels.add( ancestors.find( selector ).addBack( selector ) );\r
+\r
+ }\r
+\r
+ // Return whatever we have found for labels\r
+ return this.pushStack( labels );\r
+};\r
+\r
+\r
+/*!\r
+ * jQuery UI Scroll Parent 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: scrollParent\r
+//>>group: Core\r
+//>>description: Get the closest ancestor element that is scrollable.\r
+//>>docs: http://api.jqueryui.com/scrollParent/\r
+\r
+\r
+var scrollParent = $.fn.scrollParent = function( includeHidden ) {\r
+ var position = this.css( "position" ),\r
+ excludeStaticParent = position === "absolute",\r
+ overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,\r
+ scrollParent = this.parents().filter( function() {\r
+ var parent = $( this );\r
+ if ( excludeStaticParent && parent.css( "position" ) === "static" ) {\r
+ return false;\r
+ }\r
+ return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) +\r
+ parent.css( "overflow-x" ) );\r
+ } ).eq( 0 );\r
+\r
+ return position === "fixed" || !scrollParent.length ?\r
+ $( this[ 0 ].ownerDocument || document ) :\r
+ scrollParent;\r
+};\r
+\r
+\r
+/*!\r
+ * jQuery UI Tabbable 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: :tabbable Selector\r
+//>>group: Core\r
+//>>description: Selects elements which can be tabbed to.\r
+//>>docs: http://api.jqueryui.com/tabbable-selector/\r
+\r
+\r
+var tabbable = $.extend( $.expr.pseudos, {\r
+ tabbable: function( element ) {\r
+ var tabIndex = $.attr( element, "tabindex" ),\r
+ hasTabindex = tabIndex != null;\r
+ return ( !hasTabindex || tabIndex >= 0 ) && $.ui.focusable( element, hasTabindex );\r
+ }\r
+} );\r
+\r
+\r
+/*!\r
+ * jQuery UI Unique ID 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: uniqueId\r
+//>>group: Core\r
+//>>description: Functions to generate and remove uniqueId's\r
+//>>docs: http://api.jqueryui.com/uniqueId/\r
+\r
+\r
+var uniqueId = $.fn.extend( {\r
+ uniqueId: ( function() {\r
+ var uuid = 0;\r
+\r
+ return function() {\r
+ return this.each( function() {\r
+ if ( !this.id ) {\r
+ this.id = "ui-id-" + ( ++uuid );\r
+ }\r
+ } );\r
+ };\r
+ } )(),\r
+\r
+ removeUniqueId: function() {\r
+ return this.each( function() {\r
+ if ( /^ui-id-\d+$/.test( this.id ) ) {\r
+ $( this ).removeAttr( "id" );\r
+ }\r
+ } );\r
+ }\r
+} );\r
+\r
+\r
+\r
+// This file is deprecated\r
+var ie = $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );\r
+\r
+/*!\r
+ * jQuery UI Mouse 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Mouse\r
+//>>group: Widgets\r
+//>>description: Abstracts mouse-based interactions to assist in creating certain widgets.\r
+//>>docs: http://api.jqueryui.com/mouse/\r
+\r
+\r
+var mouseHandled = false;\r
+$( document ).on( "mouseup", function() {\r
+ mouseHandled = false;\r
+} );\r
+\r
+var widgetsMouse = $.widget( "ui.mouse", {\r
+ version: "1.13.1",\r
+ options: {\r
+ cancel: "input, textarea, button, select, option",\r
+ distance: 1,\r
+ delay: 0\r
+ },\r
+ _mouseInit: function() {\r
+ var that = this;\r
+\r
+ this.element\r
+ .on( "mousedown." + this.widgetName, function( event ) {\r
+ return that._mouseDown( event );\r
+ } )\r
+ .on( "click." + this.widgetName, function( event ) {\r
+ if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) {\r
+ $.removeData( event.target, that.widgetName + ".preventClickEvent" );\r
+ event.stopImmediatePropagation();\r
+ return false;\r
+ }\r
+ } );\r
+\r
+ this.started = false;\r
+ },\r
+\r
+ // TODO: make sure destroying one instance of mouse doesn't mess with\r
+ // other instances of mouse\r
+ _mouseDestroy: function() {\r
+ this.element.off( "." + this.widgetName );\r
+ if ( this._mouseMoveDelegate ) {\r
+ this.document\r
+ .off( "mousemove." + this.widgetName, this._mouseMoveDelegate )\r
+ .off( "mouseup." + this.widgetName, this._mouseUpDelegate );\r
+ }\r
+ },\r
+\r
+ _mouseDown: function( event ) {\r
+\r
+ // don't let more than one widget handle mouseStart\r
+ if ( mouseHandled ) {\r
+ return;\r
+ }\r
+\r
+ this._mouseMoved = false;\r
+\r
+ // We may have missed mouseup (out of window)\r
+ if ( this._mouseStarted ) {\r
+ this._mouseUp( event );\r
+ }\r
+\r
+ this._mouseDownEvent = event;\r
+\r
+ var that = this,\r
+ btnIsLeft = ( event.which === 1 ),\r
+\r
+ // event.target.nodeName works around a bug in IE 8 with\r
+ // disabled inputs (#7620)\r
+ elIsCancel = ( typeof this.options.cancel === "string" && event.target.nodeName ?\r
+ $( event.target ).closest( this.options.cancel ).length : false );\r
+ if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) {\r
+ return true;\r
+ }\r
+\r
+ this.mouseDelayMet = !this.options.delay;\r
+ if ( !this.mouseDelayMet ) {\r
+ this._mouseDelayTimer = setTimeout( function() {\r
+ that.mouseDelayMet = true;\r
+ }, this.options.delay );\r
+ }\r
+\r
+ if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {\r
+ this._mouseStarted = ( this._mouseStart( event ) !== false );\r
+ if ( !this._mouseStarted ) {\r
+ event.preventDefault();\r
+ return true;\r
+ }\r
+ }\r
+\r
+ // Click event may never have fired (Gecko & Opera)\r
+ if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) {\r
+ $.removeData( event.target, this.widgetName + ".preventClickEvent" );\r
+ }\r
+\r
+ // These delegates are required to keep context\r
+ this._mouseMoveDelegate = function( event ) {\r
+ return that._mouseMove( event );\r
+ };\r
+ this._mouseUpDelegate = function( event ) {\r
+ return that._mouseUp( event );\r
+ };\r
+\r
+ this.document\r
+ .on( "mousemove." + this.widgetName, this._mouseMoveDelegate )\r
+ .on( "mouseup." + this.widgetName, this._mouseUpDelegate );\r
+\r
+ event.preventDefault();\r
+\r
+ mouseHandled = true;\r
+ return true;\r
+ },\r
+\r
+ _mouseMove: function( event ) {\r
+\r
+ // Only check for mouseups outside the document if you've moved inside the document\r
+ // at least once. This prevents the firing of mouseup in the case of IE<9, which will\r
+ // fire a mousemove event if content is placed under the cursor. See #7778\r
+ // Support: IE <9\r
+ if ( this._mouseMoved ) {\r
+\r
+ // IE mouseup check - mouseup happened when mouse was out of window\r
+ if ( $.ui.ie && ( !document.documentMode || document.documentMode < 9 ) &&\r
+ !event.button ) {\r
+ return this._mouseUp( event );\r
+\r
+ // Iframe mouseup check - mouseup occurred in another document\r
+ } else if ( !event.which ) {\r
+\r
+ // Support: Safari <=8 - 9\r
+ // Safari sets which to 0 if you press any of the following keys\r
+ // during a drag (#14461)\r
+ if ( event.originalEvent.altKey || event.originalEvent.ctrlKey ||\r
+ event.originalEvent.metaKey || event.originalEvent.shiftKey ) {\r
+ this.ignoreMissingWhich = true;\r
+ } else if ( !this.ignoreMissingWhich ) {\r
+ return this._mouseUp( event );\r
+ }\r
+ }\r
+ }\r
+\r
+ if ( event.which || event.button ) {\r
+ this._mouseMoved = true;\r
+ }\r
+\r
+ if ( this._mouseStarted ) {\r
+ this._mouseDrag( event );\r
+ return event.preventDefault();\r
+ }\r
+\r
+ if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {\r
+ this._mouseStarted =\r
+ ( this._mouseStart( this._mouseDownEvent, event ) !== false );\r
+ if ( this._mouseStarted ) {\r
+ this._mouseDrag( event );\r
+ } else {\r
+ this._mouseUp( event );\r
+ }\r
+ }\r
+\r
+ return !this._mouseStarted;\r
+ },\r
+\r
+ _mouseUp: function( event ) {\r
+ this.document\r
+ .off( "mousemove." + this.widgetName, this._mouseMoveDelegate )\r
+ .off( "mouseup." + this.widgetName, this._mouseUpDelegate );\r
+\r
+ if ( this._mouseStarted ) {\r
+ this._mouseStarted = false;\r
+\r
+ if ( event.target === this._mouseDownEvent.target ) {\r
+ $.data( event.target, this.widgetName + ".preventClickEvent", true );\r
+ }\r
+\r
+ this._mouseStop( event );\r
+ }\r
+\r
+ if ( this._mouseDelayTimer ) {\r
+ clearTimeout( this._mouseDelayTimer );\r
+ delete this._mouseDelayTimer;\r
+ }\r
+\r
+ this.ignoreMissingWhich = false;\r
+ mouseHandled = false;\r
+ event.preventDefault();\r
+ },\r
+\r
+ _mouseDistanceMet: function( event ) {\r
+ return ( Math.max(\r
+ Math.abs( this._mouseDownEvent.pageX - event.pageX ),\r
+ Math.abs( this._mouseDownEvent.pageY - event.pageY )\r
+ ) >= this.options.distance\r
+ );\r
+ },\r
+\r
+ _mouseDelayMet: function( /* event */ ) {\r
+ return this.mouseDelayMet;\r
+ },\r
+\r
+ // These are placeholder methods, to be overriden by extending plugin\r
+ _mouseStart: function( /* event */ ) {},\r
+ _mouseDrag: function( /* event */ ) {},\r
+ _mouseStop: function( /* event */ ) {},\r
+ _mouseCapture: function( /* event */ ) {\r
+ return true;\r
+ }\r
+} );\r
+\r
+\r
+\r
+// $.ui.plugin is deprecated. Use $.widget() extensions instead.\r
+var plugin = $.ui.plugin = {\r
+ add: function( module, option, set ) {\r
+ var i,\r
+ proto = $.ui[ module ].prototype;\r
+ for ( i in set ) {\r
+ proto.plugins[ i ] = proto.plugins[ i ] || [];\r
+ proto.plugins[ i ].push( [ option, set[ i ] ] );\r
+ }\r
+ },\r
+ call: function( instance, name, args, allowDisconnected ) {\r
+ var i,\r
+ set = instance.plugins[ name ];\r
+\r
+ if ( !set ) {\r
+ return;\r
+ }\r
+\r
+ if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode ||\r
+ instance.element[ 0 ].parentNode.nodeType === 11 ) ) {\r
+ return;\r
+ }\r
+\r
+ for ( i = 0; i < set.length; i++ ) {\r
+ if ( instance.options[ set[ i ][ 0 ] ] ) {\r
+ set[ i ][ 1 ].apply( instance.element, args );\r
+ }\r
+ }\r
+ }\r
+};\r
+\r
+\r
+\r
+var safeActiveElement = $.ui.safeActiveElement = function( document ) {\r
+ var activeElement;\r
+\r
+ // Support: IE 9 only\r
+ // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>\r
+ try {\r
+ activeElement = document.activeElement;\r
+ } catch ( error ) {\r
+ activeElement = document.body;\r
+ }\r
+\r
+ // Support: IE 9 - 11 only\r
+ // IE may return null instead of an element\r
+ // Interestingly, this only seems to occur when NOT in an iframe\r
+ if ( !activeElement ) {\r
+ activeElement = document.body;\r
+ }\r
+\r
+ // Support: IE 11 only\r
+ // IE11 returns a seemingly empty object in some cases when accessing\r
+ // document.activeElement from an <iframe>\r
+ if ( !activeElement.nodeName ) {\r
+ activeElement = document.body;\r
+ }\r
+\r
+ return activeElement;\r
+};\r
+\r
+\r
+\r
+var safeBlur = $.ui.safeBlur = function( element ) {\r
+\r
+ // Support: IE9 - 10 only\r
+ // If the <body> is blurred, IE will switch windows, see #9420\r
+ if ( element && element.nodeName.toLowerCase() !== "body" ) {\r
+ $( element ).trigger( "blur" );\r
+ }\r
+};\r
+\r
+\r
+/*!\r
+ * jQuery UI Draggable 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Draggable\r
+//>>group: Interactions\r
+//>>description: Enables dragging functionality for any element.\r
+//>>docs: http://api.jqueryui.com/draggable/\r
+//>>demos: http://jqueryui.com/draggable/\r
+//>>css.structure: ../../themes/base/draggable.css\r
+\r
+\r
+$.widget( "ui.draggable", $.ui.mouse, {\r
+ version: "1.13.1",\r
+ widgetEventPrefix: "drag",\r
+ options: {\r
+ addClasses: true,\r
+ appendTo: "parent",\r
+ axis: false,\r
+ connectToSortable: false,\r
+ containment: false,\r
+ cursor: "auto",\r
+ cursorAt: false,\r
+ grid: false,\r
+ handle: false,\r
+ helper: "original",\r
+ iframeFix: false,\r
+ opacity: false,\r
+ refreshPositions: false,\r
+ revert: false,\r
+ revertDuration: 500,\r
+ scope: "default",\r
+ scroll: true,\r
+ scrollSensitivity: 20,\r
+ scrollSpeed: 20,\r
+ snap: false,\r
+ snapMode: "both",\r
+ snapTolerance: 20,\r
+ stack: false,\r
+ zIndex: false,\r
+\r
+ // Callbacks\r
+ drag: null,\r
+ start: null,\r
+ stop: null\r
+ },\r
+ _create: function() {\r
+\r
+ if ( this.options.helper === "original" ) {\r
+ this._setPositionRelative();\r
+ }\r
+ if ( this.options.addClasses ) {\r
+ this._addClass( "ui-draggable" );\r
+ }\r
+ this._setHandleClassName();\r
+\r
+ this._mouseInit();\r
+ },\r
+\r
+ _setOption: function( key, value ) {\r
+ this._super( key, value );\r
+ if ( key === "handle" ) {\r
+ this._removeHandleClassName();\r
+ this._setHandleClassName();\r
+ }\r
+ },\r
+\r
+ _destroy: function() {\r
+ if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) {\r
+ this.destroyOnClear = true;\r
+ return;\r
+ }\r
+ this._removeHandleClassName();\r
+ this._mouseDestroy();\r
+ },\r
+\r
+ _mouseCapture: function( event ) {\r
+ var o = this.options;\r
+\r
+ // Among others, prevent a drag on a resizable-handle\r
+ if ( this.helper || o.disabled ||\r
+ $( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) {\r
+ return false;\r
+ }\r
+\r
+ //Quit if we're not on a valid handle\r
+ this.handle = this._getHandle( event );\r
+ if ( !this.handle ) {\r
+ return false;\r
+ }\r
+\r
+ this._blurActiveElement( event );\r
+\r
+ this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix );\r
+\r
+ return true;\r
+\r
+ },\r
+\r
+ _blockFrames: function( selector ) {\r
+ this.iframeBlocks = this.document.find( selector ).map( function() {\r
+ var iframe = $( this );\r
+\r
+ return $( "<div>" )\r
+ .css( "position", "absolute" )\r
+ .appendTo( iframe.parent() )\r
+ .outerWidth( iframe.outerWidth() )\r
+ .outerHeight( iframe.outerHeight() )\r
+ .offset( iframe.offset() )[ 0 ];\r
+ } );\r
+ },\r
+\r
+ _unblockFrames: function() {\r
+ if ( this.iframeBlocks ) {\r
+ this.iframeBlocks.remove();\r
+ delete this.iframeBlocks;\r
+ }\r
+ },\r
+\r
+ _blurActiveElement: function( event ) {\r
+ var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ),\r
+ target = $( event.target );\r
+\r
+ // Don't blur if the event occurred on an element that is within\r
+ // the currently focused element\r
+ // See #10527, #12472\r
+ if ( target.closest( activeElement ).length ) {\r
+ return;\r
+ }\r
+\r
+ // Blur any element that currently has focus, see #4261\r
+ $.ui.safeBlur( activeElement );\r
+ },\r
+\r
+ _mouseStart: function( event ) {\r
+\r
+ var o = this.options;\r
+\r
+ //Create and append the visible helper\r
+ this.helper = this._createHelper( event );\r
+\r
+ this._addClass( this.helper, "ui-draggable-dragging" );\r
+\r
+ //Cache the helper size\r
+ this._cacheHelperProportions();\r
+\r
+ //If ddmanager is used for droppables, set the global draggable\r
+ if ( $.ui.ddmanager ) {\r
+ $.ui.ddmanager.current = this;\r
+ }\r
+\r
+ /*\r
+ * - Position generation -\r
+ * This block generates everything position related - it's the core of draggables.\r
+ */\r
+\r
+ //Cache the margins of the original element\r
+ this._cacheMargins();\r
+\r
+ //Store the helper's css position\r
+ this.cssPosition = this.helper.css( "position" );\r
+ this.scrollParent = this.helper.scrollParent( true );\r
+ this.offsetParent = this.helper.offsetParent();\r
+ this.hasFixedAncestor = this.helper.parents().filter( function() {\r
+ return $( this ).css( "position" ) === "fixed";\r
+ } ).length > 0;\r
+\r
+ //The element's absolute position on the page minus margins\r
+ this.positionAbs = this.element.offset();\r
+ this._refreshOffsets( event );\r
+\r
+ //Generate the original position\r
+ this.originalPosition = this.position = this._generatePosition( event, false );\r
+ this.originalPageX = event.pageX;\r
+ this.originalPageY = event.pageY;\r
+\r
+ //Adjust the mouse offset relative to the helper if "cursorAt" is supplied\r
+ if ( o.cursorAt ) {\r
+ this._adjustOffsetFromHelper( o.cursorAt );\r
+ }\r
+\r
+ //Set a containment if given in the options\r
+ this._setContainment();\r
+\r
+ //Trigger event + callbacks\r
+ if ( this._trigger( "start", event ) === false ) {\r
+ this._clear();\r
+ return false;\r
+ }\r
+\r
+ //Recache the helper size\r
+ this._cacheHelperProportions();\r
+\r
+ //Prepare the droppable offsets\r
+ if ( $.ui.ddmanager && !o.dropBehaviour ) {\r
+ $.ui.ddmanager.prepareOffsets( this, event );\r
+ }\r
+\r
+ // Execute the drag once - this causes the helper not to be visible before getting its\r
+ // correct position\r
+ this._mouseDrag( event, true );\r
+\r
+ // If the ddmanager is used for droppables, inform the manager that dragging has started\r
+ // (see #5003)\r
+ if ( $.ui.ddmanager ) {\r
+ $.ui.ddmanager.dragStart( this, event );\r
+ }\r
+\r
+ return true;\r
+ },\r
+\r
+ _refreshOffsets: function( event ) {\r
+ this.offset = {\r
+ top: this.positionAbs.top - this.margins.top,\r
+ left: this.positionAbs.left - this.margins.left,\r
+ scroll: false,\r
+ parent: this._getParentOffset(),\r
+ relative: this._getRelativeOffset()\r
+ };\r
+\r
+ this.offset.click = {\r
+ left: event.pageX - this.offset.left,\r
+ top: event.pageY - this.offset.top\r
+ };\r
+ },\r
+\r
+ _mouseDrag: function( event, noPropagation ) {\r
+\r
+ // reset any necessary cached properties (see #5009)\r
+ if ( this.hasFixedAncestor ) {\r
+ this.offset.parent = this._getParentOffset();\r
+ }\r
+\r
+ //Compute the helpers position\r
+ this.position = this._generatePosition( event, true );\r
+ this.positionAbs = this._convertPositionTo( "absolute" );\r
+\r
+ //Call plugins and callbacks and use the resulting position if something is returned\r
+ if ( !noPropagation ) {\r
+ var ui = this._uiHash();\r
+ if ( this._trigger( "drag", event, ui ) === false ) {\r
+ this._mouseUp( new $.Event( "mouseup", event ) );\r
+ return false;\r
+ }\r
+ this.position = ui.position;\r
+ }\r
+\r
+ this.helper[ 0 ].style.left = this.position.left + "px";\r
+ this.helper[ 0 ].style.top = this.position.top + "px";\r
+\r
+ if ( $.ui.ddmanager ) {\r
+ $.ui.ddmanager.drag( this, event );\r
+ }\r
+\r
+ return false;\r
+ },\r
+\r
+ _mouseStop: function( event ) {\r
+\r
+ //If we are using droppables, inform the manager about the drop\r
+ var that = this,\r
+ dropped = false;\r
+ if ( $.ui.ddmanager && !this.options.dropBehaviour ) {\r
+ dropped = $.ui.ddmanager.drop( this, event );\r
+ }\r
+\r
+ //if a drop comes from outside (a sortable)\r
+ if ( this.dropped ) {\r
+ dropped = this.dropped;\r
+ this.dropped = false;\r
+ }\r
+\r
+ if ( ( this.options.revert === "invalid" && !dropped ) ||\r
+ ( this.options.revert === "valid" && dropped ) ||\r
+ this.options.revert === true || ( typeof this.options.revert === "function" &&\r
+ this.options.revert.call( this.element, dropped ) )\r
+ ) {\r
+ $( this.helper ).animate(\r
+ this.originalPosition,\r
+ parseInt( this.options.revertDuration, 10 ),\r
+ function() {\r
+ if ( that._trigger( "stop", event ) !== false ) {\r
+ that._clear();\r
+ }\r
+ }\r
+ );\r
+ } else {\r
+ if ( this._trigger( "stop", event ) !== false ) {\r
+ this._clear();\r
+ }\r
+ }\r
+\r
+ return false;\r
+ },\r
+\r
+ _mouseUp: function( event ) {\r
+ this._unblockFrames();\r
+\r
+ // If the ddmanager is used for droppables, inform the manager that dragging has stopped\r
+ // (see #5003)\r
+ if ( $.ui.ddmanager ) {\r
+ $.ui.ddmanager.dragStop( this, event );\r
+ }\r
+\r
+ // Only need to focus if the event occurred on the draggable itself, see #10527\r
+ if ( this.handleElement.is( event.target ) ) {\r
+\r
+ // The interaction is over; whether or not the click resulted in a drag,\r
+ // focus the element\r
+ this.element.trigger( "focus" );\r
+ }\r
+\r
+ return $.ui.mouse.prototype._mouseUp.call( this, event );\r
+ },\r
+\r
+ cancel: function() {\r
+\r
+ if ( this.helper.is( ".ui-draggable-dragging" ) ) {\r
+ this._mouseUp( new $.Event( "mouseup", { target: this.element[ 0 ] } ) );\r
+ } else {\r
+ this._clear();\r
+ }\r
+\r
+ return this;\r
+\r
+ },\r
+\r
+ _getHandle: function( event ) {\r
+ return this.options.handle ?\r
+ !!$( event.target ).closest( this.element.find( this.options.handle ) ).length :\r
+ true;\r
+ },\r
+\r
+ _setHandleClassName: function() {\r
+ this.handleElement = this.options.handle ?\r
+ this.element.find( this.options.handle ) : this.element;\r
+ this._addClass( this.handleElement, "ui-draggable-handle" );\r
+ },\r
+\r
+ _removeHandleClassName: function() {\r
+ this._removeClass( this.handleElement, "ui-draggable-handle" );\r
+ },\r
+\r
+ _createHelper: function( event ) {\r
+\r
+ var o = this.options,\r
+ helperIsFunction = typeof o.helper === "function",\r
+ helper = helperIsFunction ?\r
+ $( o.helper.apply( this.element[ 0 ], [ event ] ) ) :\r
+ ( o.helper === "clone" ?\r
+ this.element.clone().removeAttr( "id" ) :\r
+ this.element );\r
+\r
+ if ( !helper.parents( "body" ).length ) {\r
+ helper.appendTo( ( o.appendTo === "parent" ?\r
+ this.element[ 0 ].parentNode :\r
+ o.appendTo ) );\r
+ }\r
+\r
+ // Http://bugs.jqueryui.com/ticket/9446\r
+ // a helper function can return the original element\r
+ // which wouldn't have been set to relative in _create\r
+ if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) {\r
+ this._setPositionRelative();\r
+ }\r
+\r
+ if ( helper[ 0 ] !== this.element[ 0 ] &&\r
+ !( /(fixed|absolute)/ ).test( helper.css( "position" ) ) ) {\r
+ helper.css( "position", "absolute" );\r
+ }\r
+\r
+ return helper;\r
+\r
+ },\r
+\r
+ _setPositionRelative: function() {\r
+ if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) {\r
+ this.element[ 0 ].style.position = "relative";\r
+ }\r
+ },\r
+\r
+ _adjustOffsetFromHelper: function( obj ) {\r
+ if ( typeof obj === "string" ) {\r
+ obj = obj.split( " " );\r
+ }\r
+ if ( Array.isArray( obj ) ) {\r
+ obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };\r
+ }\r
+ if ( "left" in obj ) {\r
+ this.offset.click.left = obj.left + this.margins.left;\r
+ }\r
+ if ( "right" in obj ) {\r
+ this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;\r
+ }\r
+ if ( "top" in obj ) {\r
+ this.offset.click.top = obj.top + this.margins.top;\r
+ }\r
+ if ( "bottom" in obj ) {\r
+ this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;\r
+ }\r
+ },\r
+\r
+ _isRootNode: function( element ) {\r
+ return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ];\r
+ },\r
+\r
+ _getParentOffset: function() {\r
+\r
+ //Get the offsetParent and cache its position\r
+ var po = this.offsetParent.offset(),\r
+ document = this.document[ 0 ];\r
+\r
+ // This is a special case where we need to modify a offset calculated on start, since the\r
+ // following happened:\r
+ // 1. The position of the helper is absolute, so it's position is calculated based on the\r
+ // next positioned parent\r
+ // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't\r
+ // the document, which means that the scroll is included in the initial calculation of the\r
+ // offset of the parent, and never recalculated upon drag\r
+ if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== document &&\r
+ $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) {\r
+ po.left += this.scrollParent.scrollLeft();\r
+ po.top += this.scrollParent.scrollTop();\r
+ }\r
+\r
+ if ( this._isRootNode( this.offsetParent[ 0 ] ) ) {\r
+ po = { top: 0, left: 0 };\r
+ }\r
+\r
+ return {\r
+ top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ),\r
+ left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 )\r
+ };\r
+\r
+ },\r
+\r
+ _getRelativeOffset: function() {\r
+ if ( this.cssPosition !== "relative" ) {\r
+ return { top: 0, left: 0 };\r
+ }\r
+\r
+ var p = this.element.position(),\r
+ scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );\r
+\r
+ return {\r
+ top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) +\r
+ ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ),\r
+ left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) +\r
+ ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 )\r
+ };\r
+\r
+ },\r
+\r
+ _cacheMargins: function() {\r
+ this.margins = {\r
+ left: ( parseInt( this.element.css( "marginLeft" ), 10 ) || 0 ),\r
+ top: ( parseInt( this.element.css( "marginTop" ), 10 ) || 0 ),\r
+ right: ( parseInt( this.element.css( "marginRight" ), 10 ) || 0 ),\r
+ bottom: ( parseInt( this.element.css( "marginBottom" ), 10 ) || 0 )\r
+ };\r
+ },\r
+\r
+ _cacheHelperProportions: function() {\r
+ this.helperProportions = {\r
+ width: this.helper.outerWidth(),\r
+ height: this.helper.outerHeight()\r
+ };\r
+ },\r
+\r
+ _setContainment: function() {\r
+\r
+ var isUserScrollable, c, ce,\r
+ o = this.options,\r
+ document = this.document[ 0 ];\r
+\r
+ this.relativeContainer = null;\r
+\r
+ if ( !o.containment ) {\r
+ this.containment = null;\r
+ return;\r
+ }\r
+\r
+ if ( o.containment === "window" ) {\r
+ this.containment = [\r
+ $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left,\r
+ $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top,\r
+ $( window ).scrollLeft() + $( window ).width() -\r
+ this.helperProportions.width - this.margins.left,\r
+ $( window ).scrollTop() +\r
+ ( $( window ).height() || document.body.parentNode.scrollHeight ) -\r
+ this.helperProportions.height - this.margins.top\r
+ ];\r
+ return;\r
+ }\r
+\r
+ if ( o.containment === "document" ) {\r
+ this.containment = [\r
+ 0,\r
+ 0,\r
+ $( document ).width() - this.helperProportions.width - this.margins.left,\r
+ ( $( document ).height() || document.body.parentNode.scrollHeight ) -\r
+ this.helperProportions.height - this.margins.top\r
+ ];\r
+ return;\r
+ }\r
+\r
+ if ( o.containment.constructor === Array ) {\r
+ this.containment = o.containment;\r
+ return;\r
+ }\r
+\r
+ if ( o.containment === "parent" ) {\r
+ o.containment = this.helper[ 0 ].parentNode;\r
+ }\r
+\r
+ c = $( o.containment );\r
+ ce = c[ 0 ];\r
+\r
+ if ( !ce ) {\r
+ return;\r
+ }\r
+\r
+ isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) );\r
+\r
+ this.containment = [\r
+ ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) +\r
+ ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),\r
+ ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) +\r
+ ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ),\r
+ ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -\r
+ ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) -\r
+ ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) -\r
+ this.helperProportions.width -\r
+ this.margins.left -\r
+ this.margins.right,\r
+ ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -\r
+ ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) -\r
+ ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) -\r
+ this.helperProportions.height -\r
+ this.margins.top -\r
+ this.margins.bottom\r
+ ];\r
+ this.relativeContainer = c;\r
+ },\r
+\r
+ _convertPositionTo: function( d, pos ) {\r
+\r
+ if ( !pos ) {\r
+ pos = this.position;\r
+ }\r
+\r
+ var mod = d === "absolute" ? 1 : -1,\r
+ scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );\r
+\r
+ return {\r
+ top: (\r
+\r
+ // The absolute mouse position\r
+ pos.top +\r
+\r
+ // Only for relative positioned nodes: Relative offset from element to offset parent\r
+ this.offset.relative.top * mod +\r
+\r
+ // The offsetParent's offset without borders (offset + border)\r
+ this.offset.parent.top * mod -\r
+ ( ( this.cssPosition === "fixed" ?\r
+ -this.offset.scroll.top :\r
+ ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod )\r
+ ),\r
+ left: (\r
+\r
+ // The absolute mouse position\r
+ pos.left +\r
+\r
+ // Only for relative positioned nodes: Relative offset from element to offset parent\r
+ this.offset.relative.left * mod +\r
+\r
+ // The offsetParent's offset without borders (offset + border)\r
+ this.offset.parent.left * mod -\r
+ ( ( this.cssPosition === "fixed" ?\r
+ -this.offset.scroll.left :\r
+ ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod )\r
+ )\r
+ };\r
+\r
+ },\r
+\r
+ _generatePosition: function( event, constrainPosition ) {\r
+\r
+ var containment, co, top, left,\r
+ o = this.options,\r
+ scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ),\r
+ pageX = event.pageX,\r
+ pageY = event.pageY;\r
+\r
+ // Cache the scroll\r
+ if ( !scrollIsRootNode || !this.offset.scroll ) {\r
+ this.offset.scroll = {\r
+ top: this.scrollParent.scrollTop(),\r
+ left: this.scrollParent.scrollLeft()\r
+ };\r
+ }\r
+\r
+ /*\r
+ * - Position constraining -\r
+ * Constrain the position to a mix of grid, containment.\r
+ */\r
+\r
+ // If we are not dragging yet, we won't check for options\r
+ if ( constrainPosition ) {\r
+ if ( this.containment ) {\r
+ if ( this.relativeContainer ) {\r
+ co = this.relativeContainer.offset();\r
+ containment = [\r
+ this.containment[ 0 ] + co.left,\r
+ this.containment[ 1 ] + co.top,\r
+ this.containment[ 2 ] + co.left,\r
+ this.containment[ 3 ] + co.top\r
+ ];\r
+ } else {\r
+ containment = this.containment;\r
+ }\r
+\r
+ if ( event.pageX - this.offset.click.left < containment[ 0 ] ) {\r
+ pageX = containment[ 0 ] + this.offset.click.left;\r
+ }\r
+ if ( event.pageY - this.offset.click.top < containment[ 1 ] ) {\r
+ pageY = containment[ 1 ] + this.offset.click.top;\r
+ }\r
+ if ( event.pageX - this.offset.click.left > containment[ 2 ] ) {\r
+ pageX = containment[ 2 ] + this.offset.click.left;\r
+ }\r
+ if ( event.pageY - this.offset.click.top > containment[ 3 ] ) {\r
+ pageY = containment[ 3 ] + this.offset.click.top;\r
+ }\r
+ }\r
+\r
+ if ( o.grid ) {\r
+\r
+ //Check for grid elements set to 0 to prevent divide by 0 error causing invalid\r
+ // argument errors in IE (see ticket #6950)\r
+ top = o.grid[ 1 ] ? this.originalPageY + Math.round( ( pageY -\r
+ this.originalPageY ) / o.grid[ 1 ] ) * o.grid[ 1 ] : this.originalPageY;\r
+ pageY = containment ? ( ( top - this.offset.click.top >= containment[ 1 ] ||\r
+ top - this.offset.click.top > containment[ 3 ] ) ?\r
+ top :\r
+ ( ( top - this.offset.click.top >= containment[ 1 ] ) ?\r
+ top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : top;\r
+\r
+ left = o.grid[ 0 ] ? this.originalPageX +\r
+ Math.round( ( pageX - this.originalPageX ) / o.grid[ 0 ] ) * o.grid[ 0 ] :\r
+ this.originalPageX;\r
+ pageX = containment ? ( ( left - this.offset.click.left >= containment[ 0 ] ||\r
+ left - this.offset.click.left > containment[ 2 ] ) ?\r
+ left :\r
+ ( ( left - this.offset.click.left >= containment[ 0 ] ) ?\r
+ left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : left;\r
+ }\r
+\r
+ if ( o.axis === "y" ) {\r
+ pageX = this.originalPageX;\r
+ }\r
+\r
+ if ( o.axis === "x" ) {\r
+ pageY = this.originalPageY;\r
+ }\r
+ }\r
+\r
+ return {\r
+ top: (\r
+\r
+ // The absolute mouse position\r
+ pageY -\r
+\r
+ // Click offset (relative to the element)\r
+ this.offset.click.top -\r
+\r
+ // Only for relative positioned nodes: Relative offset from element to offset parent\r
+ this.offset.relative.top -\r
+\r
+ // The offsetParent's offset without borders (offset + border)\r
+ this.offset.parent.top +\r
+ ( this.cssPosition === "fixed" ?\r
+ -this.offset.scroll.top :\r
+ ( scrollIsRootNode ? 0 : this.offset.scroll.top ) )\r
+ ),\r
+ left: (\r
+\r
+ // The absolute mouse position\r
+ pageX -\r
+\r
+ // Click offset (relative to the element)\r
+ this.offset.click.left -\r
+\r
+ // Only for relative positioned nodes: Relative offset from element to offset parent\r
+ this.offset.relative.left -\r
+\r
+ // The offsetParent's offset without borders (offset + border)\r
+ this.offset.parent.left +\r
+ ( this.cssPosition === "fixed" ?\r
+ -this.offset.scroll.left :\r
+ ( scrollIsRootNode ? 0 : this.offset.scroll.left ) )\r
+ )\r
+ };\r
+\r
+ },\r
+\r
+ _clear: function() {\r
+ this._removeClass( this.helper, "ui-draggable-dragging" );\r
+ if ( this.helper[ 0 ] !== this.element[ 0 ] && !this.cancelHelperRemoval ) {\r
+ this.helper.remove();\r
+ }\r
+ this.helper = null;\r
+ this.cancelHelperRemoval = false;\r
+ if ( this.destroyOnClear ) {\r
+ this.destroy();\r
+ }\r
+ },\r
+\r
+ // From now on bulk stuff - mainly helpers\r
+\r
+ _trigger: function( type, event, ui ) {\r
+ ui = ui || this._uiHash();\r
+ $.ui.plugin.call( this, type, [ event, ui, this ], true );\r
+\r
+ // Absolute position and offset (see #6884 ) have to be recalculated after plugins\r
+ if ( /^(drag|start|stop)/.test( type ) ) {\r
+ this.positionAbs = this._convertPositionTo( "absolute" );\r
+ ui.offset = this.positionAbs;\r
+ }\r
+ return $.Widget.prototype._trigger.call( this, type, event, ui );\r
+ },\r
+\r
+ plugins: {},\r
+\r
+ _uiHash: function() {\r
+ return {\r
+ helper: this.helper,\r
+ position: this.position,\r
+ originalPosition: this.originalPosition,\r
+ offset: this.positionAbs\r
+ };\r
+ }\r
+\r
+} );\r
+\r
+$.ui.plugin.add( "draggable", "connectToSortable", {\r
+ start: function( event, ui, draggable ) {\r
+ var uiSortable = $.extend( {}, ui, {\r
+ item: draggable.element\r
+ } );\r
+\r
+ draggable.sortables = [];\r
+ $( draggable.options.connectToSortable ).each( function() {\r
+ var sortable = $( this ).sortable( "instance" );\r
+\r
+ if ( sortable && !sortable.options.disabled ) {\r
+ draggable.sortables.push( sortable );\r
+\r
+ // RefreshPositions is called at drag start to refresh the containerCache\r
+ // which is used in drag. This ensures it's initialized and synchronized\r
+ // with any changes that might have happened on the page since initialization.\r
+ sortable.refreshPositions();\r
+ sortable._trigger( "activate", event, uiSortable );\r
+ }\r
+ } );\r
+ },\r
+ stop: function( event, ui, draggable ) {\r
+ var uiSortable = $.extend( {}, ui, {\r
+ item: draggable.element\r
+ } );\r
+\r
+ draggable.cancelHelperRemoval = false;\r
+\r
+ $.each( draggable.sortables, function() {\r
+ var sortable = this;\r
+\r
+ if ( sortable.isOver ) {\r
+ sortable.isOver = 0;\r
+\r
+ // Allow this sortable to handle removing the helper\r
+ draggable.cancelHelperRemoval = true;\r
+ sortable.cancelHelperRemoval = false;\r
+\r
+ // Use _storedCSS To restore properties in the sortable,\r
+ // as this also handles revert (#9675) since the draggable\r
+ // may have modified them in unexpected ways (#8809)\r
+ sortable._storedCSS = {\r
+ position: sortable.placeholder.css( "position" ),\r
+ top: sortable.placeholder.css( "top" ),\r
+ left: sortable.placeholder.css( "left" )\r
+ };\r
+\r
+ sortable._mouseStop( event );\r
+\r
+ // Once drag has ended, the sortable should return to using\r
+ // its original helper, not the shared helper from draggable\r
+ sortable.options.helper = sortable.options._helper;\r
+ } else {\r
+\r
+ // Prevent this Sortable from removing the helper.\r
+ // However, don't set the draggable to remove the helper\r
+ // either as another connected Sortable may yet handle the removal.\r
+ sortable.cancelHelperRemoval = true;\r
+\r
+ sortable._trigger( "deactivate", event, uiSortable );\r
+ }\r
+ } );\r
+ },\r
+ drag: function( event, ui, draggable ) {\r
+ $.each( draggable.sortables, function() {\r
+ var innermostIntersecting = false,\r
+ sortable = this;\r
+\r
+ // Copy over variables that sortable's _intersectsWith uses\r
+ sortable.positionAbs = draggable.positionAbs;\r
+ sortable.helperProportions = draggable.helperProportions;\r
+ sortable.offset.click = draggable.offset.click;\r
+\r
+ if ( sortable._intersectsWith( sortable.containerCache ) ) {\r
+ innermostIntersecting = true;\r
+\r
+ $.each( draggable.sortables, function() {\r
+\r
+ // Copy over variables that sortable's _intersectsWith uses\r
+ this.positionAbs = draggable.positionAbs;\r
+ this.helperProportions = draggable.helperProportions;\r
+ this.offset.click = draggable.offset.click;\r
+\r
+ if ( this !== sortable &&\r
+ this._intersectsWith( this.containerCache ) &&\r
+ $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) {\r
+ innermostIntersecting = false;\r
+ }\r
+\r
+ return innermostIntersecting;\r
+ } );\r
+ }\r
+\r
+ if ( innermostIntersecting ) {\r
+\r
+ // If it intersects, we use a little isOver variable and set it once,\r
+ // so that the move-in stuff gets fired only once.\r
+ if ( !sortable.isOver ) {\r
+ sortable.isOver = 1;\r
+\r
+ // Store draggable's parent in case we need to reappend to it later.\r
+ draggable._parent = ui.helper.parent();\r
+\r
+ sortable.currentItem = ui.helper\r
+ .appendTo( sortable.element )\r
+ .data( "ui-sortable-item", true );\r
+\r
+ // Store helper option to later restore it\r
+ sortable.options._helper = sortable.options.helper;\r
+\r
+ sortable.options.helper = function() {\r
+ return ui.helper[ 0 ];\r
+ };\r
+\r
+ // Fire the start events of the sortable with our passed browser event,\r
+ // and our own helper (so it doesn't create a new one)\r
+ event.target = sortable.currentItem[ 0 ];\r
+ sortable._mouseCapture( event, true );\r
+ sortable._mouseStart( event, true, true );\r
+\r
+ // Because the browser event is way off the new appended portlet,\r
+ // modify necessary variables to reflect the changes\r
+ sortable.offset.click.top = draggable.offset.click.top;\r
+ sortable.offset.click.left = draggable.offset.click.left;\r
+ sortable.offset.parent.left -= draggable.offset.parent.left -\r
+ sortable.offset.parent.left;\r
+ sortable.offset.parent.top -= draggable.offset.parent.top -\r
+ sortable.offset.parent.top;\r
+\r
+ draggable._trigger( "toSortable", event );\r
+\r
+ // Inform draggable that the helper is in a valid drop zone,\r
+ // used solely in the revert option to handle "valid/invalid".\r
+ draggable.dropped = sortable.element;\r
+\r
+ // Need to refreshPositions of all sortables in the case that\r
+ // adding to one sortable changes the location of the other sortables (#9675)\r
+ $.each( draggable.sortables, function() {\r
+ this.refreshPositions();\r
+ } );\r
+\r
+ // Hack so receive/update callbacks work (mostly)\r
+ draggable.currentItem = draggable.element;\r
+ sortable.fromOutside = draggable;\r
+ }\r
+\r
+ if ( sortable.currentItem ) {\r
+ sortable._mouseDrag( event );\r
+\r
+ // Copy the sortable's position because the draggable's can potentially reflect\r
+ // a relative position, while sortable is always absolute, which the dragged\r
+ // element has now become. (#8809)\r
+ ui.position = sortable.position;\r
+ }\r
+ } else {\r
+\r
+ // If it doesn't intersect with the sortable, and it intersected before,\r
+ // we fake the drag stop of the sortable, but make sure it doesn't remove\r
+ // the helper by using cancelHelperRemoval.\r
+ if ( sortable.isOver ) {\r
+\r
+ sortable.isOver = 0;\r
+ sortable.cancelHelperRemoval = true;\r
+\r
+ // Calling sortable's mouseStop would trigger a revert,\r
+ // so revert must be temporarily false until after mouseStop is called.\r
+ sortable.options._revert = sortable.options.revert;\r
+ sortable.options.revert = false;\r
+\r
+ sortable._trigger( "out", event, sortable._uiHash( sortable ) );\r
+ sortable._mouseStop( event, true );\r
+\r
+ // Restore sortable behaviors that were modfied\r
+ // when the draggable entered the sortable area (#9481)\r
+ sortable.options.revert = sortable.options._revert;\r
+ sortable.options.helper = sortable.options._helper;\r
+\r
+ if ( sortable.placeholder ) {\r
+ sortable.placeholder.remove();\r
+ }\r
+\r
+ // Restore and recalculate the draggable's offset considering the sortable\r
+ // may have modified them in unexpected ways. (#8809, #10669)\r
+ ui.helper.appendTo( draggable._parent );\r
+ draggable._refreshOffsets( event );\r
+ ui.position = draggable._generatePosition( event, true );\r
+\r
+ draggable._trigger( "fromSortable", event );\r
+\r
+ // Inform draggable that the helper is no longer in a valid drop zone\r
+ draggable.dropped = false;\r
+\r
+ // Need to refreshPositions of all sortables just in case removing\r
+ // from one sortable changes the location of other sortables (#9675)\r
+ $.each( draggable.sortables, function() {\r
+ this.refreshPositions();\r
+ } );\r
+ }\r
+ }\r
+ } );\r
+ }\r
+} );\r
+\r
+$.ui.plugin.add( "draggable", "cursor", {\r
+ start: function( event, ui, instance ) {\r
+ var t = $( "body" ),\r
+ o = instance.options;\r
+\r
+ if ( t.css( "cursor" ) ) {\r
+ o._cursor = t.css( "cursor" );\r
+ }\r
+ t.css( "cursor", o.cursor );\r
+ },\r
+ stop: function( event, ui, instance ) {\r
+ var o = instance.options;\r
+ if ( o._cursor ) {\r
+ $( "body" ).css( "cursor", o._cursor );\r
+ }\r
+ }\r
+} );\r
+\r
+$.ui.plugin.add( "draggable", "opacity", {\r
+ start: function( event, ui, instance ) {\r
+ var t = $( ui.helper ),\r
+ o = instance.options;\r
+ if ( t.css( "opacity" ) ) {\r
+ o._opacity = t.css( "opacity" );\r
+ }\r
+ t.css( "opacity", o.opacity );\r
+ },\r
+ stop: function( event, ui, instance ) {\r
+ var o = instance.options;\r
+ if ( o._opacity ) {\r
+ $( ui.helper ).css( "opacity", o._opacity );\r
+ }\r
+ }\r
+} );\r
+\r
+$.ui.plugin.add( "draggable", "scroll", {\r
+ start: function( event, ui, i ) {\r
+ if ( !i.scrollParentNotHidden ) {\r
+ i.scrollParentNotHidden = i.helper.scrollParent( false );\r
+ }\r
+\r
+ if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] &&\r
+ i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) {\r
+ i.overflowOffset = i.scrollParentNotHidden.offset();\r
+ }\r
+ },\r
+ drag: function( event, ui, i ) {\r
+\r
+ var o = i.options,\r
+ scrolled = false,\r
+ scrollParent = i.scrollParentNotHidden[ 0 ],\r
+ document = i.document[ 0 ];\r
+\r
+ if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) {\r
+ if ( !o.axis || o.axis !== "x" ) {\r
+ if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY <\r
+ o.scrollSensitivity ) {\r
+ scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed;\r
+ } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) {\r
+ scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed;\r
+ }\r
+ }\r
+\r
+ if ( !o.axis || o.axis !== "y" ) {\r
+ if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX <\r
+ o.scrollSensitivity ) {\r
+ scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed;\r
+ } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) {\r
+ scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed;\r
+ }\r
+ }\r
+\r
+ } else {\r
+\r
+ if ( !o.axis || o.axis !== "x" ) {\r
+ if ( event.pageY - $( document ).scrollTop() < o.scrollSensitivity ) {\r
+ scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed );\r
+ } else if ( $( window ).height() - ( event.pageY - $( document ).scrollTop() ) <\r
+ o.scrollSensitivity ) {\r
+ scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed );\r
+ }\r
+ }\r
+\r
+ if ( !o.axis || o.axis !== "y" ) {\r
+ if ( event.pageX - $( document ).scrollLeft() < o.scrollSensitivity ) {\r
+ scrolled = $( document ).scrollLeft(\r
+ $( document ).scrollLeft() - o.scrollSpeed\r
+ );\r
+ } else if ( $( window ).width() - ( event.pageX - $( document ).scrollLeft() ) <\r
+ o.scrollSensitivity ) {\r
+ scrolled = $( document ).scrollLeft(\r
+ $( document ).scrollLeft() + o.scrollSpeed\r
+ );\r
+ }\r
+ }\r
+\r
+ }\r
+\r
+ if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) {\r
+ $.ui.ddmanager.prepareOffsets( i, event );\r
+ }\r
+\r
+ }\r
+} );\r
+\r
+$.ui.plugin.add( "draggable", "snap", {\r
+ start: function( event, ui, i ) {\r
+\r
+ var o = i.options;\r
+\r
+ i.snapElements = [];\r
+\r
+ $( o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap )\r
+ .each( function() {\r
+ var $t = $( this ),\r
+ $o = $t.offset();\r
+ if ( this !== i.element[ 0 ] ) {\r
+ i.snapElements.push( {\r
+ item: this,\r
+ width: $t.outerWidth(), height: $t.outerHeight(),\r
+ top: $o.top, left: $o.left\r
+ } );\r
+ }\r
+ } );\r
+\r
+ },\r
+ drag: function( event, ui, inst ) {\r
+\r
+ var ts, bs, ls, rs, l, r, t, b, i, first,\r
+ o = inst.options,\r
+ d = o.snapTolerance,\r
+ x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,\r
+ y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;\r
+\r
+ for ( i = inst.snapElements.length - 1; i >= 0; i-- ) {\r
+\r
+ l = inst.snapElements[ i ].left - inst.margins.left;\r
+ r = l + inst.snapElements[ i ].width;\r
+ t = inst.snapElements[ i ].top - inst.margins.top;\r
+ b = t + inst.snapElements[ i ].height;\r
+\r
+ if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d ||\r
+ !$.contains( inst.snapElements[ i ].item.ownerDocument,\r
+ inst.snapElements[ i ].item ) ) {\r
+ if ( inst.snapElements[ i ].snapping ) {\r
+ if ( inst.options.snap.release ) {\r
+ inst.options.snap.release.call(\r
+ inst.element,\r
+ event,\r
+ $.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } )\r
+ );\r
+ }\r
+ }\r
+ inst.snapElements[ i ].snapping = false;\r
+ continue;\r
+ }\r
+\r
+ if ( o.snapMode !== "inner" ) {\r
+ ts = Math.abs( t - y2 ) <= d;\r
+ bs = Math.abs( b - y1 ) <= d;\r
+ ls = Math.abs( l - x2 ) <= d;\r
+ rs = Math.abs( r - x1 ) <= d;\r
+ if ( ts ) {\r
+ ui.position.top = inst._convertPositionTo( "relative", {\r
+ top: t - inst.helperProportions.height,\r
+ left: 0\r
+ } ).top;\r
+ }\r
+ if ( bs ) {\r
+ ui.position.top = inst._convertPositionTo( "relative", {\r
+ top: b,\r
+ left: 0\r
+ } ).top;\r
+ }\r
+ if ( ls ) {\r
+ ui.position.left = inst._convertPositionTo( "relative", {\r
+ top: 0,\r
+ left: l - inst.helperProportions.width\r
+ } ).left;\r
+ }\r
+ if ( rs ) {\r
+ ui.position.left = inst._convertPositionTo( "relative", {\r
+ top: 0,\r
+ left: r\r
+ } ).left;\r
+ }\r
+ }\r
+\r
+ first = ( ts || bs || ls || rs );\r
+\r
+ if ( o.snapMode !== "outer" ) {\r
+ ts = Math.abs( t - y1 ) <= d;\r
+ bs = Math.abs( b - y2 ) <= d;\r
+ ls = Math.abs( l - x1 ) <= d;\r
+ rs = Math.abs( r - x2 ) <= d;\r
+ if ( ts ) {\r
+ ui.position.top = inst._convertPositionTo( "relative", {\r
+ top: t,\r
+ left: 0\r
+ } ).top;\r
+ }\r
+ if ( bs ) {\r
+ ui.position.top = inst._convertPositionTo( "relative", {\r
+ top: b - inst.helperProportions.height,\r
+ left: 0\r
+ } ).top;\r
+ }\r
+ if ( ls ) {\r
+ ui.position.left = inst._convertPositionTo( "relative", {\r
+ top: 0,\r
+ left: l\r
+ } ).left;\r
+ }\r
+ if ( rs ) {\r
+ ui.position.left = inst._convertPositionTo( "relative", {\r
+ top: 0,\r
+ left: r - inst.helperProportions.width\r
+ } ).left;\r
+ }\r
+ }\r
+\r
+ if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) {\r
+ if ( inst.options.snap.snap ) {\r
+ inst.options.snap.snap.call(\r
+ inst.element,\r
+ event,\r
+ $.extend( inst._uiHash(), {\r
+ snapItem: inst.snapElements[ i ].item\r
+ } ) );\r
+ }\r
+ }\r
+ inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first );\r
+\r
+ }\r
+\r
+ }\r
+} );\r
+\r
+$.ui.plugin.add( "draggable", "stack", {\r
+ start: function( event, ui, instance ) {\r
+ var min,\r
+ o = instance.options,\r
+ group = $.makeArray( $( o.stack ) ).sort( function( a, b ) {\r
+ return ( parseInt( $( a ).css( "zIndex" ), 10 ) || 0 ) -\r
+ ( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 );\r
+ } );\r
+\r
+ if ( !group.length ) {\r
+ return;\r
+ }\r
+\r
+ min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0;\r
+ $( group ).each( function( i ) {\r
+ $( this ).css( "zIndex", min + i );\r
+ } );\r
+ this.css( "zIndex", ( min + group.length ) );\r
+ }\r
+} );\r
+\r
+$.ui.plugin.add( "draggable", "zIndex", {\r
+ start: function( event, ui, instance ) {\r
+ var t = $( ui.helper ),\r
+ o = instance.options;\r
+\r
+ if ( t.css( "zIndex" ) ) {\r
+ o._zIndex = t.css( "zIndex" );\r
+ }\r
+ t.css( "zIndex", o.zIndex );\r
+ },\r
+ stop: function( event, ui, instance ) {\r
+ var o = instance.options;\r
+\r
+ if ( o._zIndex ) {\r
+ $( ui.helper ).css( "zIndex", o._zIndex );\r
+ }\r
+ }\r
+} );\r
+\r
+var widgetsDraggable = $.ui.draggable;\r
+\r
+\r
+/*!\r
+ * jQuery UI Droppable 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Droppable\r
+//>>group: Interactions\r
+//>>description: Enables drop targets for draggable elements.\r
+//>>docs: http://api.jqueryui.com/droppable/\r
+//>>demos: http://jqueryui.com/droppable/\r
+\r
+\r
+$.widget( "ui.droppable", {\r
+ version: "1.13.1",\r
+ widgetEventPrefix: "drop",\r
+ options: {\r
+ accept: "*",\r
+ addClasses: true,\r
+ greedy: false,\r
+ scope: "default",\r
+ tolerance: "intersect",\r
+\r
+ // Callbacks\r
+ activate: null,\r
+ deactivate: null,\r
+ drop: null,\r
+ out: null,\r
+ over: null\r
+ },\r
+ _create: function() {\r
+\r
+ var proportions,\r
+ o = this.options,\r
+ accept = o.accept;\r
+\r
+ this.isover = false;\r
+ this.isout = true;\r
+\r
+ this.accept = typeof accept === "function" ? accept : function( d ) {\r
+ return d.is( accept );\r
+ };\r
+\r
+ this.proportions = function( /* valueToWrite */ ) {\r
+ if ( arguments.length ) {\r
+\r
+ // Store the droppable's proportions\r
+ proportions = arguments[ 0 ];\r
+ } else {\r
+\r
+ // Retrieve or derive the droppable's proportions\r
+ return proportions ?\r
+ proportions :\r
+ proportions = {\r
+ width: this.element[ 0 ].offsetWidth,\r
+ height: this.element[ 0 ].offsetHeight\r
+ };\r
+ }\r
+ };\r
+\r
+ this._addToManager( o.scope );\r
+\r
+ if ( o.addClasses ) {\r
+ this._addClass( "ui-droppable" );\r
+ }\r
+\r
+ },\r
+\r
+ _addToManager: function( scope ) {\r
+\r
+ // Add the reference and positions to the manager\r
+ $.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || [];\r
+ $.ui.ddmanager.droppables[ scope ].push( this );\r
+ },\r
+\r
+ _splice: function( drop ) {\r
+ var i = 0;\r
+ for ( ; i < drop.length; i++ ) {\r
+ if ( drop[ i ] === this ) {\r
+ drop.splice( i, 1 );\r
+ }\r
+ }\r
+ },\r
+\r
+ _destroy: function() {\r
+ var drop = $.ui.ddmanager.droppables[ this.options.scope ];\r
+\r
+ this._splice( drop );\r
+ },\r
+\r
+ _setOption: function( key, value ) {\r
+\r
+ if ( key === "accept" ) {\r
+ this.accept = typeof value === "function" ? value : function( d ) {\r
+ return d.is( value );\r
+ };\r
+ } else if ( key === "scope" ) {\r
+ var drop = $.ui.ddmanager.droppables[ this.options.scope ];\r
+\r
+ this._splice( drop );\r
+ this._addToManager( value );\r
+ }\r
+\r
+ this._super( key, value );\r
+ },\r
+\r
+ _activate: function( event ) {\r
+ var draggable = $.ui.ddmanager.current;\r
+\r
+ this._addActiveClass();\r
+ if ( draggable ) {\r
+ this._trigger( "activate", event, this.ui( draggable ) );\r
+ }\r
+ },\r
+\r
+ _deactivate: function( event ) {\r
+ var draggable = $.ui.ddmanager.current;\r
+\r
+ this._removeActiveClass();\r
+ if ( draggable ) {\r
+ this._trigger( "deactivate", event, this.ui( draggable ) );\r
+ }\r
+ },\r
+\r
+ _over: function( event ) {\r
+\r
+ var draggable = $.ui.ddmanager.current;\r
+\r
+ // Bail if draggable and droppable are same element\r
+ if ( !draggable || ( draggable.currentItem ||\r
+ draggable.element )[ 0 ] === this.element[ 0 ] ) {\r
+ return;\r
+ }\r
+\r
+ if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem ||\r
+ draggable.element ) ) ) {\r
+ this._addHoverClass();\r
+ this._trigger( "over", event, this.ui( draggable ) );\r
+ }\r
+\r
+ },\r
+\r
+ _out: function( event ) {\r
+\r
+ var draggable = $.ui.ddmanager.current;\r
+\r
+ // Bail if draggable and droppable are same element\r
+ if ( !draggable || ( draggable.currentItem ||\r
+ draggable.element )[ 0 ] === this.element[ 0 ] ) {\r
+ return;\r
+ }\r
+\r
+ if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem ||\r
+ draggable.element ) ) ) {\r
+ this._removeHoverClass();\r
+ this._trigger( "out", event, this.ui( draggable ) );\r
+ }\r
+\r
+ },\r
+\r
+ _drop: function( event, custom ) {\r
+\r
+ var draggable = custom || $.ui.ddmanager.current,\r
+ childrenIntersection = false;\r
+\r
+ // Bail if draggable and droppable are same element\r
+ if ( !draggable || ( draggable.currentItem ||\r
+ draggable.element )[ 0 ] === this.element[ 0 ] ) {\r
+ return false;\r
+ }\r
+\r
+ this.element\r
+ .find( ":data(ui-droppable)" )\r
+ .not( ".ui-draggable-dragging" )\r
+ .each( function() {\r
+ var inst = $( this ).droppable( "instance" );\r
+ if (\r
+ inst.options.greedy &&\r
+ !inst.options.disabled &&\r
+ inst.options.scope === draggable.options.scope &&\r
+ inst.accept.call(\r
+ inst.element[ 0 ], ( draggable.currentItem || draggable.element )\r
+ ) &&\r
+ $.ui.intersect(\r
+ draggable,\r
+ $.extend( inst, { offset: inst.element.offset() } ),\r
+ inst.options.tolerance, event\r
+ )\r
+ ) {\r
+ childrenIntersection = true;\r
+ return false;\r
+ }\r
+ } );\r
+ if ( childrenIntersection ) {\r
+ return false;\r
+ }\r
+\r
+ if ( this.accept.call( this.element[ 0 ],\r
+ ( draggable.currentItem || draggable.element ) ) ) {\r
+ this._removeActiveClass();\r
+ this._removeHoverClass();\r
+\r
+ this._trigger( "drop", event, this.ui( draggable ) );\r
+ return this.element;\r
+ }\r
+\r
+ return false;\r
+\r
+ },\r
+\r
+ ui: function( c ) {\r
+ return {\r
+ draggable: ( c.currentItem || c.element ),\r
+ helper: c.helper,\r
+ position: c.position,\r
+ offset: c.positionAbs\r
+ };\r
+ },\r
+\r
+ // Extension points just to make backcompat sane and avoid duplicating logic\r
+ // TODO: Remove in 1.14 along with call to it below\r
+ _addHoverClass: function() {\r
+ this._addClass( "ui-droppable-hover" );\r
+ },\r
+\r
+ _removeHoverClass: function() {\r
+ this._removeClass( "ui-droppable-hover" );\r
+ },\r
+\r
+ _addActiveClass: function() {\r
+ this._addClass( "ui-droppable-active" );\r
+ },\r
+\r
+ _removeActiveClass: function() {\r
+ this._removeClass( "ui-droppable-active" );\r
+ }\r
+} );\r
+\r
+$.ui.intersect = ( function() {\r
+ function isOverAxis( x, reference, size ) {\r
+ return ( x >= reference ) && ( x < ( reference + size ) );\r
+ }\r
+\r
+ return function( draggable, droppable, toleranceMode, event ) {\r
+\r
+ if ( !droppable.offset ) {\r
+ return false;\r
+ }\r
+\r
+ var x1 = ( draggable.positionAbs ||\r
+ draggable.position.absolute ).left + draggable.margins.left,\r
+ y1 = ( draggable.positionAbs ||\r
+ draggable.position.absolute ).top + draggable.margins.top,\r
+ x2 = x1 + draggable.helperProportions.width,\r
+ y2 = y1 + draggable.helperProportions.height,\r
+ l = droppable.offset.left,\r
+ t = droppable.offset.top,\r
+ r = l + droppable.proportions().width,\r
+ b = t + droppable.proportions().height;\r
+\r
+ switch ( toleranceMode ) {\r
+ case "fit":\r
+ return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b );\r
+ case "intersect":\r
+ return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half\r
+ x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half\r
+ t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half\r
+ y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half\r
+ case "pointer":\r
+ return isOverAxis( event.pageY, t, droppable.proportions().height ) &&\r
+ isOverAxis( event.pageX, l, droppable.proportions().width );\r
+ case "touch":\r
+ return (\r
+ ( y1 >= t && y1 <= b ) || // Top edge touching\r
+ ( y2 >= t && y2 <= b ) || // Bottom edge touching\r
+ ( y1 < t && y2 > b ) // Surrounded vertically\r
+ ) && (\r
+ ( x1 >= l && x1 <= r ) || // Left edge touching\r
+ ( x2 >= l && x2 <= r ) || // Right edge touching\r
+ ( x1 < l && x2 > r ) // Surrounded horizontally\r
+ );\r
+ default:\r
+ return false;\r
+ }\r
+ };\r
+} )();\r
+\r
+/*\r
+ This manager tracks offsets of draggables and droppables\r
+*/\r
+$.ui.ddmanager = {\r
+ current: null,\r
+ droppables: { "default": [] },\r
+ prepareOffsets: function( t, event ) {\r
+\r
+ var i, j,\r
+ m = $.ui.ddmanager.droppables[ t.options.scope ] || [],\r
+ type = event ? event.type : null, // workaround for #2317\r
+ list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack();\r
+\r
+ droppablesLoop: for ( i = 0; i < m.length; i++ ) {\r
+\r
+ // No disabled and non-accepted\r
+ if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ],\r
+ ( t.currentItem || t.element ) ) ) ) {\r
+ continue;\r
+ }\r
+\r
+ // Filter out elements in the current dragged item\r
+ for ( j = 0; j < list.length; j++ ) {\r
+ if ( list[ j ] === m[ i ].element[ 0 ] ) {\r
+ m[ i ].proportions().height = 0;\r
+ continue droppablesLoop;\r
+ }\r
+ }\r
+\r
+ m[ i ].visible = m[ i ].element.css( "display" ) !== "none";\r
+ if ( !m[ i ].visible ) {\r
+ continue;\r
+ }\r
+\r
+ // Activate the droppable if used directly from draggables\r
+ if ( type === "mousedown" ) {\r
+ m[ i ]._activate.call( m[ i ], event );\r
+ }\r
+\r
+ m[ i ].offset = m[ i ].element.offset();\r
+ m[ i ].proportions( {\r
+ width: m[ i ].element[ 0 ].offsetWidth,\r
+ height: m[ i ].element[ 0 ].offsetHeight\r
+ } );\r
+\r
+ }\r
+\r
+ },\r
+ drop: function( draggable, event ) {\r
+\r
+ var dropped = false;\r
+\r
+ // Create a copy of the droppables in case the list changes during the drop (#9116)\r
+ $.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() {\r
+\r
+ if ( !this.options ) {\r
+ return;\r
+ }\r
+ if ( !this.options.disabled && this.visible &&\r
+ $.ui.intersect( draggable, this, this.options.tolerance, event ) ) {\r
+ dropped = this._drop.call( this, event ) || dropped;\r
+ }\r
+\r
+ if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ],\r
+ ( draggable.currentItem || draggable.element ) ) ) {\r
+ this.isout = true;\r
+ this.isover = false;\r
+ this._deactivate.call( this, event );\r
+ }\r
+\r
+ } );\r
+ return dropped;\r
+\r
+ },\r
+ dragStart: function( draggable, event ) {\r
+\r
+ // Listen for scrolling so that if the dragging causes scrolling the position of the\r
+ // droppables can be recalculated (see #5003)\r
+ draggable.element.parentsUntil( "body" ).on( "scroll.droppable", function() {\r
+ if ( !draggable.options.refreshPositions ) {\r
+ $.ui.ddmanager.prepareOffsets( draggable, event );\r
+ }\r
+ } );\r
+ },\r
+ drag: function( draggable, event ) {\r
+\r
+ // If you have a highly dynamic page, you might try this option. It renders positions\r
+ // every time you move the mouse.\r
+ if ( draggable.options.refreshPositions ) {\r
+ $.ui.ddmanager.prepareOffsets( draggable, event );\r
+ }\r
+\r
+ // Run through all droppables and check their positions based on specific tolerance options\r
+ $.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() {\r
+\r
+ if ( this.options.disabled || this.greedyChild || !this.visible ) {\r
+ return;\r
+ }\r
+\r
+ var parentInstance, scope, parent,\r
+ intersects = $.ui.intersect( draggable, this, this.options.tolerance, event ),\r
+ c = !intersects && this.isover ?\r
+ "isout" :\r
+ ( intersects && !this.isover ? "isover" : null );\r
+ if ( !c ) {\r
+ return;\r
+ }\r
+\r
+ if ( this.options.greedy ) {\r
+\r
+ // find droppable parents with same scope\r
+ scope = this.options.scope;\r
+ parent = this.element.parents( ":data(ui-droppable)" ).filter( function() {\r
+ return $( this ).droppable( "instance" ).options.scope === scope;\r
+ } );\r
+\r
+ if ( parent.length ) {\r
+ parentInstance = $( parent[ 0 ] ).droppable( "instance" );\r
+ parentInstance.greedyChild = ( c === "isover" );\r
+ }\r
+ }\r
+\r
+ // We just moved into a greedy child\r
+ if ( parentInstance && c === "isover" ) {\r
+ parentInstance.isover = false;\r
+ parentInstance.isout = true;\r
+ parentInstance._out.call( parentInstance, event );\r
+ }\r
+\r
+ this[ c ] = true;\r
+ this[ c === "isout" ? "isover" : "isout" ] = false;\r
+ this[ c === "isover" ? "_over" : "_out" ].call( this, event );\r
+\r
+ // We just moved out of a greedy child\r
+ if ( parentInstance && c === "isout" ) {\r
+ parentInstance.isout = false;\r
+ parentInstance.isover = true;\r
+ parentInstance._over.call( parentInstance, event );\r
+ }\r
+ } );\r
+\r
+ },\r
+ dragStop: function( draggable, event ) {\r
+ draggable.element.parentsUntil( "body" ).off( "scroll.droppable" );\r
+\r
+ // Call prepareOffsets one final time since IE does not fire return scroll events when\r
+ // overflow was caused by drag (see #5003)\r
+ if ( !draggable.options.refreshPositions ) {\r
+ $.ui.ddmanager.prepareOffsets( draggable, event );\r
+ }\r
+ }\r
+};\r
+\r
+// DEPRECATED\r
+// TODO: switch return back to widget declaration at top of file when this is removed\r
+if ( $.uiBackCompat !== false ) {\r
+\r
+ // Backcompat for activeClass and hoverClass options\r
+ $.widget( "ui.droppable", $.ui.droppable, {\r
+ options: {\r
+ hoverClass: false,\r
+ activeClass: false\r
+ },\r
+ _addActiveClass: function() {\r
+ this._super();\r
+ if ( this.options.activeClass ) {\r
+ this.element.addClass( this.options.activeClass );\r
+ }\r
+ },\r
+ _removeActiveClass: function() {\r
+ this._super();\r
+ if ( this.options.activeClass ) {\r
+ this.element.removeClass( this.options.activeClass );\r
+ }\r
+ },\r
+ _addHoverClass: function() {\r
+ this._super();\r
+ if ( this.options.hoverClass ) {\r
+ this.element.addClass( this.options.hoverClass );\r
+ }\r
+ },\r
+ _removeHoverClass: function() {\r
+ this._super();\r
+ if ( this.options.hoverClass ) {\r
+ this.element.removeClass( this.options.hoverClass );\r
+ }\r
+ }\r
+ } );\r
+}\r
+\r
+var widgetsDroppable = $.ui.droppable;\r
+\r
+\r
+/*!\r
+ * jQuery UI Resizable 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Resizable\r
+//>>group: Interactions\r
+//>>description: Enables resize functionality for any element.\r
+//>>docs: http://api.jqueryui.com/resizable/\r
+//>>demos: http://jqueryui.com/resizable/\r
+//>>css.structure: ../../themes/base/core.css\r
+//>>css.structure: ../../themes/base/resizable.css\r
+//>>css.theme: ../../themes/base/theme.css\r
+\r
+\r
+$.widget( "ui.resizable", $.ui.mouse, {\r
+ version: "1.13.1",\r
+ widgetEventPrefix: "resize",\r
+ options: {\r
+ alsoResize: false,\r
+ animate: false,\r
+ animateDuration: "slow",\r
+ animateEasing: "swing",\r
+ aspectRatio: false,\r
+ autoHide: false,\r
+ classes: {\r
+ "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se"\r
+ },\r
+ containment: false,\r
+ ghost: false,\r
+ grid: false,\r
+ handles: "e,s,se",\r
+ helper: false,\r
+ maxHeight: null,\r
+ maxWidth: null,\r
+ minHeight: 10,\r
+ minWidth: 10,\r
+\r
+ // See #7960\r
+ zIndex: 90,\r
+\r
+ // Callbacks\r
+ resize: null,\r
+ start: null,\r
+ stop: null\r
+ },\r
+\r
+ _num: function( value ) {\r
+ return parseFloat( value ) || 0;\r
+ },\r
+\r
+ _isNumber: function( value ) {\r
+ return !isNaN( parseFloat( value ) );\r
+ },\r
+\r
+ _hasScroll: function( el, a ) {\r
+\r
+ if ( $( el ).css( "overflow" ) === "hidden" ) {\r
+ return false;\r
+ }\r
+\r
+ var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",\r
+ has = false;\r
+\r
+ if ( el[ scroll ] > 0 ) {\r
+ return true;\r
+ }\r
+\r
+ // TODO: determine which cases actually cause this to happen\r
+ // if the element doesn't have the scroll set, see if it's possible to\r
+ // set the scroll\r
+ try {\r
+ el[ scroll ] = 1;\r
+ has = ( el[ scroll ] > 0 );\r
+ el[ scroll ] = 0;\r
+ } catch ( e ) {\r
+\r
+ // `el` might be a string, then setting `scroll` will throw\r
+ // an error in strict mode; ignore it.\r
+ }\r
+ return has;\r
+ },\r
+\r
+ _create: function() {\r
+\r
+ var margins,\r
+ o = this.options,\r
+ that = this;\r
+ this._addClass( "ui-resizable" );\r
+\r
+ $.extend( this, {\r
+ _aspectRatio: !!( o.aspectRatio ),\r
+ aspectRatio: o.aspectRatio,\r
+ originalElement: this.element,\r
+ _proportionallyResizeElements: [],\r
+ _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null\r
+ } );\r
+\r
+ // Wrap the element if it cannot hold child nodes\r
+ if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) {\r
+\r
+ this.element.wrap(\r
+ $( "<div class='ui-wrapper'></div>" ).css( {\r
+ overflow: "hidden",\r
+ position: this.element.css( "position" ),\r
+ width: this.element.outerWidth(),\r
+ height: this.element.outerHeight(),\r
+ top: this.element.css( "top" ),\r
+ left: this.element.css( "left" )\r
+ } )\r
+ );\r
+\r
+ this.element = this.element.parent().data(\r
+ "ui-resizable", this.element.resizable( "instance" )\r
+ );\r
+\r
+ this.elementIsWrapper = true;\r
+\r
+ margins = {\r
+ marginTop: this.originalElement.css( "marginTop" ),\r
+ marginRight: this.originalElement.css( "marginRight" ),\r
+ marginBottom: this.originalElement.css( "marginBottom" ),\r
+ marginLeft: this.originalElement.css( "marginLeft" )\r
+ };\r
+\r
+ this.element.css( margins );\r
+ this.originalElement.css( "margin", 0 );\r
+\r
+ // support: Safari\r
+ // Prevent Safari textarea resize\r
+ this.originalResizeStyle = this.originalElement.css( "resize" );\r
+ this.originalElement.css( "resize", "none" );\r
+\r
+ this._proportionallyResizeElements.push( this.originalElement.css( {\r
+ position: "static",\r
+ zoom: 1,\r
+ display: "block"\r
+ } ) );\r
+\r
+ // Support: IE9\r
+ // avoid IE jump (hard set the margin)\r
+ this.originalElement.css( margins );\r
+\r
+ this._proportionallyResize();\r
+ }\r
+\r
+ this._setupHandles();\r
+\r
+ if ( o.autoHide ) {\r
+ $( this.element )\r
+ .on( "mouseenter", function() {\r
+ if ( o.disabled ) {\r
+ return;\r
+ }\r
+ that._removeClass( "ui-resizable-autohide" );\r
+ that._handles.show();\r
+ } )\r
+ .on( "mouseleave", function() {\r
+ if ( o.disabled ) {\r
+ return;\r
+ }\r
+ if ( !that.resizing ) {\r
+ that._addClass( "ui-resizable-autohide" );\r
+ that._handles.hide();\r
+ }\r
+ } );\r
+ }\r
+\r
+ this._mouseInit();\r
+ },\r
+\r
+ _destroy: function() {\r
+\r
+ this._mouseDestroy();\r
+ this._addedHandles.remove();\r
+\r
+ var wrapper,\r
+ _destroy = function( exp ) {\r
+ $( exp )\r
+ .removeData( "resizable" )\r
+ .removeData( "ui-resizable" )\r
+ .off( ".resizable" );\r
+ };\r
+\r
+ // TODO: Unwrap at same DOM position\r
+ if ( this.elementIsWrapper ) {\r
+ _destroy( this.element );\r
+ wrapper = this.element;\r
+ this.originalElement.css( {\r
+ position: wrapper.css( "position" ),\r
+ width: wrapper.outerWidth(),\r
+ height: wrapper.outerHeight(),\r
+ top: wrapper.css( "top" ),\r
+ left: wrapper.css( "left" )\r
+ } ).insertAfter( wrapper );\r
+ wrapper.remove();\r
+ }\r
+\r
+ this.originalElement.css( "resize", this.originalResizeStyle );\r
+ _destroy( this.originalElement );\r
+\r
+ return this;\r
+ },\r
+\r
+ _setOption: function( key, value ) {\r
+ this._super( key, value );\r
+\r
+ switch ( key ) {\r
+ case "handles":\r
+ this._removeHandles();\r
+ this._setupHandles();\r
+ break;\r
+ case "aspectRatio":\r
+ this._aspectRatio = !!value;\r
+ break;\r
+ default:\r
+ break;\r
+ }\r
+ },\r
+\r
+ _setupHandles: function() {\r
+ var o = this.options, handle, i, n, hname, axis, that = this;\r
+ this.handles = o.handles ||\r
+ ( !$( ".ui-resizable-handle", this.element ).length ?\r
+ "e,s,se" : {\r
+ n: ".ui-resizable-n",\r
+ e: ".ui-resizable-e",\r
+ s: ".ui-resizable-s",\r
+ w: ".ui-resizable-w",\r
+ se: ".ui-resizable-se",\r
+ sw: ".ui-resizable-sw",\r
+ ne: ".ui-resizable-ne",\r
+ nw: ".ui-resizable-nw"\r
+ } );\r
+\r
+ this._handles = $();\r
+ this._addedHandles = $();\r
+ if ( this.handles.constructor === String ) {\r
+\r
+ if ( this.handles === "all" ) {\r
+ this.handles = "n,e,s,w,se,sw,ne,nw";\r
+ }\r
+\r
+ n = this.handles.split( "," );\r
+ this.handles = {};\r
+\r
+ for ( i = 0; i < n.length; i++ ) {\r
+\r
+ handle = String.prototype.trim.call( n[ i ] );\r
+ hname = "ui-resizable-" + handle;\r
+ axis = $( "<div>" );\r
+ this._addClass( axis, "ui-resizable-handle " + hname );\r
+\r
+ axis.css( { zIndex: o.zIndex } );\r
+\r
+ this.handles[ handle ] = ".ui-resizable-" + handle;\r
+ if ( !this.element.children( this.handles[ handle ] ).length ) {\r
+ this.element.append( axis );\r
+ this._addedHandles = this._addedHandles.add( axis );\r
+ }\r
+ }\r
+\r
+ }\r
+\r
+ this._renderAxis = function( target ) {\r
+\r
+ var i, axis, padPos, padWrapper;\r
+\r
+ target = target || this.element;\r
+\r
+ for ( i in this.handles ) {\r
+\r
+ if ( this.handles[ i ].constructor === String ) {\r
+ this.handles[ i ] = this.element.children( this.handles[ i ] ).first().show();\r
+ } else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) {\r
+ this.handles[ i ] = $( this.handles[ i ] );\r
+ this._on( this.handles[ i ], { "mousedown": that._mouseDown } );\r
+ }\r
+\r
+ if ( this.elementIsWrapper &&\r
+ this.originalElement[ 0 ]\r
+ .nodeName\r
+ .match( /^(textarea|input|select|button)$/i ) ) {\r
+ axis = $( this.handles[ i ], this.element );\r
+\r
+ padWrapper = /sw|ne|nw|se|n|s/.test( i ) ?\r
+ axis.outerHeight() :\r
+ axis.outerWidth();\r
+\r
+ padPos = [ "padding",\r
+ /ne|nw|n/.test( i ) ? "Top" :\r
+ /se|sw|s/.test( i ) ? "Bottom" :\r
+ /^e$/.test( i ) ? "Right" : "Left" ].join( "" );\r
+\r
+ target.css( padPos, padWrapper );\r
+\r
+ this._proportionallyResize();\r
+ }\r
+\r
+ this._handles = this._handles.add( this.handles[ i ] );\r
+ }\r
+ };\r
+\r
+ // TODO: make renderAxis a prototype function\r
+ this._renderAxis( this.element );\r
+\r
+ this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) );\r
+ this._handles.disableSelection();\r
+\r
+ this._handles.on( "mouseover", function() {\r
+ if ( !that.resizing ) {\r
+ if ( this.className ) {\r
+ axis = this.className.match( /ui-resizable-(se|sw|ne|nw|n|e|s|w)/i );\r
+ }\r
+ that.axis = axis && axis[ 1 ] ? axis[ 1 ] : "se";\r
+ }\r
+ } );\r
+\r
+ if ( o.autoHide ) {\r
+ this._handles.hide();\r
+ this._addClass( "ui-resizable-autohide" );\r
+ }\r
+ },\r
+\r
+ _removeHandles: function() {\r
+ this._addedHandles.remove();\r
+ },\r
+\r
+ _mouseCapture: function( event ) {\r
+ var i, handle,\r
+ capture = false;\r
+\r
+ for ( i in this.handles ) {\r
+ handle = $( this.handles[ i ] )[ 0 ];\r
+ if ( handle === event.target || $.contains( handle, event.target ) ) {\r
+ capture = true;\r
+ }\r
+ }\r
+\r
+ return !this.options.disabled && capture;\r
+ },\r
+\r
+ _mouseStart: function( event ) {\r
+\r
+ var curleft, curtop, cursor,\r
+ o = this.options,\r
+ el = this.element;\r
+\r
+ this.resizing = true;\r
+\r
+ this._renderProxy();\r
+\r
+ curleft = this._num( this.helper.css( "left" ) );\r
+ curtop = this._num( this.helper.css( "top" ) );\r
+\r
+ if ( o.containment ) {\r
+ curleft += $( o.containment ).scrollLeft() || 0;\r
+ curtop += $( o.containment ).scrollTop() || 0;\r
+ }\r
+\r
+ this.offset = this.helper.offset();\r
+ this.position = { left: curleft, top: curtop };\r
+\r
+ this.size = this._helper ? {\r
+ width: this.helper.width(),\r
+ height: this.helper.height()\r
+ } : {\r
+ width: el.width(),\r
+ height: el.height()\r
+ };\r
+\r
+ this.originalSize = this._helper ? {\r
+ width: el.outerWidth(),\r
+ height: el.outerHeight()\r
+ } : {\r
+ width: el.width(),\r
+ height: el.height()\r
+ };\r
+\r
+ this.sizeDiff = {\r
+ width: el.outerWidth() - el.width(),\r
+ height: el.outerHeight() - el.height()\r
+ };\r
+\r
+ this.originalPosition = { left: curleft, top: curtop };\r
+ this.originalMousePosition = { left: event.pageX, top: event.pageY };\r
+\r
+ this.aspectRatio = ( typeof o.aspectRatio === "number" ) ?\r
+ o.aspectRatio :\r
+ ( ( this.originalSize.width / this.originalSize.height ) || 1 );\r
+\r
+ cursor = $( ".ui-resizable-" + this.axis ).css( "cursor" );\r
+ $( "body" ).css( "cursor", cursor === "auto" ? this.axis + "-resize" : cursor );\r
+\r
+ this._addClass( "ui-resizable-resizing" );\r
+ this._propagate( "start", event );\r
+ return true;\r
+ },\r
+\r
+ _mouseDrag: function( event ) {\r
+\r
+ var data, props,\r
+ smp = this.originalMousePosition,\r
+ a = this.axis,\r
+ dx = ( event.pageX - smp.left ) || 0,\r
+ dy = ( event.pageY - smp.top ) || 0,\r
+ trigger = this._change[ a ];\r
+\r
+ this._updatePrevProperties();\r
+\r
+ if ( !trigger ) {\r
+ return false;\r
+ }\r
+\r
+ data = trigger.apply( this, [ event, dx, dy ] );\r
+\r
+ this._updateVirtualBoundaries( event.shiftKey );\r
+ if ( this._aspectRatio || event.shiftKey ) {\r
+ data = this._updateRatio( data, event );\r
+ }\r
+\r
+ data = this._respectSize( data, event );\r
+\r
+ this._updateCache( data );\r
+\r
+ this._propagate( "resize", event );\r
+\r
+ props = this._applyChanges();\r
+\r
+ if ( !this._helper && this._proportionallyResizeElements.length ) {\r
+ this._proportionallyResize();\r
+ }\r
+\r
+ if ( !$.isEmptyObject( props ) ) {\r
+ this._updatePrevProperties();\r
+ this._trigger( "resize", event, this.ui() );\r
+ this._applyChanges();\r
+ }\r
+\r
+ return false;\r
+ },\r
+\r
+ _mouseStop: function( event ) {\r
+\r
+ this.resizing = false;\r
+ var pr, ista, soffseth, soffsetw, s, left, top,\r
+ o = this.options, that = this;\r
+\r
+ if ( this._helper ) {\r
+\r
+ pr = this._proportionallyResizeElements;\r
+ ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName );\r
+ soffseth = ista && this._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height;\r
+ soffsetw = ista ? 0 : that.sizeDiff.width;\r
+\r
+ s = {\r
+ width: ( that.helper.width() - soffsetw ),\r
+ height: ( that.helper.height() - soffseth )\r
+ };\r
+ left = ( parseFloat( that.element.css( "left" ) ) +\r
+ ( that.position.left - that.originalPosition.left ) ) || null;\r
+ top = ( parseFloat( that.element.css( "top" ) ) +\r
+ ( that.position.top - that.originalPosition.top ) ) || null;\r
+\r
+ if ( !o.animate ) {\r
+ this.element.css( $.extend( s, { top: top, left: left } ) );\r
+ }\r
+\r
+ that.helper.height( that.size.height );\r
+ that.helper.width( that.size.width );\r
+\r
+ if ( this._helper && !o.animate ) {\r
+ this._proportionallyResize();\r
+ }\r
+ }\r
+\r
+ $( "body" ).css( "cursor", "auto" );\r
+\r
+ this._removeClass( "ui-resizable-resizing" );\r
+\r
+ this._propagate( "stop", event );\r
+\r
+ if ( this._helper ) {\r
+ this.helper.remove();\r
+ }\r
+\r
+ return false;\r
+\r
+ },\r
+\r
+ _updatePrevProperties: function() {\r
+ this.prevPosition = {\r
+ top: this.position.top,\r
+ left: this.position.left\r
+ };\r
+ this.prevSize = {\r
+ width: this.size.width,\r
+ height: this.size.height\r
+ };\r
+ },\r
+\r
+ _applyChanges: function() {\r
+ var props = {};\r
+\r
+ if ( this.position.top !== this.prevPosition.top ) {\r
+ props.top = this.position.top + "px";\r
+ }\r
+ if ( this.position.left !== this.prevPosition.left ) {\r
+ props.left = this.position.left + "px";\r
+ }\r
+ if ( this.size.width !== this.prevSize.width ) {\r
+ props.width = this.size.width + "px";\r
+ }\r
+ if ( this.size.height !== this.prevSize.height ) {\r
+ props.height = this.size.height + "px";\r
+ }\r
+\r
+ this.helper.css( props );\r
+\r
+ return props;\r
+ },\r
+\r
+ _updateVirtualBoundaries: function( forceAspectRatio ) {\r
+ var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,\r
+ o = this.options;\r
+\r
+ b = {\r
+ minWidth: this._isNumber( o.minWidth ) ? o.minWidth : 0,\r
+ maxWidth: this._isNumber( o.maxWidth ) ? o.maxWidth : Infinity,\r
+ minHeight: this._isNumber( o.minHeight ) ? o.minHeight : 0,\r
+ maxHeight: this._isNumber( o.maxHeight ) ? o.maxHeight : Infinity\r
+ };\r
+\r
+ if ( this._aspectRatio || forceAspectRatio ) {\r
+ pMinWidth = b.minHeight * this.aspectRatio;\r
+ pMinHeight = b.minWidth / this.aspectRatio;\r
+ pMaxWidth = b.maxHeight * this.aspectRatio;\r
+ pMaxHeight = b.maxWidth / this.aspectRatio;\r
+\r
+ if ( pMinWidth > b.minWidth ) {\r
+ b.minWidth = pMinWidth;\r
+ }\r
+ if ( pMinHeight > b.minHeight ) {\r
+ b.minHeight = pMinHeight;\r
+ }\r
+ if ( pMaxWidth < b.maxWidth ) {\r
+ b.maxWidth = pMaxWidth;\r
+ }\r
+ if ( pMaxHeight < b.maxHeight ) {\r
+ b.maxHeight = pMaxHeight;\r
+ }\r
+ }\r
+ this._vBoundaries = b;\r
+ },\r
+\r
+ _updateCache: function( data ) {\r
+ this.offset = this.helper.offset();\r
+ if ( this._isNumber( data.left ) ) {\r
+ this.position.left = data.left;\r
+ }\r
+ if ( this._isNumber( data.top ) ) {\r
+ this.position.top = data.top;\r
+ }\r
+ if ( this._isNumber( data.height ) ) {\r
+ this.size.height = data.height;\r
+ }\r
+ if ( this._isNumber( data.width ) ) {\r
+ this.size.width = data.width;\r
+ }\r
+ },\r
+\r
+ _updateRatio: function( data ) {\r
+\r
+ var cpos = this.position,\r
+ csize = this.size,\r
+ a = this.axis;\r
+\r
+ if ( this._isNumber( data.height ) ) {\r
+ data.width = ( data.height * this.aspectRatio );\r
+ } else if ( this._isNumber( data.width ) ) {\r
+ data.height = ( data.width / this.aspectRatio );\r
+ }\r
+\r
+ if ( a === "sw" ) {\r
+ data.left = cpos.left + ( csize.width - data.width );\r
+ data.top = null;\r
+ }\r
+ if ( a === "nw" ) {\r
+ data.top = cpos.top + ( csize.height - data.height );\r
+ data.left = cpos.left + ( csize.width - data.width );\r
+ }\r
+\r
+ return data;\r
+ },\r
+\r
+ _respectSize: function( data ) {\r
+\r
+ var o = this._vBoundaries,\r
+ a = this.axis,\r
+ ismaxw = this._isNumber( data.width ) && o.maxWidth && ( o.maxWidth < data.width ),\r
+ ismaxh = this._isNumber( data.height ) && o.maxHeight && ( o.maxHeight < data.height ),\r
+ isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ),\r
+ isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ),\r
+ dw = this.originalPosition.left + this.originalSize.width,\r
+ dh = this.originalPosition.top + this.originalSize.height,\r
+ cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a );\r
+ if ( isminw ) {\r
+ data.width = o.minWidth;\r
+ }\r
+ if ( isminh ) {\r
+ data.height = o.minHeight;\r
+ }\r
+ if ( ismaxw ) {\r
+ data.width = o.maxWidth;\r
+ }\r
+ if ( ismaxh ) {\r
+ data.height = o.maxHeight;\r
+ }\r
+\r
+ if ( isminw && cw ) {\r
+ data.left = dw - o.minWidth;\r
+ }\r
+ if ( ismaxw && cw ) {\r
+ data.left = dw - o.maxWidth;\r
+ }\r
+ if ( isminh && ch ) {\r
+ data.top = dh - o.minHeight;\r
+ }\r
+ if ( ismaxh && ch ) {\r
+ data.top = dh - o.maxHeight;\r
+ }\r
+\r
+ // Fixing jump error on top/left - bug #2330\r
+ if ( !data.width && !data.height && !data.left && data.top ) {\r
+ data.top = null;\r
+ } else if ( !data.width && !data.height && !data.top && data.left ) {\r
+ data.left = null;\r
+ }\r
+\r
+ return data;\r
+ },\r
+\r
+ _getPaddingPlusBorderDimensions: function( element ) {\r
+ var i = 0,\r
+ widths = [],\r
+ borders = [\r
+ element.css( "borderTopWidth" ),\r
+ element.css( "borderRightWidth" ),\r
+ element.css( "borderBottomWidth" ),\r
+ element.css( "borderLeftWidth" )\r
+ ],\r
+ paddings = [\r
+ element.css( "paddingTop" ),\r
+ element.css( "paddingRight" ),\r
+ element.css( "paddingBottom" ),\r
+ element.css( "paddingLeft" )\r
+ ];\r
+\r
+ for ( ; i < 4; i++ ) {\r
+ widths[ i ] = ( parseFloat( borders[ i ] ) || 0 );\r
+ widths[ i ] += ( parseFloat( paddings[ i ] ) || 0 );\r
+ }\r
+\r
+ return {\r
+ height: widths[ 0 ] + widths[ 2 ],\r
+ width: widths[ 1 ] + widths[ 3 ]\r
+ };\r
+ },\r
+\r
+ _proportionallyResize: function() {\r
+\r
+ if ( !this._proportionallyResizeElements.length ) {\r
+ return;\r
+ }\r
+\r
+ var prel,\r
+ i = 0,\r
+ element = this.helper || this.element;\r
+\r
+ for ( ; i < this._proportionallyResizeElements.length; i++ ) {\r
+\r
+ prel = this._proportionallyResizeElements[ i ];\r
+\r
+ // TODO: Seems like a bug to cache this.outerDimensions\r
+ // considering that we are in a loop.\r
+ if ( !this.outerDimensions ) {\r
+ this.outerDimensions = this._getPaddingPlusBorderDimensions( prel );\r
+ }\r
+\r
+ prel.css( {\r
+ height: ( element.height() - this.outerDimensions.height ) || 0,\r
+ width: ( element.width() - this.outerDimensions.width ) || 0\r
+ } );\r
+\r
+ }\r
+\r
+ },\r
+\r
+ _renderProxy: function() {\r
+\r
+ var el = this.element, o = this.options;\r
+ this.elementOffset = el.offset();\r
+\r
+ if ( this._helper ) {\r
+\r
+ this.helper = this.helper || $( "<div></div>" ).css( { overflow: "hidden" } );\r
+\r
+ this._addClass( this.helper, this._helper );\r
+ this.helper.css( {\r
+ width: this.element.outerWidth(),\r
+ height: this.element.outerHeight(),\r
+ position: "absolute",\r
+ left: this.elementOffset.left + "px",\r
+ top: this.elementOffset.top + "px",\r
+ zIndex: ++o.zIndex //TODO: Don't modify option\r
+ } );\r
+\r
+ this.helper\r
+ .appendTo( "body" )\r
+ .disableSelection();\r
+\r
+ } else {\r
+ this.helper = this.element;\r
+ }\r
+\r
+ },\r
+\r
+ _change: {\r
+ e: function( event, dx ) {\r
+ return { width: this.originalSize.width + dx };\r
+ },\r
+ w: function( event, dx ) {\r
+ var cs = this.originalSize, sp = this.originalPosition;\r
+ return { left: sp.left + dx, width: cs.width - dx };\r
+ },\r
+ n: function( event, dx, dy ) {\r
+ var cs = this.originalSize, sp = this.originalPosition;\r
+ return { top: sp.top + dy, height: cs.height - dy };\r
+ },\r
+ s: function( event, dx, dy ) {\r
+ return { height: this.originalSize.height + dy };\r
+ },\r
+ se: function( event, dx, dy ) {\r
+ return $.extend( this._change.s.apply( this, arguments ),\r
+ this._change.e.apply( this, [ event, dx, dy ] ) );\r
+ },\r
+ sw: function( event, dx, dy ) {\r
+ return $.extend( this._change.s.apply( this, arguments ),\r
+ this._change.w.apply( this, [ event, dx, dy ] ) );\r
+ },\r
+ ne: function( event, dx, dy ) {\r
+ return $.extend( this._change.n.apply( this, arguments ),\r
+ this._change.e.apply( this, [ event, dx, dy ] ) );\r
+ },\r
+ nw: function( event, dx, dy ) {\r
+ return $.extend( this._change.n.apply( this, arguments ),\r
+ this._change.w.apply( this, [ event, dx, dy ] ) );\r
+ }\r
+ },\r
+\r
+ _propagate: function( n, event ) {\r
+ $.ui.plugin.call( this, n, [ event, this.ui() ] );\r
+ if ( n !== "resize" ) {\r
+ this._trigger( n, event, this.ui() );\r
+ }\r
+ },\r
+\r
+ plugins: {},\r
+\r
+ ui: function() {\r
+ return {\r
+ originalElement: this.originalElement,\r
+ element: this.element,\r
+ helper: this.helper,\r
+ position: this.position,\r
+ size: this.size,\r
+ originalSize: this.originalSize,\r
+ originalPosition: this.originalPosition\r
+ };\r
+ }\r
+\r
+} );\r
+\r
+/*\r
+ * Resizable Extensions\r
+ */\r
+\r
+$.ui.plugin.add( "resizable", "animate", {\r
+\r
+ stop: function( event ) {\r
+ var that = $( this ).resizable( "instance" ),\r
+ o = that.options,\r
+ pr = that._proportionallyResizeElements,\r
+ ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ),\r
+ soffseth = ista && that._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height,\r
+ soffsetw = ista ? 0 : that.sizeDiff.width,\r
+ style = {\r
+ width: ( that.size.width - soffsetw ),\r
+ height: ( that.size.height - soffseth )\r
+ },\r
+ left = ( parseFloat( that.element.css( "left" ) ) +\r
+ ( that.position.left - that.originalPosition.left ) ) || null,\r
+ top = ( parseFloat( that.element.css( "top" ) ) +\r
+ ( that.position.top - that.originalPosition.top ) ) || null;\r
+\r
+ that.element.animate(\r
+ $.extend( style, top && left ? { top: top, left: left } : {} ), {\r
+ duration: o.animateDuration,\r
+ easing: o.animateEasing,\r
+ step: function() {\r
+\r
+ var data = {\r
+ width: parseFloat( that.element.css( "width" ) ),\r
+ height: parseFloat( that.element.css( "height" ) ),\r
+ top: parseFloat( that.element.css( "top" ) ),\r
+ left: parseFloat( that.element.css( "left" ) )\r
+ };\r
+\r
+ if ( pr && pr.length ) {\r
+ $( pr[ 0 ] ).css( { width: data.width, height: data.height } );\r
+ }\r
+\r
+ // Propagating resize, and updating values for each animation step\r
+ that._updateCache( data );\r
+ that._propagate( "resize", event );\r
+\r
+ }\r
+ }\r
+ );\r
+ }\r
+\r
+} );\r
+\r
+$.ui.plugin.add( "resizable", "containment", {\r
+\r
+ start: function() {\r
+ var element, p, co, ch, cw, width, height,\r
+ that = $( this ).resizable( "instance" ),\r
+ o = that.options,\r
+ el = that.element,\r
+ oc = o.containment,\r
+ ce = ( oc instanceof $ ) ?\r
+ oc.get( 0 ) :\r
+ ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc;\r
+\r
+ if ( !ce ) {\r
+ return;\r
+ }\r
+\r
+ that.containerElement = $( ce );\r
+\r
+ if ( /document/.test( oc ) || oc === document ) {\r
+ that.containerOffset = {\r
+ left: 0,\r
+ top: 0\r
+ };\r
+ that.containerPosition = {\r
+ left: 0,\r
+ top: 0\r
+ };\r
+\r
+ that.parentData = {\r
+ element: $( document ),\r
+ left: 0,\r
+ top: 0,\r
+ width: $( document ).width(),\r
+ height: $( document ).height() || document.body.parentNode.scrollHeight\r
+ };\r
+ } else {\r
+ element = $( ce );\r
+ p = [];\r
+ $( [ "Top", "Right", "Left", "Bottom" ] ).each( function( i, name ) {\r
+ p[ i ] = that._num( element.css( "padding" + name ) );\r
+ } );\r
+\r
+ that.containerOffset = element.offset();\r
+ that.containerPosition = element.position();\r
+ that.containerSize = {\r
+ height: ( element.innerHeight() - p[ 3 ] ),\r
+ width: ( element.innerWidth() - p[ 1 ] )\r
+ };\r
+\r
+ co = that.containerOffset;\r
+ ch = that.containerSize.height;\r
+ cw = that.containerSize.width;\r
+ width = ( that._hasScroll( ce, "left" ) ? ce.scrollWidth : cw );\r
+ height = ( that._hasScroll( ce ) ? ce.scrollHeight : ch );\r
+\r
+ that.parentData = {\r
+ element: ce,\r
+ left: co.left,\r
+ top: co.top,\r
+ width: width,\r
+ height: height\r
+ };\r
+ }\r
+ },\r
+\r
+ resize: function( event ) {\r
+ var woset, hoset, isParent, isOffsetRelative,\r
+ that = $( this ).resizable( "instance" ),\r
+ o = that.options,\r
+ co = that.containerOffset,\r
+ cp = that.position,\r
+ pRatio = that._aspectRatio || event.shiftKey,\r
+ cop = {\r
+ top: 0,\r
+ left: 0\r
+ },\r
+ ce = that.containerElement,\r
+ continueResize = true;\r
+\r
+ if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) {\r
+ cop = co;\r
+ }\r
+\r
+ if ( cp.left < ( that._helper ? co.left : 0 ) ) {\r
+ that.size.width = that.size.width +\r
+ ( that._helper ?\r
+ ( that.position.left - co.left ) :\r
+ ( that.position.left - cop.left ) );\r
+\r
+ if ( pRatio ) {\r
+ that.size.height = that.size.width / that.aspectRatio;\r
+ continueResize = false;\r
+ }\r
+ that.position.left = o.helper ? co.left : 0;\r
+ }\r
+\r
+ if ( cp.top < ( that._helper ? co.top : 0 ) ) {\r
+ that.size.height = that.size.height +\r
+ ( that._helper ?\r
+ ( that.position.top - co.top ) :\r
+ that.position.top );\r
+\r
+ if ( pRatio ) {\r
+ that.size.width = that.size.height * that.aspectRatio;\r
+ continueResize = false;\r
+ }\r
+ that.position.top = that._helper ? co.top : 0;\r
+ }\r
+\r
+ isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 );\r
+ isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) );\r
+\r
+ if ( isParent && isOffsetRelative ) {\r
+ that.offset.left = that.parentData.left + that.position.left;\r
+ that.offset.top = that.parentData.top + that.position.top;\r
+ } else {\r
+ that.offset.left = that.element.offset().left;\r
+ that.offset.top = that.element.offset().top;\r
+ }\r
+\r
+ woset = Math.abs( that.sizeDiff.width +\r
+ ( that._helper ?\r
+ that.offset.left - cop.left :\r
+ ( that.offset.left - co.left ) ) );\r
+\r
+ hoset = Math.abs( that.sizeDiff.height +\r
+ ( that._helper ?\r
+ that.offset.top - cop.top :\r
+ ( that.offset.top - co.top ) ) );\r
+\r
+ if ( woset + that.size.width >= that.parentData.width ) {\r
+ that.size.width = that.parentData.width - woset;\r
+ if ( pRatio ) {\r
+ that.size.height = that.size.width / that.aspectRatio;\r
+ continueResize = false;\r
+ }\r
+ }\r
+\r
+ if ( hoset + that.size.height >= that.parentData.height ) {\r
+ that.size.height = that.parentData.height - hoset;\r
+ if ( pRatio ) {\r
+ that.size.width = that.size.height * that.aspectRatio;\r
+ continueResize = false;\r
+ }\r
+ }\r
+\r
+ if ( !continueResize ) {\r
+ that.position.left = that.prevPosition.left;\r
+ that.position.top = that.prevPosition.top;\r
+ that.size.width = that.prevSize.width;\r
+ that.size.height = that.prevSize.height;\r
+ }\r
+ },\r
+\r
+ stop: function() {\r
+ var that = $( this ).resizable( "instance" ),\r
+ o = that.options,\r
+ co = that.containerOffset,\r
+ cop = that.containerPosition,\r
+ ce = that.containerElement,\r
+ helper = $( that.helper ),\r
+ ho = helper.offset(),\r
+ w = helper.outerWidth() - that.sizeDiff.width,\r
+ h = helper.outerHeight() - that.sizeDiff.height;\r
+\r
+ if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) {\r
+ $( this ).css( {\r
+ left: ho.left - cop.left - co.left,\r
+ width: w,\r
+ height: h\r
+ } );\r
+ }\r
+\r
+ if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) {\r
+ $( this ).css( {\r
+ left: ho.left - cop.left - co.left,\r
+ width: w,\r
+ height: h\r
+ } );\r
+ }\r
+ }\r
+} );\r
+\r
+$.ui.plugin.add( "resizable", "alsoResize", {\r
+\r
+ start: function() {\r
+ var that = $( this ).resizable( "instance" ),\r
+ o = that.options;\r
+\r
+ $( o.alsoResize ).each( function() {\r
+ var el = $( this );\r
+ el.data( "ui-resizable-alsoresize", {\r
+ width: parseFloat( el.width() ), height: parseFloat( el.height() ),\r
+ left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) )\r
+ } );\r
+ } );\r
+ },\r
+\r
+ resize: function( event, ui ) {\r
+ var that = $( this ).resizable( "instance" ),\r
+ o = that.options,\r
+ os = that.originalSize,\r
+ op = that.originalPosition,\r
+ delta = {\r
+ height: ( that.size.height - os.height ) || 0,\r
+ width: ( that.size.width - os.width ) || 0,\r
+ top: ( that.position.top - op.top ) || 0,\r
+ left: ( that.position.left - op.left ) || 0\r
+ };\r
+\r
+ $( o.alsoResize ).each( function() {\r
+ var el = $( this ), start = $( this ).data( "ui-resizable-alsoresize" ), style = {},\r
+ css = el.parents( ui.originalElement[ 0 ] ).length ?\r
+ [ "width", "height" ] :\r
+ [ "width", "height", "top", "left" ];\r
+\r
+ $.each( css, function( i, prop ) {\r
+ var sum = ( start[ prop ] || 0 ) + ( delta[ prop ] || 0 );\r
+ if ( sum && sum >= 0 ) {\r
+ style[ prop ] = sum || null;\r
+ }\r
+ } );\r
+\r
+ el.css( style );\r
+ } );\r
+ },\r
+\r
+ stop: function() {\r
+ $( this ).removeData( "ui-resizable-alsoresize" );\r
+ }\r
+} );\r
+\r
+$.ui.plugin.add( "resizable", "ghost", {\r
+\r
+ start: function() {\r
+\r
+ var that = $( this ).resizable( "instance" ), cs = that.size;\r
+\r
+ that.ghost = that.originalElement.clone();\r
+ that.ghost.css( {\r
+ opacity: 0.25,\r
+ display: "block",\r
+ position: "relative",\r
+ height: cs.height,\r
+ width: cs.width,\r
+ margin: 0,\r
+ left: 0,\r
+ top: 0\r
+ } );\r
+\r
+ that._addClass( that.ghost, "ui-resizable-ghost" );\r
+\r
+ // DEPRECATED\r
+ // TODO: remove after 1.12\r
+ if ( $.uiBackCompat !== false && typeof that.options.ghost === "string" ) {\r
+\r
+ // Ghost option\r
+ that.ghost.addClass( this.options.ghost );\r
+ }\r
+\r
+ that.ghost.appendTo( that.helper );\r
+\r
+ },\r
+\r
+ resize: function() {\r
+ var that = $( this ).resizable( "instance" );\r
+ if ( that.ghost ) {\r
+ that.ghost.css( {\r
+ position: "relative",\r
+ height: that.size.height,\r
+ width: that.size.width\r
+ } );\r
+ }\r
+ },\r
+\r
+ stop: function() {\r
+ var that = $( this ).resizable( "instance" );\r
+ if ( that.ghost && that.helper ) {\r
+ that.helper.get( 0 ).removeChild( that.ghost.get( 0 ) );\r
+ }\r
+ }\r
+\r
+} );\r
+\r
+$.ui.plugin.add( "resizable", "grid", {\r
+\r
+ resize: function() {\r
+ var outerDimensions,\r
+ that = $( this ).resizable( "instance" ),\r
+ o = that.options,\r
+ cs = that.size,\r
+ os = that.originalSize,\r
+ op = that.originalPosition,\r
+ a = that.axis,\r
+ grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid,\r
+ gridX = ( grid[ 0 ] || 1 ),\r
+ gridY = ( grid[ 1 ] || 1 ),\r
+ ox = Math.round( ( cs.width - os.width ) / gridX ) * gridX,\r
+ oy = Math.round( ( cs.height - os.height ) / gridY ) * gridY,\r
+ newWidth = os.width + ox,\r
+ newHeight = os.height + oy,\r
+ isMaxWidth = o.maxWidth && ( o.maxWidth < newWidth ),\r
+ isMaxHeight = o.maxHeight && ( o.maxHeight < newHeight ),\r
+ isMinWidth = o.minWidth && ( o.minWidth > newWidth ),\r
+ isMinHeight = o.minHeight && ( o.minHeight > newHeight );\r
+\r
+ o.grid = grid;\r
+\r
+ if ( isMinWidth ) {\r
+ newWidth += gridX;\r
+ }\r
+ if ( isMinHeight ) {\r
+ newHeight += gridY;\r
+ }\r
+ if ( isMaxWidth ) {\r
+ newWidth -= gridX;\r
+ }\r
+ if ( isMaxHeight ) {\r
+ newHeight -= gridY;\r
+ }\r
+\r
+ if ( /^(se|s|e)$/.test( a ) ) {\r
+ that.size.width = newWidth;\r
+ that.size.height = newHeight;\r
+ } else if ( /^(ne)$/.test( a ) ) {\r
+ that.size.width = newWidth;\r
+ that.size.height = newHeight;\r
+ that.position.top = op.top - oy;\r
+ } else if ( /^(sw)$/.test( a ) ) {\r
+ that.size.width = newWidth;\r
+ that.size.height = newHeight;\r
+ that.position.left = op.left - ox;\r
+ } else {\r
+ if ( newHeight - gridY <= 0 || newWidth - gridX <= 0 ) {\r
+ outerDimensions = that._getPaddingPlusBorderDimensions( this );\r
+ }\r
+\r
+ if ( newHeight - gridY > 0 ) {\r
+ that.size.height = newHeight;\r
+ that.position.top = op.top - oy;\r
+ } else {\r
+ newHeight = gridY - outerDimensions.height;\r
+ that.size.height = newHeight;\r
+ that.position.top = op.top + os.height - newHeight;\r
+ }\r
+ if ( newWidth - gridX > 0 ) {\r
+ that.size.width = newWidth;\r
+ that.position.left = op.left - ox;\r
+ } else {\r
+ newWidth = gridX - outerDimensions.width;\r
+ that.size.width = newWidth;\r
+ that.position.left = op.left + os.width - newWidth;\r
+ }\r
+ }\r
+ }\r
+\r
+} );\r
+\r
+var widgetsResizable = $.ui.resizable;\r
+\r
+\r
+/*!\r
+ * jQuery UI Selectable 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Selectable\r
+//>>group: Interactions\r
+//>>description: Allows groups of elements to be selected with the mouse.\r
+//>>docs: http://api.jqueryui.com/selectable/\r
+//>>demos: http://jqueryui.com/selectable/\r
+//>>css.structure: ../../themes/base/selectable.css\r
+\r
+\r
+var widgetsSelectable = $.widget( "ui.selectable", $.ui.mouse, {\r
+ version: "1.13.1",\r
+ options: {\r
+ appendTo: "body",\r
+ autoRefresh: true,\r
+ distance: 0,\r
+ filter: "*",\r
+ tolerance: "touch",\r
+\r
+ // Callbacks\r
+ selected: null,\r
+ selecting: null,\r
+ start: null,\r
+ stop: null,\r
+ unselected: null,\r
+ unselecting: null\r
+ },\r
+ _create: function() {\r
+ var that = this;\r
+\r
+ this._addClass( "ui-selectable" );\r
+\r
+ this.dragged = false;\r
+\r
+ // Cache selectee children based on filter\r
+ this.refresh = function() {\r
+ that.elementPos = $( that.element[ 0 ] ).offset();\r
+ that.selectees = $( that.options.filter, that.element[ 0 ] );\r
+ that._addClass( that.selectees, "ui-selectee" );\r
+ that.selectees.each( function() {\r
+ var $this = $( this ),\r
+ selecteeOffset = $this.offset(),\r
+ pos = {\r
+ left: selecteeOffset.left - that.elementPos.left,\r
+ top: selecteeOffset.top - that.elementPos.top\r
+ };\r
+ $.data( this, "selectable-item", {\r
+ element: this,\r
+ $element: $this,\r
+ left: pos.left,\r
+ top: pos.top,\r
+ right: pos.left + $this.outerWidth(),\r
+ bottom: pos.top + $this.outerHeight(),\r
+ startselected: false,\r
+ selected: $this.hasClass( "ui-selected" ),\r
+ selecting: $this.hasClass( "ui-selecting" ),\r
+ unselecting: $this.hasClass( "ui-unselecting" )\r
+ } );\r
+ } );\r
+ };\r
+ this.refresh();\r
+\r
+ this._mouseInit();\r
+\r
+ this.helper = $( "<div>" );\r
+ this._addClass( this.helper, "ui-selectable-helper" );\r
+ },\r
+\r
+ _destroy: function() {\r
+ this.selectees.removeData( "selectable-item" );\r
+ this._mouseDestroy();\r
+ },\r
+\r
+ _mouseStart: function( event ) {\r
+ var that = this,\r
+ options = this.options;\r
+\r
+ this.opos = [ event.pageX, event.pageY ];\r
+ this.elementPos = $( this.element[ 0 ] ).offset();\r
+\r
+ if ( this.options.disabled ) {\r
+ return;\r
+ }\r
+\r
+ this.selectees = $( options.filter, this.element[ 0 ] );\r
+\r
+ this._trigger( "start", event );\r
+\r
+ $( options.appendTo ).append( this.helper );\r
+\r
+ // position helper (lasso)\r
+ this.helper.css( {\r
+ "left": event.pageX,\r
+ "top": event.pageY,\r
+ "width": 0,\r
+ "height": 0\r
+ } );\r
+\r
+ if ( options.autoRefresh ) {\r
+ this.refresh();\r
+ }\r
+\r
+ this.selectees.filter( ".ui-selected" ).each( function() {\r
+ var selectee = $.data( this, "selectable-item" );\r
+ selectee.startselected = true;\r
+ if ( !event.metaKey && !event.ctrlKey ) {\r
+ that._removeClass( selectee.$element, "ui-selected" );\r
+ selectee.selected = false;\r
+ that._addClass( selectee.$element, "ui-unselecting" );\r
+ selectee.unselecting = true;\r
+\r
+ // selectable UNSELECTING callback\r
+ that._trigger( "unselecting", event, {\r
+ unselecting: selectee.element\r
+ } );\r
+ }\r
+ } );\r
+\r
+ $( event.target ).parents().addBack().each( function() {\r
+ var doSelect,\r
+ selectee = $.data( this, "selectable-item" );\r
+ if ( selectee ) {\r
+ doSelect = ( !event.metaKey && !event.ctrlKey ) ||\r
+ !selectee.$element.hasClass( "ui-selected" );\r
+ that._removeClass( selectee.$element, doSelect ? "ui-unselecting" : "ui-selected" )\r
+ ._addClass( selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting" );\r
+ selectee.unselecting = !doSelect;\r
+ selectee.selecting = doSelect;\r
+ selectee.selected = doSelect;\r
+\r
+ // selectable (UN)SELECTING callback\r
+ if ( doSelect ) {\r
+ that._trigger( "selecting", event, {\r
+ selecting: selectee.element\r
+ } );\r
+ } else {\r
+ that._trigger( "unselecting", event, {\r
+ unselecting: selectee.element\r
+ } );\r
+ }\r
+ return false;\r
+ }\r
+ } );\r
+\r
+ },\r
+\r
+ _mouseDrag: function( event ) {\r
+\r
+ this.dragged = true;\r
+\r
+ if ( this.options.disabled ) {\r
+ return;\r
+ }\r
+\r
+ var tmp,\r
+ that = this,\r
+ options = this.options,\r
+ x1 = this.opos[ 0 ],\r
+ y1 = this.opos[ 1 ],\r
+ x2 = event.pageX,\r
+ y2 = event.pageY;\r
+\r
+ if ( x1 > x2 ) {\r
+ tmp = x2; x2 = x1; x1 = tmp;\r
+ }\r
+ if ( y1 > y2 ) {\r
+ tmp = y2; y2 = y1; y1 = tmp;\r
+ }\r
+ this.helper.css( { left: x1, top: y1, width: x2 - x1, height: y2 - y1 } );\r
+\r
+ this.selectees.each( function() {\r
+ var selectee = $.data( this, "selectable-item" ),\r
+ hit = false,\r
+ offset = {};\r
+\r
+ //prevent helper from being selected if appendTo: selectable\r
+ if ( !selectee || selectee.element === that.element[ 0 ] ) {\r
+ return;\r
+ }\r
+\r
+ offset.left = selectee.left + that.elementPos.left;\r
+ offset.right = selectee.right + that.elementPos.left;\r
+ offset.top = selectee.top + that.elementPos.top;\r
+ offset.bottom = selectee.bottom + that.elementPos.top;\r
+\r
+ if ( options.tolerance === "touch" ) {\r
+ hit = ( !( offset.left > x2 || offset.right < x1 || offset.top > y2 ||\r
+ offset.bottom < y1 ) );\r
+ } else if ( options.tolerance === "fit" ) {\r
+ hit = ( offset.left > x1 && offset.right < x2 && offset.top > y1 &&\r
+ offset.bottom < y2 );\r
+ }\r
+\r
+ if ( hit ) {\r
+\r
+ // SELECT\r
+ if ( selectee.selected ) {\r
+ that._removeClass( selectee.$element, "ui-selected" );\r
+ selectee.selected = false;\r
+ }\r
+ if ( selectee.unselecting ) {\r
+ that._removeClass( selectee.$element, "ui-unselecting" );\r
+ selectee.unselecting = false;\r
+ }\r
+ if ( !selectee.selecting ) {\r
+ that._addClass( selectee.$element, "ui-selecting" );\r
+ selectee.selecting = true;\r
+\r
+ // selectable SELECTING callback\r
+ that._trigger( "selecting", event, {\r
+ selecting: selectee.element\r
+ } );\r
+ }\r
+ } else {\r
+\r
+ // UNSELECT\r
+ if ( selectee.selecting ) {\r
+ if ( ( event.metaKey || event.ctrlKey ) && selectee.startselected ) {\r
+ that._removeClass( selectee.$element, "ui-selecting" );\r
+ selectee.selecting = false;\r
+ that._addClass( selectee.$element, "ui-selected" );\r
+ selectee.selected = true;\r
+ } else {\r
+ that._removeClass( selectee.$element, "ui-selecting" );\r
+ selectee.selecting = false;\r
+ if ( selectee.startselected ) {\r
+ that._addClass( selectee.$element, "ui-unselecting" );\r
+ selectee.unselecting = true;\r
+ }\r
+\r
+ // selectable UNSELECTING callback\r
+ that._trigger( "unselecting", event, {\r
+ unselecting: selectee.element\r
+ } );\r
+ }\r
+ }\r
+ if ( selectee.selected ) {\r
+ if ( !event.metaKey && !event.ctrlKey && !selectee.startselected ) {\r
+ that._removeClass( selectee.$element, "ui-selected" );\r
+ selectee.selected = false;\r
+\r
+ that._addClass( selectee.$element, "ui-unselecting" );\r
+ selectee.unselecting = true;\r
+\r
+ // selectable UNSELECTING callback\r
+ that._trigger( "unselecting", event, {\r
+ unselecting: selectee.element\r
+ } );\r
+ }\r
+ }\r
+ }\r
+ } );\r
+\r
+ return false;\r
+ },\r
+\r
+ _mouseStop: function( event ) {\r
+ var that = this;\r
+\r
+ this.dragged = false;\r
+\r
+ $( ".ui-unselecting", this.element[ 0 ] ).each( function() {\r
+ var selectee = $.data( this, "selectable-item" );\r
+ that._removeClass( selectee.$element, "ui-unselecting" );\r
+ selectee.unselecting = false;\r
+ selectee.startselected = false;\r
+ that._trigger( "unselected", event, {\r
+ unselected: selectee.element\r
+ } );\r
+ } );\r
+ $( ".ui-selecting", this.element[ 0 ] ).each( function() {\r
+ var selectee = $.data( this, "selectable-item" );\r
+ that._removeClass( selectee.$element, "ui-selecting" )\r
+ ._addClass( selectee.$element, "ui-selected" );\r
+ selectee.selecting = false;\r
+ selectee.selected = true;\r
+ selectee.startselected = true;\r
+ that._trigger( "selected", event, {\r
+ selected: selectee.element\r
+ } );\r
+ } );\r
+ this._trigger( "stop", event );\r
+\r
+ this.helper.remove();\r
+\r
+ return false;\r
+ }\r
+\r
+} );\r
+\r
+\r
+/*!\r
+ * jQuery UI Sortable 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Sortable\r
+//>>group: Interactions\r
+//>>description: Enables items in a list to be sorted using the mouse.\r
+//>>docs: http://api.jqueryui.com/sortable/\r
+//>>demos: http://jqueryui.com/sortable/\r
+//>>css.structure: ../../themes/base/sortable.css\r
+\r
+\r
+var widgetsSortable = $.widget( "ui.sortable", $.ui.mouse, {\r
+ version: "1.13.1",\r
+ widgetEventPrefix: "sort",\r
+ ready: false,\r
+ options: {\r
+ appendTo: "parent",\r
+ axis: false,\r
+ connectWith: false,\r
+ containment: false,\r
+ cursor: "auto",\r
+ cursorAt: false,\r
+ dropOnEmpty: true,\r
+ forcePlaceholderSize: false,\r
+ forceHelperSize: false,\r
+ grid: false,\r
+ handle: false,\r
+ helper: "original",\r
+ items: "> *",\r
+ opacity: false,\r
+ placeholder: false,\r
+ revert: false,\r
+ scroll: true,\r
+ scrollSensitivity: 20,\r
+ scrollSpeed: 20,\r
+ scope: "default",\r
+ tolerance: "intersect",\r
+ zIndex: 1000,\r
+\r
+ // Callbacks\r
+ activate: null,\r
+ beforeStop: null,\r
+ change: null,\r
+ deactivate: null,\r
+ out: null,\r
+ over: null,\r
+ receive: null,\r
+ remove: null,\r
+ sort: null,\r
+ start: null,\r
+ stop: null,\r
+ update: null\r
+ },\r
+\r
+ _isOverAxis: function( x, reference, size ) {\r
+ return ( x >= reference ) && ( x < ( reference + size ) );\r
+ },\r
+\r
+ _isFloating: function( item ) {\r
+ return ( /left|right/ ).test( item.css( "float" ) ) ||\r
+ ( /inline|table-cell/ ).test( item.css( "display" ) );\r
+ },\r
+\r
+ _create: function() {\r
+ this.containerCache = {};\r
+ this._addClass( "ui-sortable" );\r
+\r
+ //Get the items\r
+ this.refresh();\r
+\r
+ //Let's determine the parent's offset\r
+ this.offset = this.element.offset();\r
+\r
+ //Initialize mouse events for interaction\r
+ this._mouseInit();\r
+\r
+ this._setHandleClassName();\r
+\r
+ //We're ready to go\r
+ this.ready = true;\r
+\r
+ },\r
+\r
+ _setOption: function( key, value ) {\r
+ this._super( key, value );\r
+\r
+ if ( key === "handle" ) {\r
+ this._setHandleClassName();\r
+ }\r
+ },\r
+\r
+ _setHandleClassName: function() {\r
+ var that = this;\r
+ this._removeClass( this.element.find( ".ui-sortable-handle" ), "ui-sortable-handle" );\r
+ $.each( this.items, function() {\r
+ that._addClass(\r
+ this.instance.options.handle ?\r
+ this.item.find( this.instance.options.handle ) :\r
+ this.item,\r
+ "ui-sortable-handle"\r
+ );\r
+ } );\r
+ },\r
+\r
+ _destroy: function() {\r
+ this._mouseDestroy();\r
+\r
+ for ( var i = this.items.length - 1; i >= 0; i-- ) {\r
+ this.items[ i ].item.removeData( this.widgetName + "-item" );\r
+ }\r
+\r
+ return this;\r
+ },\r
+\r
+ _mouseCapture: function( event, overrideHandle ) {\r
+ var currentItem = null,\r
+ validHandle = false,\r
+ that = this;\r
+\r
+ if ( this.reverting ) {\r
+ return false;\r
+ }\r
+\r
+ if ( this.options.disabled || this.options.type === "static" ) {\r
+ return false;\r
+ }\r
+\r
+ //We have to refresh the items data once first\r
+ this._refreshItems( event );\r
+\r
+ //Find out if the clicked node (or one of its parents) is a actual item in this.items\r
+ $( event.target ).parents().each( function() {\r
+ if ( $.data( this, that.widgetName + "-item" ) === that ) {\r
+ currentItem = $( this );\r
+ return false;\r
+ }\r
+ } );\r
+ if ( $.data( event.target, that.widgetName + "-item" ) === that ) {\r
+ currentItem = $( event.target );\r
+ }\r
+\r
+ if ( !currentItem ) {\r
+ return false;\r
+ }\r
+ if ( this.options.handle && !overrideHandle ) {\r
+ $( this.options.handle, currentItem ).find( "*" ).addBack().each( function() {\r
+ if ( this === event.target ) {\r
+ validHandle = true;\r
+ }\r
+ } );\r
+ if ( !validHandle ) {\r
+ return false;\r
+ }\r
+ }\r
+\r
+ this.currentItem = currentItem;\r
+ this._removeCurrentsFromItems();\r
+ return true;\r
+\r
+ },\r
+\r
+ _mouseStart: function( event, overrideHandle, noActivation ) {\r
+\r
+ var i, body,\r
+ o = this.options;\r
+\r
+ this.currentContainer = this;\r
+\r
+ //We only need to call refreshPositions, because the refreshItems call has been moved to\r
+ // mouseCapture\r
+ this.refreshPositions();\r
+\r
+ //Prepare the dragged items parent\r
+ this.appendTo = $( o.appendTo !== "parent" ?\r
+ o.appendTo :\r
+ this.currentItem.parent() );\r
+\r
+ //Create and append the visible helper\r
+ this.helper = this._createHelper( event );\r
+\r
+ //Cache the helper size\r
+ this._cacheHelperProportions();\r
+\r
+ /*\r
+ * - Position generation -\r
+ * This block generates everything position related - it's the core of draggables.\r
+ */\r
+\r
+ //Cache the margins of the original element\r
+ this._cacheMargins();\r
+\r
+ //The element's absolute position on the page minus margins\r
+ this.offset = this.currentItem.offset();\r
+ this.offset = {\r
+ top: this.offset.top - this.margins.top,\r
+ left: this.offset.left - this.margins.left\r
+ };\r
+\r
+ $.extend( this.offset, {\r
+ click: { //Where the click happened, relative to the element\r
+ left: event.pageX - this.offset.left,\r
+ top: event.pageY - this.offset.top\r
+ },\r
+\r
+ // This is a relative to absolute position minus the actual position calculation -\r
+ // only used for relative positioned helper\r
+ relative: this._getRelativeOffset()\r
+ } );\r
+\r
+ // After we get the helper offset, but before we get the parent offset we can\r
+ // change the helper's position to absolute\r
+ // TODO: Still need to figure out a way to make relative sorting possible\r
+ this.helper.css( "position", "absolute" );\r
+ this.cssPosition = this.helper.css( "position" );\r
+\r
+ //Adjust the mouse offset relative to the helper if "cursorAt" is supplied\r
+ if ( o.cursorAt ) {\r
+ this._adjustOffsetFromHelper( o.cursorAt );\r
+ }\r
+\r
+ //Cache the former DOM position\r
+ this.domPosition = {\r
+ prev: this.currentItem.prev()[ 0 ],\r
+ parent: this.currentItem.parent()[ 0 ]\r
+ };\r
+\r
+ // If the helper is not the original, hide the original so it's not playing any role during\r
+ // the drag, won't cause anything bad this way\r
+ if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {\r
+ this.currentItem.hide();\r
+ }\r
+\r
+ //Create the placeholder\r
+ this._createPlaceholder();\r
+\r
+ //Get the next scrolling parent\r
+ this.scrollParent = this.placeholder.scrollParent();\r
+\r
+ $.extend( this.offset, {\r
+ parent: this._getParentOffset()\r
+ } );\r
+\r
+ //Set a containment if given in the options\r
+ if ( o.containment ) {\r
+ this._setContainment();\r
+ }\r
+\r
+ if ( o.cursor && o.cursor !== "auto" ) { // cursor option\r
+ body = this.document.find( "body" );\r
+\r
+ // Support: IE\r
+ this.storedCursor = body.css( "cursor" );\r
+ body.css( "cursor", o.cursor );\r
+\r
+ this.storedStylesheet =\r
+ $( "<style>*{ cursor: " + o.cursor + " !important; }</style>" ).appendTo( body );\r
+ }\r
+\r
+ // We need to make sure to grab the zIndex before setting the\r
+ // opacity, because setting the opacity to anything lower than 1\r
+ // causes the zIndex to change from "auto" to 0.\r
+ if ( o.zIndex ) { // zIndex option\r
+ if ( this.helper.css( "zIndex" ) ) {\r
+ this._storedZIndex = this.helper.css( "zIndex" );\r
+ }\r
+ this.helper.css( "zIndex", o.zIndex );\r
+ }\r
+\r
+ if ( o.opacity ) { // opacity option\r
+ if ( this.helper.css( "opacity" ) ) {\r
+ this._storedOpacity = this.helper.css( "opacity" );\r
+ }\r
+ this.helper.css( "opacity", o.opacity );\r
+ }\r
+\r
+ //Prepare scrolling\r
+ if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&\r
+ this.scrollParent[ 0 ].tagName !== "HTML" ) {\r
+ this.overflowOffset = this.scrollParent.offset();\r
+ }\r
+\r
+ //Call callbacks\r
+ this._trigger( "start", event, this._uiHash() );\r
+\r
+ //Recache the helper size\r
+ if ( !this._preserveHelperProportions ) {\r
+ this._cacheHelperProportions();\r
+ }\r
+\r
+ //Post "activate" events to possible containers\r
+ if ( !noActivation ) {\r
+ for ( i = this.containers.length - 1; i >= 0; i-- ) {\r
+ this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );\r
+ }\r
+ }\r
+\r
+ //Prepare possible droppables\r
+ if ( $.ui.ddmanager ) {\r
+ $.ui.ddmanager.current = this;\r
+ }\r
+\r
+ if ( $.ui.ddmanager && !o.dropBehaviour ) {\r
+ $.ui.ddmanager.prepareOffsets( this, event );\r
+ }\r
+\r
+ this.dragging = true;\r
+\r
+ this._addClass( this.helper, "ui-sortable-helper" );\r
+\r
+ //Move the helper, if needed\r
+ if ( !this.helper.parent().is( this.appendTo ) ) {\r
+ this.helper.detach().appendTo( this.appendTo );\r
+\r
+ //Update position\r
+ this.offset.parent = this._getParentOffset();\r
+ }\r
+\r
+ //Generate the original position\r
+ this.position = this.originalPosition = this._generatePosition( event );\r
+ this.originalPageX = event.pageX;\r
+ this.originalPageY = event.pageY;\r
+ this.lastPositionAbs = this.positionAbs = this._convertPositionTo( "absolute" );\r
+\r
+ this._mouseDrag( event );\r
+\r
+ return true;\r
+\r
+ },\r
+\r
+ _scroll: function( event ) {\r
+ var o = this.options,\r
+ scrolled = false;\r
+\r
+ if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&\r
+ this.scrollParent[ 0 ].tagName !== "HTML" ) {\r
+\r
+ if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) -\r
+ event.pageY < o.scrollSensitivity ) {\r
+ this.scrollParent[ 0 ].scrollTop =\r
+ scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed;\r
+ } else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) {\r
+ this.scrollParent[ 0 ].scrollTop =\r
+ scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed;\r
+ }\r
+\r
+ if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) -\r
+ event.pageX < o.scrollSensitivity ) {\r
+ this.scrollParent[ 0 ].scrollLeft = scrolled =\r
+ this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed;\r
+ } else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) {\r
+ this.scrollParent[ 0 ].scrollLeft = scrolled =\r
+ this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed;\r
+ }\r
+\r
+ } else {\r
+\r
+ if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) {\r
+ scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed );\r
+ } else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) <\r
+ o.scrollSensitivity ) {\r
+ scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed );\r
+ }\r
+\r
+ if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) {\r
+ scrolled = this.document.scrollLeft(\r
+ this.document.scrollLeft() - o.scrollSpeed\r
+ );\r
+ } else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) <\r
+ o.scrollSensitivity ) {\r
+ scrolled = this.document.scrollLeft(\r
+ this.document.scrollLeft() + o.scrollSpeed\r
+ );\r
+ }\r
+\r
+ }\r
+\r
+ return scrolled;\r
+ },\r
+\r
+ _mouseDrag: function( event ) {\r
+ var i, item, itemElement, intersection,\r
+ o = this.options;\r
+\r
+ //Compute the helpers position\r
+ this.position = this._generatePosition( event );\r
+ this.positionAbs = this._convertPositionTo( "absolute" );\r
+\r
+ //Set the helper position\r
+ if ( !this.options.axis || this.options.axis !== "y" ) {\r
+ this.helper[ 0 ].style.left = this.position.left + "px";\r
+ }\r
+ if ( !this.options.axis || this.options.axis !== "x" ) {\r
+ this.helper[ 0 ].style.top = this.position.top + "px";\r
+ }\r
+\r
+ //Do scrolling\r
+ if ( o.scroll ) {\r
+ if ( this._scroll( event ) !== false ) {\r
+\r
+ //Update item positions used in position checks\r
+ this._refreshItemPositions( true );\r
+\r
+ if ( $.ui.ddmanager && !o.dropBehaviour ) {\r
+ $.ui.ddmanager.prepareOffsets( this, event );\r
+ }\r
+ }\r
+ }\r
+\r
+ this.dragDirection = {\r
+ vertical: this._getDragVerticalDirection(),\r
+ horizontal: this._getDragHorizontalDirection()\r
+ };\r
+\r
+ //Rearrange\r
+ for ( i = this.items.length - 1; i >= 0; i-- ) {\r
+\r
+ //Cache variables and intersection, continue if no intersection\r
+ item = this.items[ i ];\r
+ itemElement = item.item[ 0 ];\r
+ intersection = this._intersectsWithPointer( item );\r
+ if ( !intersection ) {\r
+ continue;\r
+ }\r
+\r
+ // Only put the placeholder inside the current Container, skip all\r
+ // items from other containers. This works because when moving\r
+ // an item from one container to another the\r
+ // currentContainer is switched before the placeholder is moved.\r
+ //\r
+ // Without this, moving items in "sub-sortables" can cause\r
+ // the placeholder to jitter between the outer and inner container.\r
+ if ( item.instance !== this.currentContainer ) {\r
+ continue;\r
+ }\r
+\r
+ // Cannot intersect with itself\r
+ // no useless actions that have been done before\r
+ // no action if the item moved is the parent of the item checked\r
+ if ( itemElement !== this.currentItem[ 0 ] &&\r
+ this.placeholder[ intersection === 1 ?\r
+ "next" : "prev" ]()[ 0 ] !== itemElement &&\r
+ !$.contains( this.placeholder[ 0 ], itemElement ) &&\r
+ ( this.options.type === "semi-dynamic" ?\r
+ !$.contains( this.element[ 0 ], itemElement ) :\r
+ true\r
+ )\r
+ ) {\r
+\r
+ this.direction = intersection === 1 ? "down" : "up";\r
+\r
+ if ( this.options.tolerance === "pointer" ||\r
+ this._intersectsWithSides( item ) ) {\r
+ this._rearrange( event, item );\r
+ } else {\r
+ break;\r
+ }\r
+\r
+ this._trigger( "change", event, this._uiHash() );\r
+ break;\r
+ }\r
+ }\r
+\r
+ //Post events to containers\r
+ this._contactContainers( event );\r
+\r
+ //Interconnect with droppables\r
+ if ( $.ui.ddmanager ) {\r
+ $.ui.ddmanager.drag( this, event );\r
+ }\r
+\r
+ //Call callbacks\r
+ this._trigger( "sort", event, this._uiHash() );\r
+\r
+ this.lastPositionAbs = this.positionAbs;\r
+ return false;\r
+\r
+ },\r
+\r
+ _mouseStop: function( event, noPropagation ) {\r
+\r
+ if ( !event ) {\r
+ return;\r
+ }\r
+\r
+ //If we are using droppables, inform the manager about the drop\r
+ if ( $.ui.ddmanager && !this.options.dropBehaviour ) {\r
+ $.ui.ddmanager.drop( this, event );\r
+ }\r
+\r
+ if ( this.options.revert ) {\r
+ var that = this,\r
+ cur = this.placeholder.offset(),\r
+ axis = this.options.axis,\r
+ animation = {};\r
+\r
+ if ( !axis || axis === "x" ) {\r
+ animation.left = cur.left - this.offset.parent.left - this.margins.left +\r
+ ( this.offsetParent[ 0 ] === this.document[ 0 ].body ?\r
+ 0 :\r
+ this.offsetParent[ 0 ].scrollLeft\r
+ );\r
+ }\r
+ if ( !axis || axis === "y" ) {\r
+ animation.top = cur.top - this.offset.parent.top - this.margins.top +\r
+ ( this.offsetParent[ 0 ] === this.document[ 0 ].body ?\r
+ 0 :\r
+ this.offsetParent[ 0 ].scrollTop\r
+ );\r
+ }\r
+ this.reverting = true;\r
+ $( this.helper ).animate(\r
+ animation,\r
+ parseInt( this.options.revert, 10 ) || 500,\r
+ function() {\r
+ that._clear( event );\r
+ }\r
+ );\r
+ } else {\r
+ this._clear( event, noPropagation );\r
+ }\r
+\r
+ return false;\r
+\r
+ },\r
+\r
+ cancel: function() {\r
+\r
+ if ( this.dragging ) {\r
+\r
+ this._mouseUp( new $.Event( "mouseup", { target: null } ) );\r
+\r
+ if ( this.options.helper === "original" ) {\r
+ this.currentItem.css( this._storedCSS );\r
+ this._removeClass( this.currentItem, "ui-sortable-helper" );\r
+ } else {\r
+ this.currentItem.show();\r
+ }\r
+\r
+ //Post deactivating events to containers\r
+ for ( var i = this.containers.length - 1; i >= 0; i-- ) {\r
+ this.containers[ i ]._trigger( "deactivate", null, this._uiHash( this ) );\r
+ if ( this.containers[ i ].containerCache.over ) {\r
+ this.containers[ i ]._trigger( "out", null, this._uiHash( this ) );\r
+ this.containers[ i ].containerCache.over = 0;\r
+ }\r
+ }\r
+\r
+ }\r
+\r
+ if ( this.placeholder ) {\r
+\r
+ //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,\r
+ // it unbinds ALL events from the original node!\r
+ if ( this.placeholder[ 0 ].parentNode ) {\r
+ this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] );\r
+ }\r
+ if ( this.options.helper !== "original" && this.helper &&\r
+ this.helper[ 0 ].parentNode ) {\r
+ this.helper.remove();\r
+ }\r
+\r
+ $.extend( this, {\r
+ helper: null,\r
+ dragging: false,\r
+ reverting: false,\r
+ _noFinalSort: null\r
+ } );\r
+\r
+ if ( this.domPosition.prev ) {\r
+ $( this.domPosition.prev ).after( this.currentItem );\r
+ } else {\r
+ $( this.domPosition.parent ).prepend( this.currentItem );\r
+ }\r
+ }\r
+\r
+ return this;\r
+\r
+ },\r
+\r
+ serialize: function( o ) {\r
+\r
+ var items = this._getItemsAsjQuery( o && o.connected ),\r
+ str = [];\r
+ o = o || {};\r
+\r
+ $( items ).each( function() {\r
+ var res = ( $( o.item || this ).attr( o.attribute || "id" ) || "" )\r
+ .match( o.expression || ( /(.+)[\-=_](.+)/ ) );\r
+ if ( res ) {\r
+ str.push(\r
+ ( o.key || res[ 1 ] + "[]" ) +\r
+ "=" + ( o.key && o.expression ? res[ 1 ] : res[ 2 ] ) );\r
+ }\r
+ } );\r
+\r
+ if ( !str.length && o.key ) {\r
+ str.push( o.key + "=" );\r
+ }\r
+\r
+ return str.join( "&" );\r
+\r
+ },\r
+\r
+ toArray: function( o ) {\r
+\r
+ var items = this._getItemsAsjQuery( o && o.connected ),\r
+ ret = [];\r
+\r
+ o = o || {};\r
+\r
+ items.each( function() {\r
+ ret.push( $( o.item || this ).attr( o.attribute || "id" ) || "" );\r
+ } );\r
+ return ret;\r
+\r
+ },\r
+\r
+ /* Be careful with the following core functions */\r
+ _intersectsWith: function( item ) {\r
+\r
+ var x1 = this.positionAbs.left,\r
+ x2 = x1 + this.helperProportions.width,\r
+ y1 = this.positionAbs.top,\r
+ y2 = y1 + this.helperProportions.height,\r
+ l = item.left,\r
+ r = l + item.width,\r
+ t = item.top,\r
+ b = t + item.height,\r
+ dyClick = this.offset.click.top,\r
+ dxClick = this.offset.click.left,\r
+ isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t &&\r
+ ( y1 + dyClick ) < b ),\r
+ isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l &&\r
+ ( x1 + dxClick ) < r ),\r
+ isOverElement = isOverElementHeight && isOverElementWidth;\r
+\r
+ if ( this.options.tolerance === "pointer" ||\r
+ this.options.forcePointerForContainers ||\r
+ ( this.options.tolerance !== "pointer" &&\r
+ this.helperProportions[ this.floating ? "width" : "height" ] >\r
+ item[ this.floating ? "width" : "height" ] )\r
+ ) {\r
+ return isOverElement;\r
+ } else {\r
+\r
+ return ( l < x1 + ( this.helperProportions.width / 2 ) && // Right Half\r
+ x2 - ( this.helperProportions.width / 2 ) < r && // Left Half\r
+ t < y1 + ( this.helperProportions.height / 2 ) && // Bottom Half\r
+ y2 - ( this.helperProportions.height / 2 ) < b ); // Top Half\r
+\r
+ }\r
+ },\r
+\r
+ _intersectsWithPointer: function( item ) {\r
+ var verticalDirection, horizontalDirection,\r
+ isOverElementHeight = ( this.options.axis === "x" ) ||\r
+ this._isOverAxis(\r
+ this.positionAbs.top + this.offset.click.top, item.top, item.height ),\r
+ isOverElementWidth = ( this.options.axis === "y" ) ||\r
+ this._isOverAxis(\r
+ this.positionAbs.left + this.offset.click.left, item.left, item.width ),\r
+ isOverElement = isOverElementHeight && isOverElementWidth;\r
+\r
+ if ( !isOverElement ) {\r
+ return false;\r
+ }\r
+\r
+ verticalDirection = this.dragDirection.vertical;\r
+ horizontalDirection = this.dragDirection.horizontal;\r
+\r
+ return this.floating ?\r
+ ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 ) :\r
+ ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) );\r
+\r
+ },\r
+\r
+ _intersectsWithSides: function( item ) {\r
+\r
+ var isOverBottomHalf = this._isOverAxis( this.positionAbs.top +\r
+ this.offset.click.top, item.top + ( item.height / 2 ), item.height ),\r
+ isOverRightHalf = this._isOverAxis( this.positionAbs.left +\r
+ this.offset.click.left, item.left + ( item.width / 2 ), item.width ),\r
+ verticalDirection = this.dragDirection.vertical,\r
+ horizontalDirection = this.dragDirection.horizontal;\r
+\r
+ if ( this.floating && horizontalDirection ) {\r
+ return ( ( horizontalDirection === "right" && isOverRightHalf ) ||\r
+ ( horizontalDirection === "left" && !isOverRightHalf ) );\r
+ } else {\r
+ return verticalDirection && ( ( verticalDirection === "down" && isOverBottomHalf ) ||\r
+ ( verticalDirection === "up" && !isOverBottomHalf ) );\r
+ }\r
+\r
+ },\r
+\r
+ _getDragVerticalDirection: function() {\r
+ var delta = this.positionAbs.top - this.lastPositionAbs.top;\r
+ return delta !== 0 && ( delta > 0 ? "down" : "up" );\r
+ },\r
+\r
+ _getDragHorizontalDirection: function() {\r
+ var delta = this.positionAbs.left - this.lastPositionAbs.left;\r
+ return delta !== 0 && ( delta > 0 ? "right" : "left" );\r
+ },\r
+\r
+ refresh: function( event ) {\r
+ this._refreshItems( event );\r
+ this._setHandleClassName();\r
+ this.refreshPositions();\r
+ return this;\r
+ },\r
+\r
+ _connectWith: function() {\r
+ var options = this.options;\r
+ return options.connectWith.constructor === String ?\r
+ [ options.connectWith ] :\r
+ options.connectWith;\r
+ },\r
+\r
+ _getItemsAsjQuery: function( connected ) {\r
+\r
+ var i, j, cur, inst,\r
+ items = [],\r
+ queries = [],\r
+ connectWith = this._connectWith();\r
+\r
+ if ( connectWith && connected ) {\r
+ for ( i = connectWith.length - 1; i >= 0; i-- ) {\r
+ cur = $( connectWith[ i ], this.document[ 0 ] );\r
+ for ( j = cur.length - 1; j >= 0; j-- ) {\r
+ inst = $.data( cur[ j ], this.widgetFullName );\r
+ if ( inst && inst !== this && !inst.options.disabled ) {\r
+ queries.push( [ typeof inst.options.items === "function" ?\r
+ inst.options.items.call( inst.element ) :\r
+ $( inst.options.items, inst.element )\r
+ .not( ".ui-sortable-helper" )\r
+ .not( ".ui-sortable-placeholder" ), inst ] );\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ queries.push( [ typeof this.options.items === "function" ?\r
+ this.options.items\r
+ .call( this.element, null, { options: this.options, item: this.currentItem } ) :\r
+ $( this.options.items, this.element )\r
+ .not( ".ui-sortable-helper" )\r
+ .not( ".ui-sortable-placeholder" ), this ] );\r
+\r
+ function addItems() {\r
+ items.push( this );\r
+ }\r
+ for ( i = queries.length - 1; i >= 0; i-- ) {\r
+ queries[ i ][ 0 ].each( addItems );\r
+ }\r
+\r
+ return $( items );\r
+\r
+ },\r
+\r
+ _removeCurrentsFromItems: function() {\r
+\r
+ var list = this.currentItem.find( ":data(" + this.widgetName + "-item)" );\r
+\r
+ this.items = $.grep( this.items, function( item ) {\r
+ for ( var j = 0; j < list.length; j++ ) {\r
+ if ( list[ j ] === item.item[ 0 ] ) {\r
+ return false;\r
+ }\r
+ }\r
+ return true;\r
+ } );\r
+\r
+ },\r
+\r
+ _refreshItems: function( event ) {\r
+\r
+ this.items = [];\r
+ this.containers = [ this ];\r
+\r
+ var i, j, cur, inst, targetData, _queries, item, queriesLength,\r
+ items = this.items,\r
+ queries = [ [ typeof this.options.items === "function" ?\r
+ this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) :\r
+ $( this.options.items, this.element ), this ] ],\r
+ connectWith = this._connectWith();\r
+\r
+ //Shouldn't be run the first time through due to massive slow-down\r
+ if ( connectWith && this.ready ) {\r
+ for ( i = connectWith.length - 1; i >= 0; i-- ) {\r
+ cur = $( connectWith[ i ], this.document[ 0 ] );\r
+ for ( j = cur.length - 1; j >= 0; j-- ) {\r
+ inst = $.data( cur[ j ], this.widgetFullName );\r
+ if ( inst && inst !== this && !inst.options.disabled ) {\r
+ queries.push( [ typeof inst.options.items === "function" ?\r
+ inst.options.items\r
+ .call( inst.element[ 0 ], event, { item: this.currentItem } ) :\r
+ $( inst.options.items, inst.element ), inst ] );\r
+ this.containers.push( inst );\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ for ( i = queries.length - 1; i >= 0; i-- ) {\r
+ targetData = queries[ i ][ 1 ];\r
+ _queries = queries[ i ][ 0 ];\r
+\r
+ for ( j = 0, queriesLength = _queries.length; j < queriesLength; j++ ) {\r
+ item = $( _queries[ j ] );\r
+\r
+ // Data for target checking (mouse manager)\r
+ item.data( this.widgetName + "-item", targetData );\r
+\r
+ items.push( {\r
+ item: item,\r
+ instance: targetData,\r
+ width: 0, height: 0,\r
+ left: 0, top: 0\r
+ } );\r
+ }\r
+ }\r
+\r
+ },\r
+\r
+ _refreshItemPositions: function( fast ) {\r
+ var i, item, t, p;\r
+\r
+ for ( i = this.items.length - 1; i >= 0; i-- ) {\r
+ item = this.items[ i ];\r
+\r
+ //We ignore calculating positions of all connected containers when we're not over them\r
+ if ( this.currentContainer && item.instance !== this.currentContainer &&\r
+ item.item[ 0 ] !== this.currentItem[ 0 ] ) {\r
+ continue;\r
+ }\r
+\r
+ t = this.options.toleranceElement ?\r
+ $( this.options.toleranceElement, item.item ) :\r
+ item.item;\r
+\r
+ if ( !fast ) {\r
+ item.width = t.outerWidth();\r
+ item.height = t.outerHeight();\r
+ }\r
+\r
+ p = t.offset();\r
+ item.left = p.left;\r
+ item.top = p.top;\r
+ }\r
+ },\r
+\r
+ refreshPositions: function( fast ) {\r
+\r
+ // Determine whether items are being displayed horizontally\r
+ this.floating = this.items.length ?\r
+ this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :\r
+ false;\r
+\r
+ // This has to be redone because due to the item being moved out/into the offsetParent,\r
+ // the offsetParent's position will change\r
+ if ( this.offsetParent && this.helper ) {\r
+ this.offset.parent = this._getParentOffset();\r
+ }\r
+\r
+ this._refreshItemPositions( fast );\r
+\r
+ var i, p;\r
+\r
+ if ( this.options.custom && this.options.custom.refreshContainers ) {\r
+ this.options.custom.refreshContainers.call( this );\r
+ } else {\r
+ for ( i = this.containers.length - 1; i >= 0; i-- ) {\r
+ p = this.containers[ i ].element.offset();\r
+ this.containers[ i ].containerCache.left = p.left;\r
+ this.containers[ i ].containerCache.top = p.top;\r
+ this.containers[ i ].containerCache.width =\r
+ this.containers[ i ].element.outerWidth();\r
+ this.containers[ i ].containerCache.height =\r
+ this.containers[ i ].element.outerHeight();\r
+ }\r
+ }\r
+\r
+ return this;\r
+ },\r
+\r
+ _createPlaceholder: function( that ) {\r
+ that = that || this;\r
+ var className, nodeName,\r
+ o = that.options;\r
+\r
+ if ( !o.placeholder || o.placeholder.constructor === String ) {\r
+ className = o.placeholder;\r
+ nodeName = that.currentItem[ 0 ].nodeName.toLowerCase();\r
+ o.placeholder = {\r
+ element: function() {\r
+\r
+ var element = $( "<" + nodeName + ">", that.document[ 0 ] );\r
+\r
+ that._addClass( element, "ui-sortable-placeholder",\r
+ className || that.currentItem[ 0 ].className )\r
+ ._removeClass( element, "ui-sortable-helper" );\r
+\r
+ if ( nodeName === "tbody" ) {\r
+ that._createTrPlaceholder(\r
+ that.currentItem.find( "tr" ).eq( 0 ),\r
+ $( "<tr>", that.document[ 0 ] ).appendTo( element )\r
+ );\r
+ } else if ( nodeName === "tr" ) {\r
+ that._createTrPlaceholder( that.currentItem, element );\r
+ } else if ( nodeName === "img" ) {\r
+ element.attr( "src", that.currentItem.attr( "src" ) );\r
+ }\r
+\r
+ if ( !className ) {\r
+ element.css( "visibility", "hidden" );\r
+ }\r
+\r
+ return element;\r
+ },\r
+ update: function( container, p ) {\r
+\r
+ // 1. If a className is set as 'placeholder option, we don't force sizes -\r
+ // the class is responsible for that\r
+ // 2. The option 'forcePlaceholderSize can be enabled to force it even if a\r
+ // class name is specified\r
+ if ( className && !o.forcePlaceholderSize ) {\r
+ return;\r
+ }\r
+\r
+ // If the element doesn't have a actual height or width by itself (without\r
+ // styles coming from a stylesheet), it receives the inline height and width\r
+ // from the dragged item. Or, if it's a tbody or tr, it's going to have a height\r
+ // anyway since we're populating them with <td>s above, but they're unlikely to\r
+ // be the correct height on their own if the row heights are dynamic, so we'll\r
+ // always assign the height of the dragged item given forcePlaceholderSize\r
+ // is true.\r
+ if ( !p.height() || ( o.forcePlaceholderSize &&\r
+ ( nodeName === "tbody" || nodeName === "tr" ) ) ) {\r
+ p.height(\r
+ that.currentItem.innerHeight() -\r
+ parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) -\r
+ parseInt( that.currentItem.css( "paddingBottom" ) || 0, 10 ) );\r
+ }\r
+ if ( !p.width() ) {\r
+ p.width(\r
+ that.currentItem.innerWidth() -\r
+ parseInt( that.currentItem.css( "paddingLeft" ) || 0, 10 ) -\r
+ parseInt( that.currentItem.css( "paddingRight" ) || 0, 10 ) );\r
+ }\r
+ }\r
+ };\r
+ }\r
+\r
+ //Create the placeholder\r
+ that.placeholder = $( o.placeholder.element.call( that.element, that.currentItem ) );\r
+\r
+ //Append it after the actual current item\r
+ that.currentItem.after( that.placeholder );\r
+\r
+ //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)\r
+ o.placeholder.update( that, that.placeholder );\r
+\r
+ },\r
+\r
+ _createTrPlaceholder: function( sourceTr, targetTr ) {\r
+ var that = this;\r
+\r
+ sourceTr.children().each( function() {\r
+ $( "<td> </td>", that.document[ 0 ] )\r
+ .attr( "colspan", $( this ).attr( "colspan" ) || 1 )\r
+ .appendTo( targetTr );\r
+ } );\r
+ },\r
+\r
+ _contactContainers: function( event ) {\r
+ var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom,\r
+ floating, axis,\r
+ innermostContainer = null,\r
+ innermostIndex = null;\r
+\r
+ // Get innermost container that intersects with item\r
+ for ( i = this.containers.length - 1; i >= 0; i-- ) {\r
+\r
+ // Never consider a container that's located within the item itself\r
+ if ( $.contains( this.currentItem[ 0 ], this.containers[ i ].element[ 0 ] ) ) {\r
+ continue;\r
+ }\r
+\r
+ if ( this._intersectsWith( this.containers[ i ].containerCache ) ) {\r
+\r
+ // If we've already found a container and it's more "inner" than this, then continue\r
+ if ( innermostContainer &&\r
+ $.contains(\r
+ this.containers[ i ].element[ 0 ],\r
+ innermostContainer.element[ 0 ] ) ) {\r
+ continue;\r
+ }\r
+\r
+ innermostContainer = this.containers[ i ];\r
+ innermostIndex = i;\r
+\r
+ } else {\r
+\r
+ // container doesn't intersect. trigger "out" event if necessary\r
+ if ( this.containers[ i ].containerCache.over ) {\r
+ this.containers[ i ]._trigger( "out", event, this._uiHash( this ) );\r
+ this.containers[ i ].containerCache.over = 0;\r
+ }\r
+ }\r
+\r
+ }\r
+\r
+ // If no intersecting containers found, return\r
+ if ( !innermostContainer ) {\r
+ return;\r
+ }\r
+\r
+ // Move the item into the container if it's not there already\r
+ if ( this.containers.length === 1 ) {\r
+ if ( !this.containers[ innermostIndex ].containerCache.over ) {\r
+ this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );\r
+ this.containers[ innermostIndex ].containerCache.over = 1;\r
+ }\r
+ } else {\r
+\r
+ // When entering a new container, we will find the item with the least distance and\r
+ // append our item near it\r
+ dist = 10000;\r
+ itemWithLeastDistance = null;\r
+ floating = innermostContainer.floating || this._isFloating( this.currentItem );\r
+ posProperty = floating ? "left" : "top";\r
+ sizeProperty = floating ? "width" : "height";\r
+ axis = floating ? "pageX" : "pageY";\r
+\r
+ for ( j = this.items.length - 1; j >= 0; j-- ) {\r
+ if ( !$.contains(\r
+ this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ] )\r
+ ) {\r
+ continue;\r
+ }\r
+ if ( this.items[ j ].item[ 0 ] === this.currentItem[ 0 ] ) {\r
+ continue;\r
+ }\r
+\r
+ cur = this.items[ j ].item.offset()[ posProperty ];\r
+ nearBottom = false;\r
+ if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) {\r
+ nearBottom = true;\r
+ }\r
+\r
+ if ( Math.abs( event[ axis ] - cur ) < dist ) {\r
+ dist = Math.abs( event[ axis ] - cur );\r
+ itemWithLeastDistance = this.items[ j ];\r
+ this.direction = nearBottom ? "up" : "down";\r
+ }\r
+ }\r
+\r
+ //Check if dropOnEmpty is enabled\r
+ if ( !itemWithLeastDistance && !this.options.dropOnEmpty ) {\r
+ return;\r
+ }\r
+\r
+ if ( this.currentContainer === this.containers[ innermostIndex ] ) {\r
+ if ( !this.currentContainer.containerCache.over ) {\r
+ this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() );\r
+ this.currentContainer.containerCache.over = 1;\r
+ }\r
+ return;\r
+ }\r
+\r
+ if ( itemWithLeastDistance ) {\r
+ this._rearrange( event, itemWithLeastDistance, null, true );\r
+ } else {\r
+ this._rearrange( event, null, this.containers[ innermostIndex ].element, true );\r
+ }\r
+ this._trigger( "change", event, this._uiHash() );\r
+ this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) );\r
+ this.currentContainer = this.containers[ innermostIndex ];\r
+\r
+ //Update the placeholder\r
+ this.options.placeholder.update( this.currentContainer, this.placeholder );\r
+\r
+ //Update scrollParent\r
+ this.scrollParent = this.placeholder.scrollParent();\r
+\r
+ //Update overflowOffset\r
+ if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&\r
+ this.scrollParent[ 0 ].tagName !== "HTML" ) {\r
+ this.overflowOffset = this.scrollParent.offset();\r
+ }\r
+\r
+ this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );\r
+ this.containers[ innermostIndex ].containerCache.over = 1;\r
+ }\r
+\r
+ },\r
+\r
+ _createHelper: function( event ) {\r
+\r
+ var o = this.options,\r
+ helper = typeof o.helper === "function" ?\r
+ $( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) :\r
+ ( o.helper === "clone" ? this.currentItem.clone() : this.currentItem );\r
+\r
+ //Add the helper to the DOM if that didn't happen already\r
+ if ( !helper.parents( "body" ).length ) {\r
+ this.appendTo[ 0 ].appendChild( helper[ 0 ] );\r
+ }\r
+\r
+ if ( helper[ 0 ] === this.currentItem[ 0 ] ) {\r
+ this._storedCSS = {\r
+ width: this.currentItem[ 0 ].style.width,\r
+ height: this.currentItem[ 0 ].style.height,\r
+ position: this.currentItem.css( "position" ),\r
+ top: this.currentItem.css( "top" ),\r
+ left: this.currentItem.css( "left" )\r
+ };\r
+ }\r
+\r
+ if ( !helper[ 0 ].style.width || o.forceHelperSize ) {\r
+ helper.width( this.currentItem.width() );\r
+ }\r
+ if ( !helper[ 0 ].style.height || o.forceHelperSize ) {\r
+ helper.height( this.currentItem.height() );\r
+ }\r
+\r
+ return helper;\r
+\r
+ },\r
+\r
+ _adjustOffsetFromHelper: function( obj ) {\r
+ if ( typeof obj === "string" ) {\r
+ obj = obj.split( " " );\r
+ }\r
+ if ( Array.isArray( obj ) ) {\r
+ obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };\r
+ }\r
+ if ( "left" in obj ) {\r
+ this.offset.click.left = obj.left + this.margins.left;\r
+ }\r
+ if ( "right" in obj ) {\r
+ this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;\r
+ }\r
+ if ( "top" in obj ) {\r
+ this.offset.click.top = obj.top + this.margins.top;\r
+ }\r
+ if ( "bottom" in obj ) {\r
+ this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;\r
+ }\r
+ },\r
+\r
+ _getParentOffset: function() {\r
+\r
+ //Get the offsetParent and cache its position\r
+ this.offsetParent = this.helper.offsetParent();\r
+ var po = this.offsetParent.offset();\r
+\r
+ // This is a special case where we need to modify a offset calculated on start, since the\r
+ // following happened:\r
+ // 1. The position of the helper is absolute, so it's position is calculated based on the\r
+ // next positioned parent\r
+ // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't\r
+ // the document, which means that the scroll is included in the initial calculation of the\r
+ // offset of the parent, and never recalculated upon drag\r
+ if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== this.document[ 0 ] &&\r
+ $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) {\r
+ po.left += this.scrollParent.scrollLeft();\r
+ po.top += this.scrollParent.scrollTop();\r
+ }\r
+\r
+ // This needs to be actually done for all browsers, since pageX/pageY includes this\r
+ // information with an ugly IE fix\r
+ if ( this.offsetParent[ 0 ] === this.document[ 0 ].body ||\r
+ ( this.offsetParent[ 0 ].tagName &&\r
+ this.offsetParent[ 0 ].tagName.toLowerCase() === "html" && $.ui.ie ) ) {\r
+ po = { top: 0, left: 0 };\r
+ }\r
+\r
+ return {\r
+ top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ),\r
+ left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 )\r
+ };\r
+\r
+ },\r
+\r
+ _getRelativeOffset: function() {\r
+\r
+ if ( this.cssPosition === "relative" ) {\r
+ var p = this.currentItem.position();\r
+ return {\r
+ top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) +\r
+ this.scrollParent.scrollTop(),\r
+ left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) +\r
+ this.scrollParent.scrollLeft()\r
+ };\r
+ } else {\r
+ return { top: 0, left: 0 };\r
+ }\r
+\r
+ },\r
+\r
+ _cacheMargins: function() {\r
+ this.margins = {\r
+ left: ( parseInt( this.currentItem.css( "marginLeft" ), 10 ) || 0 ),\r
+ top: ( parseInt( this.currentItem.css( "marginTop" ), 10 ) || 0 )\r
+ };\r
+ },\r
+\r
+ _cacheHelperProportions: function() {\r
+ this.helperProportions = {\r
+ width: this.helper.outerWidth(),\r
+ height: this.helper.outerHeight()\r
+ };\r
+ },\r
+\r
+ _setContainment: function() {\r
+\r
+ var ce, co, over,\r
+ o = this.options;\r
+ if ( o.containment === "parent" ) {\r
+ o.containment = this.helper[ 0 ].parentNode;\r
+ }\r
+ if ( o.containment === "document" || o.containment === "window" ) {\r
+ this.containment = [\r
+ 0 - this.offset.relative.left - this.offset.parent.left,\r
+ 0 - this.offset.relative.top - this.offset.parent.top,\r
+ o.containment === "document" ?\r
+ this.document.width() :\r
+ this.window.width() - this.helperProportions.width - this.margins.left,\r
+ ( o.containment === "document" ?\r
+ ( this.document.height() || document.body.parentNode.scrollHeight ) :\r
+ this.window.height() || this.document[ 0 ].body.parentNode.scrollHeight\r
+ ) - this.helperProportions.height - this.margins.top\r
+ ];\r
+ }\r
+\r
+ if ( !( /^(document|window|parent)$/ ).test( o.containment ) ) {\r
+ ce = $( o.containment )[ 0 ];\r
+ co = $( o.containment ).offset();\r
+ over = ( $( ce ).css( "overflow" ) !== "hidden" );\r
+\r
+ this.containment = [\r
+ co.left + ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) +\r
+ ( parseInt( $( ce ).css( "paddingLeft" ), 10 ) || 0 ) - this.margins.left,\r
+ co.top + ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) +\r
+ ( parseInt( $( ce ).css( "paddingTop" ), 10 ) || 0 ) - this.margins.top,\r
+ co.left + ( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -\r
+ ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) -\r
+ ( parseInt( $( ce ).css( "paddingRight" ), 10 ) || 0 ) -\r
+ this.helperProportions.width - this.margins.left,\r
+ co.top + ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -\r
+ ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) -\r
+ ( parseInt( $( ce ).css( "paddingBottom" ), 10 ) || 0 ) -\r
+ this.helperProportions.height - this.margins.top\r
+ ];\r
+ }\r
+\r
+ },\r
+\r
+ _convertPositionTo: function( d, pos ) {\r
+\r
+ if ( !pos ) {\r
+ pos = this.position;\r
+ }\r
+ var mod = d === "absolute" ? 1 : -1,\r
+ scroll = this.cssPosition === "absolute" &&\r
+ !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&\r
+ $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ?\r
+ this.offsetParent :\r
+ this.scrollParent,\r
+ scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );\r
+\r
+ return {\r
+ top: (\r
+\r
+ // The absolute mouse position\r
+ pos.top +\r
+\r
+ // Only for relative positioned nodes: Relative offset from element to offset parent\r
+ this.offset.relative.top * mod +\r
+\r
+ // The offsetParent's offset without borders (offset + border)\r
+ this.offset.parent.top * mod -\r
+ ( ( this.cssPosition === "fixed" ?\r
+ -this.scrollParent.scrollTop() :\r
+ ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod )\r
+ ),\r
+ left: (\r
+\r
+ // The absolute mouse position\r
+ pos.left +\r
+\r
+ // Only for relative positioned nodes: Relative offset from element to offset parent\r
+ this.offset.relative.left * mod +\r
+\r
+ // The offsetParent's offset without borders (offset + border)\r
+ this.offset.parent.left * mod -\r
+ ( ( this.cssPosition === "fixed" ?\r
+ -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :\r
+ scroll.scrollLeft() ) * mod )\r
+ )\r
+ };\r
+\r
+ },\r
+\r
+ _generatePosition: function( event ) {\r
+\r
+ var top, left,\r
+ o = this.options,\r
+ pageX = event.pageX,\r
+ pageY = event.pageY,\r
+ scroll = this.cssPosition === "absolute" &&\r
+ !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&\r
+ $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ?\r
+ this.offsetParent :\r
+ this.scrollParent,\r
+ scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );\r
+\r
+ // This is another very weird special case that only happens for relative elements:\r
+ // 1. If the css position is relative\r
+ // 2. and the scroll parent is the document or similar to the offset parent\r
+ // we have to refresh the relative offset during the scroll so there are no jumps\r
+ if ( this.cssPosition === "relative" && !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&\r
+ this.scrollParent[ 0 ] !== this.offsetParent[ 0 ] ) ) {\r
+ this.offset.relative = this._getRelativeOffset();\r
+ }\r
+\r
+ /*\r
+ * - Position constraining -\r
+ * Constrain the position to a mix of grid, containment.\r
+ */\r
+\r
+ if ( this.originalPosition ) { //If we are not dragging yet, we won't check for options\r
+\r
+ if ( this.containment ) {\r
+ if ( event.pageX - this.offset.click.left < this.containment[ 0 ] ) {\r
+ pageX = this.containment[ 0 ] + this.offset.click.left;\r
+ }\r
+ if ( event.pageY - this.offset.click.top < this.containment[ 1 ] ) {\r
+ pageY = this.containment[ 1 ] + this.offset.click.top;\r
+ }\r
+ if ( event.pageX - this.offset.click.left > this.containment[ 2 ] ) {\r
+ pageX = this.containment[ 2 ] + this.offset.click.left;\r
+ }\r
+ if ( event.pageY - this.offset.click.top > this.containment[ 3 ] ) {\r
+ pageY = this.containment[ 3 ] + this.offset.click.top;\r
+ }\r
+ }\r
+\r
+ if ( o.grid ) {\r
+ top = this.originalPageY + Math.round( ( pageY - this.originalPageY ) /\r
+ o.grid[ 1 ] ) * o.grid[ 1 ];\r
+ pageY = this.containment ?\r
+ ( ( top - this.offset.click.top >= this.containment[ 1 ] &&\r
+ top - this.offset.click.top <= this.containment[ 3 ] ) ?\r
+ top :\r
+ ( ( top - this.offset.click.top >= this.containment[ 1 ] ) ?\r
+ top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) :\r
+ top;\r
+\r
+ left = this.originalPageX + Math.round( ( pageX - this.originalPageX ) /\r
+ o.grid[ 0 ] ) * o.grid[ 0 ];\r
+ pageX = this.containment ?\r
+ ( ( left - this.offset.click.left >= this.containment[ 0 ] &&\r
+ left - this.offset.click.left <= this.containment[ 2 ] ) ?\r
+ left :\r
+ ( ( left - this.offset.click.left >= this.containment[ 0 ] ) ?\r
+ left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) :\r
+ left;\r
+ }\r
+\r
+ }\r
+\r
+ return {\r
+ top: (\r
+\r
+ // The absolute mouse position\r
+ pageY -\r
+\r
+ // Click offset (relative to the element)\r
+ this.offset.click.top -\r
+\r
+ // Only for relative positioned nodes: Relative offset from element to offset parent\r
+ this.offset.relative.top -\r
+\r
+ // The offsetParent's offset without borders (offset + border)\r
+ this.offset.parent.top +\r
+ ( ( this.cssPosition === "fixed" ?\r
+ -this.scrollParent.scrollTop() :\r
+ ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) )\r
+ ),\r
+ left: (\r
+\r
+ // The absolute mouse position\r
+ pageX -\r
+\r
+ // Click offset (relative to the element)\r
+ this.offset.click.left -\r
+\r
+ // Only for relative positioned nodes: Relative offset from element to offset parent\r
+ this.offset.relative.left -\r
+\r
+ // The offsetParent's offset without borders (offset + border)\r
+ this.offset.parent.left +\r
+ ( ( this.cssPosition === "fixed" ?\r
+ -this.scrollParent.scrollLeft() :\r
+ scrollIsRootNode ? 0 : scroll.scrollLeft() ) )\r
+ )\r
+ };\r
+\r
+ },\r
+\r
+ _rearrange: function( event, i, a, hardRefresh ) {\r
+\r
+ if ( a ) {\r
+ a[ 0 ].appendChild( this.placeholder[ 0 ] );\r
+ } else {\r
+ i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ],\r
+ ( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) );\r
+ }\r
+\r
+ //Various things done here to improve the performance:\r
+ // 1. we create a setTimeout, that calls refreshPositions\r
+ // 2. on the instance, we have a counter variable, that get's higher after every append\r
+ // 3. on the local scope, we copy the counter variable, and check in the timeout,\r
+ // if it's still the same\r
+ // 4. this lets only the last addition to the timeout stack through\r
+ this.counter = this.counter ? ++this.counter : 1;\r
+ var counter = this.counter;\r
+\r
+ this._delay( function() {\r
+ if ( counter === this.counter ) {\r
+\r
+ //Precompute after each DOM insertion, NOT on mousemove\r
+ this.refreshPositions( !hardRefresh );\r
+ }\r
+ } );\r
+\r
+ },\r
+\r
+ _clear: function( event, noPropagation ) {\r
+\r
+ this.reverting = false;\r
+\r
+ // We delay all events that have to be triggered to after the point where the placeholder\r
+ // has been removed and everything else normalized again\r
+ var i,\r
+ delayedTriggers = [];\r
+\r
+ // We first have to update the dom position of the actual currentItem\r
+ // Note: don't do it if the current item is already removed (by a user), or it gets\r
+ // reappended (see #4088)\r
+ if ( !this._noFinalSort && this.currentItem.parent().length ) {\r
+ this.placeholder.before( this.currentItem );\r
+ }\r
+ this._noFinalSort = null;\r
+\r
+ if ( this.helper[ 0 ] === this.currentItem[ 0 ] ) {\r
+ for ( i in this._storedCSS ) {\r
+ if ( this._storedCSS[ i ] === "auto" || this._storedCSS[ i ] === "static" ) {\r
+ this._storedCSS[ i ] = "";\r
+ }\r
+ }\r
+ this.currentItem.css( this._storedCSS );\r
+ this._removeClass( this.currentItem, "ui-sortable-helper" );\r
+ } else {\r
+ this.currentItem.show();\r
+ }\r
+\r
+ if ( this.fromOutside && !noPropagation ) {\r
+ delayedTriggers.push( function( event ) {\r
+ this._trigger( "receive", event, this._uiHash( this.fromOutside ) );\r
+ } );\r
+ }\r
+ if ( ( this.fromOutside ||\r
+ this.domPosition.prev !==\r
+ this.currentItem.prev().not( ".ui-sortable-helper" )[ 0 ] ||\r
+ this.domPosition.parent !== this.currentItem.parent()[ 0 ] ) && !noPropagation ) {\r
+\r
+ // Trigger update callback if the DOM position has changed\r
+ delayedTriggers.push( function( event ) {\r
+ this._trigger( "update", event, this._uiHash() );\r
+ } );\r
+ }\r
+\r
+ // Check if the items Container has Changed and trigger appropriate\r
+ // events.\r
+ if ( this !== this.currentContainer ) {\r
+ if ( !noPropagation ) {\r
+ delayedTriggers.push( function( event ) {\r
+ this._trigger( "remove", event, this._uiHash() );\r
+ } );\r
+ delayedTriggers.push( ( function( c ) {\r
+ return function( event ) {\r
+ c._trigger( "receive", event, this._uiHash( this ) );\r
+ };\r
+ } ).call( this, this.currentContainer ) );\r
+ delayedTriggers.push( ( function( c ) {\r
+ return function( event ) {\r
+ c._trigger( "update", event, this._uiHash( this ) );\r
+ };\r
+ } ).call( this, this.currentContainer ) );\r
+ }\r
+ }\r
+\r
+ //Post events to containers\r
+ function delayEvent( type, instance, container ) {\r
+ return function( event ) {\r
+ container._trigger( type, event, instance._uiHash( instance ) );\r
+ };\r
+ }\r
+ for ( i = this.containers.length - 1; i >= 0; i-- ) {\r
+ if ( !noPropagation ) {\r
+ delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );\r
+ }\r
+ if ( this.containers[ i ].containerCache.over ) {\r
+ delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );\r
+ this.containers[ i ].containerCache.over = 0;\r
+ }\r
+ }\r
+\r
+ //Do what was originally in plugins\r
+ if ( this.storedCursor ) {\r
+ this.document.find( "body" ).css( "cursor", this.storedCursor );\r
+ this.storedStylesheet.remove();\r
+ }\r
+ if ( this._storedOpacity ) {\r
+ this.helper.css( "opacity", this._storedOpacity );\r
+ }\r
+ if ( this._storedZIndex ) {\r
+ this.helper.css( "zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex );\r
+ }\r
+\r
+ this.dragging = false;\r
+\r
+ if ( !noPropagation ) {\r
+ this._trigger( "beforeStop", event, this._uiHash() );\r
+ }\r
+\r
+ //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,\r
+ // it unbinds ALL events from the original node!\r
+ this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] );\r
+\r
+ if ( !this.cancelHelperRemoval ) {\r
+ if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {\r
+ this.helper.remove();\r
+ }\r
+ this.helper = null;\r
+ }\r
+\r
+ if ( !noPropagation ) {\r
+ for ( i = 0; i < delayedTriggers.length; i++ ) {\r
+\r
+ // Trigger all delayed events\r
+ delayedTriggers[ i ].call( this, event );\r
+ }\r
+ this._trigger( "stop", event, this._uiHash() );\r
+ }\r
+\r
+ this.fromOutside = false;\r
+ return !this.cancelHelperRemoval;\r
+\r
+ },\r
+\r
+ _trigger: function() {\r
+ if ( $.Widget.prototype._trigger.apply( this, arguments ) === false ) {\r
+ this.cancel();\r
+ }\r
+ },\r
+\r
+ _uiHash: function( _inst ) {\r
+ var inst = _inst || this;\r
+ return {\r
+ helper: inst.helper,\r
+ placeholder: inst.placeholder || $( [] ),\r
+ position: inst.position,\r
+ originalPosition: inst.originalPosition,\r
+ offset: inst.positionAbs,\r
+ item: inst.currentItem,\r
+ sender: _inst ? _inst.element : null\r
+ };\r
+ }\r
+\r
+} );\r
+\r
+\r
+/*!\r
+ * jQuery UI Accordion 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Accordion\r
+//>>group: Widgets\r
+/* eslint-disable max-len */\r
+//>>description: Displays collapsible content panels for presenting information in a limited amount of space.\r
+/* eslint-enable max-len */\r
+//>>docs: http://api.jqueryui.com/accordion/\r
+//>>demos: http://jqueryui.com/accordion/\r
+//>>css.structure: ../../themes/base/core.css\r
+//>>css.structure: ../../themes/base/accordion.css\r
+//>>css.theme: ../../themes/base/theme.css\r
+\r
+\r
+var widgetsAccordion = $.widget( "ui.accordion", {\r
+ version: "1.13.1",\r
+ options: {\r
+ active: 0,\r
+ animate: {},\r
+ classes: {\r
+ "ui-accordion-header": "ui-corner-top",\r
+ "ui-accordion-header-collapsed": "ui-corner-all",\r
+ "ui-accordion-content": "ui-corner-bottom"\r
+ },\r
+ collapsible: false,\r
+ event: "click",\r
+ header: function( elem ) {\r
+ return elem.find( "> li > :first-child" ).add( elem.find( "> :not(li)" ).even() );\r
+ },\r
+ heightStyle: "auto",\r
+ icons: {\r
+ activeHeader: "ui-icon-triangle-1-s",\r
+ header: "ui-icon-triangle-1-e"\r
+ },\r
+\r
+ // Callbacks\r
+ activate: null,\r
+ beforeActivate: null\r
+ },\r
+\r
+ hideProps: {\r
+ borderTopWidth: "hide",\r
+ borderBottomWidth: "hide",\r
+ paddingTop: "hide",\r
+ paddingBottom: "hide",\r
+ height: "hide"\r
+ },\r
+\r
+ showProps: {\r
+ borderTopWidth: "show",\r
+ borderBottomWidth: "show",\r
+ paddingTop: "show",\r
+ paddingBottom: "show",\r
+ height: "show"\r
+ },\r
+\r
+ _create: function() {\r
+ var options = this.options;\r
+\r
+ this.prevShow = this.prevHide = $();\r
+ this._addClass( "ui-accordion", "ui-widget ui-helper-reset" );\r
+ this.element.attr( "role", "tablist" );\r
+\r
+ // Don't allow collapsible: false and active: false / null\r
+ if ( !options.collapsible && ( options.active === false || options.active == null ) ) {\r
+ options.active = 0;\r
+ }\r
+\r
+ this._processPanels();\r
+\r
+ // handle negative values\r
+ if ( options.active < 0 ) {\r
+ options.active += this.headers.length;\r
+ }\r
+ this._refresh();\r
+ },\r
+\r
+ _getCreateEventData: function() {\r
+ return {\r
+ header: this.active,\r
+ panel: !this.active.length ? $() : this.active.next()\r
+ };\r
+ },\r
+\r
+ _createIcons: function() {\r
+ var icon, children,\r
+ icons = this.options.icons;\r
+\r
+ if ( icons ) {\r
+ icon = $( "<span>" );\r
+ this._addClass( icon, "ui-accordion-header-icon", "ui-icon " + icons.header );\r
+ icon.prependTo( this.headers );\r
+ children = this.active.children( ".ui-accordion-header-icon" );\r
+ this._removeClass( children, icons.header )\r
+ ._addClass( children, null, icons.activeHeader )\r
+ ._addClass( this.headers, "ui-accordion-icons" );\r
+ }\r
+ },\r
+\r
+ _destroyIcons: function() {\r
+ this._removeClass( this.headers, "ui-accordion-icons" );\r
+ this.headers.children( ".ui-accordion-header-icon" ).remove();\r
+ },\r
+\r
+ _destroy: function() {\r
+ var contents;\r
+\r
+ // Clean up main element\r
+ this.element.removeAttr( "role" );\r
+\r
+ // Clean up headers\r
+ this.headers\r
+ .removeAttr( "role aria-expanded aria-selected aria-controls tabIndex" )\r
+ .removeUniqueId();\r
+\r
+ this._destroyIcons();\r
+\r
+ // Clean up content panels\r
+ contents = this.headers.next()\r
+ .css( "display", "" )\r
+ .removeAttr( "role aria-hidden aria-labelledby" )\r
+ .removeUniqueId();\r
+\r
+ if ( this.options.heightStyle !== "content" ) {\r
+ contents.css( "height", "" );\r
+ }\r
+ },\r
+\r
+ _setOption: function( key, value ) {\r
+ if ( key === "active" ) {\r
+\r
+ // _activate() will handle invalid values and update this.options\r
+ this._activate( value );\r
+ return;\r
+ }\r
+\r
+ if ( key === "event" ) {\r
+ if ( this.options.event ) {\r
+ this._off( this.headers, this.options.event );\r
+ }\r
+ this._setupEvents( value );\r
+ }\r
+\r
+ this._super( key, value );\r
+\r
+ // Setting collapsible: false while collapsed; open first panel\r
+ if ( key === "collapsible" && !value && this.options.active === false ) {\r
+ this._activate( 0 );\r
+ }\r
+\r
+ if ( key === "icons" ) {\r
+ this._destroyIcons();\r
+ if ( value ) {\r
+ this._createIcons();\r
+ }\r
+ }\r
+ },\r
+\r
+ _setOptionDisabled: function( value ) {\r
+ this._super( value );\r
+\r
+ this.element.attr( "aria-disabled", value );\r
+\r
+ // Support: IE8 Only\r
+ // #5332 / #6059 - opacity doesn't cascade to positioned elements in IE\r
+ // so we need to add the disabled class to the headers and panels\r
+ this._toggleClass( null, "ui-state-disabled", !!value );\r
+ this._toggleClass( this.headers.add( this.headers.next() ), null, "ui-state-disabled",\r
+ !!value );\r
+ },\r
+\r
+ _keydown: function( event ) {\r
+ if ( event.altKey || event.ctrlKey ) {\r
+ return;\r
+ }\r
+\r
+ var keyCode = $.ui.keyCode,\r
+ length = this.headers.length,\r
+ currentIndex = this.headers.index( event.target ),\r
+ toFocus = false;\r
+\r
+ switch ( event.keyCode ) {\r
+ case keyCode.RIGHT:\r
+ case keyCode.DOWN:\r
+ toFocus = this.headers[ ( currentIndex + 1 ) % length ];\r
+ break;\r
+ case keyCode.LEFT:\r
+ case keyCode.UP:\r
+ toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];\r
+ break;\r
+ case keyCode.SPACE:\r
+ case keyCode.ENTER:\r
+ this._eventHandler( event );\r
+ break;\r
+ case keyCode.HOME:\r
+ toFocus = this.headers[ 0 ];\r
+ break;\r
+ case keyCode.END:\r
+ toFocus = this.headers[ length - 1 ];\r
+ break;\r
+ }\r
+\r
+ if ( toFocus ) {\r
+ $( event.target ).attr( "tabIndex", -1 );\r
+ $( toFocus ).attr( "tabIndex", 0 );\r
+ $( toFocus ).trigger( "focus" );\r
+ event.preventDefault();\r
+ }\r
+ },\r
+\r
+ _panelKeyDown: function( event ) {\r
+ if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {\r
+ $( event.currentTarget ).prev().trigger( "focus" );\r
+ }\r
+ },\r
+\r
+ refresh: function() {\r
+ var options = this.options;\r
+ this._processPanels();\r
+\r
+ // Was collapsed or no panel\r
+ if ( ( options.active === false && options.collapsible === true ) ||\r
+ !this.headers.length ) {\r
+ options.active = false;\r
+ this.active = $();\r
+\r
+ // active false only when collapsible is true\r
+ } else if ( options.active === false ) {\r
+ this._activate( 0 );\r
+\r
+ // was active, but active panel is gone\r
+ } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {\r
+\r
+ // all remaining panel are disabled\r
+ if ( this.headers.length === this.headers.find( ".ui-state-disabled" ).length ) {\r
+ options.active = false;\r
+ this.active = $();\r
+\r
+ // activate previous panel\r
+ } else {\r
+ this._activate( Math.max( 0, options.active - 1 ) );\r
+ }\r
+\r
+ // was active, active panel still exists\r
+ } else {\r
+\r
+ // make sure active index is correct\r
+ options.active = this.headers.index( this.active );\r
+ }\r
+\r
+ this._destroyIcons();\r
+\r
+ this._refresh();\r
+ },\r
+\r
+ _processPanels: function() {\r
+ var prevHeaders = this.headers,\r
+ prevPanels = this.panels;\r
+\r
+ if ( typeof this.options.header === "function" ) {\r
+ this.headers = this.options.header( this.element );\r
+ } else {\r
+ this.headers = this.element.find( this.options.header );\r
+ }\r
+ this._addClass( this.headers, "ui-accordion-header ui-accordion-header-collapsed",\r
+ "ui-state-default" );\r
+\r
+ this.panels = this.headers.next().filter( ":not(.ui-accordion-content-active)" ).hide();\r
+ this._addClass( this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content" );\r
+\r
+ // Avoid memory leaks (#10056)\r
+ if ( prevPanels ) {\r
+ this._off( prevHeaders.not( this.headers ) );\r
+ this._off( prevPanels.not( this.panels ) );\r
+ }\r
+ },\r
+\r
+ _refresh: function() {\r
+ var maxHeight,\r
+ options = this.options,\r
+ heightStyle = options.heightStyle,\r
+ parent = this.element.parent();\r
+\r
+ this.active = this._findActive( options.active );\r
+ this._addClass( this.active, "ui-accordion-header-active", "ui-state-active" )\r
+ ._removeClass( this.active, "ui-accordion-header-collapsed" );\r
+ this._addClass( this.active.next(), "ui-accordion-content-active" );\r
+ this.active.next().show();\r
+\r
+ this.headers\r
+ .attr( "role", "tab" )\r
+ .each( function() {\r
+ var header = $( this ),\r
+ headerId = header.uniqueId().attr( "id" ),\r
+ panel = header.next(),\r
+ panelId = panel.uniqueId().attr( "id" );\r
+ header.attr( "aria-controls", panelId );\r
+ panel.attr( "aria-labelledby", headerId );\r
+ } )\r
+ .next()\r
+ .attr( "role", "tabpanel" );\r
+\r
+ this.headers\r
+ .not( this.active )\r
+ .attr( {\r
+ "aria-selected": "false",\r
+ "aria-expanded": "false",\r
+ tabIndex: -1\r
+ } )\r
+ .next()\r
+ .attr( {\r
+ "aria-hidden": "true"\r
+ } )\r
+ .hide();\r
+\r
+ // Make sure at least one header is in the tab order\r
+ if ( !this.active.length ) {\r
+ this.headers.eq( 0 ).attr( "tabIndex", 0 );\r
+ } else {\r
+ this.active.attr( {\r
+ "aria-selected": "true",\r
+ "aria-expanded": "true",\r
+ tabIndex: 0\r
+ } )\r
+ .next()\r
+ .attr( {\r
+ "aria-hidden": "false"\r
+ } );\r
+ }\r
+\r
+ this._createIcons();\r
+\r
+ this._setupEvents( options.event );\r
+\r
+ if ( heightStyle === "fill" ) {\r
+ maxHeight = parent.height();\r
+ this.element.siblings( ":visible" ).each( function() {\r
+ var elem = $( this ),\r
+ position = elem.css( "position" );\r
+\r
+ if ( position === "absolute" || position === "fixed" ) {\r
+ return;\r
+ }\r
+ maxHeight -= elem.outerHeight( true );\r
+ } );\r
+\r
+ this.headers.each( function() {\r
+ maxHeight -= $( this ).outerHeight( true );\r
+ } );\r
+\r
+ this.headers.next()\r
+ .each( function() {\r
+ $( this ).height( Math.max( 0, maxHeight -\r
+ $( this ).innerHeight() + $( this ).height() ) );\r
+ } )\r
+ .css( "overflow", "auto" );\r
+ } else if ( heightStyle === "auto" ) {\r
+ maxHeight = 0;\r
+ this.headers.next()\r
+ .each( function() {\r
+ var isVisible = $( this ).is( ":visible" );\r
+ if ( !isVisible ) {\r
+ $( this ).show();\r
+ }\r
+ maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );\r
+ if ( !isVisible ) {\r
+ $( this ).hide();\r
+ }\r
+ } )\r
+ .height( maxHeight );\r
+ }\r
+ },\r
+\r
+ _activate: function( index ) {\r
+ var active = this._findActive( index )[ 0 ];\r
+\r
+ // Trying to activate the already active panel\r
+ if ( active === this.active[ 0 ] ) {\r
+ return;\r
+ }\r
+\r
+ // Trying to collapse, simulate a click on the currently active header\r
+ active = active || this.active[ 0 ];\r
+\r
+ this._eventHandler( {\r
+ target: active,\r
+ currentTarget: active,\r
+ preventDefault: $.noop\r
+ } );\r
+ },\r
+\r
+ _findActive: function( selector ) {\r
+ return typeof selector === "number" ? this.headers.eq( selector ) : $();\r
+ },\r
+\r
+ _setupEvents: function( event ) {\r
+ var events = {\r
+ keydown: "_keydown"\r
+ };\r
+ if ( event ) {\r
+ $.each( event.split( " " ), function( index, eventName ) {\r
+ events[ eventName ] = "_eventHandler";\r
+ } );\r
+ }\r
+\r
+ this._off( this.headers.add( this.headers.next() ) );\r
+ this._on( this.headers, events );\r
+ this._on( this.headers.next(), { keydown: "_panelKeyDown" } );\r
+ this._hoverable( this.headers );\r
+ this._focusable( this.headers );\r
+ },\r
+\r
+ _eventHandler: function( event ) {\r
+ var activeChildren, clickedChildren,\r
+ options = this.options,\r
+ active = this.active,\r
+ clicked = $( event.currentTarget ),\r
+ clickedIsActive = clicked[ 0 ] === active[ 0 ],\r
+ collapsing = clickedIsActive && options.collapsible,\r
+ toShow = collapsing ? $() : clicked.next(),\r
+ toHide = active.next(),\r
+ eventData = {\r
+ oldHeader: active,\r
+ oldPanel: toHide,\r
+ newHeader: collapsing ? $() : clicked,\r
+ newPanel: toShow\r
+ };\r
+\r
+ event.preventDefault();\r
+\r
+ if (\r
+\r
+ // click on active header, but not collapsible\r
+ ( clickedIsActive && !options.collapsible ) ||\r
+\r
+ // allow canceling activation\r
+ ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {\r
+ return;\r
+ }\r
+\r
+ options.active = collapsing ? false : this.headers.index( clicked );\r
+\r
+ // When the call to ._toggle() comes after the class changes\r
+ // it causes a very odd bug in IE 8 (see #6720)\r
+ this.active = clickedIsActive ? $() : clicked;\r
+ this._toggle( eventData );\r
+\r
+ // Switch classes\r
+ // corner classes on the previously active header stay after the animation\r
+ this._removeClass( active, "ui-accordion-header-active", "ui-state-active" );\r
+ if ( options.icons ) {\r
+ activeChildren = active.children( ".ui-accordion-header-icon" );\r
+ this._removeClass( activeChildren, null, options.icons.activeHeader )\r
+ ._addClass( activeChildren, null, options.icons.header );\r
+ }\r
+\r
+ if ( !clickedIsActive ) {\r
+ this._removeClass( clicked, "ui-accordion-header-collapsed" )\r
+ ._addClass( clicked, "ui-accordion-header-active", "ui-state-active" );\r
+ if ( options.icons ) {\r
+ clickedChildren = clicked.children( ".ui-accordion-header-icon" );\r
+ this._removeClass( clickedChildren, null, options.icons.header )\r
+ ._addClass( clickedChildren, null, options.icons.activeHeader );\r
+ }\r
+\r
+ this._addClass( clicked.next(), "ui-accordion-content-active" );\r
+ }\r
+ },\r
+\r
+ _toggle: function( data ) {\r
+ var toShow = data.newPanel,\r
+ toHide = this.prevShow.length ? this.prevShow : data.oldPanel;\r
+\r
+ // Handle activating a panel during the animation for another activation\r
+ this.prevShow.add( this.prevHide ).stop( true, true );\r
+ this.prevShow = toShow;\r
+ this.prevHide = toHide;\r
+\r
+ if ( this.options.animate ) {\r
+ this._animate( toShow, toHide, data );\r
+ } else {\r
+ toHide.hide();\r
+ toShow.show();\r
+ this._toggleComplete( data );\r
+ }\r
+\r
+ toHide.attr( {\r
+ "aria-hidden": "true"\r
+ } );\r
+ toHide.prev().attr( {\r
+ "aria-selected": "false",\r
+ "aria-expanded": "false"\r
+ } );\r
+\r
+ // if we're switching panels, remove the old header from the tab order\r
+ // if we're opening from collapsed state, remove the previous header from the tab order\r
+ // if we're collapsing, then keep the collapsing header in the tab order\r
+ if ( toShow.length && toHide.length ) {\r
+ toHide.prev().attr( {\r
+ "tabIndex": -1,\r
+ "aria-expanded": "false"\r
+ } );\r
+ } else if ( toShow.length ) {\r
+ this.headers.filter( function() {\r
+ return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0;\r
+ } )\r
+ .attr( "tabIndex", -1 );\r
+ }\r
+\r
+ toShow\r
+ .attr( "aria-hidden", "false" )\r
+ .prev()\r
+ .attr( {\r
+ "aria-selected": "true",\r
+ "aria-expanded": "true",\r
+ tabIndex: 0\r
+ } );\r
+ },\r
+\r
+ _animate: function( toShow, toHide, data ) {\r
+ var total, easing, duration,\r
+ that = this,\r
+ adjust = 0,\r
+ boxSizing = toShow.css( "box-sizing" ),\r
+ down = toShow.length &&\r
+ ( !toHide.length || ( toShow.index() < toHide.index() ) ),\r
+ animate = this.options.animate || {},\r
+ options = down && animate.down || animate,\r
+ complete = function() {\r
+ that._toggleComplete( data );\r
+ };\r
+\r
+ if ( typeof options === "number" ) {\r
+ duration = options;\r
+ }\r
+ if ( typeof options === "string" ) {\r
+ easing = options;\r
+ }\r
+\r
+ // fall back from options to animation in case of partial down settings\r
+ easing = easing || options.easing || animate.easing;\r
+ duration = duration || options.duration || animate.duration;\r
+\r
+ if ( !toHide.length ) {\r
+ return toShow.animate( this.showProps, duration, easing, complete );\r
+ }\r
+ if ( !toShow.length ) {\r
+ return toHide.animate( this.hideProps, duration, easing, complete );\r
+ }\r
+\r
+ total = toShow.show().outerHeight();\r
+ toHide.animate( this.hideProps, {\r
+ duration: duration,\r
+ easing: easing,\r
+ step: function( now, fx ) {\r
+ fx.now = Math.round( now );\r
+ }\r
+ } );\r
+ toShow\r
+ .hide()\r
+ .animate( this.showProps, {\r
+ duration: duration,\r
+ easing: easing,\r
+ complete: complete,\r
+ step: function( now, fx ) {\r
+ fx.now = Math.round( now );\r
+ if ( fx.prop !== "height" ) {\r
+ if ( boxSizing === "content-box" ) {\r
+ adjust += fx.now;\r
+ }\r
+ } else if ( that.options.heightStyle !== "content" ) {\r
+ fx.now = Math.round( total - toHide.outerHeight() - adjust );\r
+ adjust = 0;\r
+ }\r
+ }\r
+ } );\r
+ },\r
+\r
+ _toggleComplete: function( data ) {\r
+ var toHide = data.oldPanel,\r
+ prev = toHide.prev();\r
+\r
+ this._removeClass( toHide, "ui-accordion-content-active" );\r
+ this._removeClass( prev, "ui-accordion-header-active" )\r
+ ._addClass( prev, "ui-accordion-header-collapsed" );\r
+\r
+ // Work around for rendering bug in IE (#5421)\r
+ if ( toHide.length ) {\r
+ toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className;\r
+ }\r
+ this._trigger( "activate", null, data );\r
+ }\r
+} );\r
+\r
+\r
+/*!\r
+ * jQuery UI Menu 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Menu\r
+//>>group: Widgets\r
+//>>description: Creates nestable menus.\r
+//>>docs: http://api.jqueryui.com/menu/\r
+//>>demos: http://jqueryui.com/menu/\r
+//>>css.structure: ../../themes/base/core.css\r
+//>>css.structure: ../../themes/base/menu.css\r
+//>>css.theme: ../../themes/base/theme.css\r
+\r
+\r
+var widgetsMenu = $.widget( "ui.menu", {\r
+ version: "1.13.1",\r
+ defaultElement: "<ul>",\r
+ delay: 300,\r
+ options: {\r
+ icons: {\r
+ submenu: "ui-icon-caret-1-e"\r
+ },\r
+ items: "> *",\r
+ menus: "ul",\r
+ position: {\r
+ my: "left top",\r
+ at: "right top"\r
+ },\r
+ role: "menu",\r
+\r
+ // Callbacks\r
+ blur: null,\r
+ focus: null,\r
+ select: null\r
+ },\r
+\r
+ _create: function() {\r
+ this.activeMenu = this.element;\r
+\r
+ // Flag used to prevent firing of the click handler\r
+ // as the event bubbles up through nested menus\r
+ this.mouseHandled = false;\r
+ this.lastMousePosition = { x: null, y: null };\r
+ this.element\r
+ .uniqueId()\r
+ .attr( {\r
+ role: this.options.role,\r
+ tabIndex: 0\r
+ } );\r
+\r
+ this._addClass( "ui-menu", "ui-widget ui-widget-content" );\r
+ this._on( {\r
+\r
+ // Prevent focus from sticking to links inside menu after clicking\r
+ // them (focus should always stay on UL during navigation).\r
+ "mousedown .ui-menu-item": function( event ) {\r
+ event.preventDefault();\r
+\r
+ this._activateItem( event );\r
+ },\r
+ "click .ui-menu-item": function( event ) {\r
+ var target = $( event.target );\r
+ var active = $( $.ui.safeActiveElement( this.document[ 0 ] ) );\r
+ if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {\r
+ this.select( event );\r
+\r
+ // Only set the mouseHandled flag if the event will bubble, see #9469.\r
+ if ( !event.isPropagationStopped() ) {\r
+ this.mouseHandled = true;\r
+ }\r
+\r
+ // Open submenu on click\r
+ if ( target.has( ".ui-menu" ).length ) {\r
+ this.expand( event );\r
+ } else if ( !this.element.is( ":focus" ) &&\r
+ active.closest( ".ui-menu" ).length ) {\r
+\r
+ // Redirect focus to the menu\r
+ this.element.trigger( "focus", [ true ] );\r
+\r
+ // If the active item is on the top level, let it stay active.\r
+ // Otherwise, blur the active item since it is no longer visible.\r
+ if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {\r
+ clearTimeout( this.timer );\r
+ }\r
+ }\r
+ }\r
+ },\r
+ "mouseenter .ui-menu-item": "_activateItem",\r
+ "mousemove .ui-menu-item": "_activateItem",\r
+ mouseleave: "collapseAll",\r
+ "mouseleave .ui-menu": "collapseAll",\r
+ focus: function( event, keepActiveItem ) {\r
+\r
+ // If there's already an active item, keep it active\r
+ // If not, activate the first item\r
+ var item = this.active || this._menuItems().first();\r
+\r
+ if ( !keepActiveItem ) {\r
+ this.focus( event, item );\r
+ }\r
+ },\r
+ blur: function( event ) {\r
+ this._delay( function() {\r
+ var notContained = !$.contains(\r
+ this.element[ 0 ],\r
+ $.ui.safeActiveElement( this.document[ 0 ] )\r
+ );\r
+ if ( notContained ) {\r
+ this.collapseAll( event );\r
+ }\r
+ } );\r
+ },\r
+ keydown: "_keydown"\r
+ } );\r
+\r
+ this.refresh();\r
+\r
+ // Clicks outside of a menu collapse any open menus\r
+ this._on( this.document, {\r
+ click: function( event ) {\r
+ if ( this._closeOnDocumentClick( event ) ) {\r
+ this.collapseAll( event, true );\r
+ }\r
+\r
+ // Reset the mouseHandled flag\r
+ this.mouseHandled = false;\r
+ }\r
+ } );\r
+ },\r
+\r
+ _activateItem: function( event ) {\r
+\r
+ // Ignore mouse events while typeahead is active, see #10458.\r
+ // Prevents focusing the wrong item when typeahead causes a scroll while the mouse\r
+ // is over an item in the menu\r
+ if ( this.previousFilter ) {\r
+ return;\r
+ }\r
+\r
+ // If the mouse didn't actually move, but the page was scrolled, ignore the event (#9356)\r
+ if ( event.clientX === this.lastMousePosition.x &&\r
+ event.clientY === this.lastMousePosition.y ) {\r
+ return;\r
+ }\r
+\r
+ this.lastMousePosition = {\r
+ x: event.clientX,\r
+ y: event.clientY\r
+ };\r
+\r
+ var actualTarget = $( event.target ).closest( ".ui-menu-item" ),\r
+ target = $( event.currentTarget );\r
+\r
+ // Ignore bubbled events on parent items, see #11641\r
+ if ( actualTarget[ 0 ] !== target[ 0 ] ) {\r
+ return;\r
+ }\r
+\r
+ // If the item is already active, there's nothing to do\r
+ if ( target.is( ".ui-state-active" ) ) {\r
+ return;\r
+ }\r
+\r
+ // Remove ui-state-active class from siblings of the newly focused menu item\r
+ // to avoid a jump caused by adjacent elements both having a class with a border\r
+ this._removeClass( target.siblings().children( ".ui-state-active" ),\r
+ null, "ui-state-active" );\r
+ this.focus( event, target );\r
+ },\r
+\r
+ _destroy: function() {\r
+ var items = this.element.find( ".ui-menu-item" )\r
+ .removeAttr( "role aria-disabled" ),\r
+ submenus = items.children( ".ui-menu-item-wrapper" )\r
+ .removeUniqueId()\r
+ .removeAttr( "tabIndex role aria-haspopup" );\r
+\r
+ // Destroy (sub)menus\r
+ this.element\r
+ .removeAttr( "aria-activedescendant" )\r
+ .find( ".ui-menu" ).addBack()\r
+ .removeAttr( "role aria-labelledby aria-expanded aria-hidden aria-disabled " +\r
+ "tabIndex" )\r
+ .removeUniqueId()\r
+ .show();\r
+\r
+ submenus.children().each( function() {\r
+ var elem = $( this );\r
+ if ( elem.data( "ui-menu-submenu-caret" ) ) {\r
+ elem.remove();\r
+ }\r
+ } );\r
+ },\r
+\r
+ _keydown: function( event ) {\r
+ var match, prev, character, skip,\r
+ preventDefault = true;\r
+\r
+ switch ( event.keyCode ) {\r
+ case $.ui.keyCode.PAGE_UP:\r
+ this.previousPage( event );\r
+ break;\r
+ case $.ui.keyCode.PAGE_DOWN:\r
+ this.nextPage( event );\r
+ break;\r
+ case $.ui.keyCode.HOME:\r
+ this._move( "first", "first", event );\r
+ break;\r
+ case $.ui.keyCode.END:\r
+ this._move( "last", "last", event );\r
+ break;\r
+ case $.ui.keyCode.UP:\r
+ this.previous( event );\r
+ break;\r
+ case $.ui.keyCode.DOWN:\r
+ this.next( event );\r
+ break;\r
+ case $.ui.keyCode.LEFT:\r
+ this.collapse( event );\r
+ break;\r
+ case $.ui.keyCode.RIGHT:\r
+ if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {\r
+ this.expand( event );\r
+ }\r
+ break;\r
+ case $.ui.keyCode.ENTER:\r
+ case $.ui.keyCode.SPACE:\r
+ this._activate( event );\r
+ break;\r
+ case $.ui.keyCode.ESCAPE:\r
+ this.collapse( event );\r
+ break;\r
+ default:\r
+ preventDefault = false;\r
+ prev = this.previousFilter || "";\r
+ skip = false;\r
+\r
+ // Support number pad values\r
+ character = event.keyCode >= 96 && event.keyCode <= 105 ?\r
+ ( event.keyCode - 96 ).toString() : String.fromCharCode( event.keyCode );\r
+\r
+ clearTimeout( this.filterTimer );\r
+\r
+ if ( character === prev ) {\r
+ skip = true;\r
+ } else {\r
+ character = prev + character;\r
+ }\r
+\r
+ match = this._filterMenuItems( character );\r
+ match = skip && match.index( this.active.next() ) !== -1 ?\r
+ this.active.nextAll( ".ui-menu-item" ) :\r
+ match;\r
+\r
+ // If no matches on the current filter, reset to the last character pressed\r
+ // to move down the menu to the first item that starts with that character\r
+ if ( !match.length ) {\r
+ character = String.fromCharCode( event.keyCode );\r
+ match = this._filterMenuItems( character );\r
+ }\r
+\r
+ if ( match.length ) {\r
+ this.focus( event, match );\r
+ this.previousFilter = character;\r
+ this.filterTimer = this._delay( function() {\r
+ delete this.previousFilter;\r
+ }, 1000 );\r
+ } else {\r
+ delete this.previousFilter;\r
+ }\r
+ }\r
+\r
+ if ( preventDefault ) {\r
+ event.preventDefault();\r
+ }\r
+ },\r
+\r
+ _activate: function( event ) {\r
+ if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {\r
+ if ( this.active.children( "[aria-haspopup='true']" ).length ) {\r
+ this.expand( event );\r
+ } else {\r
+ this.select( event );\r
+ }\r
+ }\r
+ },\r
+\r
+ refresh: function() {\r
+ var menus, items, newSubmenus, newItems, newWrappers,\r
+ that = this,\r
+ icon = this.options.icons.submenu,\r
+ submenus = this.element.find( this.options.menus );\r
+\r
+ this._toggleClass( "ui-menu-icons", null, !!this.element.find( ".ui-icon" ).length );\r
+\r
+ // Initialize nested menus\r
+ newSubmenus = submenus.filter( ":not(.ui-menu)" )\r
+ .hide()\r
+ .attr( {\r
+ role: this.options.role,\r
+ "aria-hidden": "true",\r
+ "aria-expanded": "false"\r
+ } )\r
+ .each( function() {\r
+ var menu = $( this ),\r
+ item = menu.prev(),\r
+ submenuCaret = $( "<span>" ).data( "ui-menu-submenu-caret", true );\r
+\r
+ that._addClass( submenuCaret, "ui-menu-icon", "ui-icon " + icon );\r
+ item\r
+ .attr( "aria-haspopup", "true" )\r
+ .prepend( submenuCaret );\r
+ menu.attr( "aria-labelledby", item.attr( "id" ) );\r
+ } );\r
+\r
+ this._addClass( newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front" );\r
+\r
+ menus = submenus.add( this.element );\r
+ items = menus.find( this.options.items );\r
+\r
+ // Initialize menu-items containing spaces and/or dashes only as dividers\r
+ items.not( ".ui-menu-item" ).each( function() {\r
+ var item = $( this );\r
+ if ( that._isDivider( item ) ) {\r
+ that._addClass( item, "ui-menu-divider", "ui-widget-content" );\r
+ }\r
+ } );\r
+\r
+ // Don't refresh list items that are already adapted\r
+ newItems = items.not( ".ui-menu-item, .ui-menu-divider" );\r
+ newWrappers = newItems.children()\r
+ .not( ".ui-menu" )\r
+ .uniqueId()\r
+ .attr( {\r
+ tabIndex: -1,\r
+ role: this._itemRole()\r
+ } );\r
+ this._addClass( newItems, "ui-menu-item" )\r
+ ._addClass( newWrappers, "ui-menu-item-wrapper" );\r
+\r
+ // Add aria-disabled attribute to any disabled menu item\r
+ items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" );\r
+\r
+ // If the active item has been removed, blur the menu\r
+ if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {\r
+ this.blur();\r
+ }\r
+ },\r
+\r
+ _itemRole: function() {\r
+ return {\r
+ menu: "menuitem",\r
+ listbox: "option"\r
+ }[ this.options.role ];\r
+ },\r
+\r
+ _setOption: function( key, value ) {\r
+ if ( key === "icons" ) {\r
+ var icons = this.element.find( ".ui-menu-icon" );\r
+ this._removeClass( icons, null, this.options.icons.submenu )\r
+ ._addClass( icons, null, value.submenu );\r
+ }\r
+ this._super( key, value );\r
+ },\r
+\r
+ _setOptionDisabled: function( value ) {\r
+ this._super( value );\r
+\r
+ this.element.attr( "aria-disabled", String( value ) );\r
+ this._toggleClass( null, "ui-state-disabled", !!value );\r
+ },\r
+\r
+ focus: function( event, item ) {\r
+ var nested, focused, activeParent;\r
+ this.blur( event, event && event.type === "focus" );\r
+\r
+ this._scrollIntoView( item );\r
+\r
+ this.active = item.first();\r
+\r
+ focused = this.active.children( ".ui-menu-item-wrapper" );\r
+ this._addClass( focused, null, "ui-state-active" );\r
+\r
+ // Only update aria-activedescendant if there's a role\r
+ // otherwise we assume focus is managed elsewhere\r
+ if ( this.options.role ) {\r
+ this.element.attr( "aria-activedescendant", focused.attr( "id" ) );\r
+ }\r
+\r
+ // Highlight active parent menu item, if any\r
+ activeParent = this.active\r
+ .parent()\r
+ .closest( ".ui-menu-item" )\r
+ .children( ".ui-menu-item-wrapper" );\r
+ this._addClass( activeParent, null, "ui-state-active" );\r
+\r
+ if ( event && event.type === "keydown" ) {\r
+ this._close();\r
+ } else {\r
+ this.timer = this._delay( function() {\r
+ this._close();\r
+ }, this.delay );\r
+ }\r
+\r
+ nested = item.children( ".ui-menu" );\r
+ if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) {\r
+ this._startOpening( nested );\r
+ }\r
+ this.activeMenu = item.parent();\r
+\r
+ this._trigger( "focus", event, { item: item } );\r
+ },\r
+\r
+ _scrollIntoView: function( item ) {\r
+ var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;\r
+ if ( this._hasScroll() ) {\r
+ borderTop = parseFloat( $.css( this.activeMenu[ 0 ], "borderTopWidth" ) ) || 0;\r
+ paddingTop = parseFloat( $.css( this.activeMenu[ 0 ], "paddingTop" ) ) || 0;\r
+ offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;\r
+ scroll = this.activeMenu.scrollTop();\r
+ elementHeight = this.activeMenu.height();\r
+ itemHeight = item.outerHeight();\r
+\r
+ if ( offset < 0 ) {\r
+ this.activeMenu.scrollTop( scroll + offset );\r
+ } else if ( offset + itemHeight > elementHeight ) {\r
+ this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );\r
+ }\r
+ }\r
+ },\r
+\r
+ blur: function( event, fromFocus ) {\r
+ if ( !fromFocus ) {\r
+ clearTimeout( this.timer );\r
+ }\r
+\r
+ if ( !this.active ) {\r
+ return;\r
+ }\r
+\r
+ this._removeClass( this.active.children( ".ui-menu-item-wrapper" ),\r
+ null, "ui-state-active" );\r
+\r
+ this._trigger( "blur", event, { item: this.active } );\r
+ this.active = null;\r
+ },\r
+\r
+ _startOpening: function( submenu ) {\r
+ clearTimeout( this.timer );\r
+\r
+ // Don't open if already open fixes a Firefox bug that caused a .5 pixel\r
+ // shift in the submenu position when mousing over the caret icon\r
+ if ( submenu.attr( "aria-hidden" ) !== "true" ) {\r
+ return;\r
+ }\r
+\r
+ this.timer = this._delay( function() {\r
+ this._close();\r
+ this._open( submenu );\r
+ }, this.delay );\r
+ },\r
+\r
+ _open: function( submenu ) {\r
+ var position = $.extend( {\r
+ of: this.active\r
+ }, this.options.position );\r
+\r
+ clearTimeout( this.timer );\r
+ this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )\r
+ .hide()\r
+ .attr( "aria-hidden", "true" );\r
+\r
+ submenu\r
+ .show()\r
+ .removeAttr( "aria-hidden" )\r
+ .attr( "aria-expanded", "true" )\r
+ .position( position );\r
+ },\r
+\r
+ collapseAll: function( event, all ) {\r
+ clearTimeout( this.timer );\r
+ this.timer = this._delay( function() {\r
+\r
+ // If we were passed an event, look for the submenu that contains the event\r
+ var currentMenu = all ? this.element :\r
+ $( event && event.target ).closest( this.element.find( ".ui-menu" ) );\r
+\r
+ // If we found no valid submenu ancestor, use the main menu to close all\r
+ // sub menus anyway\r
+ if ( !currentMenu.length ) {\r
+ currentMenu = this.element;\r
+ }\r
+\r
+ this._close( currentMenu );\r
+\r
+ this.blur( event );\r
+\r
+ // Work around active item staying active after menu is blurred\r
+ this._removeClass( currentMenu.find( ".ui-state-active" ), null, "ui-state-active" );\r
+\r
+ this.activeMenu = currentMenu;\r
+ }, all ? 0 : this.delay );\r
+ },\r
+\r
+ // With no arguments, closes the currently active menu - if nothing is active\r
+ // it closes all menus. If passed an argument, it will search for menus BELOW\r
+ _close: function( startMenu ) {\r
+ if ( !startMenu ) {\r
+ startMenu = this.active ? this.active.parent() : this.element;\r
+ }\r
+\r
+ startMenu.find( ".ui-menu" )\r
+ .hide()\r
+ .attr( "aria-hidden", "true" )\r
+ .attr( "aria-expanded", "false" );\r
+ },\r
+\r
+ _closeOnDocumentClick: function( event ) {\r
+ return !$( event.target ).closest( ".ui-menu" ).length;\r
+ },\r
+\r
+ _isDivider: function( item ) {\r
+\r
+ // Match hyphen, em dash, en dash\r
+ return !/[^\-\u2014\u2013\s]/.test( item.text() );\r
+ },\r
+\r
+ collapse: function( event ) {\r
+ var newItem = this.active &&\r
+ this.active.parent().closest( ".ui-menu-item", this.element );\r
+ if ( newItem && newItem.length ) {\r
+ this._close();\r
+ this.focus( event, newItem );\r
+ }\r
+ },\r
+\r
+ expand: function( event ) {\r
+ var newItem = this.active && this._menuItems( this.active.children( ".ui-menu" ) ).first();\r
+\r
+ if ( newItem && newItem.length ) {\r
+ this._open( newItem.parent() );\r
+\r
+ // Delay so Firefox will not hide activedescendant change in expanding submenu from AT\r
+ this._delay( function() {\r
+ this.focus( event, newItem );\r
+ } );\r
+ }\r
+ },\r
+\r
+ next: function( event ) {\r
+ this._move( "next", "first", event );\r
+ },\r
+\r
+ previous: function( event ) {\r
+ this._move( "prev", "last", event );\r
+ },\r
+\r
+ isFirstItem: function() {\r
+ return this.active && !this.active.prevAll( ".ui-menu-item" ).length;\r
+ },\r
+\r
+ isLastItem: function() {\r
+ return this.active && !this.active.nextAll( ".ui-menu-item" ).length;\r
+ },\r
+\r
+ _menuItems: function( menu ) {\r
+ return ( menu || this.element )\r
+ .find( this.options.items )\r
+ .filter( ".ui-menu-item" );\r
+ },\r
+\r
+ _move: function( direction, filter, event ) {\r
+ var next;\r
+ if ( this.active ) {\r
+ if ( direction === "first" || direction === "last" ) {\r
+ next = this.active\r
+ [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )\r
+ .last();\r
+ } else {\r
+ next = this.active\r
+ [ direction + "All" ]( ".ui-menu-item" )\r
+ .first();\r
+ }\r
+ }\r
+ if ( !next || !next.length || !this.active ) {\r
+ next = this._menuItems( this.activeMenu )[ filter ]();\r
+ }\r
+\r
+ this.focus( event, next );\r
+ },\r
+\r
+ nextPage: function( event ) {\r
+ var item, base, height;\r
+\r
+ if ( !this.active ) {\r
+ this.next( event );\r
+ return;\r
+ }\r
+ if ( this.isLastItem() ) {\r
+ return;\r
+ }\r
+ if ( this._hasScroll() ) {\r
+ base = this.active.offset().top;\r
+ height = this.element.innerHeight();\r
+\r
+ // jQuery 3.2 doesn't include scrollbars in innerHeight, add it back.\r
+ if ( $.fn.jquery.indexOf( "3.2." ) === 0 ) {\r
+ height += this.element[ 0 ].offsetHeight - this.element.outerHeight();\r
+ }\r
+\r
+ this.active.nextAll( ".ui-menu-item" ).each( function() {\r
+ item = $( this );\r
+ return item.offset().top - base - height < 0;\r
+ } );\r
+\r
+ this.focus( event, item );\r
+ } else {\r
+ this.focus( event, this._menuItems( this.activeMenu )\r
+ [ !this.active ? "first" : "last" ]() );\r
+ }\r
+ },\r
+\r
+ previousPage: function( event ) {\r
+ var item, base, height;\r
+ if ( !this.active ) {\r
+ this.next( event );\r
+ return;\r
+ }\r
+ if ( this.isFirstItem() ) {\r
+ return;\r
+ }\r
+ if ( this._hasScroll() ) {\r
+ base = this.active.offset().top;\r
+ height = this.element.innerHeight();\r
+\r
+ // jQuery 3.2 doesn't include scrollbars in innerHeight, add it back.\r
+ if ( $.fn.jquery.indexOf( "3.2." ) === 0 ) {\r
+ height += this.element[ 0 ].offsetHeight - this.element.outerHeight();\r
+ }\r
+\r
+ this.active.prevAll( ".ui-menu-item" ).each( function() {\r
+ item = $( this );\r
+ return item.offset().top - base + height > 0;\r
+ } );\r
+\r
+ this.focus( event, item );\r
+ } else {\r
+ this.focus( event, this._menuItems( this.activeMenu ).first() );\r
+ }\r
+ },\r
+\r
+ _hasScroll: function() {\r
+ return this.element.outerHeight() < this.element.prop( "scrollHeight" );\r
+ },\r
+\r
+ select: function( event ) {\r
+\r
+ // TODO: It should never be possible to not have an active item at this\r
+ // point, but the tests don't trigger mouseenter before click.\r
+ this.active = this.active || $( event.target ).closest( ".ui-menu-item" );\r
+ var ui = { item: this.active };\r
+ if ( !this.active.has( ".ui-menu" ).length ) {\r
+ this.collapseAll( event, true );\r
+ }\r
+ this._trigger( "select", event, ui );\r
+ },\r
+\r
+ _filterMenuItems: function( character ) {\r
+ var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ),\r
+ regex = new RegExp( "^" + escapedCharacter, "i" );\r
+\r
+ return this.activeMenu\r
+ .find( this.options.items )\r
+\r
+ // Only match on items, not dividers or other content (#10571)\r
+ .filter( ".ui-menu-item" )\r
+ .filter( function() {\r
+ return regex.test(\r
+ String.prototype.trim.call(\r
+ $( this ).children( ".ui-menu-item-wrapper" ).text() ) );\r
+ } );\r
+ }\r
+} );\r
+\r
+\r
+/*!\r
+ * jQuery UI Autocomplete 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Autocomplete\r
+//>>group: Widgets\r
+//>>description: Lists suggested words as the user is typing.\r
+//>>docs: http://api.jqueryui.com/autocomplete/\r
+//>>demos: http://jqueryui.com/autocomplete/\r
+//>>css.structure: ../../themes/base/core.css\r
+//>>css.structure: ../../themes/base/autocomplete.css\r
+//>>css.theme: ../../themes/base/theme.css\r
+\r
+\r
+$.widget( "ui.autocomplete", {\r
+ version: "1.13.1",\r
+ defaultElement: "<input>",\r
+ options: {\r
+ appendTo: null,\r
+ autoFocus: false,\r
+ delay: 300,\r
+ minLength: 1,\r
+ position: {\r
+ my: "left top",\r
+ at: "left bottom",\r
+ collision: "none"\r
+ },\r
+ source: null,\r
+\r
+ // Callbacks\r
+ change: null,\r
+ close: null,\r
+ focus: null,\r
+ open: null,\r
+ response: null,\r
+ search: null,\r
+ select: null\r
+ },\r
+\r
+ requestIndex: 0,\r
+ pending: 0,\r
+ liveRegionTimer: null,\r
+\r
+ _create: function() {\r
+\r
+ // Some browsers only repeat keydown events, not keypress events,\r
+ // so we use the suppressKeyPress flag to determine if we've already\r
+ // handled the keydown event. #7269\r
+ // Unfortunately the code for & in keypress is the same as the up arrow,\r
+ // so we use the suppressKeyPressRepeat flag to avoid handling keypress\r
+ // events when we know the keydown event was used to modify the\r
+ // search term. #7799\r
+ var suppressKeyPress, suppressKeyPressRepeat, suppressInput,\r
+ nodeName = this.element[ 0 ].nodeName.toLowerCase(),\r
+ isTextarea = nodeName === "textarea",\r
+ isInput = nodeName === "input";\r
+\r
+ // Textareas are always multi-line\r
+ // Inputs are always single-line, even if inside a contentEditable element\r
+ // IE also treats inputs as contentEditable\r
+ // All other element types are determined by whether or not they're contentEditable\r
+ this.isMultiLine = isTextarea || !isInput && this._isContentEditable( this.element );\r
+\r
+ this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ];\r
+ this.isNewMenu = true;\r
+\r
+ this._addClass( "ui-autocomplete-input" );\r
+ this.element.attr( "autocomplete", "off" );\r
+\r
+ this._on( this.element, {\r
+ keydown: function( event ) {\r
+ if ( this.element.prop( "readOnly" ) ) {\r
+ suppressKeyPress = true;\r
+ suppressInput = true;\r
+ suppressKeyPressRepeat = true;\r
+ return;\r
+ }\r
+\r
+ suppressKeyPress = false;\r
+ suppressInput = false;\r
+ suppressKeyPressRepeat = false;\r
+ var keyCode = $.ui.keyCode;\r
+ switch ( event.keyCode ) {\r
+ case keyCode.PAGE_UP:\r
+ suppressKeyPress = true;\r
+ this._move( "previousPage", event );\r
+ break;\r
+ case keyCode.PAGE_DOWN:\r
+ suppressKeyPress = true;\r
+ this._move( "nextPage", event );\r
+ break;\r
+ case keyCode.UP:\r
+ suppressKeyPress = true;\r
+ this._keyEvent( "previous", event );\r
+ break;\r
+ case keyCode.DOWN:\r
+ suppressKeyPress = true;\r
+ this._keyEvent( "next", event );\r
+ break;\r
+ case keyCode.ENTER:\r
+\r
+ // when menu is open and has focus\r
+ if ( this.menu.active ) {\r
+\r
+ // #6055 - Opera still allows the keypress to occur\r
+ // which causes forms to submit\r
+ suppressKeyPress = true;\r
+ event.preventDefault();\r
+ this.menu.select( event );\r
+ }\r
+ break;\r
+ case keyCode.TAB:\r
+ if ( this.menu.active ) {\r
+ this.menu.select( event );\r
+ }\r
+ break;\r
+ case keyCode.ESCAPE:\r
+ if ( this.menu.element.is( ":visible" ) ) {\r
+ if ( !this.isMultiLine ) {\r
+ this._value( this.term );\r
+ }\r
+ this.close( event );\r
+\r
+ // Different browsers have different default behavior for escape\r
+ // Single press can mean undo or clear\r
+ // Double press in IE means clear the whole form\r
+ event.preventDefault();\r
+ }\r
+ break;\r
+ default:\r
+ suppressKeyPressRepeat = true;\r
+\r
+ // search timeout should be triggered before the input value is changed\r
+ this._searchTimeout( event );\r
+ break;\r
+ }\r
+ },\r
+ keypress: function( event ) {\r
+ if ( suppressKeyPress ) {\r
+ suppressKeyPress = false;\r
+ if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {\r
+ event.preventDefault();\r
+ }\r
+ return;\r
+ }\r
+ if ( suppressKeyPressRepeat ) {\r
+ return;\r
+ }\r
+\r
+ // Replicate some key handlers to allow them to repeat in Firefox and Opera\r
+ var keyCode = $.ui.keyCode;\r
+ switch ( event.keyCode ) {\r
+ case keyCode.PAGE_UP:\r
+ this._move( "previousPage", event );\r
+ break;\r
+ case keyCode.PAGE_DOWN:\r
+ this._move( "nextPage", event );\r
+ break;\r
+ case keyCode.UP:\r
+ this._keyEvent( "previous", event );\r
+ break;\r
+ case keyCode.DOWN:\r
+ this._keyEvent( "next", event );\r
+ break;\r
+ }\r
+ },\r
+ input: function( event ) {\r
+ if ( suppressInput ) {\r
+ suppressInput = false;\r
+ event.preventDefault();\r
+ return;\r
+ }\r
+ this._searchTimeout( event );\r
+ },\r
+ focus: function() {\r
+ this.selectedItem = null;\r
+ this.previous = this._value();\r
+ },\r
+ blur: function( event ) {\r
+ clearTimeout( this.searching );\r
+ this.close( event );\r
+ this._change( event );\r
+ }\r
+ } );\r
+\r
+ this._initSource();\r
+ this.menu = $( "<ul>" )\r
+ .appendTo( this._appendTo() )\r
+ .menu( {\r
+\r
+ // disable ARIA support, the live region takes care of that\r
+ role: null\r
+ } )\r
+ .hide()\r
+\r
+ // Support: IE 11 only, Edge <= 14\r
+ // For other browsers, we preventDefault() on the mousedown event\r
+ // to keep the dropdown from taking focus from the input. This doesn't\r
+ // work for IE/Edge, causing problems with selection and scrolling (#9638)\r
+ // Happily, IE and Edge support an "unselectable" attribute that\r
+ // prevents an element from receiving focus, exactly what we want here.\r
+ .attr( {\r
+ "unselectable": "on"\r
+ } )\r
+ .menu( "instance" );\r
+\r
+ this._addClass( this.menu.element, "ui-autocomplete", "ui-front" );\r
+ this._on( this.menu.element, {\r
+ mousedown: function( event ) {\r
+\r
+ // Prevent moving focus out of the text field\r
+ event.preventDefault();\r
+ },\r
+ menufocus: function( event, ui ) {\r
+ var label, item;\r
+\r
+ // support: Firefox\r
+ // Prevent accidental activation of menu items in Firefox (#7024 #9118)\r
+ if ( this.isNewMenu ) {\r
+ this.isNewMenu = false;\r
+ if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {\r
+ this.menu.blur();\r
+\r
+ this.document.one( "mousemove", function() {\r
+ $( event.target ).trigger( event.originalEvent );\r
+ } );\r
+\r
+ return;\r
+ }\r
+ }\r
+\r
+ item = ui.item.data( "ui-autocomplete-item" );\r
+ if ( false !== this._trigger( "focus", event, { item: item } ) ) {\r
+\r
+ // use value to match what will end up in the input, if it was a key event\r
+ if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) {\r
+ this._value( item.value );\r
+ }\r
+ }\r
+\r
+ // Announce the value in the liveRegion\r
+ label = ui.item.attr( "aria-label" ) || item.value;\r
+ if ( label && String.prototype.trim.call( label ).length ) {\r
+ clearTimeout( this.liveRegionTimer );\r
+ this.liveRegionTimer = this._delay( function() {\r
+ this.liveRegion.html( $( "<div>" ).text( label ) );\r
+ }, 100 );\r
+ }\r
+ },\r
+ menuselect: function( event, ui ) {\r
+ var item = ui.item.data( "ui-autocomplete-item" ),\r
+ previous = this.previous;\r
+\r
+ // Only trigger when focus was lost (click on menu)\r
+ if ( this.element[ 0 ] !== $.ui.safeActiveElement( this.document[ 0 ] ) ) {\r
+ this.element.trigger( "focus" );\r
+ this.previous = previous;\r
+\r
+ // #6109 - IE triggers two focus events and the second\r
+ // is asynchronous, so we need to reset the previous\r
+ // term synchronously and asynchronously :-(\r
+ this._delay( function() {\r
+ this.previous = previous;\r
+ this.selectedItem = item;\r
+ } );\r
+ }\r
+\r
+ if ( false !== this._trigger( "select", event, { item: item } ) ) {\r
+ this._value( item.value );\r
+ }\r
+\r
+ // reset the term after the select event\r
+ // this allows custom select handling to work properly\r
+ this.term = this._value();\r
+\r
+ this.close( event );\r
+ this.selectedItem = item;\r
+ }\r
+ } );\r
+\r
+ this.liveRegion = $( "<div>", {\r
+ role: "status",\r
+ "aria-live": "assertive",\r
+ "aria-relevant": "additions"\r
+ } )\r
+ .appendTo( this.document[ 0 ].body );\r
+\r
+ this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" );\r
+\r
+ // Turning off autocomplete prevents the browser from remembering the\r
+ // value when navigating through history, so we re-enable autocomplete\r
+ // if the page is unloaded before the widget is destroyed. #7790\r
+ this._on( this.window, {\r
+ beforeunload: function() {\r
+ this.element.removeAttr( "autocomplete" );\r
+ }\r
+ } );\r
+ },\r
+\r
+ _destroy: function() {\r
+ clearTimeout( this.searching );\r
+ this.element.removeAttr( "autocomplete" );\r
+ this.menu.element.remove();\r
+ this.liveRegion.remove();\r
+ },\r
+\r
+ _setOption: function( key, value ) {\r
+ this._super( key, value );\r
+ if ( key === "source" ) {\r
+ this._initSource();\r
+ }\r
+ if ( key === "appendTo" ) {\r
+ this.menu.element.appendTo( this._appendTo() );\r
+ }\r
+ if ( key === "disabled" && value && this.xhr ) {\r
+ this.xhr.abort();\r
+ }\r
+ },\r
+\r
+ _isEventTargetInWidget: function( event ) {\r
+ var menuElement = this.menu.element[ 0 ];\r
+\r
+ return event.target === this.element[ 0 ] ||\r
+ event.target === menuElement ||\r
+ $.contains( menuElement, event.target );\r
+ },\r
+\r
+ _closeOnClickOutside: function( event ) {\r
+ if ( !this._isEventTargetInWidget( event ) ) {\r
+ this.close();\r
+ }\r
+ },\r
+\r
+ _appendTo: function() {\r
+ var element = this.options.appendTo;\r
+\r
+ if ( element ) {\r
+ element = element.jquery || element.nodeType ?\r
+ $( element ) :\r
+ this.document.find( element ).eq( 0 );\r
+ }\r
+\r
+ if ( !element || !element[ 0 ] ) {\r
+ element = this.element.closest( ".ui-front, dialog" );\r
+ }\r
+\r
+ if ( !element.length ) {\r
+ element = this.document[ 0 ].body;\r
+ }\r
+\r
+ return element;\r
+ },\r
+\r
+ _initSource: function() {\r
+ var array, url,\r
+ that = this;\r
+ if ( Array.isArray( this.options.source ) ) {\r
+ array = this.options.source;\r
+ this.source = function( request, response ) {\r
+ response( $.ui.autocomplete.filter( array, request.term ) );\r
+ };\r
+ } else if ( typeof this.options.source === "string" ) {\r
+ url = this.options.source;\r
+ this.source = function( request, response ) {\r
+ if ( that.xhr ) {\r
+ that.xhr.abort();\r
+ }\r
+ that.xhr = $.ajax( {\r
+ url: url,\r
+ data: request,\r
+ dataType: "json",\r
+ success: function( data ) {\r
+ response( data );\r
+ },\r
+ error: function() {\r
+ response( [] );\r
+ }\r
+ } );\r
+ };\r
+ } else {\r
+ this.source = this.options.source;\r
+ }\r
+ },\r
+\r
+ _searchTimeout: function( event ) {\r
+ clearTimeout( this.searching );\r
+ this.searching = this._delay( function() {\r
+\r
+ // Search if the value has changed, or if the user retypes the same value (see #7434)\r
+ var equalValues = this.term === this._value(),\r
+ menuVisible = this.menu.element.is( ":visible" ),\r
+ modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;\r
+\r
+ if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) {\r
+ this.selectedItem = null;\r
+ this.search( null, event );\r
+ }\r
+ }, this.options.delay );\r
+ },\r
+\r
+ search: function( value, event ) {\r
+ value = value != null ? value : this._value();\r
+\r
+ // Always save the actual value, not the one passed as an argument\r
+ this.term = this._value();\r
+\r
+ if ( value.length < this.options.minLength ) {\r
+ return this.close( event );\r
+ }\r
+\r
+ if ( this._trigger( "search", event ) === false ) {\r
+ return;\r
+ }\r
+\r
+ return this._search( value );\r
+ },\r
+\r
+ _search: function( value ) {\r
+ this.pending++;\r
+ this._addClass( "ui-autocomplete-loading" );\r
+ this.cancelSearch = false;\r
+\r
+ this.source( { term: value }, this._response() );\r
+ },\r
+\r
+ _response: function() {\r
+ var index = ++this.requestIndex;\r
+\r
+ return function( content ) {\r
+ if ( index === this.requestIndex ) {\r
+ this.__response( content );\r
+ }\r
+\r
+ this.pending--;\r
+ if ( !this.pending ) {\r
+ this._removeClass( "ui-autocomplete-loading" );\r
+ }\r
+ }.bind( this );\r
+ },\r
+\r
+ __response: function( content ) {\r
+ if ( content ) {\r
+ content = this._normalize( content );\r
+ }\r
+ this._trigger( "response", null, { content: content } );\r
+ if ( !this.options.disabled && content && content.length && !this.cancelSearch ) {\r
+ this._suggest( content );\r
+ this._trigger( "open" );\r
+ } else {\r
+\r
+ // use ._close() instead of .close() so we don't cancel future searches\r
+ this._close();\r
+ }\r
+ },\r
+\r
+ close: function( event ) {\r
+ this.cancelSearch = true;\r
+ this._close( event );\r
+ },\r
+\r
+ _close: function( event ) {\r
+\r
+ // Remove the handler that closes the menu on outside clicks\r
+ this._off( this.document, "mousedown" );\r
+\r
+ if ( this.menu.element.is( ":visible" ) ) {\r
+ this.menu.element.hide();\r
+ this.menu.blur();\r
+ this.isNewMenu = true;\r
+ this._trigger( "close", event );\r
+ }\r
+ },\r
+\r
+ _change: function( event ) {\r
+ if ( this.previous !== this._value() ) {\r
+ this._trigger( "change", event, { item: this.selectedItem } );\r
+ }\r
+ },\r
+\r
+ _normalize: function( items ) {\r
+\r
+ // assume all items have the right format when the first item is complete\r
+ if ( items.length && items[ 0 ].label && items[ 0 ].value ) {\r
+ return items;\r
+ }\r
+ return $.map( items, function( item ) {\r
+ if ( typeof item === "string" ) {\r
+ return {\r
+ label: item,\r
+ value: item\r
+ };\r
+ }\r
+ return $.extend( {}, item, {\r
+ label: item.label || item.value,\r
+ value: item.value || item.label\r
+ } );\r
+ } );\r
+ },\r
+\r
+ _suggest: function( items ) {\r
+ var ul = this.menu.element.empty();\r
+ this._renderMenu( ul, items );\r
+ this.isNewMenu = true;\r
+ this.menu.refresh();\r
+\r
+ // Size and position menu\r
+ ul.show();\r
+ this._resizeMenu();\r
+ ul.position( $.extend( {\r
+ of: this.element\r
+ }, this.options.position ) );\r
+\r
+ if ( this.options.autoFocus ) {\r
+ this.menu.next();\r
+ }\r
+\r
+ // Listen for interactions outside of the widget (#6642)\r
+ this._on( this.document, {\r
+ mousedown: "_closeOnClickOutside"\r
+ } );\r
+ },\r
+\r
+ _resizeMenu: function() {\r
+ var ul = this.menu.element;\r
+ ul.outerWidth( Math.max(\r
+\r
+ // Firefox wraps long text (possibly a rounding bug)\r
+ // so we add 1px to avoid the wrapping (#7513)\r
+ ul.width( "" ).outerWidth() + 1,\r
+ this.element.outerWidth()\r
+ ) );\r
+ },\r
+\r
+ _renderMenu: function( ul, items ) {\r
+ var that = this;\r
+ $.each( items, function( index, item ) {\r
+ that._renderItemData( ul, item );\r
+ } );\r
+ },\r
+\r
+ _renderItemData: function( ul, item ) {\r
+ return this._renderItem( ul, item ).data( "ui-autocomplete-item", item );\r
+ },\r
+\r
+ _renderItem: function( ul, item ) {\r
+ return $( "<li>" )\r
+ .append( $( "<div>" ).text( item.label ) )\r
+ .appendTo( ul );\r
+ },\r
+\r
+ _move: function( direction, event ) {\r
+ if ( !this.menu.element.is( ":visible" ) ) {\r
+ this.search( null, event );\r
+ return;\r
+ }\r
+ if ( this.menu.isFirstItem() && /^previous/.test( direction ) ||\r
+ this.menu.isLastItem() && /^next/.test( direction ) ) {\r
+\r
+ if ( !this.isMultiLine ) {\r
+ this._value( this.term );\r
+ }\r
+\r
+ this.menu.blur();\r
+ return;\r
+ }\r
+ this.menu[ direction ]( event );\r
+ },\r
+\r
+ widget: function() {\r
+ return this.menu.element;\r
+ },\r
+\r
+ _value: function() {\r
+ return this.valueMethod.apply( this.element, arguments );\r
+ },\r
+\r
+ _keyEvent: function( keyEvent, event ) {\r
+ if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {\r
+ this._move( keyEvent, event );\r
+\r
+ // Prevents moving cursor to beginning/end of the text field in some browsers\r
+ event.preventDefault();\r
+ }\r
+ },\r
+\r
+ // Support: Chrome <=50\r
+ // We should be able to just use this.element.prop( "isContentEditable" )\r
+ // but hidden elements always report false in Chrome.\r
+ // https://code.google.com/p/chromium/issues/detail?id=313082\r
+ _isContentEditable: function( element ) {\r
+ if ( !element.length ) {\r
+ return false;\r
+ }\r
+\r
+ var editable = element.prop( "contentEditable" );\r
+\r
+ if ( editable === "inherit" ) {\r
+ return this._isContentEditable( element.parent() );\r
+ }\r
+\r
+ return editable === "true";\r
+ }\r
+} );\r
+\r
+$.extend( $.ui.autocomplete, {\r
+ escapeRegex: function( value ) {\r
+ return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );\r
+ },\r
+ filter: function( array, term ) {\r
+ var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" );\r
+ return $.grep( array, function( value ) {\r
+ return matcher.test( value.label || value.value || value );\r
+ } );\r
+ }\r
+} );\r
+\r
+// Live region extension, adding a `messages` option\r
+// NOTE: This is an experimental API. We are still investigating\r
+// a full solution for string manipulation and internationalization.\r
+$.widget( "ui.autocomplete", $.ui.autocomplete, {\r
+ options: {\r
+ messages: {\r
+ noResults: "No search results.",\r
+ results: function( amount ) {\r
+ return amount + ( amount > 1 ? " results are" : " result is" ) +\r
+ " available, use up and down arrow keys to navigate.";\r
+ }\r
+ }\r
+ },\r
+\r
+ __response: function( content ) {\r
+ var message;\r
+ this._superApply( arguments );\r
+ if ( this.options.disabled || this.cancelSearch ) {\r
+ return;\r
+ }\r
+ if ( content && content.length ) {\r
+ message = this.options.messages.results( content.length );\r
+ } else {\r
+ message = this.options.messages.noResults;\r
+ }\r
+ clearTimeout( this.liveRegionTimer );\r
+ this.liveRegionTimer = this._delay( function() {\r
+ this.liveRegion.html( $( "<div>" ).text( message ) );\r
+ }, 100 );\r
+ }\r
+} );\r
+\r
+var widgetsAutocomplete = $.ui.autocomplete;\r
+\r
+\r
+/*!\r
+ * jQuery UI Controlgroup 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Controlgroup\r
+//>>group: Widgets\r
+//>>description: Visually groups form control widgets\r
+//>>docs: http://api.jqueryui.com/controlgroup/\r
+//>>demos: http://jqueryui.com/controlgroup/\r
+//>>css.structure: ../../themes/base/core.css\r
+//>>css.structure: ../../themes/base/controlgroup.css\r
+//>>css.theme: ../../themes/base/theme.css\r
+\r
+\r
+var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g;\r
+\r
+var widgetsControlgroup = $.widget( "ui.controlgroup", {\r
+ version: "1.13.1",\r
+ defaultElement: "<div>",\r
+ options: {\r
+ direction: "horizontal",\r
+ disabled: null,\r
+ onlyVisible: true,\r
+ items: {\r
+ "button": "input[type=button], input[type=submit], input[type=reset], button, a",\r
+ "controlgroupLabel": ".ui-controlgroup-label",\r
+ "checkboxradio": "input[type='checkbox'], input[type='radio']",\r
+ "selectmenu": "select",\r
+ "spinner": ".ui-spinner-input"\r
+ }\r
+ },\r
+\r
+ _create: function() {\r
+ this._enhance();\r
+ },\r
+\r
+ // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation\r
+ _enhance: function() {\r
+ this.element.attr( "role", "toolbar" );\r
+ this.refresh();\r
+ },\r
+\r
+ _destroy: function() {\r
+ this._callChildMethod( "destroy" );\r
+ this.childWidgets.removeData( "ui-controlgroup-data" );\r
+ this.element.removeAttr( "role" );\r
+ if ( this.options.items.controlgroupLabel ) {\r
+ this.element\r
+ .find( this.options.items.controlgroupLabel )\r
+ .find( ".ui-controlgroup-label-contents" )\r
+ .contents().unwrap();\r
+ }\r
+ },\r
+\r
+ _initWidgets: function() {\r
+ var that = this,\r
+ childWidgets = [];\r
+\r
+ // First we iterate over each of the items options\r
+ $.each( this.options.items, function( widget, selector ) {\r
+ var labels;\r
+ var options = {};\r
+\r
+ // Make sure the widget has a selector set\r
+ if ( !selector ) {\r
+ return;\r
+ }\r
+\r
+ if ( widget === "controlgroupLabel" ) {\r
+ labels = that.element.find( selector );\r
+ labels.each( function() {\r
+ var element = $( this );\r
+\r
+ if ( element.children( ".ui-controlgroup-label-contents" ).length ) {\r
+ return;\r
+ }\r
+ element.contents()\r
+ .wrapAll( "<span class='ui-controlgroup-label-contents'></span>" );\r
+ } );\r
+ that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" );\r
+ childWidgets = childWidgets.concat( labels.get() );\r
+ return;\r
+ }\r
+\r
+ // Make sure the widget actually exists\r
+ if ( !$.fn[ widget ] ) {\r
+ return;\r
+ }\r
+\r
+ // We assume everything is in the middle to start because we can't determine\r
+ // first / last elements until all enhancments are done.\r
+ if ( that[ "_" + widget + "Options" ] ) {\r
+ options = that[ "_" + widget + "Options" ]( "middle" );\r
+ } else {\r
+ options = { classes: {} };\r
+ }\r
+\r
+ // Find instances of this widget inside controlgroup and init them\r
+ that.element\r
+ .find( selector )\r
+ .each( function() {\r
+ var element = $( this );\r
+ var instance = element[ widget ]( "instance" );\r
+\r
+ // We need to clone the default options for this type of widget to avoid\r
+ // polluting the variable options which has a wider scope than a single widget.\r
+ var instanceOptions = $.widget.extend( {}, options );\r
+\r
+ // If the button is the child of a spinner ignore it\r
+ // TODO: Find a more generic solution\r
+ if ( widget === "button" && element.parent( ".ui-spinner" ).length ) {\r
+ return;\r
+ }\r
+\r
+ // Create the widget if it doesn't exist\r
+ if ( !instance ) {\r
+ instance = element[ widget ]()[ widget ]( "instance" );\r
+ }\r
+ if ( instance ) {\r
+ instanceOptions.classes =\r
+ that._resolveClassesValues( instanceOptions.classes, instance );\r
+ }\r
+ element[ widget ]( instanceOptions );\r
+\r
+ // Store an instance of the controlgroup to be able to reference\r
+ // from the outermost element for changing options and refresh\r
+ var widgetElement = element[ widget ]( "widget" );\r
+ $.data( widgetElement[ 0 ], "ui-controlgroup-data",\r
+ instance ? instance : element[ widget ]( "instance" ) );\r
+\r
+ childWidgets.push( widgetElement[ 0 ] );\r
+ } );\r
+ } );\r
+\r
+ this.childWidgets = $( $.uniqueSort( childWidgets ) );\r
+ this._addClass( this.childWidgets, "ui-controlgroup-item" );\r
+ },\r
+\r
+ _callChildMethod: function( method ) {\r
+ this.childWidgets.each( function() {\r
+ var element = $( this ),\r
+ data = element.data( "ui-controlgroup-data" );\r
+ if ( data && data[ method ] ) {\r
+ data[ method ]();\r
+ }\r
+ } );\r
+ },\r
+\r
+ _updateCornerClass: function( element, position ) {\r
+ var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all";\r
+ var add = this._buildSimpleOptions( position, "label" ).classes.label;\r
+\r
+ this._removeClass( element, null, remove );\r
+ this._addClass( element, null, add );\r
+ },\r
+\r
+ _buildSimpleOptions: function( position, key ) {\r
+ var direction = this.options.direction === "vertical";\r
+ var result = {\r
+ classes: {}\r
+ };\r
+ result.classes[ key ] = {\r
+ "middle": "",\r
+ "first": "ui-corner-" + ( direction ? "top" : "left" ),\r
+ "last": "ui-corner-" + ( direction ? "bottom" : "right" ),\r
+ "only": "ui-corner-all"\r
+ }[ position ];\r
+\r
+ return result;\r
+ },\r
+\r
+ _spinnerOptions: function( position ) {\r
+ var options = this._buildSimpleOptions( position, "ui-spinner" );\r
+\r
+ options.classes[ "ui-spinner-up" ] = "";\r
+ options.classes[ "ui-spinner-down" ] = "";\r
+\r
+ return options;\r
+ },\r
+\r
+ _buttonOptions: function( position ) {\r
+ return this._buildSimpleOptions( position, "ui-button" );\r
+ },\r
+\r
+ _checkboxradioOptions: function( position ) {\r
+ return this._buildSimpleOptions( position, "ui-checkboxradio-label" );\r
+ },\r
+\r
+ _selectmenuOptions: function( position ) {\r
+ var direction = this.options.direction === "vertical";\r
+ return {\r
+ width: direction ? "auto" : false,\r
+ classes: {\r
+ middle: {\r
+ "ui-selectmenu-button-open": "",\r
+ "ui-selectmenu-button-closed": ""\r
+ },\r
+ first: {\r
+ "ui-selectmenu-button-open": "ui-corner-" + ( direction ? "top" : "tl" ),\r
+ "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "top" : "left" )\r
+ },\r
+ last: {\r
+ "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr",\r
+ "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "bottom" : "right" )\r
+ },\r
+ only: {\r
+ "ui-selectmenu-button-open": "ui-corner-top",\r
+ "ui-selectmenu-button-closed": "ui-corner-all"\r
+ }\r
+\r
+ }[ position ]\r
+ };\r
+ },\r
+\r
+ _resolveClassesValues: function( classes, instance ) {\r
+ var result = {};\r
+ $.each( classes, function( key ) {\r
+ var current = instance.options.classes[ key ] || "";\r
+ current = String.prototype.trim.call( current.replace( controlgroupCornerRegex, "" ) );\r
+ result[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " );\r
+ } );\r
+ return result;\r
+ },\r
+\r
+ _setOption: function( key, value ) {\r
+ if ( key === "direction" ) {\r
+ this._removeClass( "ui-controlgroup-" + this.options.direction );\r
+ }\r
+\r
+ this._super( key, value );\r
+ if ( key === "disabled" ) {\r
+ this._callChildMethod( value ? "disable" : "enable" );\r
+ return;\r
+ }\r
+\r
+ this.refresh();\r
+ },\r
+\r
+ refresh: function() {\r
+ var children,\r
+ that = this;\r
+\r
+ this._addClass( "ui-controlgroup ui-controlgroup-" + this.options.direction );\r
+\r
+ if ( this.options.direction === "horizontal" ) {\r
+ this._addClass( null, "ui-helper-clearfix" );\r
+ }\r
+ this._initWidgets();\r
+\r
+ children = this.childWidgets;\r
+\r
+ // We filter here because we need to track all childWidgets not just the visible ones\r
+ if ( this.options.onlyVisible ) {\r
+ children = children.filter( ":visible" );\r
+ }\r
+\r
+ if ( children.length ) {\r
+\r
+ // We do this last because we need to make sure all enhancment is done\r
+ // before determining first and last\r
+ $.each( [ "first", "last" ], function( index, value ) {\r
+ var instance = children[ value ]().data( "ui-controlgroup-data" );\r
+\r
+ if ( instance && that[ "_" + instance.widgetName + "Options" ] ) {\r
+ var options = that[ "_" + instance.widgetName + "Options" ](\r
+ children.length === 1 ? "only" : value\r
+ );\r
+ options.classes = that._resolveClassesValues( options.classes, instance );\r
+ instance.element[ instance.widgetName ]( options );\r
+ } else {\r
+ that._updateCornerClass( children[ value ](), value );\r
+ }\r
+ } );\r
+\r
+ // Finally call the refresh method on each of the child widgets.\r
+ this._callChildMethod( "refresh" );\r
+ }\r
+ }\r
+} );\r
+\r
+/*!\r
+ * jQuery UI Checkboxradio 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Checkboxradio\r
+//>>group: Widgets\r
+//>>description: Enhances a form with multiple themeable checkboxes or radio buttons.\r
+//>>docs: http://api.jqueryui.com/checkboxradio/\r
+//>>demos: http://jqueryui.com/checkboxradio/\r
+//>>css.structure: ../../themes/base/core.css\r
+//>>css.structure: ../../themes/base/button.css\r
+//>>css.structure: ../../themes/base/checkboxradio.css\r
+//>>css.theme: ../../themes/base/theme.css\r
+\r
+\r
+$.widget( "ui.checkboxradio", [ $.ui.formResetMixin, {\r
+ version: "1.13.1",\r
+ options: {\r
+ disabled: null,\r
+ label: null,\r
+ icon: true,\r
+ classes: {\r
+ "ui-checkboxradio-label": "ui-corner-all",\r
+ "ui-checkboxradio-icon": "ui-corner-all"\r
+ }\r
+ },\r
+\r
+ _getCreateOptions: function() {\r
+ var disabled, labels;\r
+ var that = this;\r
+ var options = this._super() || {};\r
+\r
+ // We read the type here, because it makes more sense to throw a element type error first,\r
+ // rather then the error for lack of a label. Often if its the wrong type, it\r
+ // won't have a label (e.g. calling on a div, btn, etc)\r
+ this._readType();\r
+\r
+ labels = this.element.labels();\r
+\r
+ // If there are multiple labels, use the last one\r
+ this.label = $( labels[ labels.length - 1 ] );\r
+ if ( !this.label.length ) {\r
+ $.error( "No label found for checkboxradio widget" );\r
+ }\r
+\r
+ this.originalLabel = "";\r
+\r
+ // We need to get the label text but this may also need to make sure it does not contain the\r
+ // input itself.\r
+ this.label.contents().not( this.element[ 0 ] ).each( function() {\r
+\r
+ // The label contents could be text, html, or a mix. We concat each element to get a\r
+ // string representation of the label, without the input as part of it.\r
+ that.originalLabel += this.nodeType === 3 ? $( this ).text() : this.outerHTML;\r
+ } );\r
+\r
+ // Set the label option if we found label text\r
+ if ( this.originalLabel ) {\r
+ options.label = this.originalLabel;\r
+ }\r
+\r
+ disabled = this.element[ 0 ].disabled;\r
+ if ( disabled != null ) {\r
+ options.disabled = disabled;\r
+ }\r
+ return options;\r
+ },\r
+\r
+ _create: function() {\r
+ var checked = this.element[ 0 ].checked;\r
+\r
+ this._bindFormResetHandler();\r
+\r
+ if ( this.options.disabled == null ) {\r
+ this.options.disabled = this.element[ 0 ].disabled;\r
+ }\r
+\r
+ this._setOption( "disabled", this.options.disabled );\r
+ this._addClass( "ui-checkboxradio", "ui-helper-hidden-accessible" );\r
+ this._addClass( this.label, "ui-checkboxradio-label", "ui-button ui-widget" );\r
+\r
+ if ( this.type === "radio" ) {\r
+ this._addClass( this.label, "ui-checkboxradio-radio-label" );\r
+ }\r
+\r
+ if ( this.options.label && this.options.label !== this.originalLabel ) {\r
+ this._updateLabel();\r
+ } else if ( this.originalLabel ) {\r
+ this.options.label = this.originalLabel;\r
+ }\r
+\r
+ this._enhance();\r
+\r
+ if ( checked ) {\r
+ this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" );\r
+ }\r
+\r
+ this._on( {\r
+ change: "_toggleClasses",\r
+ focus: function() {\r
+ this._addClass( this.label, null, "ui-state-focus ui-visual-focus" );\r
+ },\r
+ blur: function() {\r
+ this._removeClass( this.label, null, "ui-state-focus ui-visual-focus" );\r
+ }\r
+ } );\r
+ },\r
+\r
+ _readType: function() {\r
+ var nodeName = this.element[ 0 ].nodeName.toLowerCase();\r
+ this.type = this.element[ 0 ].type;\r
+ if ( nodeName !== "input" || !/radio|checkbox/.test( this.type ) ) {\r
+ $.error( "Can't create checkboxradio on element.nodeName=" + nodeName +\r
+ " and element.type=" + this.type );\r
+ }\r
+ },\r
+\r
+ // Support jQuery Mobile enhanced option\r
+ _enhance: function() {\r
+ this._updateIcon( this.element[ 0 ].checked );\r
+ },\r
+\r
+ widget: function() {\r
+ return this.label;\r
+ },\r
+\r
+ _getRadioGroup: function() {\r
+ var group;\r
+ var name = this.element[ 0 ].name;\r
+ var nameSelector = "input[name='" + $.escapeSelector( name ) + "']";\r
+\r
+ if ( !name ) {\r
+ return $( [] );\r
+ }\r
+\r
+ if ( this.form.length ) {\r
+ group = $( this.form[ 0 ].elements ).filter( nameSelector );\r
+ } else {\r
+\r
+ // Not inside a form, check all inputs that also are not inside a form\r
+ group = $( nameSelector ).filter( function() {\r
+ return $( this )._form().length === 0;\r
+ } );\r
+ }\r
+\r
+ return group.not( this.element );\r
+ },\r
+\r
+ _toggleClasses: function() {\r
+ var checked = this.element[ 0 ].checked;\r
+ this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );\r
+\r
+ if ( this.options.icon && this.type === "checkbox" ) {\r
+ this._toggleClass( this.icon, null, "ui-icon-check ui-state-checked", checked )\r
+ ._toggleClass( this.icon, null, "ui-icon-blank", !checked );\r
+ }\r
+\r
+ if ( this.type === "radio" ) {\r
+ this._getRadioGroup()\r
+ .each( function() {\r
+ var instance = $( this ).checkboxradio( "instance" );\r
+\r
+ if ( instance ) {\r
+ instance._removeClass( instance.label,\r
+ "ui-checkboxradio-checked", "ui-state-active" );\r
+ }\r
+ } );\r
+ }\r
+ },\r
+\r
+ _destroy: function() {\r
+ this._unbindFormResetHandler();\r
+\r
+ if ( this.icon ) {\r
+ this.icon.remove();\r
+ this.iconSpace.remove();\r
+ }\r
+ },\r
+\r
+ _setOption: function( key, value ) {\r
+\r
+ // We don't allow the value to be set to nothing\r
+ if ( key === "label" && !value ) {\r
+ return;\r
+ }\r
+\r
+ this._super( key, value );\r
+\r
+ if ( key === "disabled" ) {\r
+ this._toggleClass( this.label, null, "ui-state-disabled", value );\r
+ this.element[ 0 ].disabled = value;\r
+\r
+ // Don't refresh when setting disabled\r
+ return;\r
+ }\r
+ this.refresh();\r
+ },\r
+\r
+ _updateIcon: function( checked ) {\r
+ var toAdd = "ui-icon ui-icon-background ";\r
+\r
+ if ( this.options.icon ) {\r
+ if ( !this.icon ) {\r
+ this.icon = $( "<span>" );\r
+ this.iconSpace = $( "<span> </span>" );\r
+ this._addClass( this.iconSpace, "ui-checkboxradio-icon-space" );\r
+ }\r
+\r
+ if ( this.type === "checkbox" ) {\r
+ toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank";\r
+ this._removeClass( this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check" );\r
+ } else {\r
+ toAdd += "ui-icon-blank";\r
+ }\r
+ this._addClass( this.icon, "ui-checkboxradio-icon", toAdd );\r
+ if ( !checked ) {\r
+ this._removeClass( this.icon, null, "ui-icon-check ui-state-checked" );\r
+ }\r
+ this.icon.prependTo( this.label ).after( this.iconSpace );\r
+ } else if ( this.icon !== undefined ) {\r
+ this.icon.remove();\r
+ this.iconSpace.remove();\r
+ delete this.icon;\r
+ }\r
+ },\r
+\r
+ _updateLabel: function() {\r
+\r
+ // Remove the contents of the label ( minus the icon, icon space, and input )\r
+ var contents = this.label.contents().not( this.element[ 0 ] );\r
+ if ( this.icon ) {\r
+ contents = contents.not( this.icon[ 0 ] );\r
+ }\r
+ if ( this.iconSpace ) {\r
+ contents = contents.not( this.iconSpace[ 0 ] );\r
+ }\r
+ contents.remove();\r
+\r
+ this.label.append( this.options.label );\r
+ },\r
+\r
+ refresh: function() {\r
+ var checked = this.element[ 0 ].checked,\r
+ isDisabled = this.element[ 0 ].disabled;\r
+\r
+ this._updateIcon( checked );\r
+ this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );\r
+ if ( this.options.label !== null ) {\r
+ this._updateLabel();\r
+ }\r
+\r
+ if ( isDisabled !== this.options.disabled ) {\r
+ this._setOptions( { "disabled": isDisabled } );\r
+ }\r
+ }\r
+\r
+} ] );\r
+\r
+var widgetsCheckboxradio = $.ui.checkboxradio;\r
+\r
+\r
+/*!\r
+ * jQuery UI Button 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Button\r
+//>>group: Widgets\r
+//>>description: Enhances a form with themeable buttons.\r
+//>>docs: http://api.jqueryui.com/button/\r
+//>>demos: http://jqueryui.com/button/\r
+//>>css.structure: ../../themes/base/core.css\r
+//>>css.structure: ../../themes/base/button.css\r
+//>>css.theme: ../../themes/base/theme.css\r
+\r
+\r
+$.widget( "ui.button", {\r
+ version: "1.13.1",\r
+ defaultElement: "<button>",\r
+ options: {\r
+ classes: {\r
+ "ui-button": "ui-corner-all"\r
+ },\r
+ disabled: null,\r
+ icon: null,\r
+ iconPosition: "beginning",\r
+ label: null,\r
+ showLabel: true\r
+ },\r
+\r
+ _getCreateOptions: function() {\r
+ var disabled,\r
+\r
+ // This is to support cases like in jQuery Mobile where the base widget does have\r
+ // an implementation of _getCreateOptions\r
+ options = this._super() || {};\r
+\r
+ this.isInput = this.element.is( "input" );\r
+\r
+ disabled = this.element[ 0 ].disabled;\r
+ if ( disabled != null ) {\r
+ options.disabled = disabled;\r
+ }\r
+\r
+ this.originalLabel = this.isInput ? this.element.val() : this.element.html();\r
+ if ( this.originalLabel ) {\r
+ options.label = this.originalLabel;\r
+ }\r
+\r
+ return options;\r
+ },\r
+\r
+ _create: function() {\r
+ if ( !this.option.showLabel & !this.options.icon ) {\r
+ this.options.showLabel = true;\r
+ }\r
+\r
+ // We have to check the option again here even though we did in _getCreateOptions,\r
+ // because null may have been passed on init which would override what was set in\r
+ // _getCreateOptions\r
+ if ( this.options.disabled == null ) {\r
+ this.options.disabled = this.element[ 0 ].disabled || false;\r
+ }\r
+\r
+ this.hasTitle = !!this.element.attr( "title" );\r
+\r
+ // Check to see if the label needs to be set or if its already correct\r
+ if ( this.options.label && this.options.label !== this.originalLabel ) {\r
+ if ( this.isInput ) {\r
+ this.element.val( this.options.label );\r
+ } else {\r
+ this.element.html( this.options.label );\r
+ }\r
+ }\r
+ this._addClass( "ui-button", "ui-widget" );\r
+ this._setOption( "disabled", this.options.disabled );\r
+ this._enhance();\r
+\r
+ if ( this.element.is( "a" ) ) {\r
+ this._on( {\r
+ "keyup": function( event ) {\r
+ if ( event.keyCode === $.ui.keyCode.SPACE ) {\r
+ event.preventDefault();\r
+\r
+ // Support: PhantomJS <= 1.9, IE 8 Only\r
+ // If a native click is available use it so we actually cause navigation\r
+ // otherwise just trigger a click event\r
+ if ( this.element[ 0 ].click ) {\r
+ this.element[ 0 ].click();\r
+ } else {\r
+ this.element.trigger( "click" );\r
+ }\r
+ }\r
+ }\r
+ } );\r
+ }\r
+ },\r
+\r
+ _enhance: function() {\r
+ if ( !this.element.is( "button" ) ) {\r
+ this.element.attr( "role", "button" );\r
+ }\r
+\r
+ if ( this.options.icon ) {\r
+ this._updateIcon( "icon", this.options.icon );\r
+ this._updateTooltip();\r
+ }\r
+ },\r
+\r
+ _updateTooltip: function() {\r
+ this.title = this.element.attr( "title" );\r
+\r
+ if ( !this.options.showLabel && !this.title ) {\r
+ this.element.attr( "title", this.options.label );\r
+ }\r
+ },\r
+\r
+ _updateIcon: function( option, value ) {\r
+ var icon = option !== "iconPosition",\r
+ position = icon ? this.options.iconPosition : value,\r
+ displayBlock = position === "top" || position === "bottom";\r
+\r
+ // Create icon\r
+ if ( !this.icon ) {\r
+ this.icon = $( "<span>" );\r
+\r
+ this._addClass( this.icon, "ui-button-icon", "ui-icon" );\r
+\r
+ if ( !this.options.showLabel ) {\r
+ this._addClass( "ui-button-icon-only" );\r
+ }\r
+ } else if ( icon ) {\r
+\r
+ // If we are updating the icon remove the old icon class\r
+ this._removeClass( this.icon, null, this.options.icon );\r
+ }\r
+\r
+ // If we are updating the icon add the new icon class\r
+ if ( icon ) {\r
+ this._addClass( this.icon, null, value );\r
+ }\r
+\r
+ this._attachIcon( position );\r
+\r
+ // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove\r
+ // the iconSpace if there is one.\r
+ if ( displayBlock ) {\r
+ this._addClass( this.icon, null, "ui-widget-icon-block" );\r
+ if ( this.iconSpace ) {\r
+ this.iconSpace.remove();\r
+ }\r
+ } else {\r
+\r
+ // Position is beginning or end so remove the ui-widget-icon-block class and add the\r
+ // space if it does not exist\r
+ if ( !this.iconSpace ) {\r
+ this.iconSpace = $( "<span> </span>" );\r
+ this._addClass( this.iconSpace, "ui-button-icon-space" );\r
+ }\r
+ this._removeClass( this.icon, null, "ui-wiget-icon-block" );\r
+ this._attachIconSpace( position );\r
+ }\r
+ },\r
+\r
+ _destroy: function() {\r
+ this.element.removeAttr( "role" );\r
+\r
+ if ( this.icon ) {\r
+ this.icon.remove();\r
+ }\r
+ if ( this.iconSpace ) {\r
+ this.iconSpace.remove();\r
+ }\r
+ if ( !this.hasTitle ) {\r
+ this.element.removeAttr( "title" );\r
+ }\r
+ },\r
+\r
+ _attachIconSpace: function( iconPosition ) {\r
+ this.icon[ /^(?:end|bottom)/.test( iconPosition ) ? "before" : "after" ]( this.iconSpace );\r
+ },\r
+\r
+ _attachIcon: function( iconPosition ) {\r
+ this.element[ /^(?:end|bottom)/.test( iconPosition ) ? "append" : "prepend" ]( this.icon );\r
+ },\r
+\r
+ _setOptions: function( options ) {\r
+ var newShowLabel = options.showLabel === undefined ?\r
+ this.options.showLabel :\r
+ options.showLabel,\r
+ newIcon = options.icon === undefined ? this.options.icon : options.icon;\r
+\r
+ if ( !newShowLabel && !newIcon ) {\r
+ options.showLabel = true;\r
+ }\r
+ this._super( options );\r
+ },\r
+\r
+ _setOption: function( key, value ) {\r
+ if ( key === "icon" ) {\r
+ if ( value ) {\r
+ this._updateIcon( key, value );\r
+ } else if ( this.icon ) {\r
+ this.icon.remove();\r
+ if ( this.iconSpace ) {\r
+ this.iconSpace.remove();\r
+ }\r
+ }\r
+ }\r
+\r
+ if ( key === "iconPosition" ) {\r
+ this._updateIcon( key, value );\r
+ }\r
+\r
+ // Make sure we can't end up with a button that has neither text nor icon\r
+ if ( key === "showLabel" ) {\r
+ this._toggleClass( "ui-button-icon-only", null, !value );\r
+ this._updateTooltip();\r
+ }\r
+\r
+ if ( key === "label" ) {\r
+ if ( this.isInput ) {\r
+ this.element.val( value );\r
+ } else {\r
+\r
+ // If there is an icon, append it, else nothing then append the value\r
+ // this avoids removal of the icon when setting label text\r
+ this.element.html( value );\r
+ if ( this.icon ) {\r
+ this._attachIcon( this.options.iconPosition );\r
+ this._attachIconSpace( this.options.iconPosition );\r
+ }\r
+ }\r
+ }\r
+\r
+ this._super( key, value );\r
+\r
+ if ( key === "disabled" ) {\r
+ this._toggleClass( null, "ui-state-disabled", value );\r
+ this.element[ 0 ].disabled = value;\r
+ if ( value ) {\r
+ this.element.trigger( "blur" );\r
+ }\r
+ }\r
+ },\r
+\r
+ refresh: function() {\r
+\r
+ // Make sure to only check disabled if its an element that supports this otherwise\r
+ // check for the disabled class to determine state\r
+ var isDisabled = this.element.is( "input, button" ) ?\r
+ this.element[ 0 ].disabled : this.element.hasClass( "ui-button-disabled" );\r
+\r
+ if ( isDisabled !== this.options.disabled ) {\r
+ this._setOptions( { disabled: isDisabled } );\r
+ }\r
+\r
+ this._updateTooltip();\r
+ }\r
+} );\r
+\r
+// DEPRECATED\r
+if ( $.uiBackCompat !== false ) {\r
+\r
+ // Text and Icons options\r
+ $.widget( "ui.button", $.ui.button, {\r
+ options: {\r
+ text: true,\r
+ icons: {\r
+ primary: null,\r
+ secondary: null\r
+ }\r
+ },\r
+\r
+ _create: function() {\r
+ if ( this.options.showLabel && !this.options.text ) {\r
+ this.options.showLabel = this.options.text;\r
+ }\r
+ if ( !this.options.showLabel && this.options.text ) {\r
+ this.options.text = this.options.showLabel;\r
+ }\r
+ if ( !this.options.icon && ( this.options.icons.primary ||\r
+ this.options.icons.secondary ) ) {\r
+ if ( this.options.icons.primary ) {\r
+ this.options.icon = this.options.icons.primary;\r
+ } else {\r
+ this.options.icon = this.options.icons.secondary;\r
+ this.options.iconPosition = "end";\r
+ }\r
+ } else if ( this.options.icon ) {\r
+ this.options.icons.primary = this.options.icon;\r
+ }\r
+ this._super();\r
+ },\r
+\r
+ _setOption: function( key, value ) {\r
+ if ( key === "text" ) {\r
+ this._super( "showLabel", value );\r
+ return;\r
+ }\r
+ if ( key === "showLabel" ) {\r
+ this.options.text = value;\r
+ }\r
+ if ( key === "icon" ) {\r
+ this.options.icons.primary = value;\r
+ }\r
+ if ( key === "icons" ) {\r
+ if ( value.primary ) {\r
+ this._super( "icon", value.primary );\r
+ this._super( "iconPosition", "beginning" );\r
+ } else if ( value.secondary ) {\r
+ this._super( "icon", value.secondary );\r
+ this._super( "iconPosition", "end" );\r
+ }\r
+ }\r
+ this._superApply( arguments );\r
+ }\r
+ } );\r
+\r
+ $.fn.button = ( function( orig ) {\r
+ return function( options ) {\r
+ var isMethodCall = typeof options === "string";\r
+ var args = Array.prototype.slice.call( arguments, 1 );\r
+ var returnValue = this;\r
+\r
+ if ( isMethodCall ) {\r
+\r
+ // If this is an empty collection, we need to have the instance method\r
+ // return undefined instead of the jQuery instance\r
+ if ( !this.length && options === "instance" ) {\r
+ returnValue = undefined;\r
+ } else {\r
+ this.each( function() {\r
+ var methodValue;\r
+ var type = $( this ).attr( "type" );\r
+ var name = type !== "checkbox" && type !== "radio" ?\r
+ "button" :\r
+ "checkboxradio";\r
+ var instance = $.data( this, "ui-" + name );\r
+\r
+ if ( options === "instance" ) {\r
+ returnValue = instance;\r
+ return false;\r
+ }\r
+\r
+ if ( !instance ) {\r
+ return $.error( "cannot call methods on button" +\r
+ " prior to initialization; " +\r
+ "attempted to call method '" + options + "'" );\r
+ }\r
+\r
+ if ( typeof instance[ options ] !== "function" ||\r
+ options.charAt( 0 ) === "_" ) {\r
+ return $.error( "no such method '" + options + "' for button" +\r
+ " widget instance" );\r
+ }\r
+\r
+ methodValue = instance[ options ].apply( instance, args );\r
+\r
+ if ( methodValue !== instance && methodValue !== undefined ) {\r
+ returnValue = methodValue && methodValue.jquery ?\r
+ returnValue.pushStack( methodValue.get() ) :\r
+ methodValue;\r
+ return false;\r
+ }\r
+ } );\r
+ }\r
+ } else {\r
+\r
+ // Allow multiple hashes to be passed on init\r
+ if ( args.length ) {\r
+ options = $.widget.extend.apply( null, [ options ].concat( args ) );\r
+ }\r
+\r
+ this.each( function() {\r
+ var type = $( this ).attr( "type" );\r
+ var name = type !== "checkbox" && type !== "radio" ? "button" : "checkboxradio";\r
+ var instance = $.data( this, "ui-" + name );\r
+\r
+ if ( instance ) {\r
+ instance.option( options || {} );\r
+ if ( instance._init ) {\r
+ instance._init();\r
+ }\r
+ } else {\r
+ if ( name === "button" ) {\r
+ orig.call( $( this ), options );\r
+ return;\r
+ }\r
+\r
+ $( this ).checkboxradio( $.extend( { icon: false }, options ) );\r
+ }\r
+ } );\r
+ }\r
+\r
+ return returnValue;\r
+ };\r
+ } )( $.fn.button );\r
+\r
+ $.fn.buttonset = function() {\r
+ if ( !$.ui.controlgroup ) {\r
+ $.error( "Controlgroup widget missing" );\r
+ }\r
+ if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" && arguments[ 2 ] ) {\r
+ return this.controlgroup.apply( this,\r
+ [ arguments[ 0 ], "items.button", arguments[ 2 ] ] );\r
+ }\r
+ if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" ) {\r
+ return this.controlgroup.apply( this, [ arguments[ 0 ], "items.button" ] );\r
+ }\r
+ if ( typeof arguments[ 0 ] === "object" && arguments[ 0 ].items ) {\r
+ arguments[ 0 ].items = {\r
+ button: arguments[ 0 ].items\r
+ };\r
+ }\r
+ return this.controlgroup.apply( this, arguments );\r
+ };\r
+}\r
+\r
+var widgetsButton = $.ui.button;\r
+\r
+\r
+/* eslint-disable max-len, camelcase */\r
+/*!\r
+ * jQuery UI Datepicker 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Datepicker\r
+//>>group: Widgets\r
+//>>description: Displays a calendar from an input or inline for selecting dates.\r
+//>>docs: http://api.jqueryui.com/datepicker/\r
+//>>demos: http://jqueryui.com/datepicker/\r
+//>>css.structure: ../../themes/base/core.css\r
+//>>css.structure: ../../themes/base/datepicker.css\r
+//>>css.theme: ../../themes/base/theme.css\r
+\r
+\r
+$.extend( $.ui, { datepicker: { version: "1.13.1" } } );\r
+\r
+var datepicker_instActive;\r
+\r
+function datepicker_getZindex( elem ) {\r
+ var position, value;\r
+ while ( elem.length && elem[ 0 ] !== document ) {\r
+\r
+ // Ignore z-index if position is set to a value where z-index is ignored by the browser\r
+ // This makes behavior of this function consistent across browsers\r
+ // WebKit always returns auto if the element is positioned\r
+ position = elem.css( "position" );\r
+ if ( position === "absolute" || position === "relative" || position === "fixed" ) {\r
+\r
+ // IE returns 0 when zIndex is not specified\r
+ // other browsers return a string\r
+ // we ignore the case of nested elements with an explicit value of 0\r
+ // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>\r
+ value = parseInt( elem.css( "zIndex" ), 10 );\r
+ if ( !isNaN( value ) && value !== 0 ) {\r
+ return value;\r
+ }\r
+ }\r
+ elem = elem.parent();\r
+ }\r
+\r
+ return 0;\r
+}\r
+\r
+/* Date picker manager.\r
+ Use the singleton instance of this class, $.datepicker, to interact with the date picker.\r
+ Settings for (groups of) date pickers are maintained in an instance object,\r
+ allowing multiple different settings on the same page. */\r
+\r
+function Datepicker() {\r
+ this._curInst = null; // The current instance in use\r
+ this._keyEvent = false; // If the last event was a key event\r
+ this._disabledInputs = []; // List of date picker inputs that have been disabled\r
+ this._datepickerShowing = false; // True if the popup picker is showing , false if not\r
+ this._inDialog = false; // True if showing within a "dialog", false if not\r
+ this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division\r
+ this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class\r
+ this._appendClass = "ui-datepicker-append"; // The name of the append marker class\r
+ this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class\r
+ this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class\r
+ this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class\r
+ this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class\r
+ this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class\r
+ this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class\r
+ this.regional = []; // Available regional settings, indexed by language code\r
+ this.regional[ "" ] = { // Default regional settings\r
+ closeText: "Done", // Display text for close link\r
+ prevText: "Prev", // Display text for previous month link\r
+ nextText: "Next", // Display text for next month link\r
+ currentText: "Today", // Display text for current month link\r
+ monthNames: [ "January", "February", "March", "April", "May", "June",\r
+ "July", "August", "September", "October", "November", "December" ], // Names of months for drop-down and formatting\r
+ monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting\r
+ dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting\r
+ dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting\r
+ dayNamesMin: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ], // Column headings for days starting at Sunday\r
+ weekHeader: "Wk", // Column header for week of the year\r
+ dateFormat: "mm/dd/yy", // See format options on parseDate\r
+ firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\r
+ isRTL: false, // True if right-to-left language, false if left-to-right\r
+ showMonthAfterYear: false, // True if the year select precedes month, false for month then year\r
+ yearSuffix: "", // Additional text to append to the year in the month headers,\r
+ selectMonthLabel: "Select month", // Invisible label for month selector\r
+ selectYearLabel: "Select year" // Invisible label for year selector\r
+ };\r
+ this._defaults = { // Global defaults for all the date picker instances\r
+ showOn: "focus", // "focus" for popup on focus,\r
+ // "button" for trigger button, or "both" for either\r
+ showAnim: "fadeIn", // Name of jQuery animation for popup\r
+ showOptions: {}, // Options for enhanced animations\r
+ defaultDate: null, // Used when field is blank: actual date,\r
+ // +/-number for offset from today, null for today\r
+ appendText: "", // Display text following the input box, e.g. showing the format\r
+ buttonText: "...", // Text for trigger button\r
+ buttonImage: "", // URL for trigger button image\r
+ buttonImageOnly: false, // True if the image appears alone, false if it appears on a button\r
+ hideIfNoPrevNext: false, // True to hide next/previous month links\r
+ // if not applicable, false to just disable them\r
+ navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\r
+ gotoCurrent: false, // True if today link goes back to current selection instead\r
+ changeMonth: false, // True if month can be selected directly, false if only prev/next\r
+ changeYear: false, // True if year can be selected directly, false if only prev/next\r
+ yearRange: "c-10:c+10", // Range of years to display in drop-down,\r
+ // either relative to today's year (-nn:+nn), relative to currently displayed year\r
+ // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\r
+ showOtherMonths: false, // True to show dates in other months, false to leave blank\r
+ selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\r
+ showWeek: false, // True to show week of the year, false to not show it\r
+ calculateWeek: this.iso8601Week, // How to calculate the week of the year,\r
+ // takes a Date and returns the number of the week for it\r
+ shortYearCutoff: "+10", // Short year values < this are in the current century,\r
+ // > this are in the previous century,\r
+ // string value starting with "+" for current year + value\r
+ minDate: null, // The earliest selectable date, or null for no limit\r
+ maxDate: null, // The latest selectable date, or null for no limit\r
+ duration: "fast", // Duration of display/closure\r
+ beforeShowDay: null, // Function that takes a date and returns an array with\r
+ // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",\r
+ // [2] = cell title (optional), e.g. $.datepicker.noWeekends\r
+ beforeShow: null, // Function that takes an input field and\r
+ // returns a set of custom settings for the date picker\r
+ onSelect: null, // Define a callback function when a date is selected\r
+ onChangeMonthYear: null, // Define a callback function when the month or year is changed\r
+ onClose: null, // Define a callback function when the datepicker is closed\r
+ onUpdateDatepicker: null, // Define a callback function when the datepicker is updated\r
+ numberOfMonths: 1, // Number of months to show at a time\r
+ showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\r
+ stepMonths: 1, // Number of months to step back/forward\r
+ stepBigMonths: 12, // Number of months to step back/forward for the big links\r
+ altField: "", // Selector for an alternate field to store selected dates into\r
+ altFormat: "", // The date format to use for the alternate field\r
+ constrainInput: true, // The input is constrained by the current date format\r
+ showButtonPanel: false, // True to show button panel, false to not show it\r
+ autoSize: false, // True to size the input for the date format, false to leave as is\r
+ disabled: false // The initial disabled state\r
+ };\r
+ $.extend( this._defaults, this.regional[ "" ] );\r
+ this.regional.en = $.extend( true, {}, this.regional[ "" ] );\r
+ this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en );\r
+ this.dpDiv = datepicker_bindHover( $( "<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) );\r
+}\r
+\r
+$.extend( Datepicker.prototype, {\r
+\r
+ /* Class name added to elements to indicate already configured with a date picker. */\r
+ markerClassName: "hasDatepicker",\r
+\r
+ //Keep track of the maximum number of rows displayed (see #7043)\r
+ maxRows: 4,\r
+\r
+ // TODO rename to "widget" when switching to widget factory\r
+ _widgetDatepicker: function() {\r
+ return this.dpDiv;\r
+ },\r
+\r
+ /* Override the default settings for all instances of the date picker.\r
+ * @param settings object - the new settings to use as defaults (anonymous object)\r
+ * @return the manager object\r
+ */\r
+ setDefaults: function( settings ) {\r
+ datepicker_extendRemove( this._defaults, settings || {} );\r
+ return this;\r
+ },\r
+\r
+ /* Attach the date picker to a jQuery selection.\r
+ * @param target element - the target input field or division or span\r
+ * @param settings object - the new settings to use for this date picker instance (anonymous)\r
+ */\r
+ _attachDatepicker: function( target, settings ) {\r
+ var nodeName, inline, inst;\r
+ nodeName = target.nodeName.toLowerCase();\r
+ inline = ( nodeName === "div" || nodeName === "span" );\r
+ if ( !target.id ) {\r
+ this.uuid += 1;\r
+ target.id = "dp" + this.uuid;\r
+ }\r
+ inst = this._newInst( $( target ), inline );\r
+ inst.settings = $.extend( {}, settings || {} );\r
+ if ( nodeName === "input" ) {\r
+ this._connectDatepicker( target, inst );\r
+ } else if ( inline ) {\r
+ this._inlineDatepicker( target, inst );\r
+ }\r
+ },\r
+\r
+ /* Create a new instance object. */\r
+ _newInst: function( target, inline ) {\r
+ var id = target[ 0 ].id.replace( /([^A-Za-z0-9_\-])/g, "\\\\$1" ); // escape jQuery meta chars\r
+ return { id: id, input: target, // associated target\r
+ selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection\r
+ drawMonth: 0, drawYear: 0, // month being drawn\r
+ inline: inline, // is datepicker inline or not\r
+ dpDiv: ( !inline ? this.dpDiv : // presentation div\r
+ datepicker_bindHover( $( "<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ) ) };\r
+ },\r
+\r
+ /* Attach the date picker to an input field. */\r
+ _connectDatepicker: function( target, inst ) {\r
+ var input = $( target );\r
+ inst.append = $( [] );\r
+ inst.trigger = $( [] );\r
+ if ( input.hasClass( this.markerClassName ) ) {\r
+ return;\r
+ }\r
+ this._attachments( input, inst );\r
+ input.addClass( this.markerClassName ).on( "keydown", this._doKeyDown ).\r
+ on( "keypress", this._doKeyPress ).on( "keyup", this._doKeyUp );\r
+ this._autoSize( inst );\r
+ $.data( target, "datepicker", inst );\r
+\r
+ //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)\r
+ if ( inst.settings.disabled ) {\r
+ this._disableDatepicker( target );\r
+ }\r
+ },\r
+\r
+ /* Make attachments based on settings. */\r
+ _attachments: function( input, inst ) {\r
+ var showOn, buttonText, buttonImage,\r
+ appendText = this._get( inst, "appendText" ),\r
+ isRTL = this._get( inst, "isRTL" );\r
+\r
+ if ( inst.append ) {\r
+ inst.append.remove();\r
+ }\r
+ if ( appendText ) {\r
+ inst.append = $( "<span>" )\r
+ .addClass( this._appendClass )\r
+ .text( appendText );\r
+ input[ isRTL ? "before" : "after" ]( inst.append );\r
+ }\r
+\r
+ input.off( "focus", this._showDatepicker );\r
+\r
+ if ( inst.trigger ) {\r
+ inst.trigger.remove();\r
+ }\r
+\r
+ showOn = this._get( inst, "showOn" );\r
+ if ( showOn === "focus" || showOn === "both" ) { // pop-up date picker when in the marked field\r
+ input.on( "focus", this._showDatepicker );\r
+ }\r
+ if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked\r
+ buttonText = this._get( inst, "buttonText" );\r
+ buttonImage = this._get( inst, "buttonImage" );\r
+\r
+ if ( this._get( inst, "buttonImageOnly" ) ) {\r
+ inst.trigger = $( "<img>" )\r
+ .addClass( this._triggerClass )\r
+ .attr( {\r
+ src: buttonImage,\r
+ alt: buttonText,\r
+ title: buttonText\r
+ } );\r
+ } else {\r
+ inst.trigger = $( "<button type='button'>" )\r
+ .addClass( this._triggerClass );\r
+ if ( buttonImage ) {\r
+ inst.trigger.html(\r
+ $( "<img>" )\r
+ .attr( {\r
+ src: buttonImage,\r
+ alt: buttonText,\r
+ title: buttonText\r
+ } )\r
+ );\r
+ } else {\r
+ inst.trigger.text( buttonText );\r
+ }\r
+ }\r
+\r
+ input[ isRTL ? "before" : "after" ]( inst.trigger );\r
+ inst.trigger.on( "click", function() {\r
+ if ( $.datepicker._datepickerShowing && $.datepicker._lastInput === input[ 0 ] ) {\r
+ $.datepicker._hideDatepicker();\r
+ } else if ( $.datepicker._datepickerShowing && $.datepicker._lastInput !== input[ 0 ] ) {\r
+ $.datepicker._hideDatepicker();\r
+ $.datepicker._showDatepicker( input[ 0 ] );\r
+ } else {\r
+ $.datepicker._showDatepicker( input[ 0 ] );\r
+ }\r
+ return false;\r
+ } );\r
+ }\r
+ },\r
+\r
+ /* Apply the maximum length for the date format. */\r
+ _autoSize: function( inst ) {\r
+ if ( this._get( inst, "autoSize" ) && !inst.inline ) {\r
+ var findMax, max, maxI, i,\r
+ date = new Date( 2009, 12 - 1, 20 ), // Ensure double digits\r
+ dateFormat = this._get( inst, "dateFormat" );\r
+\r
+ if ( dateFormat.match( /[DM]/ ) ) {\r
+ findMax = function( names ) {\r
+ max = 0;\r
+ maxI = 0;\r
+ for ( i = 0; i < names.length; i++ ) {\r
+ if ( names[ i ].length > max ) {\r
+ max = names[ i ].length;\r
+ maxI = i;\r
+ }\r
+ }\r
+ return maxI;\r
+ };\r
+ date.setMonth( findMax( this._get( inst, ( dateFormat.match( /MM/ ) ?\r
+ "monthNames" : "monthNamesShort" ) ) ) );\r
+ date.setDate( findMax( this._get( inst, ( dateFormat.match( /DD/ ) ?\r
+ "dayNames" : "dayNamesShort" ) ) ) + 20 - date.getDay() );\r
+ }\r
+ inst.input.attr( "size", this._formatDate( inst, date ).length );\r
+ }\r
+ },\r
+\r
+ /* Attach an inline date picker to a div. */\r
+ _inlineDatepicker: function( target, inst ) {\r
+ var divSpan = $( target );\r
+ if ( divSpan.hasClass( this.markerClassName ) ) {\r
+ return;\r
+ }\r
+ divSpan.addClass( this.markerClassName ).append( inst.dpDiv );\r
+ $.data( target, "datepicker", inst );\r
+ this._setDate( inst, this._getDefaultDate( inst ), true );\r
+ this._updateDatepicker( inst );\r
+ this._updateAlternate( inst );\r
+\r
+ //If disabled option is true, disable the datepicker before showing it (see ticket #5665)\r
+ if ( inst.settings.disabled ) {\r
+ this._disableDatepicker( target );\r
+ }\r
+\r
+ // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements\r
+ // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height\r
+ inst.dpDiv.css( "display", "block" );\r
+ },\r
+\r
+ /* Pop-up the date picker in a "dialog" box.\r
+ * @param input element - ignored\r
+ * @param date string or Date - the initial date to display\r
+ * @param onSelect function - the function to call when a date is selected\r
+ * @param settings object - update the dialog date picker instance's settings (anonymous object)\r
+ * @param pos int[2] - coordinates for the dialog's position within the screen or\r
+ * event - with x/y coordinates or\r
+ * leave empty for default (screen centre)\r
+ * @return the manager object\r
+ */\r
+ _dialogDatepicker: function( input, date, onSelect, settings, pos ) {\r
+ var id, browserWidth, browserHeight, scrollX, scrollY,\r
+ inst = this._dialogInst; // internal instance\r
+\r
+ if ( !inst ) {\r
+ this.uuid += 1;\r
+ id = "dp" + this.uuid;\r
+ this._dialogInput = $( "<input type='text' id='" + id +\r
+ "' style='position: absolute; top: -100px; width: 0px;'/>" );\r
+ this._dialogInput.on( "keydown", this._doKeyDown );\r
+ $( "body" ).append( this._dialogInput );\r
+ inst = this._dialogInst = this._newInst( this._dialogInput, false );\r
+ inst.settings = {};\r
+ $.data( this._dialogInput[ 0 ], "datepicker", inst );\r
+ }\r
+ datepicker_extendRemove( inst.settings, settings || {} );\r
+ date = ( date && date.constructor === Date ? this._formatDate( inst, date ) : date );\r
+ this._dialogInput.val( date );\r
+\r
+ this._pos = ( pos ? ( pos.length ? pos : [ pos.pageX, pos.pageY ] ) : null );\r
+ if ( !this._pos ) {\r
+ browserWidth = document.documentElement.clientWidth;\r
+ browserHeight = document.documentElement.clientHeight;\r
+ scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;\r
+ scrollY = document.documentElement.scrollTop || document.body.scrollTop;\r
+ this._pos = // should use actual width/height below\r
+ [ ( browserWidth / 2 ) - 100 + scrollX, ( browserHeight / 2 ) - 150 + scrollY ];\r
+ }\r
+\r
+ // Move input on screen for focus, but hidden behind dialog\r
+ this._dialogInput.css( "left", ( this._pos[ 0 ] + 20 ) + "px" ).css( "top", this._pos[ 1 ] + "px" );\r
+ inst.settings.onSelect = onSelect;\r
+ this._inDialog = true;\r
+ this.dpDiv.addClass( this._dialogClass );\r
+ this._showDatepicker( this._dialogInput[ 0 ] );\r
+ if ( $.blockUI ) {\r
+ $.blockUI( this.dpDiv );\r
+ }\r
+ $.data( this._dialogInput[ 0 ], "datepicker", inst );\r
+ return this;\r
+ },\r
+\r
+ /* Detach a datepicker from its control.\r
+ * @param target element - the target input field or division or span\r
+ */\r
+ _destroyDatepicker: function( target ) {\r
+ var nodeName,\r
+ $target = $( target ),\r
+ inst = $.data( target, "datepicker" );\r
+\r
+ if ( !$target.hasClass( this.markerClassName ) ) {\r
+ return;\r
+ }\r
+\r
+ nodeName = target.nodeName.toLowerCase();\r
+ $.removeData( target, "datepicker" );\r
+ if ( nodeName === "input" ) {\r
+ inst.append.remove();\r
+ inst.trigger.remove();\r
+ $target.removeClass( this.markerClassName ).\r
+ off( "focus", this._showDatepicker ).\r
+ off( "keydown", this._doKeyDown ).\r
+ off( "keypress", this._doKeyPress ).\r
+ off( "keyup", this._doKeyUp );\r
+ } else if ( nodeName === "div" || nodeName === "span" ) {\r
+ $target.removeClass( this.markerClassName ).empty();\r
+ }\r
+\r
+ if ( datepicker_instActive === inst ) {\r
+ datepicker_instActive = null;\r
+ this._curInst = null;\r
+ }\r
+ },\r
+\r
+ /* Enable the date picker to a jQuery selection.\r
+ * @param target element - the target input field or division or span\r
+ */\r
+ _enableDatepicker: function( target ) {\r
+ var nodeName, inline,\r
+ $target = $( target ),\r
+ inst = $.data( target, "datepicker" );\r
+\r
+ if ( !$target.hasClass( this.markerClassName ) ) {\r
+ return;\r
+ }\r
+\r
+ nodeName = target.nodeName.toLowerCase();\r
+ if ( nodeName === "input" ) {\r
+ target.disabled = false;\r
+ inst.trigger.filter( "button" ).\r
+ each( function() {\r
+ this.disabled = false;\r
+ } ).end().\r
+ filter( "img" ).css( { opacity: "1.0", cursor: "" } );\r
+ } else if ( nodeName === "div" || nodeName === "span" ) {\r
+ inline = $target.children( "." + this._inlineClass );\r
+ inline.children().removeClass( "ui-state-disabled" );\r
+ inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ).\r
+ prop( "disabled", false );\r
+ }\r
+ this._disabledInputs = $.map( this._disabledInputs,\r
+\r
+ // Delete entry\r
+ function( value ) {\r
+ return ( value === target ? null : value );\r
+ } );\r
+ },\r
+\r
+ /* Disable the date picker to a jQuery selection.\r
+ * @param target element - the target input field or division or span\r
+ */\r
+ _disableDatepicker: function( target ) {\r
+ var nodeName, inline,\r
+ $target = $( target ),\r
+ inst = $.data( target, "datepicker" );\r
+\r
+ if ( !$target.hasClass( this.markerClassName ) ) {\r
+ return;\r
+ }\r
+\r
+ nodeName = target.nodeName.toLowerCase();\r
+ if ( nodeName === "input" ) {\r
+ target.disabled = true;\r
+ inst.trigger.filter( "button" ).\r
+ each( function() {\r
+ this.disabled = true;\r
+ } ).end().\r
+ filter( "img" ).css( { opacity: "0.5", cursor: "default" } );\r
+ } else if ( nodeName === "div" || nodeName === "span" ) {\r
+ inline = $target.children( "." + this._inlineClass );\r
+ inline.children().addClass( "ui-state-disabled" );\r
+ inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ).\r
+ prop( "disabled", true );\r
+ }\r
+ this._disabledInputs = $.map( this._disabledInputs,\r
+\r
+ // Delete entry\r
+ function( value ) {\r
+ return ( value === target ? null : value );\r
+ } );\r
+ this._disabledInputs[ this._disabledInputs.length ] = target;\r
+ },\r
+\r
+ /* Is the first field in a jQuery collection disabled as a datepicker?\r
+ * @param target element - the target input field or division or span\r
+ * @return boolean - true if disabled, false if enabled\r
+ */\r
+ _isDisabledDatepicker: function( target ) {\r
+ if ( !target ) {\r
+ return false;\r
+ }\r
+ for ( var i = 0; i < this._disabledInputs.length; i++ ) {\r
+ if ( this._disabledInputs[ i ] === target ) {\r
+ return true;\r
+ }\r
+ }\r
+ return false;\r
+ },\r
+\r
+ /* Retrieve the instance data for the target control.\r
+ * @param target element - the target input field or division or span\r
+ * @return object - the associated instance data\r
+ * @throws error if a jQuery problem getting data\r
+ */\r
+ _getInst: function( target ) {\r
+ try {\r
+ return $.data( target, "datepicker" );\r
+ } catch ( err ) {\r
+ throw "Missing instance data for this datepicker";\r
+ }\r
+ },\r
+\r
+ /* Update or retrieve the settings for a date picker attached to an input field or division.\r
+ * @param target element - the target input field or division or span\r
+ * @param name object - the new settings to update or\r
+ * string - the name of the setting to change or retrieve,\r
+ * when retrieving also "all" for all instance settings or\r
+ * "defaults" for all global defaults\r
+ * @param value any - the new value for the setting\r
+ * (omit if above is an object or to retrieve a value)\r
+ */\r
+ _optionDatepicker: function( target, name, value ) {\r
+ var settings, date, minDate, maxDate,\r
+ inst = this._getInst( target );\r
+\r
+ if ( arguments.length === 2 && typeof name === "string" ) {\r
+ return ( name === "defaults" ? $.extend( {}, $.datepicker._defaults ) :\r
+ ( inst ? ( name === "all" ? $.extend( {}, inst.settings ) :\r
+ this._get( inst, name ) ) : null ) );\r
+ }\r
+\r
+ settings = name || {};\r
+ if ( typeof name === "string" ) {\r
+ settings = {};\r
+ settings[ name ] = value;\r
+ }\r
+\r
+ if ( inst ) {\r
+ if ( this._curInst === inst ) {\r
+ this._hideDatepicker();\r
+ }\r
+\r
+ date = this._getDateDatepicker( target, true );\r
+ minDate = this._getMinMaxDate( inst, "min" );\r
+ maxDate = this._getMinMaxDate( inst, "max" );\r
+ datepicker_extendRemove( inst.settings, settings );\r
+\r
+ // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided\r
+ if ( minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined ) {\r
+ inst.settings.minDate = this._formatDate( inst, minDate );\r
+ }\r
+ if ( maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined ) {\r
+ inst.settings.maxDate = this._formatDate( inst, maxDate );\r
+ }\r
+ if ( "disabled" in settings ) {\r
+ if ( settings.disabled ) {\r
+ this._disableDatepicker( target );\r
+ } else {\r
+ this._enableDatepicker( target );\r
+ }\r
+ }\r
+ this._attachments( $( target ), inst );\r
+ this._autoSize( inst );\r
+ this._setDate( inst, date );\r
+ this._updateAlternate( inst );\r
+ this._updateDatepicker( inst );\r
+ }\r
+ },\r
+\r
+ // Change method deprecated\r
+ _changeDatepicker: function( target, name, value ) {\r
+ this._optionDatepicker( target, name, value );\r
+ },\r
+\r
+ /* Redraw the date picker attached to an input field or division.\r
+ * @param target element - the target input field or division or span\r
+ */\r
+ _refreshDatepicker: function( target ) {\r
+ var inst = this._getInst( target );\r
+ if ( inst ) {\r
+ this._updateDatepicker( inst );\r
+ }\r
+ },\r
+\r
+ /* Set the dates for a jQuery selection.\r
+ * @param target element - the target input field or division or span\r
+ * @param date Date - the new date\r
+ */\r
+ _setDateDatepicker: function( target, date ) {\r
+ var inst = this._getInst( target );\r
+ if ( inst ) {\r
+ this._setDate( inst, date );\r
+ this._updateDatepicker( inst );\r
+ this._updateAlternate( inst );\r
+ }\r
+ },\r
+\r
+ /* Get the date(s) for the first entry in a jQuery selection.\r
+ * @param target element - the target input field or division or span\r
+ * @param noDefault boolean - true if no default date is to be used\r
+ * @return Date - the current date\r
+ */\r
+ _getDateDatepicker: function( target, noDefault ) {\r
+ var inst = this._getInst( target );\r
+ if ( inst && !inst.inline ) {\r
+ this._setDateFromField( inst, noDefault );\r
+ }\r
+ return ( inst ? this._getDate( inst ) : null );\r
+ },\r
+\r
+ /* Handle keystrokes. */\r
+ _doKeyDown: function( event ) {\r
+ var onSelect, dateStr, sel,\r
+ inst = $.datepicker._getInst( event.target ),\r
+ handled = true,\r
+ isRTL = inst.dpDiv.is( ".ui-datepicker-rtl" );\r
+\r
+ inst._keyEvent = true;\r
+ if ( $.datepicker._datepickerShowing ) {\r
+ switch ( event.keyCode ) {\r
+ case 9: $.datepicker._hideDatepicker();\r
+ handled = false;\r
+ break; // hide on tab out\r
+ case 13: sel = $( "td." + $.datepicker._dayOverClass + ":not(." +\r
+ $.datepicker._currentClass + ")", inst.dpDiv );\r
+ if ( sel[ 0 ] ) {\r
+ $.datepicker._selectDay( event.target, inst.selectedMonth, inst.selectedYear, sel[ 0 ] );\r
+ }\r
+\r
+ onSelect = $.datepicker._get( inst, "onSelect" );\r
+ if ( onSelect ) {\r
+ dateStr = $.datepicker._formatDate( inst );\r
+\r
+ // Trigger custom callback\r
+ onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] );\r
+ } else {\r
+ $.datepicker._hideDatepicker();\r
+ }\r
+\r
+ return false; // don't submit the form\r
+ case 27: $.datepicker._hideDatepicker();\r
+ break; // hide on escape\r
+ case 33: $.datepicker._adjustDate( event.target, ( event.ctrlKey ?\r
+ -$.datepicker._get( inst, "stepBigMonths" ) :\r
+ -$.datepicker._get( inst, "stepMonths" ) ), "M" );\r
+ break; // previous month/year on page up/+ ctrl\r
+ case 34: $.datepicker._adjustDate( event.target, ( event.ctrlKey ?\r
+ +$.datepicker._get( inst, "stepBigMonths" ) :\r
+ +$.datepicker._get( inst, "stepMonths" ) ), "M" );\r
+ break; // next month/year on page down/+ ctrl\r
+ case 35: if ( event.ctrlKey || event.metaKey ) {\r
+ $.datepicker._clearDate( event.target );\r
+ }\r
+ handled = event.ctrlKey || event.metaKey;\r
+ break; // clear on ctrl or command +end\r
+ case 36: if ( event.ctrlKey || event.metaKey ) {\r
+ $.datepicker._gotoToday( event.target );\r
+ }\r
+ handled = event.ctrlKey || event.metaKey;\r
+ break; // current on ctrl or command +home\r
+ case 37: if ( event.ctrlKey || event.metaKey ) {\r
+ $.datepicker._adjustDate( event.target, ( isRTL ? +1 : -1 ), "D" );\r
+ }\r
+ handled = event.ctrlKey || event.metaKey;\r
+\r
+ // -1 day on ctrl or command +left\r
+ if ( event.originalEvent.altKey ) {\r
+ $.datepicker._adjustDate( event.target, ( event.ctrlKey ?\r
+ -$.datepicker._get( inst, "stepBigMonths" ) :\r
+ -$.datepicker._get( inst, "stepMonths" ) ), "M" );\r
+ }\r
+\r
+ // next month/year on alt +left on Mac\r
+ break;\r
+ case 38: if ( event.ctrlKey || event.metaKey ) {\r
+ $.datepicker._adjustDate( event.target, -7, "D" );\r
+ }\r
+ handled = event.ctrlKey || event.metaKey;\r
+ break; // -1 week on ctrl or command +up\r
+ case 39: if ( event.ctrlKey || event.metaKey ) {\r
+ $.datepicker._adjustDate( event.target, ( isRTL ? -1 : +1 ), "D" );\r
+ }\r
+ handled = event.ctrlKey || event.metaKey;\r
+\r
+ // +1 day on ctrl or command +right\r
+ if ( event.originalEvent.altKey ) {\r
+ $.datepicker._adjustDate( event.target, ( event.ctrlKey ?\r
+ +$.datepicker._get( inst, "stepBigMonths" ) :\r
+ +$.datepicker._get( inst, "stepMonths" ) ), "M" );\r
+ }\r
+\r
+ // next month/year on alt +right\r
+ break;\r
+ case 40: if ( event.ctrlKey || event.metaKey ) {\r
+ $.datepicker._adjustDate( event.target, +7, "D" );\r
+ }\r
+ handled = event.ctrlKey || event.metaKey;\r
+ break; // +1 week on ctrl or command +down\r
+ default: handled = false;\r
+ }\r
+ } else if ( event.keyCode === 36 && event.ctrlKey ) { // display the date picker on ctrl+home\r
+ $.datepicker._showDatepicker( this );\r
+ } else {\r
+ handled = false;\r
+ }\r
+\r
+ if ( handled ) {\r
+ event.preventDefault();\r
+ event.stopPropagation();\r
+ }\r
+ },\r
+\r
+ /* Filter entered characters - based on date format. */\r
+ _doKeyPress: function( event ) {\r
+ var chars, chr,\r
+ inst = $.datepicker._getInst( event.target );\r
+\r
+ if ( $.datepicker._get( inst, "constrainInput" ) ) {\r
+ chars = $.datepicker._possibleChars( $.datepicker._get( inst, "dateFormat" ) );\r
+ chr = String.fromCharCode( event.charCode == null ? event.keyCode : event.charCode );\r
+ return event.ctrlKey || event.metaKey || ( chr < " " || !chars || chars.indexOf( chr ) > -1 );\r
+ }\r
+ },\r
+\r
+ /* Synchronise manual entry and field/alternate field. */\r
+ _doKeyUp: function( event ) {\r
+ var date,\r
+ inst = $.datepicker._getInst( event.target );\r
+\r
+ if ( inst.input.val() !== inst.lastVal ) {\r
+ try {\r
+ date = $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ),\r
+ ( inst.input ? inst.input.val() : null ),\r
+ $.datepicker._getFormatConfig( inst ) );\r
+\r
+ if ( date ) { // only if valid\r
+ $.datepicker._setDateFromField( inst );\r
+ $.datepicker._updateAlternate( inst );\r
+ $.datepicker._updateDatepicker( inst );\r
+ }\r
+ } catch ( err ) {\r
+ }\r
+ }\r
+ return true;\r
+ },\r
+\r
+ /* Pop-up the date picker for a given input field.\r
+ * If false returned from beforeShow event handler do not show.\r
+ * @param input element - the input field attached to the date picker or\r
+ * event - if triggered by focus\r
+ */\r
+ _showDatepicker: function( input ) {\r
+ input = input.target || input;\r
+ if ( input.nodeName.toLowerCase() !== "input" ) { // find from button/image trigger\r
+ input = $( "input", input.parentNode )[ 0 ];\r
+ }\r
+\r
+ if ( $.datepicker._isDisabledDatepicker( input ) || $.datepicker._lastInput === input ) { // already here\r
+ return;\r
+ }\r
+\r
+ var inst, beforeShow, beforeShowSettings, isFixed,\r
+ offset, showAnim, duration;\r
+\r
+ inst = $.datepicker._getInst( input );\r
+ if ( $.datepicker._curInst && $.datepicker._curInst !== inst ) {\r
+ $.datepicker._curInst.dpDiv.stop( true, true );\r
+ if ( inst && $.datepicker._datepickerShowing ) {\r
+ $.datepicker._hideDatepicker( $.datepicker._curInst.input[ 0 ] );\r
+ }\r
+ }\r
+\r
+ beforeShow = $.datepicker._get( inst, "beforeShow" );\r
+ beforeShowSettings = beforeShow ? beforeShow.apply( input, [ input, inst ] ) : {};\r
+ if ( beforeShowSettings === false ) {\r
+ return;\r
+ }\r
+ datepicker_extendRemove( inst.settings, beforeShowSettings );\r
+\r
+ inst.lastVal = null;\r
+ $.datepicker._lastInput = input;\r
+ $.datepicker._setDateFromField( inst );\r
+\r
+ if ( $.datepicker._inDialog ) { // hide cursor\r
+ input.value = "";\r
+ }\r
+ if ( !$.datepicker._pos ) { // position below input\r
+ $.datepicker._pos = $.datepicker._findPos( input );\r
+ $.datepicker._pos[ 1 ] += input.offsetHeight; // add the height\r
+ }\r
+\r
+ isFixed = false;\r
+ $( input ).parents().each( function() {\r
+ isFixed |= $( this ).css( "position" ) === "fixed";\r
+ return !isFixed;\r
+ } );\r
+\r
+ offset = { left: $.datepicker._pos[ 0 ], top: $.datepicker._pos[ 1 ] };\r
+ $.datepicker._pos = null;\r
+\r
+ //to avoid flashes on Firefox\r
+ inst.dpDiv.empty();\r
+\r
+ // determine sizing offscreen\r
+ inst.dpDiv.css( { position: "absolute", display: "block", top: "-1000px" } );\r
+ $.datepicker._updateDatepicker( inst );\r
+\r
+ // fix width for dynamic number of date pickers\r
+ // and adjust position before showing\r
+ offset = $.datepicker._checkOffset( inst, offset, isFixed );\r
+ inst.dpDiv.css( { position: ( $.datepicker._inDialog && $.blockUI ?\r
+ "static" : ( isFixed ? "fixed" : "absolute" ) ), display: "none",\r
+ left: offset.left + "px", top: offset.top + "px" } );\r
+\r
+ if ( !inst.inline ) {\r
+ showAnim = $.datepicker._get( inst, "showAnim" );\r
+ duration = $.datepicker._get( inst, "duration" );\r
+ inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 );\r
+ $.datepicker._datepickerShowing = true;\r
+\r
+ if ( $.effects && $.effects.effect[ showAnim ] ) {\r
+ inst.dpDiv.show( showAnim, $.datepicker._get( inst, "showOptions" ), duration );\r
+ } else {\r
+ inst.dpDiv[ showAnim || "show" ]( showAnim ? duration : null );\r
+ }\r
+\r
+ if ( $.datepicker._shouldFocusInput( inst ) ) {\r
+ inst.input.trigger( "focus" );\r
+ }\r
+\r
+ $.datepicker._curInst = inst;\r
+ }\r
+ },\r
+\r
+ /* Generate the date picker content. */\r
+ _updateDatepicker: function( inst ) {\r
+ this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)\r
+ datepicker_instActive = inst; // for delegate hover events\r
+ inst.dpDiv.empty().append( this._generateHTML( inst ) );\r
+ this._attachHandlers( inst );\r
+\r
+ var origyearshtml,\r
+ numMonths = this._getNumberOfMonths( inst ),\r
+ cols = numMonths[ 1 ],\r
+ width = 17,\r
+ activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" ),\r
+ onUpdateDatepicker = $.datepicker._get( inst, "onUpdateDatepicker" );\r
+\r
+ if ( activeCell.length > 0 ) {\r
+ datepicker_handleMouseover.apply( activeCell.get( 0 ) );\r
+ }\r
+\r
+ inst.dpDiv.removeClass( "ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4" ).width( "" );\r
+ if ( cols > 1 ) {\r
+ inst.dpDiv.addClass( "ui-datepicker-multi-" + cols ).css( "width", ( width * cols ) + "em" );\r
+ }\r
+ inst.dpDiv[ ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ? "add" : "remove" ) +\r
+ "Class" ]( "ui-datepicker-multi" );\r
+ inst.dpDiv[ ( this._get( inst, "isRTL" ) ? "add" : "remove" ) +\r
+ "Class" ]( "ui-datepicker-rtl" );\r
+\r
+ if ( inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) {\r
+ inst.input.trigger( "focus" );\r
+ }\r
+\r
+ // Deffered render of the years select (to avoid flashes on Firefox)\r
+ if ( inst.yearshtml ) {\r
+ origyearshtml = inst.yearshtml;\r
+ setTimeout( function() {\r
+\r
+ //assure that inst.yearshtml didn't change.\r
+ if ( origyearshtml === inst.yearshtml && inst.yearshtml ) {\r
+ inst.dpDiv.find( "select.ui-datepicker-year" ).first().replaceWith( inst.yearshtml );\r
+ }\r
+ origyearshtml = inst.yearshtml = null;\r
+ }, 0 );\r
+ }\r
+\r
+ if ( onUpdateDatepicker ) {\r
+ onUpdateDatepicker.apply( ( inst.input ? inst.input[ 0 ] : null ), [ inst ] );\r
+ }\r
+ },\r
+\r
+ // #6694 - don't focus the input if it's already focused\r
+ // this breaks the change event in IE\r
+ // Support: IE and jQuery <1.9\r
+ _shouldFocusInput: function( inst ) {\r
+ return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" );\r
+ },\r
+\r
+ /* Check positioning to remain on screen. */\r
+ _checkOffset: function( inst, offset, isFixed ) {\r
+ var dpWidth = inst.dpDiv.outerWidth(),\r
+ dpHeight = inst.dpDiv.outerHeight(),\r
+ inputWidth = inst.input ? inst.input.outerWidth() : 0,\r
+ inputHeight = inst.input ? inst.input.outerHeight() : 0,\r
+ viewWidth = document.documentElement.clientWidth + ( isFixed ? 0 : $( document ).scrollLeft() ),\r
+ viewHeight = document.documentElement.clientHeight + ( isFixed ? 0 : $( document ).scrollTop() );\r
+\r
+ offset.left -= ( this._get( inst, "isRTL" ) ? ( dpWidth - inputWidth ) : 0 );\r
+ offset.left -= ( isFixed && offset.left === inst.input.offset().left ) ? $( document ).scrollLeft() : 0;\r
+ offset.top -= ( isFixed && offset.top === ( inst.input.offset().top + inputHeight ) ) ? $( document ).scrollTop() : 0;\r
+\r
+ // Now check if datepicker is showing outside window viewport - move to a better place if so.\r
+ offset.left -= Math.min( offset.left, ( offset.left + dpWidth > viewWidth && viewWidth > dpWidth ) ?\r
+ Math.abs( offset.left + dpWidth - viewWidth ) : 0 );\r
+ offset.top -= Math.min( offset.top, ( offset.top + dpHeight > viewHeight && viewHeight > dpHeight ) ?\r
+ Math.abs( dpHeight + inputHeight ) : 0 );\r
+\r
+ return offset;\r
+ },\r
+\r
+ /* Find an object's position on the screen. */\r
+ _findPos: function( obj ) {\r
+ var position,\r
+ inst = this._getInst( obj ),\r
+ isRTL = this._get( inst, "isRTL" );\r
+\r
+ while ( obj && ( obj.type === "hidden" || obj.nodeType !== 1 || $.expr.pseudos.hidden( obj ) ) ) {\r
+ obj = obj[ isRTL ? "previousSibling" : "nextSibling" ];\r
+ }\r
+\r
+ position = $( obj ).offset();\r
+ return [ position.left, position.top ];\r
+ },\r
+\r
+ /* Hide the date picker from view.\r
+ * @param input element - the input field attached to the date picker\r
+ */\r
+ _hideDatepicker: function( input ) {\r
+ var showAnim, duration, postProcess, onClose,\r
+ inst = this._curInst;\r
+\r
+ if ( !inst || ( input && inst !== $.data( input, "datepicker" ) ) ) {\r
+ return;\r
+ }\r
+\r
+ if ( this._datepickerShowing ) {\r
+ showAnim = this._get( inst, "showAnim" );\r
+ duration = this._get( inst, "duration" );\r
+ postProcess = function() {\r
+ $.datepicker._tidyDialog( inst );\r
+ };\r
+\r
+ // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed\r
+ if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) {\r
+ inst.dpDiv.hide( showAnim, $.datepicker._get( inst, "showOptions" ), duration, postProcess );\r
+ } else {\r
+ inst.dpDiv[ ( showAnim === "slideDown" ? "slideUp" :\r
+ ( showAnim === "fadeIn" ? "fadeOut" : "hide" ) ) ]( ( showAnim ? duration : null ), postProcess );\r
+ }\r
+\r
+ if ( !showAnim ) {\r
+ postProcess();\r
+ }\r
+ this._datepickerShowing = false;\r
+\r
+ onClose = this._get( inst, "onClose" );\r
+ if ( onClose ) {\r
+ onClose.apply( ( inst.input ? inst.input[ 0 ] : null ), [ ( inst.input ? inst.input.val() : "" ), inst ] );\r
+ }\r
+\r
+ this._lastInput = null;\r
+ if ( this._inDialog ) {\r
+ this._dialogInput.css( { position: "absolute", left: "0", top: "-100px" } );\r
+ if ( $.blockUI ) {\r
+ $.unblockUI();\r
+ $( "body" ).append( this.dpDiv );\r
+ }\r
+ }\r
+ this._inDialog = false;\r
+ }\r
+ },\r
+\r
+ /* Tidy up after a dialog display. */\r
+ _tidyDialog: function( inst ) {\r
+ inst.dpDiv.removeClass( this._dialogClass ).off( ".ui-datepicker-calendar" );\r
+ },\r
+\r
+ /* Close date picker if clicked elsewhere. */\r
+ _checkExternalClick: function( event ) {\r
+ if ( !$.datepicker._curInst ) {\r
+ return;\r
+ }\r
+\r
+ var $target = $( event.target ),\r
+ inst = $.datepicker._getInst( $target[ 0 ] );\r
+\r
+ if ( ( ( $target[ 0 ].id !== $.datepicker._mainDivId &&\r
+ $target.parents( "#" + $.datepicker._mainDivId ).length === 0 &&\r
+ !$target.hasClass( $.datepicker.markerClassName ) &&\r
+ !$target.closest( "." + $.datepicker._triggerClass ).length &&\r
+ $.datepicker._datepickerShowing && !( $.datepicker._inDialog && $.blockUI ) ) ) ||\r
+ ( $target.hasClass( $.datepicker.markerClassName ) && $.datepicker._curInst !== inst ) ) {\r
+ $.datepicker._hideDatepicker();\r
+ }\r
+ },\r
+\r
+ /* Adjust one of the date sub-fields. */\r
+ _adjustDate: function( id, offset, period ) {\r
+ var target = $( id ),\r
+ inst = this._getInst( target[ 0 ] );\r
+\r
+ if ( this._isDisabledDatepicker( target[ 0 ] ) ) {\r
+ return;\r
+ }\r
+ this._adjustInstDate( inst, offset, period );\r
+ this._updateDatepicker( inst );\r
+ },\r
+\r
+ /* Action for current link. */\r
+ _gotoToday: function( id ) {\r
+ var date,\r
+ target = $( id ),\r
+ inst = this._getInst( target[ 0 ] );\r
+\r
+ if ( this._get( inst, "gotoCurrent" ) && inst.currentDay ) {\r
+ inst.selectedDay = inst.currentDay;\r
+ inst.drawMonth = inst.selectedMonth = inst.currentMonth;\r
+ inst.drawYear = inst.selectedYear = inst.currentYear;\r
+ } else {\r
+ date = new Date();\r
+ inst.selectedDay = date.getDate();\r
+ inst.drawMonth = inst.selectedMonth = date.getMonth();\r
+ inst.drawYear = inst.selectedYear = date.getFullYear();\r
+ }\r
+ this._notifyChange( inst );\r
+ this._adjustDate( target );\r
+ },\r
+\r
+ /* Action for selecting a new month/year. */\r
+ _selectMonthYear: function( id, select, period ) {\r
+ var target = $( id ),\r
+ inst = this._getInst( target[ 0 ] );\r
+\r
+ inst[ "selected" + ( period === "M" ? "Month" : "Year" ) ] =\r
+ inst[ "draw" + ( period === "M" ? "Month" : "Year" ) ] =\r
+ parseInt( select.options[ select.selectedIndex ].value, 10 );\r
+\r
+ this._notifyChange( inst );\r
+ this._adjustDate( target );\r
+ },\r
+\r
+ /* Action for selecting a day. */\r
+ _selectDay: function( id, month, year, td ) {\r
+ var inst,\r
+ target = $( id );\r
+\r
+ if ( $( td ).hasClass( this._unselectableClass ) || this._isDisabledDatepicker( target[ 0 ] ) ) {\r
+ return;\r
+ }\r
+\r
+ inst = this._getInst( target[ 0 ] );\r
+ inst.selectedDay = inst.currentDay = parseInt( $( "a", td ).attr( "data-date" ) );\r
+ inst.selectedMonth = inst.currentMonth = month;\r
+ inst.selectedYear = inst.currentYear = year;\r
+ this._selectDate( id, this._formatDate( inst,\r
+ inst.currentDay, inst.currentMonth, inst.currentYear ) );\r
+ },\r
+\r
+ /* Erase the input field and hide the date picker. */\r
+ _clearDate: function( id ) {\r
+ var target = $( id );\r
+ this._selectDate( target, "" );\r
+ },\r
+\r
+ /* Update the input field with the selected date. */\r
+ _selectDate: function( id, dateStr ) {\r
+ var onSelect,\r
+ target = $( id ),\r
+ inst = this._getInst( target[ 0 ] );\r
+\r
+ dateStr = ( dateStr != null ? dateStr : this._formatDate( inst ) );\r
+ if ( inst.input ) {\r
+ inst.input.val( dateStr );\r
+ }\r
+ this._updateAlternate( inst );\r
+\r
+ onSelect = this._get( inst, "onSelect" );\r
+ if ( onSelect ) {\r
+ onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); // trigger custom callback\r
+ } else if ( inst.input ) {\r
+ inst.input.trigger( "change" ); // fire the change event\r
+ }\r
+\r
+ if ( inst.inline ) {\r
+ this._updateDatepicker( inst );\r
+ } else {\r
+ this._hideDatepicker();\r
+ this._lastInput = inst.input[ 0 ];\r
+ if ( typeof( inst.input[ 0 ] ) !== "object" ) {\r
+ inst.input.trigger( "focus" ); // restore focus\r
+ }\r
+ this._lastInput = null;\r
+ }\r
+ },\r
+\r
+ /* Update any alternate field to synchronise with the main field. */\r
+ _updateAlternate: function( inst ) {\r
+ var altFormat, date, dateStr,\r
+ altField = this._get( inst, "altField" );\r
+\r
+ if ( altField ) { // update alternate field too\r
+ altFormat = this._get( inst, "altFormat" ) || this._get( inst, "dateFormat" );\r
+ date = this._getDate( inst );\r
+ dateStr = this.formatDate( altFormat, date, this._getFormatConfig( inst ) );\r
+ $( document ).find( altField ).val( dateStr );\r
+ }\r
+ },\r
+\r
+ /* Set as beforeShowDay function to prevent selection of weekends.\r
+ * @param date Date - the date to customise\r
+ * @return [boolean, string] - is this date selectable?, what is its CSS class?\r
+ */\r
+ noWeekends: function( date ) {\r
+ var day = date.getDay();\r
+ return [ ( day > 0 && day < 6 ), "" ];\r
+ },\r
+\r
+ /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.\r
+ * @param date Date - the date to get the week for\r
+ * @return number - the number of the week within the year that contains this date\r
+ */\r
+ iso8601Week: function( date ) {\r
+ var time,\r
+ checkDate = new Date( date.getTime() );\r
+\r
+ // Find Thursday of this week starting on Monday\r
+ checkDate.setDate( checkDate.getDate() + 4 - ( checkDate.getDay() || 7 ) );\r
+\r
+ time = checkDate.getTime();\r
+ checkDate.setMonth( 0 ); // Compare with Jan 1\r
+ checkDate.setDate( 1 );\r
+ return Math.floor( Math.round( ( time - checkDate ) / 86400000 ) / 7 ) + 1;\r
+ },\r
+\r
+ /* Parse a string value into a date object.\r
+ * See formatDate below for the possible formats.\r
+ *\r
+ * @param format string - the expected format of the date\r
+ * @param value string - the date in the above format\r
+ * @param settings Object - attributes include:\r
+ * shortYearCutoff number - the cutoff year for determining the century (optional)\r
+ * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)\r
+ * dayNames string[7] - names of the days from Sunday (optional)\r
+ * monthNamesShort string[12] - abbreviated names of the months (optional)\r
+ * monthNames string[12] - names of the months (optional)\r
+ * @return Date - the extracted date value or null if value is blank\r
+ */\r
+ parseDate: function( format, value, settings ) {\r
+ if ( format == null || value == null ) {\r
+ throw "Invalid arguments";\r
+ }\r
+\r
+ value = ( typeof value === "object" ? value.toString() : value + "" );\r
+ if ( value === "" ) {\r
+ return null;\r
+ }\r
+\r
+ var iFormat, dim, extra,\r
+ iValue = 0,\r
+ shortYearCutoffTemp = ( settings ? settings.shortYearCutoff : null ) || this._defaults.shortYearCutoff,\r
+ shortYearCutoff = ( typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp :\r
+ new Date().getFullYear() % 100 + parseInt( shortYearCutoffTemp, 10 ) ),\r
+ dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort,\r
+ dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames,\r
+ monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort,\r
+ monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames,\r
+ year = -1,\r
+ month = -1,\r
+ day = -1,\r
+ doy = -1,\r
+ literal = false,\r
+ date,\r
+\r
+ // Check whether a format character is doubled\r
+ lookAhead = function( match ) {\r
+ var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );\r
+ if ( matches ) {\r
+ iFormat++;\r
+ }\r
+ return matches;\r
+ },\r
+\r
+ // Extract a number from the string value\r
+ getNumber = function( match ) {\r
+ var isDoubled = lookAhead( match ),\r
+ size = ( match === "@" ? 14 : ( match === "!" ? 20 :\r
+ ( match === "y" && isDoubled ? 4 : ( match === "o" ? 3 : 2 ) ) ) ),\r
+ minSize = ( match === "y" ? size : 1 ),\r
+ digits = new RegExp( "^\\d{" + minSize + "," + size + "}" ),\r
+ num = value.substring( iValue ).match( digits );\r
+ if ( !num ) {\r
+ throw "Missing number at position " + iValue;\r
+ }\r
+ iValue += num[ 0 ].length;\r
+ return parseInt( num[ 0 ], 10 );\r
+ },\r
+\r
+ // Extract a name from the string value and convert to an index\r
+ getName = function( match, shortNames, longNames ) {\r
+ var index = -1,\r
+ names = $.map( lookAhead( match ) ? longNames : shortNames, function( v, k ) {\r
+ return [ [ k, v ] ];\r
+ } ).sort( function( a, b ) {\r
+ return -( a[ 1 ].length - b[ 1 ].length );\r
+ } );\r
+\r
+ $.each( names, function( i, pair ) {\r
+ var name = pair[ 1 ];\r
+ if ( value.substr( iValue, name.length ).toLowerCase() === name.toLowerCase() ) {\r
+ index = pair[ 0 ];\r
+ iValue += name.length;\r
+ return false;\r
+ }\r
+ } );\r
+ if ( index !== -1 ) {\r
+ return index + 1;\r
+ } else {\r
+ throw "Unknown name at position " + iValue;\r
+ }\r
+ },\r
+\r
+ // Confirm that a literal character matches the string value\r
+ checkLiteral = function() {\r
+ if ( value.charAt( iValue ) !== format.charAt( iFormat ) ) {\r
+ throw "Unexpected literal at position " + iValue;\r
+ }\r
+ iValue++;\r
+ };\r
+\r
+ for ( iFormat = 0; iFormat < format.length; iFormat++ ) {\r
+ if ( literal ) {\r
+ if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {\r
+ literal = false;\r
+ } else {\r
+ checkLiteral();\r
+ }\r
+ } else {\r
+ switch ( format.charAt( iFormat ) ) {\r
+ case "d":\r
+ day = getNumber( "d" );\r
+ break;\r
+ case "D":\r
+ getName( "D", dayNamesShort, dayNames );\r
+ break;\r
+ case "o":\r
+ doy = getNumber( "o" );\r
+ break;\r
+ case "m":\r
+ month = getNumber( "m" );\r
+ break;\r
+ case "M":\r
+ month = getName( "M", monthNamesShort, monthNames );\r
+ break;\r
+ case "y":\r
+ year = getNumber( "y" );\r
+ break;\r
+ case "@":\r
+ date = new Date( getNumber( "@" ) );\r
+ year = date.getFullYear();\r
+ month = date.getMonth() + 1;\r
+ day = date.getDate();\r
+ break;\r
+ case "!":\r
+ date = new Date( ( getNumber( "!" ) - this._ticksTo1970 ) / 10000 );\r
+ year = date.getFullYear();\r
+ month = date.getMonth() + 1;\r
+ day = date.getDate();\r
+ break;\r
+ case "'":\r
+ if ( lookAhead( "'" ) ) {\r
+ checkLiteral();\r
+ } else {\r
+ literal = true;\r
+ }\r
+ break;\r
+ default:\r
+ checkLiteral();\r
+ }\r
+ }\r
+ }\r
+\r
+ if ( iValue < value.length ) {\r
+ extra = value.substr( iValue );\r
+ if ( !/^\s+/.test( extra ) ) {\r
+ throw "Extra/unparsed characters found in date: " + extra;\r
+ }\r
+ }\r
+\r
+ if ( year === -1 ) {\r
+ year = new Date().getFullYear();\r
+ } else if ( year < 100 ) {\r
+ year += new Date().getFullYear() - new Date().getFullYear() % 100 +\r
+ ( year <= shortYearCutoff ? 0 : -100 );\r
+ }\r
+\r
+ if ( doy > -1 ) {\r
+ month = 1;\r
+ day = doy;\r
+ do {\r
+ dim = this._getDaysInMonth( year, month - 1 );\r
+ if ( day <= dim ) {\r
+ break;\r
+ }\r
+ month++;\r
+ day -= dim;\r
+ } while ( true );\r
+ }\r
+\r
+ date = this._daylightSavingAdjust( new Date( year, month - 1, day ) );\r
+ if ( date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day ) {\r
+ throw "Invalid date"; // E.g. 31/02/00\r
+ }\r
+ return date;\r
+ },\r
+\r
+ /* Standard date formats. */\r
+ ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601)\r
+ COOKIE: "D, dd M yy",\r
+ ISO_8601: "yy-mm-dd",\r
+ RFC_822: "D, d M y",\r
+ RFC_850: "DD, dd-M-y",\r
+ RFC_1036: "D, d M y",\r
+ RFC_1123: "D, d M yy",\r
+ RFC_2822: "D, d M yy",\r
+ RSS: "D, d M y", // RFC 822\r
+ TICKS: "!",\r
+ TIMESTAMP: "@",\r
+ W3C: "yy-mm-dd", // ISO 8601\r
+\r
+ _ticksTo1970: ( ( ( 1970 - 1 ) * 365 + Math.floor( 1970 / 4 ) - Math.floor( 1970 / 100 ) +\r
+ Math.floor( 1970 / 400 ) ) * 24 * 60 * 60 * 10000000 ),\r
+\r
+ /* Format a date object into a string value.\r
+ * The format can be combinations of the following:\r
+ * d - day of month (no leading zero)\r
+ * dd - day of month (two digit)\r
+ * o - day of year (no leading zeros)\r
+ * oo - day of year (three digit)\r
+ * D - day name short\r
+ * DD - day name long\r
+ * m - month of year (no leading zero)\r
+ * mm - month of year (two digit)\r
+ * M - month name short\r
+ * MM - month name long\r
+ * y - year (two digit)\r
+ * yy - year (four digit)\r
+ * @ - Unix timestamp (ms since 01/01/1970)\r
+ * ! - Windows ticks (100ns since 01/01/0001)\r
+ * "..." - literal text\r
+ * '' - single quote\r
+ *\r
+ * @param format string - the desired format of the date\r
+ * @param date Date - the date value to format\r
+ * @param settings Object - attributes include:\r
+ * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)\r
+ * dayNames string[7] - names of the days from Sunday (optional)\r
+ * monthNamesShort string[12] - abbreviated names of the months (optional)\r
+ * monthNames string[12] - names of the months (optional)\r
+ * @return string - the date in the above format\r
+ */\r
+ formatDate: function( format, date, settings ) {\r
+ if ( !date ) {\r
+ return "";\r
+ }\r
+\r
+ var iFormat,\r
+ dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort,\r
+ dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames,\r
+ monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort,\r
+ monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames,\r
+\r
+ // Check whether a format character is doubled\r
+ lookAhead = function( match ) {\r
+ var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );\r
+ if ( matches ) {\r
+ iFormat++;\r
+ }\r
+ return matches;\r
+ },\r
+\r
+ // Format a number, with leading zero if necessary\r
+ formatNumber = function( match, value, len ) {\r
+ var num = "" + value;\r
+ if ( lookAhead( match ) ) {\r
+ while ( num.length < len ) {\r
+ num = "0" + num;\r
+ }\r
+ }\r
+ return num;\r
+ },\r
+\r
+ // Format a name, short or long as requested\r
+ formatName = function( match, value, shortNames, longNames ) {\r
+ return ( lookAhead( match ) ? longNames[ value ] : shortNames[ value ] );\r
+ },\r
+ output = "",\r
+ literal = false;\r
+\r
+ if ( date ) {\r
+ for ( iFormat = 0; iFormat < format.length; iFormat++ ) {\r
+ if ( literal ) {\r
+ if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {\r
+ literal = false;\r
+ } else {\r
+ output += format.charAt( iFormat );\r
+ }\r
+ } else {\r
+ switch ( format.charAt( iFormat ) ) {\r
+ case "d":\r
+ output += formatNumber( "d", date.getDate(), 2 );\r
+ break;\r
+ case "D":\r
+ output += formatName( "D", date.getDay(), dayNamesShort, dayNames );\r
+ break;\r
+ case "o":\r
+ output += formatNumber( "o",\r
+ Math.round( ( new Date( date.getFullYear(), date.getMonth(), date.getDate() ).getTime() - new Date( date.getFullYear(), 0, 0 ).getTime() ) / 86400000 ), 3 );\r
+ break;\r
+ case "m":\r
+ output += formatNumber( "m", date.getMonth() + 1, 2 );\r
+ break;\r
+ case "M":\r
+ output += formatName( "M", date.getMonth(), monthNamesShort, monthNames );\r
+ break;\r
+ case "y":\r
+ output += ( lookAhead( "y" ) ? date.getFullYear() :\r
+ ( date.getFullYear() % 100 < 10 ? "0" : "" ) + date.getFullYear() % 100 );\r
+ break;\r
+ case "@":\r
+ output += date.getTime();\r
+ break;\r
+ case "!":\r
+ output += date.getTime() * 10000 + this._ticksTo1970;\r
+ break;\r
+ case "'":\r
+ if ( lookAhead( "'" ) ) {\r
+ output += "'";\r
+ } else {\r
+ literal = true;\r
+ }\r
+ break;\r
+ default:\r
+ output += format.charAt( iFormat );\r
+ }\r
+ }\r
+ }\r
+ }\r
+ return output;\r
+ },\r
+\r
+ /* Extract all possible characters from the date format. */\r
+ _possibleChars: function( format ) {\r
+ var iFormat,\r
+ chars = "",\r
+ literal = false,\r
+\r
+ // Check whether a format character is doubled\r
+ lookAhead = function( match ) {\r
+ var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );\r
+ if ( matches ) {\r
+ iFormat++;\r
+ }\r
+ return matches;\r
+ };\r
+\r
+ for ( iFormat = 0; iFormat < format.length; iFormat++ ) {\r
+ if ( literal ) {\r
+ if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {\r
+ literal = false;\r
+ } else {\r
+ chars += format.charAt( iFormat );\r
+ }\r
+ } else {\r
+ switch ( format.charAt( iFormat ) ) {\r
+ case "d": case "m": case "y": case "@":\r
+ chars += "0123456789";\r
+ break;\r
+ case "D": case "M":\r
+ return null; // Accept anything\r
+ case "'":\r
+ if ( lookAhead( "'" ) ) {\r
+ chars += "'";\r
+ } else {\r
+ literal = true;\r
+ }\r
+ break;\r
+ default:\r
+ chars += format.charAt( iFormat );\r
+ }\r
+ }\r
+ }\r
+ return chars;\r
+ },\r
+\r
+ /* Get a setting value, defaulting if necessary. */\r
+ _get: function( inst, name ) {\r
+ return inst.settings[ name ] !== undefined ?\r
+ inst.settings[ name ] : this._defaults[ name ];\r
+ },\r
+\r
+ /* Parse existing date and initialise date picker. */\r
+ _setDateFromField: function( inst, noDefault ) {\r
+ if ( inst.input.val() === inst.lastVal ) {\r
+ return;\r
+ }\r
+\r
+ var dateFormat = this._get( inst, "dateFormat" ),\r
+ dates = inst.lastVal = inst.input ? inst.input.val() : null,\r
+ defaultDate = this._getDefaultDate( inst ),\r
+ date = defaultDate,\r
+ settings = this._getFormatConfig( inst );\r
+\r
+ try {\r
+ date = this.parseDate( dateFormat, dates, settings ) || defaultDate;\r
+ } catch ( event ) {\r
+ dates = ( noDefault ? "" : dates );\r
+ }\r
+ inst.selectedDay = date.getDate();\r
+ inst.drawMonth = inst.selectedMonth = date.getMonth();\r
+ inst.drawYear = inst.selectedYear = date.getFullYear();\r
+ inst.currentDay = ( dates ? date.getDate() : 0 );\r
+ inst.currentMonth = ( dates ? date.getMonth() : 0 );\r
+ inst.currentYear = ( dates ? date.getFullYear() : 0 );\r
+ this._adjustInstDate( inst );\r
+ },\r
+\r
+ /* Retrieve the default date shown on opening. */\r
+ _getDefaultDate: function( inst ) {\r
+ return this._restrictMinMax( inst,\r
+ this._determineDate( inst, this._get( inst, "defaultDate" ), new Date() ) );\r
+ },\r
+\r
+ /* A date may be specified as an exact value or a relative one. */\r
+ _determineDate: function( inst, date, defaultDate ) {\r
+ var offsetNumeric = function( offset ) {\r
+ var date = new Date();\r
+ date.setDate( date.getDate() + offset );\r
+ return date;\r
+ },\r
+ offsetString = function( offset ) {\r
+ try {\r
+ return $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ),\r
+ offset, $.datepicker._getFormatConfig( inst ) );\r
+ } catch ( e ) {\r
+\r
+ // Ignore\r
+ }\r
+\r
+ var date = ( offset.toLowerCase().match( /^c/ ) ?\r
+ $.datepicker._getDate( inst ) : null ) || new Date(),\r
+ year = date.getFullYear(),\r
+ month = date.getMonth(),\r
+ day = date.getDate(),\r
+ pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,\r
+ matches = pattern.exec( offset );\r
+\r
+ while ( matches ) {\r
+ switch ( matches[ 2 ] || "d" ) {\r
+ case "d" : case "D" :\r
+ day += parseInt( matches[ 1 ], 10 ); break;\r
+ case "w" : case "W" :\r
+ day += parseInt( matches[ 1 ], 10 ) * 7; break;\r
+ case "m" : case "M" :\r
+ month += parseInt( matches[ 1 ], 10 );\r
+ day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) );\r
+ break;\r
+ case "y": case "Y" :\r
+ year += parseInt( matches[ 1 ], 10 );\r
+ day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) );\r
+ break;\r
+ }\r
+ matches = pattern.exec( offset );\r
+ }\r
+ return new Date( year, month, day );\r
+ },\r
+ newDate = ( date == null || date === "" ? defaultDate : ( typeof date === "string" ? offsetString( date ) :\r
+ ( typeof date === "number" ? ( isNaN( date ) ? defaultDate : offsetNumeric( date ) ) : new Date( date.getTime() ) ) ) );\r
+\r
+ newDate = ( newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate );\r
+ if ( newDate ) {\r
+ newDate.setHours( 0 );\r
+ newDate.setMinutes( 0 );\r
+ newDate.setSeconds( 0 );\r
+ newDate.setMilliseconds( 0 );\r
+ }\r
+ return this._daylightSavingAdjust( newDate );\r
+ },\r
+\r
+ /* Handle switch to/from daylight saving.\r
+ * Hours may be non-zero on daylight saving cut-over:\r
+ * > 12 when midnight changeover, but then cannot generate\r
+ * midnight datetime, so jump to 1AM, otherwise reset.\r
+ * @param date (Date) the date to check\r
+ * @return (Date) the corrected date\r
+ */\r
+ _daylightSavingAdjust: function( date ) {\r
+ if ( !date ) {\r
+ return null;\r
+ }\r
+ date.setHours( date.getHours() > 12 ? date.getHours() + 2 : 0 );\r
+ return date;\r
+ },\r
+\r
+ /* Set the date(s) directly. */\r
+ _setDate: function( inst, date, noChange ) {\r
+ var clear = !date,\r
+ origMonth = inst.selectedMonth,\r
+ origYear = inst.selectedYear,\r
+ newDate = this._restrictMinMax( inst, this._determineDate( inst, date, new Date() ) );\r
+\r
+ inst.selectedDay = inst.currentDay = newDate.getDate();\r
+ inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();\r
+ inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();\r
+ if ( ( origMonth !== inst.selectedMonth || origYear !== inst.selectedYear ) && !noChange ) {\r
+ this._notifyChange( inst );\r
+ }\r
+ this._adjustInstDate( inst );\r
+ if ( inst.input ) {\r
+ inst.input.val( clear ? "" : this._formatDate( inst ) );\r
+ }\r
+ },\r
+\r
+ /* Retrieve the date(s) directly. */\r
+ _getDate: function( inst ) {\r
+ var startDate = ( !inst.currentYear || ( inst.input && inst.input.val() === "" ) ? null :\r
+ this._daylightSavingAdjust( new Date(\r
+ inst.currentYear, inst.currentMonth, inst.currentDay ) ) );\r
+ return startDate;\r
+ },\r
+\r
+ /* Attach the onxxx handlers. These are declared statically so\r
+ * they work with static code transformers like Caja.\r
+ */\r
+ _attachHandlers: function( inst ) {\r
+ var stepMonths = this._get( inst, "stepMonths" ),\r
+ id = "#" + inst.id.replace( /\\\\/g, "\\" );\r
+ inst.dpDiv.find( "[data-handler]" ).map( function() {\r
+ var handler = {\r
+ prev: function() {\r
+ $.datepicker._adjustDate( id, -stepMonths, "M" );\r
+ },\r
+ next: function() {\r
+ $.datepicker._adjustDate( id, +stepMonths, "M" );\r
+ },\r
+ hide: function() {\r
+ $.datepicker._hideDatepicker();\r
+ },\r
+ today: function() {\r
+ $.datepicker._gotoToday( id );\r
+ },\r
+ selectDay: function() {\r
+ $.datepicker._selectDay( id, +this.getAttribute( "data-month" ), +this.getAttribute( "data-year" ), this );\r
+ return false;\r
+ },\r
+ selectMonth: function() {\r
+ $.datepicker._selectMonthYear( id, this, "M" );\r
+ return false;\r
+ },\r
+ selectYear: function() {\r
+ $.datepicker._selectMonthYear( id, this, "Y" );\r
+ return false;\r
+ }\r
+ };\r
+ $( this ).on( this.getAttribute( "data-event" ), handler[ this.getAttribute( "data-handler" ) ] );\r
+ } );\r
+ },\r
+\r
+ /* Generate the HTML for the current state of the date picker. */\r
+ _generateHTML: function( inst ) {\r
+ var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,\r
+ controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,\r
+ monthNames, monthNamesShort, beforeShowDay, showOtherMonths,\r
+ selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,\r
+ cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows,\r
+ printDate, dRow, tbody, daySettings, otherMonth, unselectable,\r
+ tempDate = new Date(),\r
+ today = this._daylightSavingAdjust(\r
+ new Date( tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate() ) ), // clear time\r
+ isRTL = this._get( inst, "isRTL" ),\r
+ showButtonPanel = this._get( inst, "showButtonPanel" ),\r
+ hideIfNoPrevNext = this._get( inst, "hideIfNoPrevNext" ),\r
+ navigationAsDateFormat = this._get( inst, "navigationAsDateFormat" ),\r
+ numMonths = this._getNumberOfMonths( inst ),\r
+ showCurrentAtPos = this._get( inst, "showCurrentAtPos" ),\r
+ stepMonths = this._get( inst, "stepMonths" ),\r
+ isMultiMonth = ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ),\r
+ currentDate = this._daylightSavingAdjust( ( !inst.currentDay ? new Date( 9999, 9, 9 ) :\r
+ new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ),\r
+ minDate = this._getMinMaxDate( inst, "min" ),\r
+ maxDate = this._getMinMaxDate( inst, "max" ),\r
+ drawMonth = inst.drawMonth - showCurrentAtPos,\r
+ drawYear = inst.drawYear;\r
+\r
+ if ( drawMonth < 0 ) {\r
+ drawMonth += 12;\r
+ drawYear--;\r
+ }\r
+ if ( maxDate ) {\r
+ maxDraw = this._daylightSavingAdjust( new Date( maxDate.getFullYear(),\r
+ maxDate.getMonth() - ( numMonths[ 0 ] * numMonths[ 1 ] ) + 1, maxDate.getDate() ) );\r
+ maxDraw = ( minDate && maxDraw < minDate ? minDate : maxDraw );\r
+ while ( this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 ) ) > maxDraw ) {\r
+ drawMonth--;\r
+ if ( drawMonth < 0 ) {\r
+ drawMonth = 11;\r
+ drawYear--;\r
+ }\r
+ }\r
+ }\r
+ inst.drawMonth = drawMonth;\r
+ inst.drawYear = drawYear;\r
+\r
+ prevText = this._get( inst, "prevText" );\r
+ prevText = ( !navigationAsDateFormat ? prevText : this.formatDate( prevText,\r
+ this._daylightSavingAdjust( new Date( drawYear, drawMonth - stepMonths, 1 ) ),\r
+ this._getFormatConfig( inst ) ) );\r
+\r
+ if ( this._canAdjustMonth( inst, -1, drawYear, drawMonth ) ) {\r
+ prev = $( "<a>" )\r
+ .attr( {\r
+ "class": "ui-datepicker-prev ui-corner-all",\r
+ "data-handler": "prev",\r
+ "data-event": "click",\r
+ title: prevText\r
+ } )\r
+ .append(\r
+ $( "<span>" )\r
+ .addClass( "ui-icon ui-icon-circle-triangle-" +\r
+ ( isRTL ? "e" : "w" ) )\r
+ .text( prevText )\r
+ )[ 0 ].outerHTML;\r
+ } else if ( hideIfNoPrevNext ) {\r
+ prev = "";\r
+ } else {\r
+ prev = $( "<a>" )\r
+ .attr( {\r
+ "class": "ui-datepicker-prev ui-corner-all ui-state-disabled",\r
+ title: prevText\r
+ } )\r
+ .append(\r
+ $( "<span>" )\r
+ .addClass( "ui-icon ui-icon-circle-triangle-" +\r
+ ( isRTL ? "e" : "w" ) )\r
+ .text( prevText )\r
+ )[ 0 ].outerHTML;\r
+ }\r
+\r
+ nextText = this._get( inst, "nextText" );\r
+ nextText = ( !navigationAsDateFormat ? nextText : this.formatDate( nextText,\r
+ this._daylightSavingAdjust( new Date( drawYear, drawMonth + stepMonths, 1 ) ),\r
+ this._getFormatConfig( inst ) ) );\r
+\r
+ if ( this._canAdjustMonth( inst, +1, drawYear, drawMonth ) ) {\r
+ next = $( "<a>" )\r
+ .attr( {\r
+ "class": "ui-datepicker-next ui-corner-all",\r
+ "data-handler": "next",\r
+ "data-event": "click",\r
+ title: nextText\r
+ } )\r
+ .append(\r
+ $( "<span>" )\r
+ .addClass( "ui-icon ui-icon-circle-triangle-" +\r
+ ( isRTL ? "w" : "e" ) )\r
+ .text( nextText )\r
+ )[ 0 ].outerHTML;\r
+ } else if ( hideIfNoPrevNext ) {\r
+ next = "";\r
+ } else {\r
+ next = $( "<a>" )\r
+ .attr( {\r
+ "class": "ui-datepicker-next ui-corner-all ui-state-disabled",\r
+ title: nextText\r
+ } )\r
+ .append(\r
+ $( "<span>" )\r
+ .attr( "class", "ui-icon ui-icon-circle-triangle-" +\r
+ ( isRTL ? "w" : "e" ) )\r
+ .text( nextText )\r
+ )[ 0 ].outerHTML;\r
+ }\r
+\r
+ currentText = this._get( inst, "currentText" );\r
+ gotoDate = ( this._get( inst, "gotoCurrent" ) && inst.currentDay ? currentDate : today );\r
+ currentText = ( !navigationAsDateFormat ? currentText :\r
+ this.formatDate( currentText, gotoDate, this._getFormatConfig( inst ) ) );\r
+\r
+ controls = "";\r
+ if ( !inst.inline ) {\r
+ controls = $( "<button>" )\r
+ .attr( {\r
+ type: "button",\r
+ "class": "ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all",\r
+ "data-handler": "hide",\r
+ "data-event": "click"\r
+ } )\r
+ .text( this._get( inst, "closeText" ) )[ 0 ].outerHTML;\r
+ }\r
+\r
+ buttonPanel = "";\r
+ if ( showButtonPanel ) {\r
+ buttonPanel = $( "<div class='ui-datepicker-buttonpane ui-widget-content'>" )\r
+ .append( isRTL ? controls : "" )\r
+ .append( this._isInRange( inst, gotoDate ) ?\r
+ $( "<button>" )\r
+ .attr( {\r
+ type: "button",\r
+ "class": "ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all",\r
+ "data-handler": "today",\r
+ "data-event": "click"\r
+ } )\r
+ .text( currentText ) :\r
+ "" )\r
+ .append( isRTL ? "" : controls )[ 0 ].outerHTML;\r
+ }\r
+\r
+ firstDay = parseInt( this._get( inst, "firstDay" ), 10 );\r
+ firstDay = ( isNaN( firstDay ) ? 0 : firstDay );\r
+\r
+ showWeek = this._get( inst, "showWeek" );\r
+ dayNames = this._get( inst, "dayNames" );\r
+ dayNamesMin = this._get( inst, "dayNamesMin" );\r
+ monthNames = this._get( inst, "monthNames" );\r
+ monthNamesShort = this._get( inst, "monthNamesShort" );\r
+ beforeShowDay = this._get( inst, "beforeShowDay" );\r
+ showOtherMonths = this._get( inst, "showOtherMonths" );\r
+ selectOtherMonths = this._get( inst, "selectOtherMonths" );\r
+ defaultDate = this._getDefaultDate( inst );\r
+ html = "";\r
+\r
+ for ( row = 0; row < numMonths[ 0 ]; row++ ) {\r
+ group = "";\r
+ this.maxRows = 4;\r
+ for ( col = 0; col < numMonths[ 1 ]; col++ ) {\r
+ selectedDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, inst.selectedDay ) );\r
+ cornerClass = " ui-corner-all";\r
+ calender = "";\r
+ if ( isMultiMonth ) {\r
+ calender += "<div class='ui-datepicker-group";\r
+ if ( numMonths[ 1 ] > 1 ) {\r
+ switch ( col ) {\r
+ case 0: calender += " ui-datepicker-group-first";\r
+ cornerClass = " ui-corner-" + ( isRTL ? "right" : "left" ); break;\r
+ case numMonths[ 1 ] - 1: calender += " ui-datepicker-group-last";\r
+ cornerClass = " ui-corner-" + ( isRTL ? "left" : "right" ); break;\r
+ default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break;\r
+ }\r
+ }\r
+ calender += "'>";\r
+ }\r
+ calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" +\r
+ ( /all|left/.test( cornerClass ) && row === 0 ? ( isRTL ? next : prev ) : "" ) +\r
+ ( /all|right/.test( cornerClass ) && row === 0 ? ( isRTL ? prev : next ) : "" ) +\r
+ this._generateMonthYearHeader( inst, drawMonth, drawYear, minDate, maxDate,\r
+ row > 0 || col > 0, monthNames, monthNamesShort ) + // draw month headers\r
+ "</div><table class='ui-datepicker-calendar'><thead>" +\r
+ "<tr>";\r
+ thead = ( showWeek ? "<th class='ui-datepicker-week-col'>" + this._get( inst, "weekHeader" ) + "</th>" : "" );\r
+ for ( dow = 0; dow < 7; dow++ ) { // days of the week\r
+ day = ( dow + firstDay ) % 7;\r
+ thead += "<th scope='col'" + ( ( dow + firstDay + 6 ) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "" ) + ">" +\r
+ "<span title='" + dayNames[ day ] + "'>" + dayNamesMin[ day ] + "</span></th>";\r
+ }\r
+ calender += thead + "</tr></thead><tbody>";\r
+ daysInMonth = this._getDaysInMonth( drawYear, drawMonth );\r
+ if ( drawYear === inst.selectedYear && drawMonth === inst.selectedMonth ) {\r
+ inst.selectedDay = Math.min( inst.selectedDay, daysInMonth );\r
+ }\r
+ leadDays = ( this._getFirstDayOfMonth( drawYear, drawMonth ) - firstDay + 7 ) % 7;\r
+ curRows = Math.ceil( ( leadDays + daysInMonth ) / 7 ); // calculate the number of rows to generate\r
+ numRows = ( isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows ); //If multiple months, use the higher number of rows (see #7043)\r
+ this.maxRows = numRows;\r
+ printDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 - leadDays ) );\r
+ for ( dRow = 0; dRow < numRows; dRow++ ) { // create date picker rows\r
+ calender += "<tr>";\r
+ tbody = ( !showWeek ? "" : "<td class='ui-datepicker-week-col'>" +\r
+ this._get( inst, "calculateWeek" )( printDate ) + "</td>" );\r
+ for ( dow = 0; dow < 7; dow++ ) { // create date picker days\r
+ daySettings = ( beforeShowDay ?\r
+ beforeShowDay.apply( ( inst.input ? inst.input[ 0 ] : null ), [ printDate ] ) : [ true, "" ] );\r
+ otherMonth = ( printDate.getMonth() !== drawMonth );\r
+ unselectable = ( otherMonth && !selectOtherMonths ) || !daySettings[ 0 ] ||\r
+ ( minDate && printDate < minDate ) || ( maxDate && printDate > maxDate );\r
+ tbody += "<td class='" +\r
+ ( ( dow + firstDay + 6 ) % 7 >= 5 ? " ui-datepicker-week-end" : "" ) + // highlight weekends\r
+ ( otherMonth ? " ui-datepicker-other-month" : "" ) + // highlight days from other months\r
+ ( ( printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent ) || // user pressed key\r
+ ( defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime() ) ?\r
+\r
+ // or defaultDate is current printedDate and defaultDate is selectedDate\r
+ " " + this._dayOverClass : "" ) + // highlight selected day\r
+ ( unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "" ) + // highlight unselectable days\r
+ ( otherMonth && !showOtherMonths ? "" : " " + daySettings[ 1 ] + // highlight custom dates\r
+ ( printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "" ) + // highlight selected day\r
+ ( printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "" ) ) + "'" + // highlight today (if different)\r
+ ( ( !otherMonth || showOtherMonths ) && daySettings[ 2 ] ? " title='" + daySettings[ 2 ].replace( /'/g, "'" ) + "'" : "" ) + // cell title\r
+ ( unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'" ) + ">" + // actions\r
+ ( otherMonth && !showOtherMonths ? " " : // display for other months\r
+ ( unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" +\r
+ ( printDate.getTime() === today.getTime() ? " ui-state-highlight" : "" ) +\r
+ ( printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "" ) + // highlight selected day\r
+ ( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months\r
+ "' href='#' aria-current='" + ( printDate.getTime() === currentDate.getTime() ? "true" : "false" ) + // mark date as selected for screen reader\r
+ "' data-date='" + printDate.getDate() + // store date as data\r
+ "'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date\r
+ printDate.setDate( printDate.getDate() + 1 );\r
+ printDate = this._daylightSavingAdjust( printDate );\r
+ }\r
+ calender += tbody + "</tr>";\r
+ }\r
+ drawMonth++;\r
+ if ( drawMonth > 11 ) {\r
+ drawMonth = 0;\r
+ drawYear++;\r
+ }\r
+ calender += "</tbody></table>" + ( isMultiMonth ? "</div>" +\r
+ ( ( numMonths[ 0 ] > 0 && col === numMonths[ 1 ] - 1 ) ? "<div class='ui-datepicker-row-break'></div>" : "" ) : "" );\r
+ group += calender;\r
+ }\r
+ html += group;\r
+ }\r
+ html += buttonPanel;\r
+ inst._keyEvent = false;\r
+ return html;\r
+ },\r
+\r
+ /* Generate the month and year header. */\r
+ _generateMonthYearHeader: function( inst, drawMonth, drawYear, minDate, maxDate,\r
+ secondary, monthNames, monthNamesShort ) {\r
+\r
+ var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,\r
+ changeMonth = this._get( inst, "changeMonth" ),\r
+ changeYear = this._get( inst, "changeYear" ),\r
+ showMonthAfterYear = this._get( inst, "showMonthAfterYear" ),\r
+ selectMonthLabel = this._get( inst, "selectMonthLabel" ),\r
+ selectYearLabel = this._get( inst, "selectYearLabel" ),\r
+ html = "<div class='ui-datepicker-title'>",\r
+ monthHtml = "";\r
+\r
+ // Month selection\r
+ if ( secondary || !changeMonth ) {\r
+ monthHtml += "<span class='ui-datepicker-month'>" + monthNames[ drawMonth ] + "</span>";\r
+ } else {\r
+ inMinYear = ( minDate && minDate.getFullYear() === drawYear );\r
+ inMaxYear = ( maxDate && maxDate.getFullYear() === drawYear );\r
+ monthHtml += "<select class='ui-datepicker-month' aria-label='" + selectMonthLabel + "' data-handler='selectMonth' data-event='change'>";\r
+ for ( month = 0; month < 12; month++ ) {\r
+ if ( ( !inMinYear || month >= minDate.getMonth() ) && ( !inMaxYear || month <= maxDate.getMonth() ) ) {\r
+ monthHtml += "<option value='" + month + "'" +\r
+ ( month === drawMonth ? " selected='selected'" : "" ) +\r
+ ">" + monthNamesShort[ month ] + "</option>";\r
+ }\r
+ }\r
+ monthHtml += "</select>";\r
+ }\r
+\r
+ if ( !showMonthAfterYear ) {\r
+ html += monthHtml + ( secondary || !( changeMonth && changeYear ) ? " " : "" );\r
+ }\r
+\r
+ // Year selection\r
+ if ( !inst.yearshtml ) {\r
+ inst.yearshtml = "";\r
+ if ( secondary || !changeYear ) {\r
+ html += "<span class='ui-datepicker-year'>" + drawYear + "</span>";\r
+ } else {\r
+\r
+ // determine range of years to display\r
+ years = this._get( inst, "yearRange" ).split( ":" );\r
+ thisYear = new Date().getFullYear();\r
+ determineYear = function( value ) {\r
+ var year = ( value.match( /c[+\-].*/ ) ? drawYear + parseInt( value.substring( 1 ), 10 ) :\r
+ ( value.match( /[+\-].*/ ) ? thisYear + parseInt( value, 10 ) :\r
+ parseInt( value, 10 ) ) );\r
+ return ( isNaN( year ) ? thisYear : year );\r
+ };\r
+ year = determineYear( years[ 0 ] );\r
+ endYear = Math.max( year, determineYear( years[ 1 ] || "" ) );\r
+ year = ( minDate ? Math.max( year, minDate.getFullYear() ) : year );\r
+ endYear = ( maxDate ? Math.min( endYear, maxDate.getFullYear() ) : endYear );\r
+ inst.yearshtml += "<select class='ui-datepicker-year' aria-label='" + selectYearLabel + "' data-handler='selectYear' data-event='change'>";\r
+ for ( ; year <= endYear; year++ ) {\r
+ inst.yearshtml += "<option value='" + year + "'" +\r
+ ( year === drawYear ? " selected='selected'" : "" ) +\r
+ ">" + year + "</option>";\r
+ }\r
+ inst.yearshtml += "</select>";\r
+\r
+ html += inst.yearshtml;\r
+ inst.yearshtml = null;\r
+ }\r
+ }\r
+\r
+ html += this._get( inst, "yearSuffix" );\r
+ if ( showMonthAfterYear ) {\r
+ html += ( secondary || !( changeMonth && changeYear ) ? " " : "" ) + monthHtml;\r
+ }\r
+ html += "</div>"; // Close datepicker_header\r
+ return html;\r
+ },\r
+\r
+ /* Adjust one of the date sub-fields. */\r
+ _adjustInstDate: function( inst, offset, period ) {\r
+ var year = inst.selectedYear + ( period === "Y" ? offset : 0 ),\r
+ month = inst.selectedMonth + ( period === "M" ? offset : 0 ),\r
+ day = Math.min( inst.selectedDay, this._getDaysInMonth( year, month ) ) + ( period === "D" ? offset : 0 ),\r
+ date = this._restrictMinMax( inst, this._daylightSavingAdjust( new Date( year, month, day ) ) );\r
+\r
+ inst.selectedDay = date.getDate();\r
+ inst.drawMonth = inst.selectedMonth = date.getMonth();\r
+ inst.drawYear = inst.selectedYear = date.getFullYear();\r
+ if ( period === "M" || period === "Y" ) {\r
+ this._notifyChange( inst );\r
+ }\r
+ },\r
+\r
+ /* Ensure a date is within any min/max bounds. */\r
+ _restrictMinMax: function( inst, date ) {\r
+ var minDate = this._getMinMaxDate( inst, "min" ),\r
+ maxDate = this._getMinMaxDate( inst, "max" ),\r
+ newDate = ( minDate && date < minDate ? minDate : date );\r
+ return ( maxDate && newDate > maxDate ? maxDate : newDate );\r
+ },\r
+\r
+ /* Notify change of month/year. */\r
+ _notifyChange: function( inst ) {\r
+ var onChange = this._get( inst, "onChangeMonthYear" );\r
+ if ( onChange ) {\r
+ onChange.apply( ( inst.input ? inst.input[ 0 ] : null ),\r
+ [ inst.selectedYear, inst.selectedMonth + 1, inst ] );\r
+ }\r
+ },\r
+\r
+ /* Determine the number of months to show. */\r
+ _getNumberOfMonths: function( inst ) {\r
+ var numMonths = this._get( inst, "numberOfMonths" );\r
+ return ( numMonths == null ? [ 1, 1 ] : ( typeof numMonths === "number" ? [ 1, numMonths ] : numMonths ) );\r
+ },\r
+\r
+ /* Determine the current maximum date - ensure no time components are set. */\r
+ _getMinMaxDate: function( inst, minMax ) {\r
+ return this._determineDate( inst, this._get( inst, minMax + "Date" ), null );\r
+ },\r
+\r
+ /* Find the number of days in a given month. */\r
+ _getDaysInMonth: function( year, month ) {\r
+ return 32 - this._daylightSavingAdjust( new Date( year, month, 32 ) ).getDate();\r
+ },\r
+\r
+ /* Find the day of the week of the first of a month. */\r
+ _getFirstDayOfMonth: function( year, month ) {\r
+ return new Date( year, month, 1 ).getDay();\r
+ },\r
+\r
+ /* Determines if we should allow a "next/prev" month display change. */\r
+ _canAdjustMonth: function( inst, offset, curYear, curMonth ) {\r
+ var numMonths = this._getNumberOfMonths( inst ),\r
+ date = this._daylightSavingAdjust( new Date( curYear,\r
+ curMonth + ( offset < 0 ? offset : numMonths[ 0 ] * numMonths[ 1 ] ), 1 ) );\r
+\r
+ if ( offset < 0 ) {\r
+ date.setDate( this._getDaysInMonth( date.getFullYear(), date.getMonth() ) );\r
+ }\r
+ return this._isInRange( inst, date );\r
+ },\r
+\r
+ /* Is the given date in the accepted range? */\r
+ _isInRange: function( inst, date ) {\r
+ var yearSplit, currentYear,\r
+ minDate = this._getMinMaxDate( inst, "min" ),\r
+ maxDate = this._getMinMaxDate( inst, "max" ),\r
+ minYear = null,\r
+ maxYear = null,\r
+ years = this._get( inst, "yearRange" );\r
+ if ( years ) {\r
+ yearSplit = years.split( ":" );\r
+ currentYear = new Date().getFullYear();\r
+ minYear = parseInt( yearSplit[ 0 ], 10 );\r
+ maxYear = parseInt( yearSplit[ 1 ], 10 );\r
+ if ( yearSplit[ 0 ].match( /[+\-].*/ ) ) {\r
+ minYear += currentYear;\r
+ }\r
+ if ( yearSplit[ 1 ].match( /[+\-].*/ ) ) {\r
+ maxYear += currentYear;\r
+ }\r
+ }\r
+\r
+ return ( ( !minDate || date.getTime() >= minDate.getTime() ) &&\r
+ ( !maxDate || date.getTime() <= maxDate.getTime() ) &&\r
+ ( !minYear || date.getFullYear() >= minYear ) &&\r
+ ( !maxYear || date.getFullYear() <= maxYear ) );\r
+ },\r
+\r
+ /* Provide the configuration settings for formatting/parsing. */\r
+ _getFormatConfig: function( inst ) {\r
+ var shortYearCutoff = this._get( inst, "shortYearCutoff" );\r
+ shortYearCutoff = ( typeof shortYearCutoff !== "string" ? shortYearCutoff :\r
+ new Date().getFullYear() % 100 + parseInt( shortYearCutoff, 10 ) );\r
+ return { shortYearCutoff: shortYearCutoff,\r
+ dayNamesShort: this._get( inst, "dayNamesShort" ), dayNames: this._get( inst, "dayNames" ),\r
+ monthNamesShort: this._get( inst, "monthNamesShort" ), monthNames: this._get( inst, "monthNames" ) };\r
+ },\r
+\r
+ /* Format the given date for display. */\r
+ _formatDate: function( inst, day, month, year ) {\r
+ if ( !day ) {\r
+ inst.currentDay = inst.selectedDay;\r
+ inst.currentMonth = inst.selectedMonth;\r
+ inst.currentYear = inst.selectedYear;\r
+ }\r
+ var date = ( day ? ( typeof day === "object" ? day :\r
+ this._daylightSavingAdjust( new Date( year, month, day ) ) ) :\r
+ this._daylightSavingAdjust( new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) );\r
+ return this.formatDate( this._get( inst, "dateFormat" ), date, this._getFormatConfig( inst ) );\r
+ }\r
+} );\r
+\r
+/*\r
+ * Bind hover events for datepicker elements.\r
+ * Done via delegate so the binding only occurs once in the lifetime of the parent div.\r
+ * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.\r
+ */\r
+function datepicker_bindHover( dpDiv ) {\r
+ var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";\r
+ return dpDiv.on( "mouseout", selector, function() {\r
+ $( this ).removeClass( "ui-state-hover" );\r
+ if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) {\r
+ $( this ).removeClass( "ui-datepicker-prev-hover" );\r
+ }\r
+ if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) {\r
+ $( this ).removeClass( "ui-datepicker-next-hover" );\r
+ }\r
+ } )\r
+ .on( "mouseover", selector, datepicker_handleMouseover );\r
+}\r
+\r
+function datepicker_handleMouseover() {\r
+ if ( !$.datepicker._isDisabledDatepicker( datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[ 0 ] : datepicker_instActive.input[ 0 ] ) ) {\r
+ $( this ).parents( ".ui-datepicker-calendar" ).find( "a" ).removeClass( "ui-state-hover" );\r
+ $( this ).addClass( "ui-state-hover" );\r
+ if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) {\r
+ $( this ).addClass( "ui-datepicker-prev-hover" );\r
+ }\r
+ if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) {\r
+ $( this ).addClass( "ui-datepicker-next-hover" );\r
+ }\r
+ }\r
+}\r
+\r
+/* jQuery extend now ignores nulls! */\r
+function datepicker_extendRemove( target, props ) {\r
+ $.extend( target, props );\r
+ for ( var name in props ) {\r
+ if ( props[ name ] == null ) {\r
+ target[ name ] = props[ name ];\r
+ }\r
+ }\r
+ return target;\r
+}\r
+\r
+/* Invoke the datepicker functionality.\r
+ @param options string - a command, optionally followed by additional parameters or\r
+ Object - settings for attaching new datepicker functionality\r
+ @return jQuery object */\r
+$.fn.datepicker = function( options ) {\r
+\r
+ /* Verify an empty collection wasn't passed - Fixes #6976 */\r
+ if ( !this.length ) {\r
+ return this;\r
+ }\r
+\r
+ /* Initialise the date picker. */\r
+ if ( !$.datepicker.initialized ) {\r
+ $( document ).on( "mousedown", $.datepicker._checkExternalClick );\r
+ $.datepicker.initialized = true;\r
+ }\r
+\r
+ /* Append datepicker main container to body if not exist. */\r
+ if ( $( "#" + $.datepicker._mainDivId ).length === 0 ) {\r
+ $( "body" ).append( $.datepicker.dpDiv );\r
+ }\r
+\r
+ var otherArgs = Array.prototype.slice.call( arguments, 1 );\r
+ if ( typeof options === "string" && ( options === "isDisabled" || options === "getDate" || options === "widget" ) ) {\r
+ return $.datepicker[ "_" + options + "Datepicker" ].\r
+ apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) );\r
+ }\r
+ if ( options === "option" && arguments.length === 2 && typeof arguments[ 1 ] === "string" ) {\r
+ return $.datepicker[ "_" + options + "Datepicker" ].\r
+ apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) );\r
+ }\r
+ return this.each( function() {\r
+ if ( typeof options === "string" ) {\r
+ $.datepicker[ "_" + options + "Datepicker" ]\r
+ .apply( $.datepicker, [ this ].concat( otherArgs ) );\r
+ } else {\r
+ $.datepicker._attachDatepicker( this, options );\r
+ }\r
+ } );\r
+};\r
+\r
+$.datepicker = new Datepicker(); // singleton instance\r
+$.datepicker.initialized = false;\r
+$.datepicker.uuid = new Date().getTime();\r
+$.datepicker.version = "1.13.1";\r
+\r
+var widgetsDatepicker = $.datepicker;\r
+\r
+\r
+/*!\r
+ * jQuery UI Dialog 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Dialog\r
+//>>group: Widgets\r
+//>>description: Displays customizable dialog windows.\r
+//>>docs: http://api.jqueryui.com/dialog/\r
+//>>demos: http://jqueryui.com/dialog/\r
+//>>css.structure: ../../themes/base/core.css\r
+//>>css.structure: ../../themes/base/dialog.css\r
+//>>css.theme: ../../themes/base/theme.css\r
+\r
+\r
+$.widget( "ui.dialog", {\r
+ version: "1.13.1",\r
+ options: {\r
+ appendTo: "body",\r
+ autoOpen: true,\r
+ buttons: [],\r
+ classes: {\r
+ "ui-dialog": "ui-corner-all",\r
+ "ui-dialog-titlebar": "ui-corner-all"\r
+ },\r
+ closeOnEscape: true,\r
+ closeText: "Close",\r
+ draggable: true,\r
+ hide: null,\r
+ height: "auto",\r
+ maxHeight: null,\r
+ maxWidth: null,\r
+ minHeight: 150,\r
+ minWidth: 150,\r
+ modal: false,\r
+ position: {\r
+ my: "center",\r
+ at: "center",\r
+ of: window,\r
+ collision: "fit",\r
+\r
+ // Ensure the titlebar is always visible\r
+ using: function( pos ) {\r
+ var topOffset = $( this ).css( pos ).offset().top;\r
+ if ( topOffset < 0 ) {\r
+ $( this ).css( "top", pos.top - topOffset );\r
+ }\r
+ }\r
+ },\r
+ resizable: true,\r
+ show: null,\r
+ title: null,\r
+ width: 300,\r
+\r
+ // Callbacks\r
+ beforeClose: null,\r
+ close: null,\r
+ drag: null,\r
+ dragStart: null,\r
+ dragStop: null,\r
+ focus: null,\r
+ open: null,\r
+ resize: null,\r
+ resizeStart: null,\r
+ resizeStop: null\r
+ },\r
+\r
+ sizeRelatedOptions: {\r
+ buttons: true,\r
+ height: true,\r
+ maxHeight: true,\r
+ maxWidth: true,\r
+ minHeight: true,\r
+ minWidth: true,\r
+ width: true\r
+ },\r
+\r
+ resizableRelatedOptions: {\r
+ maxHeight: true,\r
+ maxWidth: true,\r
+ minHeight: true,\r
+ minWidth: true\r
+ },\r
+\r
+ _create: function() {\r
+ this.originalCss = {\r
+ display: this.element[ 0 ].style.display,\r
+ width: this.element[ 0 ].style.width,\r
+ minHeight: this.element[ 0 ].style.minHeight,\r
+ maxHeight: this.element[ 0 ].style.maxHeight,\r
+ height: this.element[ 0 ].style.height\r
+ };\r
+ this.originalPosition = {\r
+ parent: this.element.parent(),\r
+ index: this.element.parent().children().index( this.element )\r
+ };\r
+ this.originalTitle = this.element.attr( "title" );\r
+ if ( this.options.title == null && this.originalTitle != null ) {\r
+ this.options.title = this.originalTitle;\r
+ }\r
+\r
+ // Dialogs can't be disabled\r
+ if ( this.options.disabled ) {\r
+ this.options.disabled = false;\r
+ }\r
+\r
+ this._createWrapper();\r
+\r
+ this.element\r
+ .show()\r
+ .removeAttr( "title" )\r
+ .appendTo( this.uiDialog );\r
+\r
+ this._addClass( "ui-dialog-content", "ui-widget-content" );\r
+\r
+ this._createTitlebar();\r
+ this._createButtonPane();\r
+\r
+ if ( this.options.draggable && $.fn.draggable ) {\r
+ this._makeDraggable();\r
+ }\r
+ if ( this.options.resizable && $.fn.resizable ) {\r
+ this._makeResizable();\r
+ }\r
+\r
+ this._isOpen = false;\r
+\r
+ this._trackFocus();\r
+ },\r
+\r
+ _init: function() {\r
+ if ( this.options.autoOpen ) {\r
+ this.open();\r
+ }\r
+ },\r
+\r
+ _appendTo: function() {\r
+ var element = this.options.appendTo;\r
+ if ( element && ( element.jquery || element.nodeType ) ) {\r
+ return $( element );\r
+ }\r
+ return this.document.find( element || "body" ).eq( 0 );\r
+ },\r
+\r
+ _destroy: function() {\r
+ var next,\r
+ originalPosition = this.originalPosition;\r
+\r
+ this._untrackInstance();\r
+ this._destroyOverlay();\r
+\r
+ this.element\r
+ .removeUniqueId()\r
+ .css( this.originalCss )\r
+\r
+ // Without detaching first, the following becomes really slow\r
+ .detach();\r
+\r
+ this.uiDialog.remove();\r
+\r
+ if ( this.originalTitle ) {\r
+ this.element.attr( "title", this.originalTitle );\r
+ }\r
+\r
+ next = originalPosition.parent.children().eq( originalPosition.index );\r
+\r
+ // Don't try to place the dialog next to itself (#8613)\r
+ if ( next.length && next[ 0 ] !== this.element[ 0 ] ) {\r
+ next.before( this.element );\r
+ } else {\r
+ originalPosition.parent.append( this.element );\r
+ }\r
+ },\r
+\r
+ widget: function() {\r
+ return this.uiDialog;\r
+ },\r
+\r
+ disable: $.noop,\r
+ enable: $.noop,\r
+\r
+ close: function( event ) {\r
+ var that = this;\r
+\r
+ if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) {\r
+ return;\r
+ }\r
+\r
+ this._isOpen = false;\r
+ this._focusedElement = null;\r
+ this._destroyOverlay();\r
+ this._untrackInstance();\r
+\r
+ if ( !this.opener.filter( ":focusable" ).trigger( "focus" ).length ) {\r
+\r
+ // Hiding a focused element doesn't trigger blur in WebKit\r
+ // so in case we have nothing to focus on, explicitly blur the active element\r
+ // https://bugs.webkit.org/show_bug.cgi?id=47182\r
+ $.ui.safeBlur( $.ui.safeActiveElement( this.document[ 0 ] ) );\r
+ }\r
+\r
+ this._hide( this.uiDialog, this.options.hide, function() {\r
+ that._trigger( "close", event );\r
+ } );\r
+ },\r
+\r
+ isOpen: function() {\r
+ return this._isOpen;\r
+ },\r
+\r
+ moveToTop: function() {\r
+ this._moveToTop();\r
+ },\r
+\r
+ _moveToTop: function( event, silent ) {\r
+ var moved = false,\r
+ zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map( function() {\r
+ return +$( this ).css( "z-index" );\r
+ } ).get(),\r
+ zIndexMax = Math.max.apply( null, zIndices );\r
+\r
+ if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) {\r
+ this.uiDialog.css( "z-index", zIndexMax + 1 );\r
+ moved = true;\r
+ }\r
+\r
+ if ( moved && !silent ) {\r
+ this._trigger( "focus", event );\r
+ }\r
+ return moved;\r
+ },\r
+\r
+ open: function() {\r
+ var that = this;\r
+ if ( this._isOpen ) {\r
+ if ( this._moveToTop() ) {\r
+ this._focusTabbable();\r
+ }\r
+ return;\r
+ }\r
+\r
+ this._isOpen = true;\r
+ this.opener = $( $.ui.safeActiveElement( this.document[ 0 ] ) );\r
+\r
+ this._size();\r
+ this._position();\r
+ this._createOverlay();\r
+ this._moveToTop( null, true );\r
+\r
+ // Ensure the overlay is moved to the top with the dialog, but only when\r
+ // opening. The overlay shouldn't move after the dialog is open so that\r
+ // modeless dialogs opened after the modal dialog stack properly.\r
+ if ( this.overlay ) {\r
+ this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 );\r
+ }\r
+\r
+ this._show( this.uiDialog, this.options.show, function() {\r
+ that._focusTabbable();\r
+ that._trigger( "focus" );\r
+ } );\r
+\r
+ // Track the dialog immediately upon opening in case a focus event\r
+ // somehow occurs outside of the dialog before an element inside the\r
+ // dialog is focused (#10152)\r
+ this._makeFocusTarget();\r
+\r
+ this._trigger( "open" );\r
+ },\r
+\r
+ _focusTabbable: function() {\r
+\r
+ // Set focus to the first match:\r
+ // 1. An element that was focused previously\r
+ // 2. First element inside the dialog matching [autofocus]\r
+ // 3. Tabbable element inside the content element\r
+ // 4. Tabbable element inside the buttonpane\r
+ // 5. The close button\r
+ // 6. The dialog itself\r
+ var hasFocus = this._focusedElement;\r
+ if ( !hasFocus ) {\r
+ hasFocus = this.element.find( "[autofocus]" );\r
+ }\r
+ if ( !hasFocus.length ) {\r
+ hasFocus = this.element.find( ":tabbable" );\r
+ }\r
+ if ( !hasFocus.length ) {\r
+ hasFocus = this.uiDialogButtonPane.find( ":tabbable" );\r
+ }\r
+ if ( !hasFocus.length ) {\r
+ hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" );\r
+ }\r
+ if ( !hasFocus.length ) {\r
+ hasFocus = this.uiDialog;\r
+ }\r
+ hasFocus.eq( 0 ).trigger( "focus" );\r
+ },\r
+\r
+ _restoreTabbableFocus: function() {\r
+ var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ),\r
+ isActive = this.uiDialog[ 0 ] === activeElement ||\r
+ $.contains( this.uiDialog[ 0 ], activeElement );\r
+ if ( !isActive ) {\r
+ this._focusTabbable();\r
+ }\r
+ },\r
+\r
+ _keepFocus: function( event ) {\r
+ event.preventDefault();\r
+ this._restoreTabbableFocus();\r
+\r
+ // support: IE\r
+ // IE <= 8 doesn't prevent moving focus even with event.preventDefault()\r
+ // so we check again later\r
+ this._delay( this._restoreTabbableFocus );\r
+ },\r
+\r
+ _createWrapper: function() {\r
+ this.uiDialog = $( "<div>" )\r
+ .hide()\r
+ .attr( {\r
+\r
+ // Setting tabIndex makes the div focusable\r
+ tabIndex: -1,\r
+ role: "dialog"\r
+ } )\r
+ .appendTo( this._appendTo() );\r
+\r
+ this._addClass( this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front" );\r
+ this._on( this.uiDialog, {\r
+ keydown: function( event ) {\r
+ if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&\r
+ event.keyCode === $.ui.keyCode.ESCAPE ) {\r
+ event.preventDefault();\r
+ this.close( event );\r
+ return;\r
+ }\r
+\r
+ // Prevent tabbing out of dialogs\r
+ if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) {\r
+ return;\r
+ }\r
+ var tabbables = this.uiDialog.find( ":tabbable" ),\r
+ first = tabbables.first(),\r
+ last = tabbables.last();\r
+\r
+ if ( ( event.target === last[ 0 ] || event.target === this.uiDialog[ 0 ] ) &&\r
+ !event.shiftKey ) {\r
+ this._delay( function() {\r
+ first.trigger( "focus" );\r
+ } );\r
+ event.preventDefault();\r
+ } else if ( ( event.target === first[ 0 ] ||\r
+ event.target === this.uiDialog[ 0 ] ) && event.shiftKey ) {\r
+ this._delay( function() {\r
+ last.trigger( "focus" );\r
+ } );\r
+ event.preventDefault();\r
+ }\r
+ },\r
+ mousedown: function( event ) {\r
+ if ( this._moveToTop( event ) ) {\r
+ this._focusTabbable();\r
+ }\r
+ }\r
+ } );\r
+\r
+ // We assume that any existing aria-describedby attribute means\r
+ // that the dialog content is marked up properly\r
+ // otherwise we brute force the content as the description\r
+ if ( !this.element.find( "[aria-describedby]" ).length ) {\r
+ this.uiDialog.attr( {\r
+ "aria-describedby": this.element.uniqueId().attr( "id" )\r
+ } );\r
+ }\r
+ },\r
+\r
+ _createTitlebar: function() {\r
+ var uiDialogTitle;\r
+\r
+ this.uiDialogTitlebar = $( "<div>" );\r
+ this._addClass( this.uiDialogTitlebar,\r
+ "ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix" );\r
+ this._on( this.uiDialogTitlebar, {\r
+ mousedown: function( event ) {\r
+\r
+ // Don't prevent click on close button (#8838)\r
+ // Focusing a dialog that is partially scrolled out of view\r
+ // causes the browser to scroll it into view, preventing the click event\r
+ if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) {\r
+\r
+ // Dialog isn't getting focus when dragging (#8063)\r
+ this.uiDialog.trigger( "focus" );\r
+ }\r
+ }\r
+ } );\r
+\r
+ // Support: IE\r
+ // Use type="button" to prevent enter keypresses in textboxes from closing the\r
+ // dialog in IE (#9312)\r
+ this.uiDialogTitlebarClose = $( "<button type='button'></button>" )\r
+ .button( {\r
+ label: $( "<a>" ).text( this.options.closeText ).html(),\r
+ icon: "ui-icon-closethick",\r
+ showLabel: false\r
+ } )\r
+ .appendTo( this.uiDialogTitlebar );\r
+\r
+ this._addClass( this.uiDialogTitlebarClose, "ui-dialog-titlebar-close" );\r
+ this._on( this.uiDialogTitlebarClose, {\r
+ click: function( event ) {\r
+ event.preventDefault();\r
+ this.close( event );\r
+ }\r
+ } );\r
+\r
+ uiDialogTitle = $( "<span>" ).uniqueId().prependTo( this.uiDialogTitlebar );\r
+ this._addClass( uiDialogTitle, "ui-dialog-title" );\r
+ this._title( uiDialogTitle );\r
+\r
+ this.uiDialogTitlebar.prependTo( this.uiDialog );\r
+\r
+ this.uiDialog.attr( {\r
+ "aria-labelledby": uiDialogTitle.attr( "id" )\r
+ } );\r
+ },\r
+\r
+ _title: function( title ) {\r
+ if ( this.options.title ) {\r
+ title.text( this.options.title );\r
+ } else {\r
+ title.html( " " );\r
+ }\r
+ },\r
+\r
+ _createButtonPane: function() {\r
+ this.uiDialogButtonPane = $( "<div>" );\r
+ this._addClass( this.uiDialogButtonPane, "ui-dialog-buttonpane",\r
+ "ui-widget-content ui-helper-clearfix" );\r
+\r
+ this.uiButtonSet = $( "<div>" )\r
+ .appendTo( this.uiDialogButtonPane );\r
+ this._addClass( this.uiButtonSet, "ui-dialog-buttonset" );\r
+\r
+ this._createButtons();\r
+ },\r
+\r
+ _createButtons: function() {\r
+ var that = this,\r
+ buttons = this.options.buttons;\r
+\r
+ // If we already have a button pane, remove it\r
+ this.uiDialogButtonPane.remove();\r
+ this.uiButtonSet.empty();\r
+\r
+ if ( $.isEmptyObject( buttons ) || ( Array.isArray( buttons ) && !buttons.length ) ) {\r
+ this._removeClass( this.uiDialog, "ui-dialog-buttons" );\r
+ return;\r
+ }\r
+\r
+ $.each( buttons, function( name, props ) {\r
+ var click, buttonOptions;\r
+ props = typeof props === "function" ?\r
+ { click: props, text: name } :\r
+ props;\r
+\r
+ // Default to a non-submitting button\r
+ props = $.extend( { type: "button" }, props );\r
+\r
+ // Change the context for the click callback to be the main element\r
+ click = props.click;\r
+ buttonOptions = {\r
+ icon: props.icon,\r
+ iconPosition: props.iconPosition,\r
+ showLabel: props.showLabel,\r
+\r
+ // Deprecated options\r
+ icons: props.icons,\r
+ text: props.text\r
+ };\r
+\r
+ delete props.click;\r
+ delete props.icon;\r
+ delete props.iconPosition;\r
+ delete props.showLabel;\r
+\r
+ // Deprecated options\r
+ delete props.icons;\r
+ if ( typeof props.text === "boolean" ) {\r
+ delete props.text;\r
+ }\r
+\r
+ $( "<button></button>", props )\r
+ .button( buttonOptions )\r
+ .appendTo( that.uiButtonSet )\r
+ .on( "click", function() {\r
+ click.apply( that.element[ 0 ], arguments );\r
+ } );\r
+ } );\r
+ this._addClass( this.uiDialog, "ui-dialog-buttons" );\r
+ this.uiDialogButtonPane.appendTo( this.uiDialog );\r
+ },\r
+\r
+ _makeDraggable: function() {\r
+ var that = this,\r
+ options = this.options;\r
+\r
+ function filteredUi( ui ) {\r
+ return {\r
+ position: ui.position,\r
+ offset: ui.offset\r
+ };\r
+ }\r
+\r
+ this.uiDialog.draggable( {\r
+ cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",\r
+ handle: ".ui-dialog-titlebar",\r
+ containment: "document",\r
+ start: function( event, ui ) {\r
+ that._addClass( $( this ), "ui-dialog-dragging" );\r
+ that._blockFrames();\r
+ that._trigger( "dragStart", event, filteredUi( ui ) );\r
+ },\r
+ drag: function( event, ui ) {\r
+ that._trigger( "drag", event, filteredUi( ui ) );\r
+ },\r
+ stop: function( event, ui ) {\r
+ var left = ui.offset.left - that.document.scrollLeft(),\r
+ top = ui.offset.top - that.document.scrollTop();\r
+\r
+ options.position = {\r
+ my: "left top",\r
+ at: "left" + ( left >= 0 ? "+" : "" ) + left + " " +\r
+ "top" + ( top >= 0 ? "+" : "" ) + top,\r
+ of: that.window\r
+ };\r
+ that._removeClass( $( this ), "ui-dialog-dragging" );\r
+ that._unblockFrames();\r
+ that._trigger( "dragStop", event, filteredUi( ui ) );\r
+ }\r
+ } );\r
+ },\r
+\r
+ _makeResizable: function() {\r
+ var that = this,\r
+ options = this.options,\r
+ handles = options.resizable,\r
+\r
+ // .ui-resizable has position: relative defined in the stylesheet\r
+ // but dialogs have to use absolute or fixed positioning\r
+ position = this.uiDialog.css( "position" ),\r
+ resizeHandles = typeof handles === "string" ?\r
+ handles :\r
+ "n,e,s,w,se,sw,ne,nw";\r
+\r
+ function filteredUi( ui ) {\r
+ return {\r
+ originalPosition: ui.originalPosition,\r
+ originalSize: ui.originalSize,\r
+ position: ui.position,\r
+ size: ui.size\r
+ };\r
+ }\r
+\r
+ this.uiDialog.resizable( {\r
+ cancel: ".ui-dialog-content",\r
+ containment: "document",\r
+ alsoResize: this.element,\r
+ maxWidth: options.maxWidth,\r
+ maxHeight: options.maxHeight,\r
+ minWidth: options.minWidth,\r
+ minHeight: this._minHeight(),\r
+ handles: resizeHandles,\r
+ start: function( event, ui ) {\r
+ that._addClass( $( this ), "ui-dialog-resizing" );\r
+ that._blockFrames();\r
+ that._trigger( "resizeStart", event, filteredUi( ui ) );\r
+ },\r
+ resize: function( event, ui ) {\r
+ that._trigger( "resize", event, filteredUi( ui ) );\r
+ },\r
+ stop: function( event, ui ) {\r
+ var offset = that.uiDialog.offset(),\r
+ left = offset.left - that.document.scrollLeft(),\r
+ top = offset.top - that.document.scrollTop();\r
+\r
+ options.height = that.uiDialog.height();\r
+ options.width = that.uiDialog.width();\r
+ options.position = {\r
+ my: "left top",\r
+ at: "left" + ( left >= 0 ? "+" : "" ) + left + " " +\r
+ "top" + ( top >= 0 ? "+" : "" ) + top,\r
+ of: that.window\r
+ };\r
+ that._removeClass( $( this ), "ui-dialog-resizing" );\r
+ that._unblockFrames();\r
+ that._trigger( "resizeStop", event, filteredUi( ui ) );\r
+ }\r
+ } )\r
+ .css( "position", position );\r
+ },\r
+\r
+ _trackFocus: function() {\r
+ this._on( this.widget(), {\r
+ focusin: function( event ) {\r
+ this._makeFocusTarget();\r
+ this._focusedElement = $( event.target );\r
+ }\r
+ } );\r
+ },\r
+\r
+ _makeFocusTarget: function() {\r
+ this._untrackInstance();\r
+ this._trackingInstances().unshift( this );\r
+ },\r
+\r
+ _untrackInstance: function() {\r
+ var instances = this._trackingInstances(),\r
+ exists = $.inArray( this, instances );\r
+ if ( exists !== -1 ) {\r
+ instances.splice( exists, 1 );\r
+ }\r
+ },\r
+\r
+ _trackingInstances: function() {\r
+ var instances = this.document.data( "ui-dialog-instances" );\r
+ if ( !instances ) {\r
+ instances = [];\r
+ this.document.data( "ui-dialog-instances", instances );\r
+ }\r
+ return instances;\r
+ },\r
+\r
+ _minHeight: function() {\r
+ var options = this.options;\r
+\r
+ return options.height === "auto" ?\r
+ options.minHeight :\r
+ Math.min( options.minHeight, options.height );\r
+ },\r
+\r
+ _position: function() {\r
+\r
+ // Need to show the dialog to get the actual offset in the position plugin\r
+ var isVisible = this.uiDialog.is( ":visible" );\r
+ if ( !isVisible ) {\r
+ this.uiDialog.show();\r
+ }\r
+ this.uiDialog.position( this.options.position );\r
+ if ( !isVisible ) {\r
+ this.uiDialog.hide();\r
+ }\r
+ },\r
+\r
+ _setOptions: function( options ) {\r
+ var that = this,\r
+ resize = false,\r
+ resizableOptions = {};\r
+\r
+ $.each( options, function( key, value ) {\r
+ that._setOption( key, value );\r
+\r
+ if ( key in that.sizeRelatedOptions ) {\r
+ resize = true;\r
+ }\r
+ if ( key in that.resizableRelatedOptions ) {\r
+ resizableOptions[ key ] = value;\r
+ }\r
+ } );\r
+\r
+ if ( resize ) {\r
+ this._size();\r
+ this._position();\r
+ }\r
+ if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {\r
+ this.uiDialog.resizable( "option", resizableOptions );\r
+ }\r
+ },\r
+\r
+ _setOption: function( key, value ) {\r
+ var isDraggable, isResizable,\r
+ uiDialog = this.uiDialog;\r
+\r
+ if ( key === "disabled" ) {\r
+ return;\r
+ }\r
+\r
+ this._super( key, value );\r
+\r
+ if ( key === "appendTo" ) {\r
+ this.uiDialog.appendTo( this._appendTo() );\r
+ }\r
+\r
+ if ( key === "buttons" ) {\r
+ this._createButtons();\r
+ }\r
+\r
+ if ( key === "closeText" ) {\r
+ this.uiDialogTitlebarClose.button( {\r
+\r
+ // Ensure that we always pass a string\r
+ label: $( "<a>" ).text( "" + this.options.closeText ).html()\r
+ } );\r
+ }\r
+\r
+ if ( key === "draggable" ) {\r
+ isDraggable = uiDialog.is( ":data(ui-draggable)" );\r
+ if ( isDraggable && !value ) {\r
+ uiDialog.draggable( "destroy" );\r
+ }\r
+\r
+ if ( !isDraggable && value ) {\r
+ this._makeDraggable();\r
+ }\r
+ }\r
+\r
+ if ( key === "position" ) {\r
+ this._position();\r
+ }\r
+\r
+ if ( key === "resizable" ) {\r
+\r
+ // currently resizable, becoming non-resizable\r
+ isResizable = uiDialog.is( ":data(ui-resizable)" );\r
+ if ( isResizable && !value ) {\r
+ uiDialog.resizable( "destroy" );\r
+ }\r
+\r
+ // Currently resizable, changing handles\r
+ if ( isResizable && typeof value === "string" ) {\r
+ uiDialog.resizable( "option", "handles", value );\r
+ }\r
+\r
+ // Currently non-resizable, becoming resizable\r
+ if ( !isResizable && value !== false ) {\r
+ this._makeResizable();\r
+ }\r
+ }\r
+\r
+ if ( key === "title" ) {\r
+ this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) );\r
+ }\r
+ },\r
+\r
+ _size: function() {\r
+\r
+ // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content\r
+ // divs will both have width and height set, so we need to reset them\r
+ var nonContentHeight, minContentHeight, maxContentHeight,\r
+ options = this.options;\r
+\r
+ // Reset content sizing\r
+ this.element.show().css( {\r
+ width: "auto",\r
+ minHeight: 0,\r
+ maxHeight: "none",\r
+ height: 0\r
+ } );\r
+\r
+ if ( options.minWidth > options.width ) {\r
+ options.width = options.minWidth;\r
+ }\r
+\r
+ // Reset wrapper sizing\r
+ // determine the height of all the non-content elements\r
+ nonContentHeight = this.uiDialog.css( {\r
+ height: "auto",\r
+ width: options.width\r
+ } )\r
+ .outerHeight();\r
+ minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );\r
+ maxContentHeight = typeof options.maxHeight === "number" ?\r
+ Math.max( 0, options.maxHeight - nonContentHeight ) :\r
+ "none";\r
+\r
+ if ( options.height === "auto" ) {\r
+ this.element.css( {\r
+ minHeight: minContentHeight,\r
+ maxHeight: maxContentHeight,\r
+ height: "auto"\r
+ } );\r
+ } else {\r
+ this.element.height( Math.max( 0, options.height - nonContentHeight ) );\r
+ }\r
+\r
+ if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {\r
+ this.uiDialog.resizable( "option", "minHeight", this._minHeight() );\r
+ }\r
+ },\r
+\r
+ _blockFrames: function() {\r
+ this.iframeBlocks = this.document.find( "iframe" ).map( function() {\r
+ var iframe = $( this );\r
+\r
+ return $( "<div>" )\r
+ .css( {\r
+ position: "absolute",\r
+ width: iframe.outerWidth(),\r
+ height: iframe.outerHeight()\r
+ } )\r
+ .appendTo( iframe.parent() )\r
+ .offset( iframe.offset() )[ 0 ];\r
+ } );\r
+ },\r
+\r
+ _unblockFrames: function() {\r
+ if ( this.iframeBlocks ) {\r
+ this.iframeBlocks.remove();\r
+ delete this.iframeBlocks;\r
+ }\r
+ },\r
+\r
+ _allowInteraction: function( event ) {\r
+ if ( $( event.target ).closest( ".ui-dialog" ).length ) {\r
+ return true;\r
+ }\r
+\r
+ // TODO: Remove hack when datepicker implements\r
+ // the .ui-front logic (#8989)\r
+ return !!$( event.target ).closest( ".ui-datepicker" ).length;\r
+ },\r
+\r
+ _createOverlay: function() {\r
+ if ( !this.options.modal ) {\r
+ return;\r
+ }\r
+\r
+ var jqMinor = $.fn.jquery.substring( 0, 4 );\r
+\r
+ // We use a delay in case the overlay is created from an\r
+ // event that we're going to be cancelling (#2804)\r
+ var isOpening = true;\r
+ this._delay( function() {\r
+ isOpening = false;\r
+ } );\r
+\r
+ if ( !this.document.data( "ui-dialog-overlays" ) ) {\r
+\r
+ // Prevent use of anchors and inputs\r
+ // This doesn't use `_on()` because it is a shared event handler\r
+ // across all open modal dialogs.\r
+ this.document.on( "focusin.ui-dialog", function( event ) {\r
+ if ( isOpening ) {\r
+ return;\r
+ }\r
+\r
+ var instance = this._trackingInstances()[ 0 ];\r
+ if ( !instance._allowInteraction( event ) ) {\r
+ event.preventDefault();\r
+ instance._focusTabbable();\r
+\r
+ // Support: jQuery >=3.4 <3.6 only\r
+ // Focus re-triggering in jQuery 3.4/3.5 makes the original element\r
+ // have its focus event propagated last, breaking the re-targeting.\r
+ // Trigger focus in a delay in addition if needed to avoid the issue\r
+ // See https://github.com/jquery/jquery/issues/4382\r
+ if ( jqMinor === "3.4." || jqMinor === "3.5." ) {\r
+ instance._delay( instance._restoreTabbableFocus );\r
+ }\r
+ }\r
+ }.bind( this ) );\r
+ }\r
+\r
+ this.overlay = $( "<div>" )\r
+ .appendTo( this._appendTo() );\r
+\r
+ this._addClass( this.overlay, null, "ui-widget-overlay ui-front" );\r
+ this._on( this.overlay, {\r
+ mousedown: "_keepFocus"\r
+ } );\r
+ this.document.data( "ui-dialog-overlays",\r
+ ( this.document.data( "ui-dialog-overlays" ) || 0 ) + 1 );\r
+ },\r
+\r
+ _destroyOverlay: function() {\r
+ if ( !this.options.modal ) {\r
+ return;\r
+ }\r
+\r
+ if ( this.overlay ) {\r
+ var overlays = this.document.data( "ui-dialog-overlays" ) - 1;\r
+\r
+ if ( !overlays ) {\r
+ this.document.off( "focusin.ui-dialog" );\r
+ this.document.removeData( "ui-dialog-overlays" );\r
+ } else {\r
+ this.document.data( "ui-dialog-overlays", overlays );\r
+ }\r
+\r
+ this.overlay.remove();\r
+ this.overlay = null;\r
+ }\r
+ }\r
+} );\r
+\r
+// DEPRECATED\r
+// TODO: switch return back to widget declaration at top of file when this is removed\r
+if ( $.uiBackCompat !== false ) {\r
+\r
+ // Backcompat for dialogClass option\r
+ $.widget( "ui.dialog", $.ui.dialog, {\r
+ options: {\r
+ dialogClass: ""\r
+ },\r
+ _createWrapper: function() {\r
+ this._super();\r
+ this.uiDialog.addClass( this.options.dialogClass );\r
+ },\r
+ _setOption: function( key, value ) {\r
+ if ( key === "dialogClass" ) {\r
+ this.uiDialog\r
+ .removeClass( this.options.dialogClass )\r
+ .addClass( value );\r
+ }\r
+ this._superApply( arguments );\r
+ }\r
+ } );\r
+}\r
+\r
+var widgetsDialog = $.ui.dialog;\r
+\r
+\r
+/*!\r
+ * jQuery UI Progressbar 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Progressbar\r
+//>>group: Widgets\r
+/* eslint-disable max-len */\r
+//>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators.\r
+/* eslint-enable max-len */\r
+//>>docs: http://api.jqueryui.com/progressbar/\r
+//>>demos: http://jqueryui.com/progressbar/\r
+//>>css.structure: ../../themes/base/core.css\r
+//>>css.structure: ../../themes/base/progressbar.css\r
+//>>css.theme: ../../themes/base/theme.css\r
+\r
+\r
+var widgetsProgressbar = $.widget( "ui.progressbar", {\r
+ version: "1.13.1",\r
+ options: {\r
+ classes: {\r
+ "ui-progressbar": "ui-corner-all",\r
+ "ui-progressbar-value": "ui-corner-left",\r
+ "ui-progressbar-complete": "ui-corner-right"\r
+ },\r
+ max: 100,\r
+ value: 0,\r
+\r
+ change: null,\r
+ complete: null\r
+ },\r
+\r
+ min: 0,\r
+\r
+ _create: function() {\r
+\r
+ // Constrain initial value\r
+ this.oldValue = this.options.value = this._constrainedValue();\r
+\r
+ this.element.attr( {\r
+\r
+ // Only set static values; aria-valuenow and aria-valuemax are\r
+ // set inside _refreshValue()\r
+ role: "progressbar",\r
+ "aria-valuemin": this.min\r
+ } );\r
+ this._addClass( "ui-progressbar", "ui-widget ui-widget-content" );\r
+\r
+ this.valueDiv = $( "<div>" ).appendTo( this.element );\r
+ this._addClass( this.valueDiv, "ui-progressbar-value", "ui-widget-header" );\r
+ this._refreshValue();\r
+ },\r
+\r
+ _destroy: function() {\r
+ this.element.removeAttr( "role aria-valuemin aria-valuemax aria-valuenow" );\r
+\r
+ this.valueDiv.remove();\r
+ },\r
+\r
+ value: function( newValue ) {\r
+ if ( newValue === undefined ) {\r
+ return this.options.value;\r
+ }\r
+\r
+ this.options.value = this._constrainedValue( newValue );\r
+ this._refreshValue();\r
+ },\r
+\r
+ _constrainedValue: function( newValue ) {\r
+ if ( newValue === undefined ) {\r
+ newValue = this.options.value;\r
+ }\r
+\r
+ this.indeterminate = newValue === false;\r
+\r
+ // Sanitize value\r
+ if ( typeof newValue !== "number" ) {\r
+ newValue = 0;\r
+ }\r
+\r
+ return this.indeterminate ? false :\r
+ Math.min( this.options.max, Math.max( this.min, newValue ) );\r
+ },\r
+\r
+ _setOptions: function( options ) {\r
+\r
+ // Ensure "value" option is set after other values (like max)\r
+ var value = options.value;\r
+ delete options.value;\r
+\r
+ this._super( options );\r
+\r
+ this.options.value = this._constrainedValue( value );\r
+ this._refreshValue();\r
+ },\r
+\r
+ _setOption: function( key, value ) {\r
+ if ( key === "max" ) {\r
+\r
+ // Don't allow a max less than min\r
+ value = Math.max( this.min, value );\r
+ }\r
+ this._super( key, value );\r
+ },\r
+\r
+ _setOptionDisabled: function( value ) {\r
+ this._super( value );\r
+\r
+ this.element.attr( "aria-disabled", value );\r
+ this._toggleClass( null, "ui-state-disabled", !!value );\r
+ },\r
+\r
+ _percentage: function() {\r
+ return this.indeterminate ?\r
+ 100 :\r
+ 100 * ( this.options.value - this.min ) / ( this.options.max - this.min );\r
+ },\r
+\r
+ _refreshValue: function() {\r
+ var value = this.options.value,\r
+ percentage = this._percentage();\r
+\r
+ this.valueDiv\r
+ .toggle( this.indeterminate || value > this.min )\r
+ .width( percentage.toFixed( 0 ) + "%" );\r
+\r
+ this\r
+ ._toggleClass( this.valueDiv, "ui-progressbar-complete", null,\r
+ value === this.options.max )\r
+ ._toggleClass( "ui-progressbar-indeterminate", null, this.indeterminate );\r
+\r
+ if ( this.indeterminate ) {\r
+ this.element.removeAttr( "aria-valuenow" );\r
+ if ( !this.overlayDiv ) {\r
+ this.overlayDiv = $( "<div>" ).appendTo( this.valueDiv );\r
+ this._addClass( this.overlayDiv, "ui-progressbar-overlay" );\r
+ }\r
+ } else {\r
+ this.element.attr( {\r
+ "aria-valuemax": this.options.max,\r
+ "aria-valuenow": value\r
+ } );\r
+ if ( this.overlayDiv ) {\r
+ this.overlayDiv.remove();\r
+ this.overlayDiv = null;\r
+ }\r
+ }\r
+\r
+ if ( this.oldValue !== value ) {\r
+ this.oldValue = value;\r
+ this._trigger( "change" );\r
+ }\r
+ if ( value === this.options.max ) {\r
+ this._trigger( "complete" );\r
+ }\r
+ }\r
+} );\r
+\r
+\r
+/*!\r
+ * jQuery UI Selectmenu 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Selectmenu\r
+//>>group: Widgets\r
+/* eslint-disable max-len */\r
+//>>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.\r
+/* eslint-enable max-len */\r
+//>>docs: http://api.jqueryui.com/selectmenu/\r
+//>>demos: http://jqueryui.com/selectmenu/\r
+//>>css.structure: ../../themes/base/core.css\r
+//>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css\r
+//>>css.theme: ../../themes/base/theme.css\r
+\r
+\r
+var widgetsSelectmenu = $.widget( "ui.selectmenu", [ $.ui.formResetMixin, {\r
+ version: "1.13.1",\r
+ defaultElement: "<select>",\r
+ options: {\r
+ appendTo: null,\r
+ classes: {\r
+ "ui-selectmenu-button-open": "ui-corner-top",\r
+ "ui-selectmenu-button-closed": "ui-corner-all"\r
+ },\r
+ disabled: null,\r
+ icons: {\r
+ button: "ui-icon-triangle-1-s"\r
+ },\r
+ position: {\r
+ my: "left top",\r
+ at: "left bottom",\r
+ collision: "none"\r
+ },\r
+ width: false,\r
+\r
+ // Callbacks\r
+ change: null,\r
+ close: null,\r
+ focus: null,\r
+ open: null,\r
+ select: null\r
+ },\r
+\r
+ _create: function() {\r
+ var selectmenuId = this.element.uniqueId().attr( "id" );\r
+ this.ids = {\r
+ element: selectmenuId,\r
+ button: selectmenuId + "-button",\r
+ menu: selectmenuId + "-menu"\r
+ };\r
+\r
+ this._drawButton();\r
+ this._drawMenu();\r
+ this._bindFormResetHandler();\r
+\r
+ this._rendered = false;\r
+ this.menuItems = $();\r
+ },\r
+\r
+ _drawButton: function() {\r
+ var icon,\r
+ that = this,\r
+ item = this._parseOption(\r
+ this.element.find( "option:selected" ),\r
+ this.element[ 0 ].selectedIndex\r
+ );\r
+\r
+ // Associate existing label with the new button\r
+ this.labels = this.element.labels().attr( "for", this.ids.button );\r
+ this._on( this.labels, {\r
+ click: function( event ) {\r
+ this.button.trigger( "focus" );\r
+ event.preventDefault();\r
+ }\r
+ } );\r
+\r
+ // Hide original select element\r
+ this.element.hide();\r
+\r
+ // Create button\r
+ this.button = $( "<span>", {\r
+ tabindex: this.options.disabled ? -1 : 0,\r
+ id: this.ids.button,\r
+ role: "combobox",\r
+ "aria-expanded": "false",\r
+ "aria-autocomplete": "list",\r
+ "aria-owns": this.ids.menu,\r
+ "aria-haspopup": "true",\r
+ title: this.element.attr( "title" )\r
+ } )\r
+ .insertAfter( this.element );\r
+\r
+ this._addClass( this.button, "ui-selectmenu-button ui-selectmenu-button-closed",\r
+ "ui-button ui-widget" );\r
+\r
+ icon = $( "<span>" ).appendTo( this.button );\r
+ this._addClass( icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button );\r
+ this.buttonItem = this._renderButtonItem( item )\r
+ .appendTo( this.button );\r
+\r
+ if ( this.options.width !== false ) {\r
+ this._resizeButton();\r
+ }\r
+\r
+ this._on( this.button, this._buttonEvents );\r
+ this.button.one( "focusin", function() {\r
+\r
+ // Delay rendering the menu items until the button receives focus.\r
+ // The menu may have already been rendered via a programmatic open.\r
+ if ( !that._rendered ) {\r
+ that._refreshMenu();\r
+ }\r
+ } );\r
+ },\r
+\r
+ _drawMenu: function() {\r
+ var that = this;\r
+\r
+ // Create menu\r
+ this.menu = $( "<ul>", {\r
+ "aria-hidden": "true",\r
+ "aria-labelledby": this.ids.button,\r
+ id: this.ids.menu\r
+ } );\r
+\r
+ // Wrap menu\r
+ this.menuWrap = $( "<div>" ).append( this.menu );\r
+ this._addClass( this.menuWrap, "ui-selectmenu-menu", "ui-front" );\r
+ this.menuWrap.appendTo( this._appendTo() );\r
+\r
+ // Initialize menu widget\r
+ this.menuInstance = this.menu\r
+ .menu( {\r
+ classes: {\r
+ "ui-menu": "ui-corner-bottom"\r
+ },\r
+ role: "listbox",\r
+ select: function( event, ui ) {\r
+ event.preventDefault();\r
+\r
+ // Support: IE8\r
+ // If the item was selected via a click, the text selection\r
+ // will be destroyed in IE\r
+ that._setSelection();\r
+\r
+ that._select( ui.item.data( "ui-selectmenu-item" ), event );\r
+ },\r
+ focus: function( event, ui ) {\r
+ var item = ui.item.data( "ui-selectmenu-item" );\r
+\r
+ // Prevent inital focus from firing and check if its a newly focused item\r
+ if ( that.focusIndex != null && item.index !== that.focusIndex ) {\r
+ that._trigger( "focus", event, { item: item } );\r
+ if ( !that.isOpen ) {\r
+ that._select( item, event );\r
+ }\r
+ }\r
+ that.focusIndex = item.index;\r
+\r
+ that.button.attr( "aria-activedescendant",\r
+ that.menuItems.eq( item.index ).attr( "id" ) );\r
+ }\r
+ } )\r
+ .menu( "instance" );\r
+\r
+ // Don't close the menu on mouseleave\r
+ this.menuInstance._off( this.menu, "mouseleave" );\r
+\r
+ // Cancel the menu's collapseAll on document click\r
+ this.menuInstance._closeOnDocumentClick = function() {\r
+ return false;\r
+ };\r
+\r
+ // Selects often contain empty items, but never contain dividers\r
+ this.menuInstance._isDivider = function() {\r
+ return false;\r
+ };\r
+ },\r
+\r
+ refresh: function() {\r
+ this._refreshMenu();\r
+ this.buttonItem.replaceWith(\r
+ this.buttonItem = this._renderButtonItem(\r
+\r
+ // Fall back to an empty object in case there are no options\r
+ this._getSelectedItem().data( "ui-selectmenu-item" ) || {}\r
+ )\r
+ );\r
+ if ( this.options.width === null ) {\r
+ this._resizeButton();\r
+ }\r
+ },\r
+\r
+ _refreshMenu: function() {\r
+ var item,\r
+ options = this.element.find( "option" );\r
+\r
+ this.menu.empty();\r
+\r
+ this._parseOptions( options );\r
+ this._renderMenu( this.menu, this.items );\r
+\r
+ this.menuInstance.refresh();\r
+ this.menuItems = this.menu.find( "li" )\r
+ .not( ".ui-selectmenu-optgroup" )\r
+ .find( ".ui-menu-item-wrapper" );\r
+\r
+ this._rendered = true;\r
+\r
+ if ( !options.length ) {\r
+ return;\r
+ }\r
+\r
+ item = this._getSelectedItem();\r
+\r
+ // Update the menu to have the correct item focused\r
+ this.menuInstance.focus( null, item );\r
+ this._setAria( item.data( "ui-selectmenu-item" ) );\r
+\r
+ // Set disabled state\r
+ this._setOption( "disabled", this.element.prop( "disabled" ) );\r
+ },\r
+\r
+ open: function( event ) {\r
+ if ( this.options.disabled ) {\r
+ return;\r
+ }\r
+\r
+ // If this is the first time the menu is being opened, render the items\r
+ if ( !this._rendered ) {\r
+ this._refreshMenu();\r
+ } else {\r
+\r
+ // Menu clears focus on close, reset focus to selected item\r
+ this._removeClass( this.menu.find( ".ui-state-active" ), null, "ui-state-active" );\r
+ this.menuInstance.focus( null, this._getSelectedItem() );\r
+ }\r
+\r
+ // If there are no options, don't open the menu\r
+ if ( !this.menuItems.length ) {\r
+ return;\r
+ }\r
+\r
+ this.isOpen = true;\r
+ this._toggleAttr();\r
+ this._resizeMenu();\r
+ this._position();\r
+\r
+ this._on( this.document, this._documentClick );\r
+\r
+ this._trigger( "open", event );\r
+ },\r
+\r
+ _position: function() {\r
+ this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) );\r
+ },\r
+\r
+ close: function( event ) {\r
+ if ( !this.isOpen ) {\r
+ return;\r
+ }\r
+\r
+ this.isOpen = false;\r
+ this._toggleAttr();\r
+\r
+ this.range = null;\r
+ this._off( this.document );\r
+\r
+ this._trigger( "close", event );\r
+ },\r
+\r
+ widget: function() {\r
+ return this.button;\r
+ },\r
+\r
+ menuWidget: function() {\r
+ return this.menu;\r
+ },\r
+\r
+ _renderButtonItem: function( item ) {\r
+ var buttonItem = $( "<span>" );\r
+\r
+ this._setText( buttonItem, item.label );\r
+ this._addClass( buttonItem, "ui-selectmenu-text" );\r
+\r
+ return buttonItem;\r
+ },\r
+\r
+ _renderMenu: function( ul, items ) {\r
+ var that = this,\r
+ currentOptgroup = "";\r
+\r
+ $.each( items, function( index, item ) {\r
+ var li;\r
+\r
+ if ( item.optgroup !== currentOptgroup ) {\r
+ li = $( "<li>", {\r
+ text: item.optgroup\r
+ } );\r
+ that._addClass( li, "ui-selectmenu-optgroup", "ui-menu-divider" +\r
+ ( item.element.parent( "optgroup" ).prop( "disabled" ) ?\r
+ " ui-state-disabled" :\r
+ "" ) );\r
+\r
+ li.appendTo( ul );\r
+\r
+ currentOptgroup = item.optgroup;\r
+ }\r
+\r
+ that._renderItemData( ul, item );\r
+ } );\r
+ },\r
+\r
+ _renderItemData: function( ul, item ) {\r
+ return this._renderItem( ul, item ).data( "ui-selectmenu-item", item );\r
+ },\r
+\r
+ _renderItem: function( ul, item ) {\r
+ var li = $( "<li>" ),\r
+ wrapper = $( "<div>", {\r
+ title: item.element.attr( "title" )\r
+ } );\r
+\r
+ if ( item.disabled ) {\r
+ this._addClass( li, null, "ui-state-disabled" );\r
+ }\r
+ this._setText( wrapper, item.label );\r
+\r
+ return li.append( wrapper ).appendTo( ul );\r
+ },\r
+\r
+ _setText: function( element, value ) {\r
+ if ( value ) {\r
+ element.text( value );\r
+ } else {\r
+ element.html( " " );\r
+ }\r
+ },\r
+\r
+ _move: function( direction, event ) {\r
+ var item, next,\r
+ filter = ".ui-menu-item";\r
+\r
+ if ( this.isOpen ) {\r
+ item = this.menuItems.eq( this.focusIndex ).parent( "li" );\r
+ } else {\r
+ item = this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" );\r
+ filter += ":not(.ui-state-disabled)";\r
+ }\r
+\r
+ if ( direction === "first" || direction === "last" ) {\r
+ next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 );\r
+ } else {\r
+ next = item[ direction + "All" ]( filter ).eq( 0 );\r
+ }\r
+\r
+ if ( next.length ) {\r
+ this.menuInstance.focus( event, next );\r
+ }\r
+ },\r
+\r
+ _getSelectedItem: function() {\r
+ return this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" );\r
+ },\r
+\r
+ _toggle: function( event ) {\r
+ this[ this.isOpen ? "close" : "open" ]( event );\r
+ },\r
+\r
+ _setSelection: function() {\r
+ var selection;\r
+\r
+ if ( !this.range ) {\r
+ return;\r
+ }\r
+\r
+ if ( window.getSelection ) {\r
+ selection = window.getSelection();\r
+ selection.removeAllRanges();\r
+ selection.addRange( this.range );\r
+\r
+ // Support: IE8\r
+ } else {\r
+ this.range.select();\r
+ }\r
+\r
+ // Support: IE\r
+ // Setting the text selection kills the button focus in IE, but\r
+ // restoring the focus doesn't kill the selection.\r
+ this.button.focus();\r
+ },\r
+\r
+ _documentClick: {\r
+ mousedown: function( event ) {\r
+ if ( !this.isOpen ) {\r
+ return;\r
+ }\r
+\r
+ if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" +\r
+ $.escapeSelector( this.ids.button ) ).length ) {\r
+ this.close( event );\r
+ }\r
+ }\r
+ },\r
+\r
+ _buttonEvents: {\r
+\r
+ // Prevent text selection from being reset when interacting with the selectmenu (#10144)\r
+ mousedown: function() {\r
+ var selection;\r
+\r
+ if ( window.getSelection ) {\r
+ selection = window.getSelection();\r
+ if ( selection.rangeCount ) {\r
+ this.range = selection.getRangeAt( 0 );\r
+ }\r
+\r
+ // Support: IE8\r
+ } else {\r
+ this.range = document.selection.createRange();\r
+ }\r
+ },\r
+\r
+ click: function( event ) {\r
+ this._setSelection();\r
+ this._toggle( event );\r
+ },\r
+\r
+ keydown: function( event ) {\r
+ var preventDefault = true;\r
+ switch ( event.keyCode ) {\r
+ case $.ui.keyCode.TAB:\r
+ case $.ui.keyCode.ESCAPE:\r
+ this.close( event );\r
+ preventDefault = false;\r
+ break;\r
+ case $.ui.keyCode.ENTER:\r
+ if ( this.isOpen ) {\r
+ this._selectFocusedItem( event );\r
+ }\r
+ break;\r
+ case $.ui.keyCode.UP:\r
+ if ( event.altKey ) {\r
+ this._toggle( event );\r
+ } else {\r
+ this._move( "prev", event );\r
+ }\r
+ break;\r
+ case $.ui.keyCode.DOWN:\r
+ if ( event.altKey ) {\r
+ this._toggle( event );\r
+ } else {\r
+ this._move( "next", event );\r
+ }\r
+ break;\r
+ case $.ui.keyCode.SPACE:\r
+ if ( this.isOpen ) {\r
+ this._selectFocusedItem( event );\r
+ } else {\r
+ this._toggle( event );\r
+ }\r
+ break;\r
+ case $.ui.keyCode.LEFT:\r
+ this._move( "prev", event );\r
+ break;\r
+ case $.ui.keyCode.RIGHT:\r
+ this._move( "next", event );\r
+ break;\r
+ case $.ui.keyCode.HOME:\r
+ case $.ui.keyCode.PAGE_UP:\r
+ this._move( "first", event );\r
+ break;\r
+ case $.ui.keyCode.END:\r
+ case $.ui.keyCode.PAGE_DOWN:\r
+ this._move( "last", event );\r
+ break;\r
+ default:\r
+ this.menu.trigger( event );\r
+ preventDefault = false;\r
+ }\r
+\r
+ if ( preventDefault ) {\r
+ event.preventDefault();\r
+ }\r
+ }\r
+ },\r
+\r
+ _selectFocusedItem: function( event ) {\r
+ var item = this.menuItems.eq( this.focusIndex ).parent( "li" );\r
+ if ( !item.hasClass( "ui-state-disabled" ) ) {\r
+ this._select( item.data( "ui-selectmenu-item" ), event );\r
+ }\r
+ },\r
+\r
+ _select: function( item, event ) {\r
+ var oldIndex = this.element[ 0 ].selectedIndex;\r
+\r
+ // Change native select element\r
+ this.element[ 0 ].selectedIndex = item.index;\r
+ this.buttonItem.replaceWith( this.buttonItem = this._renderButtonItem( item ) );\r
+ this._setAria( item );\r
+ this._trigger( "select", event, { item: item } );\r
+\r
+ if ( item.index !== oldIndex ) {\r
+ this._trigger( "change", event, { item: item } );\r
+ }\r
+\r
+ this.close( event );\r
+ },\r
+\r
+ _setAria: function( item ) {\r
+ var id = this.menuItems.eq( item.index ).attr( "id" );\r
+\r
+ this.button.attr( {\r
+ "aria-labelledby": id,\r
+ "aria-activedescendant": id\r
+ } );\r
+ this.menu.attr( "aria-activedescendant", id );\r
+ },\r
+\r
+ _setOption: function( key, value ) {\r
+ if ( key === "icons" ) {\r
+ var icon = this.button.find( "span.ui-icon" );\r
+ this._removeClass( icon, null, this.options.icons.button )\r
+ ._addClass( icon, null, value.button );\r
+ }\r
+\r
+ this._super( key, value );\r
+\r
+ if ( key === "appendTo" ) {\r
+ this.menuWrap.appendTo( this._appendTo() );\r
+ }\r
+\r
+ if ( key === "width" ) {\r
+ this._resizeButton();\r
+ }\r
+ },\r
+\r
+ _setOptionDisabled: function( value ) {\r
+ this._super( value );\r
+\r
+ this.menuInstance.option( "disabled", value );\r
+ this.button.attr( "aria-disabled", value );\r
+ this._toggleClass( this.button, null, "ui-state-disabled", value );\r
+\r
+ this.element.prop( "disabled", value );\r
+ if ( value ) {\r
+ this.button.attr( "tabindex", -1 );\r
+ this.close();\r
+ } else {\r
+ this.button.attr( "tabindex", 0 );\r
+ }\r
+ },\r
+\r
+ _appendTo: function() {\r
+ var element = this.options.appendTo;\r
+\r
+ if ( element ) {\r
+ element = element.jquery || element.nodeType ?\r
+ $( element ) :\r
+ this.document.find( element ).eq( 0 );\r
+ }\r
+\r
+ if ( !element || !element[ 0 ] ) {\r
+ element = this.element.closest( ".ui-front, dialog" );\r
+ }\r
+\r
+ if ( !element.length ) {\r
+ element = this.document[ 0 ].body;\r
+ }\r
+\r
+ return element;\r
+ },\r
+\r
+ _toggleAttr: function() {\r
+ this.button.attr( "aria-expanded", this.isOpen );\r
+\r
+ // We can't use two _toggleClass() calls here, because we need to make sure\r
+ // we always remove classes first and add them second, otherwise if both classes have the\r
+ // same theme class, it will be removed after we add it.\r
+ this._removeClass( this.button, "ui-selectmenu-button-" +\r
+ ( this.isOpen ? "closed" : "open" ) )\r
+ ._addClass( this.button, "ui-selectmenu-button-" +\r
+ ( this.isOpen ? "open" : "closed" ) )\r
+ ._toggleClass( this.menuWrap, "ui-selectmenu-open", null, this.isOpen );\r
+\r
+ this.menu.attr( "aria-hidden", !this.isOpen );\r
+ },\r
+\r
+ _resizeButton: function() {\r
+ var width = this.options.width;\r
+\r
+ // For `width: false`, just remove inline style and stop\r
+ if ( width === false ) {\r
+ this.button.css( "width", "" );\r
+ return;\r
+ }\r
+\r
+ // For `width: null`, match the width of the original element\r
+ if ( width === null ) {\r
+ width = this.element.show().outerWidth();\r
+ this.element.hide();\r
+ }\r
+\r
+ this.button.outerWidth( width );\r
+ },\r
+\r
+ _resizeMenu: function() {\r
+ this.menu.outerWidth( Math.max(\r
+ this.button.outerWidth(),\r
+\r
+ // Support: IE10\r
+ // IE10 wraps long text (possibly a rounding bug)\r
+ // so we add 1px to avoid the wrapping\r
+ this.menu.width( "" ).outerWidth() + 1\r
+ ) );\r
+ },\r
+\r
+ _getCreateOptions: function() {\r
+ var options = this._super();\r
+\r
+ options.disabled = this.element.prop( "disabled" );\r
+\r
+ return options;\r
+ },\r
+\r
+ _parseOptions: function( options ) {\r
+ var that = this,\r
+ data = [];\r
+ options.each( function( index, item ) {\r
+ if ( item.hidden ) {\r
+ return;\r
+ }\r
+\r
+ data.push( that._parseOption( $( item ), index ) );\r
+ } );\r
+ this.items = data;\r
+ },\r
+\r
+ _parseOption: function( option, index ) {\r
+ var optgroup = option.parent( "optgroup" );\r
+\r
+ return {\r
+ element: option,\r
+ index: index,\r
+ value: option.val(),\r
+ label: option.text(),\r
+ optgroup: optgroup.attr( "label" ) || "",\r
+ disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" )\r
+ };\r
+ },\r
+\r
+ _destroy: function() {\r
+ this._unbindFormResetHandler();\r
+ this.menuWrap.remove();\r
+ this.button.remove();\r
+ this.element.show();\r
+ this.element.removeUniqueId();\r
+ this.labels.attr( "for", this.ids.element );\r
+ }\r
+} ] );\r
+\r
+\r
+/*!\r
+ * jQuery UI Slider 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Slider\r
+//>>group: Widgets\r
+//>>description: Displays a flexible slider with ranges and accessibility via keyboard.\r
+//>>docs: http://api.jqueryui.com/slider/\r
+//>>demos: http://jqueryui.com/slider/\r
+//>>css.structure: ../../themes/base/core.css\r
+//>>css.structure: ../../themes/base/slider.css\r
+//>>css.theme: ../../themes/base/theme.css\r
+\r
+\r
+var widgetsSlider = $.widget( "ui.slider", $.ui.mouse, {\r
+ version: "1.13.1",\r
+ widgetEventPrefix: "slide",\r
+\r
+ options: {\r
+ animate: false,\r
+ classes: {\r
+ "ui-slider": "ui-corner-all",\r
+ "ui-slider-handle": "ui-corner-all",\r
+\r
+ // Note: ui-widget-header isn't the most fittingly semantic framework class for this\r
+ // element, but worked best visually with a variety of themes\r
+ "ui-slider-range": "ui-corner-all ui-widget-header"\r
+ },\r
+ distance: 0,\r
+ max: 100,\r
+ min: 0,\r
+ orientation: "horizontal",\r
+ range: false,\r
+ step: 1,\r
+ value: 0,\r
+ values: null,\r
+\r
+ // Callbacks\r
+ change: null,\r
+ slide: null,\r
+ start: null,\r
+ stop: null\r
+ },\r
+\r
+ // Number of pages in a slider\r
+ // (how many times can you page up/down to go through the whole range)\r
+ numPages: 5,\r
+\r
+ _create: function() {\r
+ this._keySliding = false;\r
+ this._mouseSliding = false;\r
+ this._animateOff = true;\r
+ this._handleIndex = null;\r
+ this._detectOrientation();\r
+ this._mouseInit();\r
+ this._calculateNewMax();\r
+\r
+ this._addClass( "ui-slider ui-slider-" + this.orientation,\r
+ "ui-widget ui-widget-content" );\r
+\r
+ this._refresh();\r
+\r
+ this._animateOff = false;\r
+ },\r
+\r
+ _refresh: function() {\r
+ this._createRange();\r
+ this._createHandles();\r
+ this._setupEvents();\r
+ this._refreshValue();\r
+ },\r
+\r
+ _createHandles: function() {\r
+ var i, handleCount,\r
+ options = this.options,\r
+ existingHandles = this.element.find( ".ui-slider-handle" ),\r
+ handle = "<span tabindex='0'></span>",\r
+ handles = [];\r
+\r
+ handleCount = ( options.values && options.values.length ) || 1;\r
+\r
+ if ( existingHandles.length > handleCount ) {\r
+ existingHandles.slice( handleCount ).remove();\r
+ existingHandles = existingHandles.slice( 0, handleCount );\r
+ }\r
+\r
+ for ( i = existingHandles.length; i < handleCount; i++ ) {\r
+ handles.push( handle );\r
+ }\r
+\r
+ this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );\r
+\r
+ this._addClass( this.handles, "ui-slider-handle", "ui-state-default" );\r
+\r
+ this.handle = this.handles.eq( 0 );\r
+\r
+ this.handles.each( function( i ) {\r
+ $( this )\r
+ .data( "ui-slider-handle-index", i )\r
+ .attr( "tabIndex", 0 );\r
+ } );\r
+ },\r
+\r
+ _createRange: function() {\r
+ var options = this.options;\r
+\r
+ if ( options.range ) {\r
+ if ( options.range === true ) {\r
+ if ( !options.values ) {\r
+ options.values = [ this._valueMin(), this._valueMin() ];\r
+ } else if ( options.values.length && options.values.length !== 2 ) {\r
+ options.values = [ options.values[ 0 ], options.values[ 0 ] ];\r
+ } else if ( Array.isArray( options.values ) ) {\r
+ options.values = options.values.slice( 0 );\r
+ }\r
+ }\r
+\r
+ if ( !this.range || !this.range.length ) {\r
+ this.range = $( "<div>" )\r
+ .appendTo( this.element );\r
+\r
+ this._addClass( this.range, "ui-slider-range" );\r
+ } else {\r
+ this._removeClass( this.range, "ui-slider-range-min ui-slider-range-max" );\r
+\r
+ // Handle range switching from true to min/max\r
+ this.range.css( {\r
+ "left": "",\r
+ "bottom": ""\r
+ } );\r
+ }\r
+ if ( options.range === "min" || options.range === "max" ) {\r
+ this._addClass( this.range, "ui-slider-range-" + options.range );\r
+ }\r
+ } else {\r
+ if ( this.range ) {\r
+ this.range.remove();\r
+ }\r
+ this.range = null;\r
+ }\r
+ },\r
+\r
+ _setupEvents: function() {\r
+ this._off( this.handles );\r
+ this._on( this.handles, this._handleEvents );\r
+ this._hoverable( this.handles );\r
+ this._focusable( this.handles );\r
+ },\r
+\r
+ _destroy: function() {\r
+ this.handles.remove();\r
+ if ( this.range ) {\r
+ this.range.remove();\r
+ }\r
+\r
+ this._mouseDestroy();\r
+ },\r
+\r
+ _mouseCapture: function( event ) {\r
+ var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,\r
+ that = this,\r
+ o = this.options;\r
+\r
+ if ( o.disabled ) {\r
+ return false;\r
+ }\r
+\r
+ this.elementSize = {\r
+ width: this.element.outerWidth(),\r
+ height: this.element.outerHeight()\r
+ };\r
+ this.elementOffset = this.element.offset();\r
+\r
+ position = { x: event.pageX, y: event.pageY };\r
+ normValue = this._normValueFromMouse( position );\r
+ distance = this._valueMax() - this._valueMin() + 1;\r
+ this.handles.each( function( i ) {\r
+ var thisDistance = Math.abs( normValue - that.values( i ) );\r
+ if ( ( distance > thisDistance ) ||\r
+ ( distance === thisDistance &&\r
+ ( i === that._lastChangedValue || that.values( i ) === o.min ) ) ) {\r
+ distance = thisDistance;\r
+ closestHandle = $( this );\r
+ index = i;\r
+ }\r
+ } );\r
+\r
+ allowed = this._start( event, index );\r
+ if ( allowed === false ) {\r
+ return false;\r
+ }\r
+ this._mouseSliding = true;\r
+\r
+ this._handleIndex = index;\r
+\r
+ this._addClass( closestHandle, null, "ui-state-active" );\r
+ closestHandle.trigger( "focus" );\r
+\r
+ offset = closestHandle.offset();\r
+ mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" );\r
+ this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {\r
+ left: event.pageX - offset.left - ( closestHandle.width() / 2 ),\r
+ top: event.pageY - offset.top -\r
+ ( closestHandle.height() / 2 ) -\r
+ ( parseInt( closestHandle.css( "borderTopWidth" ), 10 ) || 0 ) -\r
+ ( parseInt( closestHandle.css( "borderBottomWidth" ), 10 ) || 0 ) +\r
+ ( parseInt( closestHandle.css( "marginTop" ), 10 ) || 0 )\r
+ };\r
+\r
+ if ( !this.handles.hasClass( "ui-state-hover" ) ) {\r
+ this._slide( event, index, normValue );\r
+ }\r
+ this._animateOff = true;\r
+ return true;\r
+ },\r
+\r
+ _mouseStart: function() {\r
+ return true;\r
+ },\r
+\r
+ _mouseDrag: function( event ) {\r
+ var position = { x: event.pageX, y: event.pageY },\r
+ normValue = this._normValueFromMouse( position );\r
+\r
+ this._slide( event, this._handleIndex, normValue );\r
+\r
+ return false;\r
+ },\r
+\r
+ _mouseStop: function( event ) {\r
+ this._removeClass( this.handles, null, "ui-state-active" );\r
+ this._mouseSliding = false;\r
+\r
+ this._stop( event, this._handleIndex );\r
+ this._change( event, this._handleIndex );\r
+\r
+ this._handleIndex = null;\r
+ this._clickOffset = null;\r
+ this._animateOff = false;\r
+\r
+ return false;\r
+ },\r
+\r
+ _detectOrientation: function() {\r
+ this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";\r
+ },\r
+\r
+ _normValueFromMouse: function( position ) {\r
+ var pixelTotal,\r
+ pixelMouse,\r
+ percentMouse,\r
+ valueTotal,\r
+ valueMouse;\r
+\r
+ if ( this.orientation === "horizontal" ) {\r
+ pixelTotal = this.elementSize.width;\r
+ pixelMouse = position.x - this.elementOffset.left -\r
+ ( this._clickOffset ? this._clickOffset.left : 0 );\r
+ } else {\r
+ pixelTotal = this.elementSize.height;\r
+ pixelMouse = position.y - this.elementOffset.top -\r
+ ( this._clickOffset ? this._clickOffset.top : 0 );\r
+ }\r
+\r
+ percentMouse = ( pixelMouse / pixelTotal );\r
+ if ( percentMouse > 1 ) {\r
+ percentMouse = 1;\r
+ }\r
+ if ( percentMouse < 0 ) {\r
+ percentMouse = 0;\r
+ }\r
+ if ( this.orientation === "vertical" ) {\r
+ percentMouse = 1 - percentMouse;\r
+ }\r
+\r
+ valueTotal = this._valueMax() - this._valueMin();\r
+ valueMouse = this._valueMin() + percentMouse * valueTotal;\r
+\r
+ return this._trimAlignValue( valueMouse );\r
+ },\r
+\r
+ _uiHash: function( index, value, values ) {\r
+ var uiHash = {\r
+ handle: this.handles[ index ],\r
+ handleIndex: index,\r
+ value: value !== undefined ? value : this.value()\r
+ };\r
+\r
+ if ( this._hasMultipleValues() ) {\r
+ uiHash.value = value !== undefined ? value : this.values( index );\r
+ uiHash.values = values || this.values();\r
+ }\r
+\r
+ return uiHash;\r
+ },\r
+\r
+ _hasMultipleValues: function() {\r
+ return this.options.values && this.options.values.length;\r
+ },\r
+\r
+ _start: function( event, index ) {\r
+ return this._trigger( "start", event, this._uiHash( index ) );\r
+ },\r
+\r
+ _slide: function( event, index, newVal ) {\r
+ var allowed, otherVal,\r
+ currentValue = this.value(),\r
+ newValues = this.values();\r
+\r
+ if ( this._hasMultipleValues() ) {\r
+ otherVal = this.values( index ? 0 : 1 );\r
+ currentValue = this.values( index );\r
+\r
+ if ( this.options.values.length === 2 && this.options.range === true ) {\r
+ newVal = index === 0 ? Math.min( otherVal, newVal ) : Math.max( otherVal, newVal );\r
+ }\r
+\r
+ newValues[ index ] = newVal;\r
+ }\r
+\r
+ if ( newVal === currentValue ) {\r
+ return;\r
+ }\r
+\r
+ allowed = this._trigger( "slide", event, this._uiHash( index, newVal, newValues ) );\r
+\r
+ // A slide can be canceled by returning false from the slide callback\r
+ if ( allowed === false ) {\r
+ return;\r
+ }\r
+\r
+ if ( this._hasMultipleValues() ) {\r
+ this.values( index, newVal );\r
+ } else {\r
+ this.value( newVal );\r
+ }\r
+ },\r
+\r
+ _stop: function( event, index ) {\r
+ this._trigger( "stop", event, this._uiHash( index ) );\r
+ },\r
+\r
+ _change: function( event, index ) {\r
+ if ( !this._keySliding && !this._mouseSliding ) {\r
+\r
+ //store the last changed value index for reference when handles overlap\r
+ this._lastChangedValue = index;\r
+ this._trigger( "change", event, this._uiHash( index ) );\r
+ }\r
+ },\r
+\r
+ value: function( newValue ) {\r
+ if ( arguments.length ) {\r
+ this.options.value = this._trimAlignValue( newValue );\r
+ this._refreshValue();\r
+ this._change( null, 0 );\r
+ return;\r
+ }\r
+\r
+ return this._value();\r
+ },\r
+\r
+ values: function( index, newValue ) {\r
+ var vals,\r
+ newValues,\r
+ i;\r
+\r
+ if ( arguments.length > 1 ) {\r
+ this.options.values[ index ] = this._trimAlignValue( newValue );\r
+ this._refreshValue();\r
+ this._change( null, index );\r
+ return;\r
+ }\r
+\r
+ if ( arguments.length ) {\r
+ if ( Array.isArray( arguments[ 0 ] ) ) {\r
+ vals = this.options.values;\r
+ newValues = arguments[ 0 ];\r
+ for ( i = 0; i < vals.length; i += 1 ) {\r
+ vals[ i ] = this._trimAlignValue( newValues[ i ] );\r
+ this._change( null, i );\r
+ }\r
+ this._refreshValue();\r
+ } else {\r
+ if ( this._hasMultipleValues() ) {\r
+ return this._values( index );\r
+ } else {\r
+ return this.value();\r
+ }\r
+ }\r
+ } else {\r
+ return this._values();\r
+ }\r
+ },\r
+\r
+ _setOption: function( key, value ) {\r
+ var i,\r
+ valsLength = 0;\r
+\r
+ if ( key === "range" && this.options.range === true ) {\r
+ if ( value === "min" ) {\r
+ this.options.value = this._values( 0 );\r
+ this.options.values = null;\r
+ } else if ( value === "max" ) {\r
+ this.options.value = this._values( this.options.values.length - 1 );\r
+ this.options.values = null;\r
+ }\r
+ }\r
+\r
+ if ( Array.isArray( this.options.values ) ) {\r
+ valsLength = this.options.values.length;\r
+ }\r
+\r
+ this._super( key, value );\r
+\r
+ switch ( key ) {\r
+ case "orientation":\r
+ this._detectOrientation();\r
+ this._removeClass( "ui-slider-horizontal ui-slider-vertical" )\r
+ ._addClass( "ui-slider-" + this.orientation );\r
+ this._refreshValue();\r
+ if ( this.options.range ) {\r
+ this._refreshRange( value );\r
+ }\r
+\r
+ // Reset positioning from previous orientation\r
+ this.handles.css( value === "horizontal" ? "bottom" : "left", "" );\r
+ break;\r
+ case "value":\r
+ this._animateOff = true;\r
+ this._refreshValue();\r
+ this._change( null, 0 );\r
+ this._animateOff = false;\r
+ break;\r
+ case "values":\r
+ this._animateOff = true;\r
+ this._refreshValue();\r
+\r
+ // Start from the last handle to prevent unreachable handles (#9046)\r
+ for ( i = valsLength - 1; i >= 0; i-- ) {\r
+ this._change( null, i );\r
+ }\r
+ this._animateOff = false;\r
+ break;\r
+ case "step":\r
+ case "min":\r
+ case "max":\r
+ this._animateOff = true;\r
+ this._calculateNewMax();\r
+ this._refreshValue();\r
+ this._animateOff = false;\r
+ break;\r
+ case "range":\r
+ this._animateOff = true;\r
+ this._refresh();\r
+ this._animateOff = false;\r
+ break;\r
+ }\r
+ },\r
+\r
+ _setOptionDisabled: function( value ) {\r
+ this._super( value );\r
+\r
+ this._toggleClass( null, "ui-state-disabled", !!value );\r
+ },\r
+\r
+ //internal value getter\r
+ // _value() returns value trimmed by min and max, aligned by step\r
+ _value: function() {\r
+ var val = this.options.value;\r
+ val = this._trimAlignValue( val );\r
+\r
+ return val;\r
+ },\r
+\r
+ //internal values getter\r
+ // _values() returns array of values trimmed by min and max, aligned by step\r
+ // _values( index ) returns single value trimmed by min and max, aligned by step\r
+ _values: function( index ) {\r
+ var val,\r
+ vals,\r
+ i;\r
+\r
+ if ( arguments.length ) {\r
+ val = this.options.values[ index ];\r
+ val = this._trimAlignValue( val );\r
+\r
+ return val;\r
+ } else if ( this._hasMultipleValues() ) {\r
+\r
+ // .slice() creates a copy of the array\r
+ // this copy gets trimmed by min and max and then returned\r
+ vals = this.options.values.slice();\r
+ for ( i = 0; i < vals.length; i += 1 ) {\r
+ vals[ i ] = this._trimAlignValue( vals[ i ] );\r
+ }\r
+\r
+ return vals;\r
+ } else {\r
+ return [];\r
+ }\r
+ },\r
+\r
+ // Returns the step-aligned value that val is closest to, between (inclusive) min and max\r
+ _trimAlignValue: function( val ) {\r
+ if ( val <= this._valueMin() ) {\r
+ return this._valueMin();\r
+ }\r
+ if ( val >= this._valueMax() ) {\r
+ return this._valueMax();\r
+ }\r
+ var step = ( this.options.step > 0 ) ? this.options.step : 1,\r
+ valModStep = ( val - this._valueMin() ) % step,\r
+ alignValue = val - valModStep;\r
+\r
+ if ( Math.abs( valModStep ) * 2 >= step ) {\r
+ alignValue += ( valModStep > 0 ) ? step : ( -step );\r
+ }\r
+\r
+ // Since JavaScript has problems with large floats, round\r
+ // the final value to 5 digits after the decimal point (see #4124)\r
+ return parseFloat( alignValue.toFixed( 5 ) );\r
+ },\r
+\r
+ _calculateNewMax: function() {\r
+ var max = this.options.max,\r
+ min = this._valueMin(),\r
+ step = this.options.step,\r
+ aboveMin = Math.round( ( max - min ) / step ) * step;\r
+ max = aboveMin + min;\r
+ if ( max > this.options.max ) {\r
+\r
+ //If max is not divisible by step, rounding off may increase its value\r
+ max -= step;\r
+ }\r
+ this.max = parseFloat( max.toFixed( this._precision() ) );\r
+ },\r
+\r
+ _precision: function() {\r
+ var precision = this._precisionOf( this.options.step );\r
+ if ( this.options.min !== null ) {\r
+ precision = Math.max( precision, this._precisionOf( this.options.min ) );\r
+ }\r
+ return precision;\r
+ },\r
+\r
+ _precisionOf: function( num ) {\r
+ var str = num.toString(),\r
+ decimal = str.indexOf( "." );\r
+ return decimal === -1 ? 0 : str.length - decimal - 1;\r
+ },\r
+\r
+ _valueMin: function() {\r
+ return this.options.min;\r
+ },\r
+\r
+ _valueMax: function() {\r
+ return this.max;\r
+ },\r
+\r
+ _refreshRange: function( orientation ) {\r
+ if ( orientation === "vertical" ) {\r
+ this.range.css( { "width": "", "left": "" } );\r
+ }\r
+ if ( orientation === "horizontal" ) {\r
+ this.range.css( { "height": "", "bottom": "" } );\r
+ }\r
+ },\r
+\r
+ _refreshValue: function() {\r
+ var lastValPercent, valPercent, value, valueMin, valueMax,\r
+ oRange = this.options.range,\r
+ o = this.options,\r
+ that = this,\r
+ animate = ( !this._animateOff ) ? o.animate : false,\r
+ _set = {};\r
+\r
+ if ( this._hasMultipleValues() ) {\r
+ this.handles.each( function( i ) {\r
+ valPercent = ( that.values( i ) - that._valueMin() ) / ( that._valueMax() -\r
+ that._valueMin() ) * 100;\r
+ _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";\r
+ $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );\r
+ if ( that.options.range === true ) {\r
+ if ( that.orientation === "horizontal" ) {\r
+ if ( i === 0 ) {\r
+ that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {\r
+ left: valPercent + "%"\r
+ }, o.animate );\r
+ }\r
+ if ( i === 1 ) {\r
+ that.range[ animate ? "animate" : "css" ]( {\r
+ width: ( valPercent - lastValPercent ) + "%"\r
+ }, {\r
+ queue: false,\r
+ duration: o.animate\r
+ } );\r
+ }\r
+ } else {\r
+ if ( i === 0 ) {\r
+ that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {\r
+ bottom: ( valPercent ) + "%"\r
+ }, o.animate );\r
+ }\r
+ if ( i === 1 ) {\r
+ that.range[ animate ? "animate" : "css" ]( {\r
+ height: ( valPercent - lastValPercent ) + "%"\r
+ }, {\r
+ queue: false,\r
+ duration: o.animate\r
+ } );\r
+ }\r
+ }\r
+ }\r
+ lastValPercent = valPercent;\r
+ } );\r
+ } else {\r
+ value = this.value();\r
+ valueMin = this._valueMin();\r
+ valueMax = this._valueMax();\r
+ valPercent = ( valueMax !== valueMin ) ?\r
+ ( value - valueMin ) / ( valueMax - valueMin ) * 100 :\r
+ 0;\r
+ _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";\r
+ this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );\r
+\r
+ if ( oRange === "min" && this.orientation === "horizontal" ) {\r
+ this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {\r
+ width: valPercent + "%"\r
+ }, o.animate );\r
+ }\r
+ if ( oRange === "max" && this.orientation === "horizontal" ) {\r
+ this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {\r
+ width: ( 100 - valPercent ) + "%"\r
+ }, o.animate );\r
+ }\r
+ if ( oRange === "min" && this.orientation === "vertical" ) {\r
+ this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {\r
+ height: valPercent + "%"\r
+ }, o.animate );\r
+ }\r
+ if ( oRange === "max" && this.orientation === "vertical" ) {\r
+ this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {\r
+ height: ( 100 - valPercent ) + "%"\r
+ }, o.animate );\r
+ }\r
+ }\r
+ },\r
+\r
+ _handleEvents: {\r
+ keydown: function( event ) {\r
+ var allowed, curVal, newVal, step,\r
+ index = $( event.target ).data( "ui-slider-handle-index" );\r
+\r
+ switch ( event.keyCode ) {\r
+ case $.ui.keyCode.HOME:\r
+ case $.ui.keyCode.END:\r
+ case $.ui.keyCode.PAGE_UP:\r
+ case $.ui.keyCode.PAGE_DOWN:\r
+ case $.ui.keyCode.UP:\r
+ case $.ui.keyCode.RIGHT:\r
+ case $.ui.keyCode.DOWN:\r
+ case $.ui.keyCode.LEFT:\r
+ event.preventDefault();\r
+ if ( !this._keySliding ) {\r
+ this._keySliding = true;\r
+ this._addClass( $( event.target ), null, "ui-state-active" );\r
+ allowed = this._start( event, index );\r
+ if ( allowed === false ) {\r
+ return;\r
+ }\r
+ }\r
+ break;\r
+ }\r
+\r
+ step = this.options.step;\r
+ if ( this._hasMultipleValues() ) {\r
+ curVal = newVal = this.values( index );\r
+ } else {\r
+ curVal = newVal = this.value();\r
+ }\r
+\r
+ switch ( event.keyCode ) {\r
+ case $.ui.keyCode.HOME:\r
+ newVal = this._valueMin();\r
+ break;\r
+ case $.ui.keyCode.END:\r
+ newVal = this._valueMax();\r
+ break;\r
+ case $.ui.keyCode.PAGE_UP:\r
+ newVal = this._trimAlignValue(\r
+ curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages )\r
+ );\r
+ break;\r
+ case $.ui.keyCode.PAGE_DOWN:\r
+ newVal = this._trimAlignValue(\r
+ curVal - ( ( this._valueMax() - this._valueMin() ) / this.numPages ) );\r
+ break;\r
+ case $.ui.keyCode.UP:\r
+ case $.ui.keyCode.RIGHT:\r
+ if ( curVal === this._valueMax() ) {\r
+ return;\r
+ }\r
+ newVal = this._trimAlignValue( curVal + step );\r
+ break;\r
+ case $.ui.keyCode.DOWN:\r
+ case $.ui.keyCode.LEFT:\r
+ if ( curVal === this._valueMin() ) {\r
+ return;\r
+ }\r
+ newVal = this._trimAlignValue( curVal - step );\r
+ break;\r
+ }\r
+\r
+ this._slide( event, index, newVal );\r
+ },\r
+ keyup: function( event ) {\r
+ var index = $( event.target ).data( "ui-slider-handle-index" );\r
+\r
+ if ( this._keySliding ) {\r
+ this._keySliding = false;\r
+ this._stop( event, index );\r
+ this._change( event, index );\r
+ this._removeClass( $( event.target ), null, "ui-state-active" );\r
+ }\r
+ }\r
+ }\r
+} );\r
+\r
+\r
+/*!\r
+ * jQuery UI Spinner 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Spinner\r
+//>>group: Widgets\r
+//>>description: Displays buttons to easily input numbers via the keyboard or mouse.\r
+//>>docs: http://api.jqueryui.com/spinner/\r
+//>>demos: http://jqueryui.com/spinner/\r
+//>>css.structure: ../../themes/base/core.css\r
+//>>css.structure: ../../themes/base/spinner.css\r
+//>>css.theme: ../../themes/base/theme.css\r
+\r
+\r
+function spinnerModifier( fn ) {\r
+ return function() {\r
+ var previous = this.element.val();\r
+ fn.apply( this, arguments );\r
+ this._refresh();\r
+ if ( previous !== this.element.val() ) {\r
+ this._trigger( "change" );\r
+ }\r
+ };\r
+}\r
+\r
+$.widget( "ui.spinner", {\r
+ version: "1.13.1",\r
+ defaultElement: "<input>",\r
+ widgetEventPrefix: "spin",\r
+ options: {\r
+ classes: {\r
+ "ui-spinner": "ui-corner-all",\r
+ "ui-spinner-down": "ui-corner-br",\r
+ "ui-spinner-up": "ui-corner-tr"\r
+ },\r
+ culture: null,\r
+ icons: {\r
+ down: "ui-icon-triangle-1-s",\r
+ up: "ui-icon-triangle-1-n"\r
+ },\r
+ incremental: true,\r
+ max: null,\r
+ min: null,\r
+ numberFormat: null,\r
+ page: 10,\r
+ step: 1,\r
+\r
+ change: null,\r
+ spin: null,\r
+ start: null,\r
+ stop: null\r
+ },\r
+\r
+ _create: function() {\r
+\r
+ // handle string values that need to be parsed\r
+ this._setOption( "max", this.options.max );\r
+ this._setOption( "min", this.options.min );\r
+ this._setOption( "step", this.options.step );\r
+\r
+ // Only format if there is a value, prevents the field from being marked\r
+ // as invalid in Firefox, see #9573.\r
+ if ( this.value() !== "" ) {\r
+\r
+ // Format the value, but don't constrain.\r
+ this._value( this.element.val(), true );\r
+ }\r
+\r
+ this._draw();\r
+ this._on( this._events );\r
+ this._refresh();\r
+\r
+ // Turning off autocomplete prevents the browser from remembering the\r
+ // value when navigating through history, so we re-enable autocomplete\r
+ // if the page is unloaded before the widget is destroyed. #7790\r
+ this._on( this.window, {\r
+ beforeunload: function() {\r
+ this.element.removeAttr( "autocomplete" );\r
+ }\r
+ } );\r
+ },\r
+\r
+ _getCreateOptions: function() {\r
+ var options = this._super();\r
+ var element = this.element;\r
+\r
+ $.each( [ "min", "max", "step" ], function( i, option ) {\r
+ var value = element.attr( option );\r
+ if ( value != null && value.length ) {\r
+ options[ option ] = value;\r
+ }\r
+ } );\r
+\r
+ return options;\r
+ },\r
+\r
+ _events: {\r
+ keydown: function( event ) {\r
+ if ( this._start( event ) && this._keydown( event ) ) {\r
+ event.preventDefault();\r
+ }\r
+ },\r
+ keyup: "_stop",\r
+ focus: function() {\r
+ this.previous = this.element.val();\r
+ },\r
+ blur: function( event ) {\r
+ if ( this.cancelBlur ) {\r
+ delete this.cancelBlur;\r
+ return;\r
+ }\r
+\r
+ this._stop();\r
+ this._refresh();\r
+ if ( this.previous !== this.element.val() ) {\r
+ this._trigger( "change", event );\r
+ }\r
+ },\r
+ mousewheel: function( event, delta ) {\r
+ var activeElement = $.ui.safeActiveElement( this.document[ 0 ] );\r
+ var isActive = this.element[ 0 ] === activeElement;\r
+\r
+ if ( !isActive || !delta ) {\r
+ return;\r
+ }\r
+\r
+ if ( !this.spinning && !this._start( event ) ) {\r
+ return false;\r
+ }\r
+\r
+ this._spin( ( delta > 0 ? 1 : -1 ) * this.options.step, event );\r
+ clearTimeout( this.mousewheelTimer );\r
+ this.mousewheelTimer = this._delay( function() {\r
+ if ( this.spinning ) {\r
+ this._stop( event );\r
+ }\r
+ }, 100 );\r
+ event.preventDefault();\r
+ },\r
+ "mousedown .ui-spinner-button": function( event ) {\r
+ var previous;\r
+\r
+ // We never want the buttons to have focus; whenever the user is\r
+ // interacting with the spinner, the focus should be on the input.\r
+ // If the input is focused then this.previous is properly set from\r
+ // when the input first received focus. If the input is not focused\r
+ // then we need to set this.previous based on the value before spinning.\r
+ previous = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] ) ?\r
+ this.previous : this.element.val();\r
+ function checkFocus() {\r
+ var isActive = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] );\r
+ if ( !isActive ) {\r
+ this.element.trigger( "focus" );\r
+ this.previous = previous;\r
+\r
+ // support: IE\r
+ // IE sets focus asynchronously, so we need to check if focus\r
+ // moved off of the input because the user clicked on the button.\r
+ this._delay( function() {\r
+ this.previous = previous;\r
+ } );\r
+ }\r
+ }\r
+\r
+ // Ensure focus is on (or stays on) the text field\r
+ event.preventDefault();\r
+ checkFocus.call( this );\r
+\r
+ // Support: IE\r
+ // IE doesn't prevent moving focus even with event.preventDefault()\r
+ // so we set a flag to know when we should ignore the blur event\r
+ // and check (again) if focus moved off of the input.\r
+ this.cancelBlur = true;\r
+ this._delay( function() {\r
+ delete this.cancelBlur;\r
+ checkFocus.call( this );\r
+ } );\r
+\r
+ if ( this._start( event ) === false ) {\r
+ return;\r
+ }\r
+\r
+ this._repeat( null, $( event.currentTarget )\r
+ .hasClass( "ui-spinner-up" ) ? 1 : -1, event );\r
+ },\r
+ "mouseup .ui-spinner-button": "_stop",\r
+ "mouseenter .ui-spinner-button": function( event ) {\r
+\r
+ // button will add ui-state-active if mouse was down while mouseleave and kept down\r
+ if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) {\r
+ return;\r
+ }\r
+\r
+ if ( this._start( event ) === false ) {\r
+ return false;\r
+ }\r
+ this._repeat( null, $( event.currentTarget )\r
+ .hasClass( "ui-spinner-up" ) ? 1 : -1, event );\r
+ },\r
+\r
+ // TODO: do we really want to consider this a stop?\r
+ // shouldn't we just stop the repeater and wait until mouseup before\r
+ // we trigger the stop event?\r
+ "mouseleave .ui-spinner-button": "_stop"\r
+ },\r
+\r
+ // Support mobile enhanced option and make backcompat more sane\r
+ _enhance: function() {\r
+ this.uiSpinner = this.element\r
+ .attr( "autocomplete", "off" )\r
+ .wrap( "<span>" )\r
+ .parent()\r
+\r
+ // Add buttons\r
+ .append(\r
+ "<a></a><a></a>"\r
+ );\r
+ },\r
+\r
+ _draw: function() {\r
+ this._enhance();\r
+\r
+ this._addClass( this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content" );\r
+ this._addClass( "ui-spinner-input" );\r
+\r
+ this.element.attr( "role", "spinbutton" );\r
+\r
+ // Button bindings\r
+ this.buttons = this.uiSpinner.children( "a" )\r
+ .attr( "tabIndex", -1 )\r
+ .attr( "aria-hidden", true )\r
+ .button( {\r
+ classes: {\r
+ "ui-button": ""\r
+ }\r
+ } );\r
+\r
+ // TODO: Right now button does not support classes this is already updated in button PR\r
+ this._removeClass( this.buttons, "ui-corner-all" );\r
+\r
+ this._addClass( this.buttons.first(), "ui-spinner-button ui-spinner-up" );\r
+ this._addClass( this.buttons.last(), "ui-spinner-button ui-spinner-down" );\r
+ this.buttons.first().button( {\r
+ "icon": this.options.icons.up,\r
+ "showLabel": false\r
+ } );\r
+ this.buttons.last().button( {\r
+ "icon": this.options.icons.down,\r
+ "showLabel": false\r
+ } );\r
+\r
+ // IE 6 doesn't understand height: 50% for the buttons\r
+ // unless the wrapper has an explicit height\r
+ if ( this.buttons.height() > Math.ceil( this.uiSpinner.height() * 0.5 ) &&\r
+ this.uiSpinner.height() > 0 ) {\r
+ this.uiSpinner.height( this.uiSpinner.height() );\r
+ }\r
+ },\r
+\r
+ _keydown: function( event ) {\r
+ var options = this.options,\r
+ keyCode = $.ui.keyCode;\r
+\r
+ switch ( event.keyCode ) {\r
+ case keyCode.UP:\r
+ this._repeat( null, 1, event );\r
+ return true;\r
+ case keyCode.DOWN:\r
+ this._repeat( null, -1, event );\r
+ return true;\r
+ case keyCode.PAGE_UP:\r
+ this._repeat( null, options.page, event );\r
+ return true;\r
+ case keyCode.PAGE_DOWN:\r
+ this._repeat( null, -options.page, event );\r
+ return true;\r
+ }\r
+\r
+ return false;\r
+ },\r
+\r
+ _start: function( event ) {\r
+ if ( !this.spinning && this._trigger( "start", event ) === false ) {\r
+ return false;\r
+ }\r
+\r
+ if ( !this.counter ) {\r
+ this.counter = 1;\r
+ }\r
+ this.spinning = true;\r
+ return true;\r
+ },\r
+\r
+ _repeat: function( i, steps, event ) {\r
+ i = i || 500;\r
+\r
+ clearTimeout( this.timer );\r
+ this.timer = this._delay( function() {\r
+ this._repeat( 40, steps, event );\r
+ }, i );\r
+\r
+ this._spin( steps * this.options.step, event );\r
+ },\r
+\r
+ _spin: function( step, event ) {\r
+ var value = this.value() || 0;\r
+\r
+ if ( !this.counter ) {\r
+ this.counter = 1;\r
+ }\r
+\r
+ value = this._adjustValue( value + step * this._increment( this.counter ) );\r
+\r
+ if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false ) {\r
+ this._value( value );\r
+ this.counter++;\r
+ }\r
+ },\r
+\r
+ _increment: function( i ) {\r
+ var incremental = this.options.incremental;\r
+\r
+ if ( incremental ) {\r
+ return typeof incremental === "function" ?\r
+ incremental( i ) :\r
+ Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 );\r
+ }\r
+\r
+ return 1;\r
+ },\r
+\r
+ _precision: function() {\r
+ var precision = this._precisionOf( this.options.step );\r
+ if ( this.options.min !== null ) {\r
+ precision = Math.max( precision, this._precisionOf( this.options.min ) );\r
+ }\r
+ return precision;\r
+ },\r
+\r
+ _precisionOf: function( num ) {\r
+ var str = num.toString(),\r
+ decimal = str.indexOf( "." );\r
+ return decimal === -1 ? 0 : str.length - decimal - 1;\r
+ },\r
+\r
+ _adjustValue: function( value ) {\r
+ var base, aboveMin,\r
+ options = this.options;\r
+\r
+ // Make sure we're at a valid step\r
+ // - find out where we are relative to the base (min or 0)\r
+ base = options.min !== null ? options.min : 0;\r
+ aboveMin = value - base;\r
+\r
+ // - round to the nearest step\r
+ aboveMin = Math.round( aboveMin / options.step ) * options.step;\r
+\r
+ // - rounding is based on 0, so adjust back to our base\r
+ value = base + aboveMin;\r
+\r
+ // Fix precision from bad JS floating point math\r
+ value = parseFloat( value.toFixed( this._precision() ) );\r
+\r
+ // Clamp the value\r
+ if ( options.max !== null && value > options.max ) {\r
+ return options.max;\r
+ }\r
+ if ( options.min !== null && value < options.min ) {\r
+ return options.min;\r
+ }\r
+\r
+ return value;\r
+ },\r
+\r
+ _stop: function( event ) {\r
+ if ( !this.spinning ) {\r
+ return;\r
+ }\r
+\r
+ clearTimeout( this.timer );\r
+ clearTimeout( this.mousewheelTimer );\r
+ this.counter = 0;\r
+ this.spinning = false;\r
+ this._trigger( "stop", event );\r
+ },\r
+\r
+ _setOption: function( key, value ) {\r
+ var prevValue, first, last;\r
+\r
+ if ( key === "culture" || key === "numberFormat" ) {\r
+ prevValue = this._parse( this.element.val() );\r
+ this.options[ key ] = value;\r
+ this.element.val( this._format( prevValue ) );\r
+ return;\r
+ }\r
+\r
+ if ( key === "max" || key === "min" || key === "step" ) {\r
+ if ( typeof value === "string" ) {\r
+ value = this._parse( value );\r
+ }\r
+ }\r
+ if ( key === "icons" ) {\r
+ first = this.buttons.first().find( ".ui-icon" );\r
+ this._removeClass( first, null, this.options.icons.up );\r
+ this._addClass( first, null, value.up );\r
+ last = this.buttons.last().find( ".ui-icon" );\r
+ this._removeClass( last, null, this.options.icons.down );\r
+ this._addClass( last, null, value.down );\r
+ }\r
+\r
+ this._super( key, value );\r
+ },\r
+\r
+ _setOptionDisabled: function( value ) {\r
+ this._super( value );\r
+\r
+ this._toggleClass( this.uiSpinner, null, "ui-state-disabled", !!value );\r
+ this.element.prop( "disabled", !!value );\r
+ this.buttons.button( value ? "disable" : "enable" );\r
+ },\r
+\r
+ _setOptions: spinnerModifier( function( options ) {\r
+ this._super( options );\r
+ } ),\r
+\r
+ _parse: function( val ) {\r
+ if ( typeof val === "string" && val !== "" ) {\r
+ val = window.Globalize && this.options.numberFormat ?\r
+ Globalize.parseFloat( val, 10, this.options.culture ) : +val;\r
+ }\r
+ return val === "" || isNaN( val ) ? null : val;\r
+ },\r
+\r
+ _format: function( value ) {\r
+ if ( value === "" ) {\r
+ return "";\r
+ }\r
+ return window.Globalize && this.options.numberFormat ?\r
+ Globalize.format( value, this.options.numberFormat, this.options.culture ) :\r
+ value;\r
+ },\r
+\r
+ _refresh: function() {\r
+ this.element.attr( {\r
+ "aria-valuemin": this.options.min,\r
+ "aria-valuemax": this.options.max,\r
+\r
+ // TODO: what should we do with values that can't be parsed?\r
+ "aria-valuenow": this._parse( this.element.val() )\r
+ } );\r
+ },\r
+\r
+ isValid: function() {\r
+ var value = this.value();\r
+\r
+ // Null is invalid\r
+ if ( value === null ) {\r
+ return false;\r
+ }\r
+\r
+ // If value gets adjusted, it's invalid\r
+ return value === this._adjustValue( value );\r
+ },\r
+\r
+ // Update the value without triggering change\r
+ _value: function( value, allowAny ) {\r
+ var parsed;\r
+ if ( value !== "" ) {\r
+ parsed = this._parse( value );\r
+ if ( parsed !== null ) {\r
+ if ( !allowAny ) {\r
+ parsed = this._adjustValue( parsed );\r
+ }\r
+ value = this._format( parsed );\r
+ }\r
+ }\r
+ this.element.val( value );\r
+ this._refresh();\r
+ },\r
+\r
+ _destroy: function() {\r
+ this.element\r
+ .prop( "disabled", false )\r
+ .removeAttr( "autocomplete role aria-valuemin aria-valuemax aria-valuenow" );\r
+\r
+ this.uiSpinner.replaceWith( this.element );\r
+ },\r
+\r
+ stepUp: spinnerModifier( function( steps ) {\r
+ this._stepUp( steps );\r
+ } ),\r
+ _stepUp: function( steps ) {\r
+ if ( this._start() ) {\r
+ this._spin( ( steps || 1 ) * this.options.step );\r
+ this._stop();\r
+ }\r
+ },\r
+\r
+ stepDown: spinnerModifier( function( steps ) {\r
+ this._stepDown( steps );\r
+ } ),\r
+ _stepDown: function( steps ) {\r
+ if ( this._start() ) {\r
+ this._spin( ( steps || 1 ) * -this.options.step );\r
+ this._stop();\r
+ }\r
+ },\r
+\r
+ pageUp: spinnerModifier( function( pages ) {\r
+ this._stepUp( ( pages || 1 ) * this.options.page );\r
+ } ),\r
+\r
+ pageDown: spinnerModifier( function( pages ) {\r
+ this._stepDown( ( pages || 1 ) * this.options.page );\r
+ } ),\r
+\r
+ value: function( newVal ) {\r
+ if ( !arguments.length ) {\r
+ return this._parse( this.element.val() );\r
+ }\r
+ spinnerModifier( this._value ).call( this, newVal );\r
+ },\r
+\r
+ widget: function() {\r
+ return this.uiSpinner;\r
+ }\r
+} );\r
+\r
+// DEPRECATED\r
+// TODO: switch return back to widget declaration at top of file when this is removed\r
+if ( $.uiBackCompat !== false ) {\r
+\r
+ // Backcompat for spinner html extension points\r
+ $.widget( "ui.spinner", $.ui.spinner, {\r
+ _enhance: function() {\r
+ this.uiSpinner = this.element\r
+ .attr( "autocomplete", "off" )\r
+ .wrap( this._uiSpinnerHtml() )\r
+ .parent()\r
+\r
+ // Add buttons\r
+ .append( this._buttonHtml() );\r
+ },\r
+ _uiSpinnerHtml: function() {\r
+ return "<span>";\r
+ },\r
+\r
+ _buttonHtml: function() {\r
+ return "<a></a><a></a>";\r
+ }\r
+ } );\r
+}\r
+\r
+var widgetsSpinner = $.ui.spinner;\r
+\r
+\r
+/*!\r
+ * jQuery UI Tabs 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Tabs\r
+//>>group: Widgets\r
+//>>description: Transforms a set of container elements into a tab structure.\r
+//>>docs: http://api.jqueryui.com/tabs/\r
+//>>demos: http://jqueryui.com/tabs/\r
+//>>css.structure: ../../themes/base/core.css\r
+//>>css.structure: ../../themes/base/tabs.css\r
+//>>css.theme: ../../themes/base/theme.css\r
+\r
+\r
+$.widget( "ui.tabs", {\r
+ version: "1.13.1",\r
+ delay: 300,\r
+ options: {\r
+ active: null,\r
+ classes: {\r
+ "ui-tabs": "ui-corner-all",\r
+ "ui-tabs-nav": "ui-corner-all",\r
+ "ui-tabs-panel": "ui-corner-bottom",\r
+ "ui-tabs-tab": "ui-corner-top"\r
+ },\r
+ collapsible: false,\r
+ event: "click",\r
+ heightStyle: "content",\r
+ hide: null,\r
+ show: null,\r
+\r
+ // Callbacks\r
+ activate: null,\r
+ beforeActivate: null,\r
+ beforeLoad: null,\r
+ load: null\r
+ },\r
+\r
+ _isLocal: ( function() {\r
+ var rhash = /#.*$/;\r
+\r
+ return function( anchor ) {\r
+ var anchorUrl, locationUrl;\r
+\r
+ anchorUrl = anchor.href.replace( rhash, "" );\r
+ locationUrl = location.href.replace( rhash, "" );\r
+\r
+ // Decoding may throw an error if the URL isn't UTF-8 (#9518)\r
+ try {\r
+ anchorUrl = decodeURIComponent( anchorUrl );\r
+ } catch ( error ) {}\r
+ try {\r
+ locationUrl = decodeURIComponent( locationUrl );\r
+ } catch ( error ) {}\r
+\r
+ return anchor.hash.length > 1 && anchorUrl === locationUrl;\r
+ };\r
+ } )(),\r
+\r
+ _create: function() {\r
+ var that = this,\r
+ options = this.options;\r
+\r
+ this.running = false;\r
+\r
+ this._addClass( "ui-tabs", "ui-widget ui-widget-content" );\r
+ this._toggleClass( "ui-tabs-collapsible", null, options.collapsible );\r
+\r
+ this._processTabs();\r
+ options.active = this._initialActive();\r
+\r
+ // Take disabling tabs via class attribute from HTML\r
+ // into account and update option properly.\r
+ if ( Array.isArray( options.disabled ) ) {\r
+ options.disabled = $.uniqueSort( options.disabled.concat(\r
+ $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {\r
+ return that.tabs.index( li );\r
+ } )\r
+ ) ).sort();\r
+ }\r
+\r
+ // Check for length avoids error when initializing empty list\r
+ if ( this.options.active !== false && this.anchors.length ) {\r
+ this.active = this._findActive( options.active );\r
+ } else {\r
+ this.active = $();\r
+ }\r
+\r
+ this._refresh();\r
+\r
+ if ( this.active.length ) {\r
+ this.load( options.active );\r
+ }\r
+ },\r
+\r
+ _initialActive: function() {\r
+ var active = this.options.active,\r
+ collapsible = this.options.collapsible,\r
+ locationHash = location.hash.substring( 1 );\r
+\r
+ if ( active === null ) {\r
+\r
+ // check the fragment identifier in the URL\r
+ if ( locationHash ) {\r
+ this.tabs.each( function( i, tab ) {\r
+ if ( $( tab ).attr( "aria-controls" ) === locationHash ) {\r
+ active = i;\r
+ return false;\r
+ }\r
+ } );\r
+ }\r
+\r
+ // Check for a tab marked active via a class\r
+ if ( active === null ) {\r
+ active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) );\r
+ }\r
+\r
+ // No active tab, set to false\r
+ if ( active === null || active === -1 ) {\r
+ active = this.tabs.length ? 0 : false;\r
+ }\r
+ }\r
+\r
+ // Handle numbers: negative, out of range\r
+ if ( active !== false ) {\r
+ active = this.tabs.index( this.tabs.eq( active ) );\r
+ if ( active === -1 ) {\r
+ active = collapsible ? false : 0;\r
+ }\r
+ }\r
+\r
+ // Don't allow collapsible: false and active: false\r
+ if ( !collapsible && active === false && this.anchors.length ) {\r
+ active = 0;\r
+ }\r
+\r
+ return active;\r
+ },\r
+\r
+ _getCreateEventData: function() {\r
+ return {\r
+ tab: this.active,\r
+ panel: !this.active.length ? $() : this._getPanelForTab( this.active )\r
+ };\r
+ },\r
+\r
+ _tabKeydown: function( event ) {\r
+ var focusedTab = $( $.ui.safeActiveElement( this.document[ 0 ] ) ).closest( "li" ),\r
+ selectedIndex = this.tabs.index( focusedTab ),\r
+ goingForward = true;\r
+\r
+ if ( this._handlePageNav( event ) ) {\r
+ return;\r
+ }\r
+\r
+ switch ( event.keyCode ) {\r
+ case $.ui.keyCode.RIGHT:\r
+ case $.ui.keyCode.DOWN:\r
+ selectedIndex++;\r
+ break;\r
+ case $.ui.keyCode.UP:\r
+ case $.ui.keyCode.LEFT:\r
+ goingForward = false;\r
+ selectedIndex--;\r
+ break;\r
+ case $.ui.keyCode.END:\r
+ selectedIndex = this.anchors.length - 1;\r
+ break;\r
+ case $.ui.keyCode.HOME:\r
+ selectedIndex = 0;\r
+ break;\r
+ case $.ui.keyCode.SPACE:\r
+\r
+ // Activate only, no collapsing\r
+ event.preventDefault();\r
+ clearTimeout( this.activating );\r
+ this._activate( selectedIndex );\r
+ return;\r
+ case $.ui.keyCode.ENTER:\r
+\r
+ // Toggle (cancel delayed activation, allow collapsing)\r
+ event.preventDefault();\r
+ clearTimeout( this.activating );\r
+\r
+ // Determine if we should collapse or activate\r
+ this._activate( selectedIndex === this.options.active ? false : selectedIndex );\r
+ return;\r
+ default:\r
+ return;\r
+ }\r
+\r
+ // Focus the appropriate tab, based on which key was pressed\r
+ event.preventDefault();\r
+ clearTimeout( this.activating );\r
+ selectedIndex = this._focusNextTab( selectedIndex, goingForward );\r
+\r
+ // Navigating with control/command key will prevent automatic activation\r
+ if ( !event.ctrlKey && !event.metaKey ) {\r
+\r
+ // Update aria-selected immediately so that AT think the tab is already selected.\r
+ // Otherwise AT may confuse the user by stating that they need to activate the tab,\r
+ // but the tab will already be activated by the time the announcement finishes.\r
+ focusedTab.attr( "aria-selected", "false" );\r
+ this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" );\r
+\r
+ this.activating = this._delay( function() {\r
+ this.option( "active", selectedIndex );\r
+ }, this.delay );\r
+ }\r
+ },\r
+\r
+ _panelKeydown: function( event ) {\r
+ if ( this._handlePageNav( event ) ) {\r
+ return;\r
+ }\r
+\r
+ // Ctrl+up moves focus to the current tab\r
+ if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) {\r
+ event.preventDefault();\r
+ this.active.trigger( "focus" );\r
+ }\r
+ },\r
+\r
+ // Alt+page up/down moves focus to the previous/next tab (and activates)\r
+ _handlePageNav: function( event ) {\r
+ if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) {\r
+ this._activate( this._focusNextTab( this.options.active - 1, false ) );\r
+ return true;\r
+ }\r
+ if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) {\r
+ this._activate( this._focusNextTab( this.options.active + 1, true ) );\r
+ return true;\r
+ }\r
+ },\r
+\r
+ _findNextTab: function( index, goingForward ) {\r
+ var lastTabIndex = this.tabs.length - 1;\r
+\r
+ function constrain() {\r
+ if ( index > lastTabIndex ) {\r
+ index = 0;\r
+ }\r
+ if ( index < 0 ) {\r
+ index = lastTabIndex;\r
+ }\r
+ return index;\r
+ }\r
+\r
+ while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) {\r
+ index = goingForward ? index + 1 : index - 1;\r
+ }\r
+\r
+ return index;\r
+ },\r
+\r
+ _focusNextTab: function( index, goingForward ) {\r
+ index = this._findNextTab( index, goingForward );\r
+ this.tabs.eq( index ).trigger( "focus" );\r
+ return index;\r
+ },\r
+\r
+ _setOption: function( key, value ) {\r
+ if ( key === "active" ) {\r
+\r
+ // _activate() will handle invalid values and update this.options\r
+ this._activate( value );\r
+ return;\r
+ }\r
+\r
+ this._super( key, value );\r
+\r
+ if ( key === "collapsible" ) {\r
+ this._toggleClass( "ui-tabs-collapsible", null, value );\r
+\r
+ // Setting collapsible: false while collapsed; open first panel\r
+ if ( !value && this.options.active === false ) {\r
+ this._activate( 0 );\r
+ }\r
+ }\r
+\r
+ if ( key === "event" ) {\r
+ this._setupEvents( value );\r
+ }\r
+\r
+ if ( key === "heightStyle" ) {\r
+ this._setupHeightStyle( value );\r
+ }\r
+ },\r
+\r
+ _sanitizeSelector: function( hash ) {\r
+ return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : "";\r
+ },\r
+\r
+ refresh: function() {\r
+ var options = this.options,\r
+ lis = this.tablist.children( ":has(a[href])" );\r
+\r
+ // Get disabled tabs from class attribute from HTML\r
+ // this will get converted to a boolean if needed in _refresh()\r
+ options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) {\r
+ return lis.index( tab );\r
+ } );\r
+\r
+ this._processTabs();\r
+\r
+ // Was collapsed or no tabs\r
+ if ( options.active === false || !this.anchors.length ) {\r
+ options.active = false;\r
+ this.active = $();\r
+\r
+ // was active, but active tab is gone\r
+ } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) {\r
+\r
+ // all remaining tabs are disabled\r
+ if ( this.tabs.length === options.disabled.length ) {\r
+ options.active = false;\r
+ this.active = $();\r
+\r
+ // activate previous tab\r
+ } else {\r
+ this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) );\r
+ }\r
+\r
+ // was active, active tab still exists\r
+ } else {\r
+\r
+ // make sure active index is correct\r
+ options.active = this.tabs.index( this.active );\r
+ }\r
+\r
+ this._refresh();\r
+ },\r
+\r
+ _refresh: function() {\r
+ this._setOptionDisabled( this.options.disabled );\r
+ this._setupEvents( this.options.event );\r
+ this._setupHeightStyle( this.options.heightStyle );\r
+\r
+ this.tabs.not( this.active ).attr( {\r
+ "aria-selected": "false",\r
+ "aria-expanded": "false",\r
+ tabIndex: -1\r
+ } );\r
+ this.panels.not( this._getPanelForTab( this.active ) )\r
+ .hide()\r
+ .attr( {\r
+ "aria-hidden": "true"\r
+ } );\r
+\r
+ // Make sure one tab is in the tab order\r
+ if ( !this.active.length ) {\r
+ this.tabs.eq( 0 ).attr( "tabIndex", 0 );\r
+ } else {\r
+ this.active\r
+ .attr( {\r
+ "aria-selected": "true",\r
+ "aria-expanded": "true",\r
+ tabIndex: 0\r
+ } );\r
+ this._addClass( this.active, "ui-tabs-active", "ui-state-active" );\r
+ this._getPanelForTab( this.active )\r
+ .show()\r
+ .attr( {\r
+ "aria-hidden": "false"\r
+ } );\r
+ }\r
+ },\r
+\r
+ _processTabs: function() {\r
+ var that = this,\r
+ prevTabs = this.tabs,\r
+ prevAnchors = this.anchors,\r
+ prevPanels = this.panels;\r
+\r
+ this.tablist = this._getList().attr( "role", "tablist" );\r
+ this._addClass( this.tablist, "ui-tabs-nav",\r
+ "ui-helper-reset ui-helper-clearfix ui-widget-header" );\r
+\r
+ // Prevent users from focusing disabled tabs via click\r
+ this.tablist\r
+ .on( "mousedown" + this.eventNamespace, "> li", function( event ) {\r
+ if ( $( this ).is( ".ui-state-disabled" ) ) {\r
+ event.preventDefault();\r
+ }\r
+ } )\r
+\r
+ // Support: IE <9\r
+ // Preventing the default action in mousedown doesn't prevent IE\r
+ // from focusing the element, so if the anchor gets focused, blur.\r
+ // We don't have to worry about focusing the previously focused\r
+ // element since clicking on a non-focusable element should focus\r
+ // the body anyway.\r
+ .on( "focus" + this.eventNamespace, ".ui-tabs-anchor", function() {\r
+ if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {\r
+ this.blur();\r
+ }\r
+ } );\r
+\r
+ this.tabs = this.tablist.find( "> li:has(a[href])" )\r
+ .attr( {\r
+ role: "tab",\r
+ tabIndex: -1\r
+ } );\r
+ this._addClass( this.tabs, "ui-tabs-tab", "ui-state-default" );\r
+\r
+ this.anchors = this.tabs.map( function() {\r
+ return $( "a", this )[ 0 ];\r
+ } )\r
+ .attr( {\r
+ tabIndex: -1\r
+ } );\r
+ this._addClass( this.anchors, "ui-tabs-anchor" );\r
+\r
+ this.panels = $();\r
+\r
+ this.anchors.each( function( i, anchor ) {\r
+ var selector, panel, panelId,\r
+ anchorId = $( anchor ).uniqueId().attr( "id" ),\r
+ tab = $( anchor ).closest( "li" ),\r
+ originalAriaControls = tab.attr( "aria-controls" );\r
+\r
+ // Inline tab\r
+ if ( that._isLocal( anchor ) ) {\r
+ selector = anchor.hash;\r
+ panelId = selector.substring( 1 );\r
+ panel = that.element.find( that._sanitizeSelector( selector ) );\r
+\r
+ // remote tab\r
+ } else {\r
+\r
+ // If the tab doesn't already have aria-controls,\r
+ // generate an id by using a throw-away element\r
+ panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id;\r
+ selector = "#" + panelId;\r
+ panel = that.element.find( selector );\r
+ if ( !panel.length ) {\r
+ panel = that._createPanel( panelId );\r
+ panel.insertAfter( that.panels[ i - 1 ] || that.tablist );\r
+ }\r
+ panel.attr( "aria-live", "polite" );\r
+ }\r
+\r
+ if ( panel.length ) {\r
+ that.panels = that.panels.add( panel );\r
+ }\r
+ if ( originalAriaControls ) {\r
+ tab.data( "ui-tabs-aria-controls", originalAriaControls );\r
+ }\r
+ tab.attr( {\r
+ "aria-controls": panelId,\r
+ "aria-labelledby": anchorId\r
+ } );\r
+ panel.attr( "aria-labelledby", anchorId );\r
+ } );\r
+\r
+ this.panels.attr( "role", "tabpanel" );\r
+ this._addClass( this.panels, "ui-tabs-panel", "ui-widget-content" );\r
+\r
+ // Avoid memory leaks (#10056)\r
+ if ( prevTabs ) {\r
+ this._off( prevTabs.not( this.tabs ) );\r
+ this._off( prevAnchors.not( this.anchors ) );\r
+ this._off( prevPanels.not( this.panels ) );\r
+ }\r
+ },\r
+\r
+ // Allow overriding how to find the list for rare usage scenarios (#7715)\r
+ _getList: function() {\r
+ return this.tablist || this.element.find( "ol, ul" ).eq( 0 );\r
+ },\r
+\r
+ _createPanel: function( id ) {\r
+ return $( "<div>" )\r
+ .attr( "id", id )\r
+ .data( "ui-tabs-destroy", true );\r
+ },\r
+\r
+ _setOptionDisabled: function( disabled ) {\r
+ var currentItem, li, i;\r
+\r
+ if ( Array.isArray( disabled ) ) {\r
+ if ( !disabled.length ) {\r
+ disabled = false;\r
+ } else if ( disabled.length === this.anchors.length ) {\r
+ disabled = true;\r
+ }\r
+ }\r
+\r
+ // Disable tabs\r
+ for ( i = 0; ( li = this.tabs[ i ] ); i++ ) {\r
+ currentItem = $( li );\r
+ if ( disabled === true || $.inArray( i, disabled ) !== -1 ) {\r
+ currentItem.attr( "aria-disabled", "true" );\r
+ this._addClass( currentItem, null, "ui-state-disabled" );\r
+ } else {\r
+ currentItem.removeAttr( "aria-disabled" );\r
+ this._removeClass( currentItem, null, "ui-state-disabled" );\r
+ }\r
+ }\r
+\r
+ this.options.disabled = disabled;\r
+\r
+ this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null,\r
+ disabled === true );\r
+ },\r
+\r
+ _setupEvents: function( event ) {\r
+ var events = {};\r
+ if ( event ) {\r
+ $.each( event.split( " " ), function( index, eventName ) {\r
+ events[ eventName ] = "_eventHandler";\r
+ } );\r
+ }\r
+\r
+ this._off( this.anchors.add( this.tabs ).add( this.panels ) );\r
+\r
+ // Always prevent the default action, even when disabled\r
+ this._on( true, this.anchors, {\r
+ click: function( event ) {\r
+ event.preventDefault();\r
+ }\r
+ } );\r
+ this._on( this.anchors, events );\r
+ this._on( this.tabs, { keydown: "_tabKeydown" } );\r
+ this._on( this.panels, { keydown: "_panelKeydown" } );\r
+\r
+ this._focusable( this.tabs );\r
+ this._hoverable( this.tabs );\r
+ },\r
+\r
+ _setupHeightStyle: function( heightStyle ) {\r
+ var maxHeight,\r
+ parent = this.element.parent();\r
+\r
+ if ( heightStyle === "fill" ) {\r
+ maxHeight = parent.height();\r
+ maxHeight -= this.element.outerHeight() - this.element.height();\r
+\r
+ this.element.siblings( ":visible" ).each( function() {\r
+ var elem = $( this ),\r
+ position = elem.css( "position" );\r
+\r
+ if ( position === "absolute" || position === "fixed" ) {\r
+ return;\r
+ }\r
+ maxHeight -= elem.outerHeight( true );\r
+ } );\r
+\r
+ this.element.children().not( this.panels ).each( function() {\r
+ maxHeight -= $( this ).outerHeight( true );\r
+ } );\r
+\r
+ this.panels.each( function() {\r
+ $( this ).height( Math.max( 0, maxHeight -\r
+ $( this ).innerHeight() + $( this ).height() ) );\r
+ } )\r
+ .css( "overflow", "auto" );\r
+ } else if ( heightStyle === "auto" ) {\r
+ maxHeight = 0;\r
+ this.panels.each( function() {\r
+ maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );\r
+ } ).height( maxHeight );\r
+ }\r
+ },\r
+\r
+ _eventHandler: function( event ) {\r
+ var options = this.options,\r
+ active = this.active,\r
+ anchor = $( event.currentTarget ),\r
+ tab = anchor.closest( "li" ),\r
+ clickedIsActive = tab[ 0 ] === active[ 0 ],\r
+ collapsing = clickedIsActive && options.collapsible,\r
+ toShow = collapsing ? $() : this._getPanelForTab( tab ),\r
+ toHide = !active.length ? $() : this._getPanelForTab( active ),\r
+ eventData = {\r
+ oldTab: active,\r
+ oldPanel: toHide,\r
+ newTab: collapsing ? $() : tab,\r
+ newPanel: toShow\r
+ };\r
+\r
+ event.preventDefault();\r
+\r
+ if ( tab.hasClass( "ui-state-disabled" ) ||\r
+\r
+ // tab is already loading\r
+ tab.hasClass( "ui-tabs-loading" ) ||\r
+\r
+ // can't switch durning an animation\r
+ this.running ||\r
+\r
+ // click on active header, but not collapsible\r
+ ( clickedIsActive && !options.collapsible ) ||\r
+\r
+ // allow canceling activation\r
+ ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {\r
+ return;\r
+ }\r
+\r
+ options.active = collapsing ? false : this.tabs.index( tab );\r
+\r
+ this.active = clickedIsActive ? $() : tab;\r
+ if ( this.xhr ) {\r
+ this.xhr.abort();\r
+ }\r
+\r
+ if ( !toHide.length && !toShow.length ) {\r
+ $.error( "jQuery UI Tabs: Mismatching fragment identifier." );\r
+ }\r
+\r
+ if ( toShow.length ) {\r
+ this.load( this.tabs.index( tab ), event );\r
+ }\r
+ this._toggle( event, eventData );\r
+ },\r
+\r
+ // Handles show/hide for selecting tabs\r
+ _toggle: function( event, eventData ) {\r
+ var that = this,\r
+ toShow = eventData.newPanel,\r
+ toHide = eventData.oldPanel;\r
+\r
+ this.running = true;\r
+\r
+ function complete() {\r
+ that.running = false;\r
+ that._trigger( "activate", event, eventData );\r
+ }\r
+\r
+ function show() {\r
+ that._addClass( eventData.newTab.closest( "li" ), "ui-tabs-active", "ui-state-active" );\r
+\r
+ if ( toShow.length && that.options.show ) {\r
+ that._show( toShow, that.options.show, complete );\r
+ } else {\r
+ toShow.show();\r
+ complete();\r
+ }\r
+ }\r
+\r
+ // Start out by hiding, then showing, then completing\r
+ if ( toHide.length && this.options.hide ) {\r
+ this._hide( toHide, this.options.hide, function() {\r
+ that._removeClass( eventData.oldTab.closest( "li" ),\r
+ "ui-tabs-active", "ui-state-active" );\r
+ show();\r
+ } );\r
+ } else {\r
+ this._removeClass( eventData.oldTab.closest( "li" ),\r
+ "ui-tabs-active", "ui-state-active" );\r
+ toHide.hide();\r
+ show();\r
+ }\r
+\r
+ toHide.attr( "aria-hidden", "true" );\r
+ eventData.oldTab.attr( {\r
+ "aria-selected": "false",\r
+ "aria-expanded": "false"\r
+ } );\r
+\r
+ // If we're switching tabs, remove the old tab from the tab order.\r
+ // If we're opening from collapsed state, remove the previous tab from the tab order.\r
+ // If we're collapsing, then keep the collapsing tab in the tab order.\r
+ if ( toShow.length && toHide.length ) {\r
+ eventData.oldTab.attr( "tabIndex", -1 );\r
+ } else if ( toShow.length ) {\r
+ this.tabs.filter( function() {\r
+ return $( this ).attr( "tabIndex" ) === 0;\r
+ } )\r
+ .attr( "tabIndex", -1 );\r
+ }\r
+\r
+ toShow.attr( "aria-hidden", "false" );\r
+ eventData.newTab.attr( {\r
+ "aria-selected": "true",\r
+ "aria-expanded": "true",\r
+ tabIndex: 0\r
+ } );\r
+ },\r
+\r
+ _activate: function( index ) {\r
+ var anchor,\r
+ active = this._findActive( index );\r
+\r
+ // Trying to activate the already active panel\r
+ if ( active[ 0 ] === this.active[ 0 ] ) {\r
+ return;\r
+ }\r
+\r
+ // Trying to collapse, simulate a click on the current active header\r
+ if ( !active.length ) {\r
+ active = this.active;\r
+ }\r
+\r
+ anchor = active.find( ".ui-tabs-anchor" )[ 0 ];\r
+ this._eventHandler( {\r
+ target: anchor,\r
+ currentTarget: anchor,\r
+ preventDefault: $.noop\r
+ } );\r
+ },\r
+\r
+ _findActive: function( index ) {\r
+ return index === false ? $() : this.tabs.eq( index );\r
+ },\r
+\r
+ _getIndex: function( index ) {\r
+\r
+ // meta-function to give users option to provide a href string instead of a numerical index.\r
+ if ( typeof index === "string" ) {\r
+ index = this.anchors.index( this.anchors.filter( "[href$='" +\r
+ $.escapeSelector( index ) + "']" ) );\r
+ }\r
+\r
+ return index;\r
+ },\r
+\r
+ _destroy: function() {\r
+ if ( this.xhr ) {\r
+ this.xhr.abort();\r
+ }\r
+\r
+ this.tablist\r
+ .removeAttr( "role" )\r
+ .off( this.eventNamespace );\r
+\r
+ this.anchors\r
+ .removeAttr( "role tabIndex" )\r
+ .removeUniqueId();\r
+\r
+ this.tabs.add( this.panels ).each( function() {\r
+ if ( $.data( this, "ui-tabs-destroy" ) ) {\r
+ $( this ).remove();\r
+ } else {\r
+ $( this ).removeAttr( "role tabIndex " +\r
+ "aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded" );\r
+ }\r
+ } );\r
+\r
+ this.tabs.each( function() {\r
+ var li = $( this ),\r
+ prev = li.data( "ui-tabs-aria-controls" );\r
+ if ( prev ) {\r
+ li\r
+ .attr( "aria-controls", prev )\r
+ .removeData( "ui-tabs-aria-controls" );\r
+ } else {\r
+ li.removeAttr( "aria-controls" );\r
+ }\r
+ } );\r
+\r
+ this.panels.show();\r
+\r
+ if ( this.options.heightStyle !== "content" ) {\r
+ this.panels.css( "height", "" );\r
+ }\r
+ },\r
+\r
+ enable: function( index ) {\r
+ var disabled = this.options.disabled;\r
+ if ( disabled === false ) {\r
+ return;\r
+ }\r
+\r
+ if ( index === undefined ) {\r
+ disabled = false;\r
+ } else {\r
+ index = this._getIndex( index );\r
+ if ( Array.isArray( disabled ) ) {\r
+ disabled = $.map( disabled, function( num ) {\r
+ return num !== index ? num : null;\r
+ } );\r
+ } else {\r
+ disabled = $.map( this.tabs, function( li, num ) {\r
+ return num !== index ? num : null;\r
+ } );\r
+ }\r
+ }\r
+ this._setOptionDisabled( disabled );\r
+ },\r
+\r
+ disable: function( index ) {\r
+ var disabled = this.options.disabled;\r
+ if ( disabled === true ) {\r
+ return;\r
+ }\r
+\r
+ if ( index === undefined ) {\r
+ disabled = true;\r
+ } else {\r
+ index = this._getIndex( index );\r
+ if ( $.inArray( index, disabled ) !== -1 ) {\r
+ return;\r
+ }\r
+ if ( Array.isArray( disabled ) ) {\r
+ disabled = $.merge( [ index ], disabled ).sort();\r
+ } else {\r
+ disabled = [ index ];\r
+ }\r
+ }\r
+ this._setOptionDisabled( disabled );\r
+ },\r
+\r
+ load: function( index, event ) {\r
+ index = this._getIndex( index );\r
+ var that = this,\r
+ tab = this.tabs.eq( index ),\r
+ anchor = tab.find( ".ui-tabs-anchor" ),\r
+ panel = this._getPanelForTab( tab ),\r
+ eventData = {\r
+ tab: tab,\r
+ panel: panel\r
+ },\r
+ complete = function( jqXHR, status ) {\r
+ if ( status === "abort" ) {\r
+ that.panels.stop( false, true );\r
+ }\r
+\r
+ that._removeClass( tab, "ui-tabs-loading" );\r
+ panel.removeAttr( "aria-busy" );\r
+\r
+ if ( jqXHR === that.xhr ) {\r
+ delete that.xhr;\r
+ }\r
+ };\r
+\r
+ // Not remote\r
+ if ( this._isLocal( anchor[ 0 ] ) ) {\r
+ return;\r
+ }\r
+\r
+ this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) );\r
+\r
+ // Support: jQuery <1.8\r
+ // jQuery <1.8 returns false if the request is canceled in beforeSend,\r
+ // but as of 1.8, $.ajax() always returns a jqXHR object.\r
+ if ( this.xhr && this.xhr.statusText !== "canceled" ) {\r
+ this._addClass( tab, "ui-tabs-loading" );\r
+ panel.attr( "aria-busy", "true" );\r
+\r
+ this.xhr\r
+ .done( function( response, status, jqXHR ) {\r
+\r
+ // support: jQuery <1.8\r
+ // http://bugs.jquery.com/ticket/11778\r
+ setTimeout( function() {\r
+ panel.html( response );\r
+ that._trigger( "load", event, eventData );\r
+\r
+ complete( jqXHR, status );\r
+ }, 1 );\r
+ } )\r
+ .fail( function( jqXHR, status ) {\r
+\r
+ // support: jQuery <1.8\r
+ // http://bugs.jquery.com/ticket/11778\r
+ setTimeout( function() {\r
+ complete( jqXHR, status );\r
+ }, 1 );\r
+ } );\r
+ }\r
+ },\r
+\r
+ _ajaxSettings: function( anchor, event, eventData ) {\r
+ var that = this;\r
+ return {\r
+\r
+ // Support: IE <11 only\r
+ // Strip any hash that exists to prevent errors with the Ajax request\r
+ url: anchor.attr( "href" ).replace( /#.*$/, "" ),\r
+ beforeSend: function( jqXHR, settings ) {\r
+ return that._trigger( "beforeLoad", event,\r
+ $.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) );\r
+ }\r
+ };\r
+ },\r
+\r
+ _getPanelForTab: function( tab ) {\r
+ var id = $( tab ).attr( "aria-controls" );\r
+ return this.element.find( this._sanitizeSelector( "#" + id ) );\r
+ }\r
+} );\r
+\r
+// DEPRECATED\r
+// TODO: Switch return back to widget declaration at top of file when this is removed\r
+if ( $.uiBackCompat !== false ) {\r
+\r
+ // Backcompat for ui-tab class (now ui-tabs-tab)\r
+ $.widget( "ui.tabs", $.ui.tabs, {\r
+ _processTabs: function() {\r
+ this._superApply( arguments );\r
+ this._addClass( this.tabs, "ui-tab" );\r
+ }\r
+ } );\r
+}\r
+\r
+var widgetsTabs = $.ui.tabs;\r
+\r
+\r
+/*!\r
+ * jQuery UI Tooltip 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Tooltip\r
+//>>group: Widgets\r
+//>>description: Shows additional information for any element on hover or focus.\r
+//>>docs: http://api.jqueryui.com/tooltip/\r
+//>>demos: http://jqueryui.com/tooltip/\r
+//>>css.structure: ../../themes/base/core.css\r
+//>>css.structure: ../../themes/base/tooltip.css\r
+//>>css.theme: ../../themes/base/theme.css\r
+\r
+\r
+$.widget( "ui.tooltip", {\r
+ version: "1.13.1",\r
+ options: {\r
+ classes: {\r
+ "ui-tooltip": "ui-corner-all ui-widget-shadow"\r
+ },\r
+ content: function() {\r
+ var title = $( this ).attr( "title" );\r
+\r
+ // Escape title, since we're going from an attribute to raw HTML\r
+ return $( "<a>" ).text( title ).html();\r
+ },\r
+ hide: true,\r
+\r
+ // Disabled elements have inconsistent behavior across browsers (#8661)\r
+ items: "[title]:not([disabled])",\r
+ position: {\r
+ my: "left top+15",\r
+ at: "left bottom",\r
+ collision: "flipfit flip"\r
+ },\r
+ show: true,\r
+ track: false,\r
+\r
+ // Callbacks\r
+ close: null,\r
+ open: null\r
+ },\r
+\r
+ _addDescribedBy: function( elem, id ) {\r
+ var describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ );\r
+ describedby.push( id );\r
+ elem\r
+ .data( "ui-tooltip-id", id )\r
+ .attr( "aria-describedby", String.prototype.trim.call( describedby.join( " " ) ) );\r
+ },\r
+\r
+ _removeDescribedBy: function( elem ) {\r
+ var id = elem.data( "ui-tooltip-id" ),\r
+ describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ ),\r
+ index = $.inArray( id, describedby );\r
+\r
+ if ( index !== -1 ) {\r
+ describedby.splice( index, 1 );\r
+ }\r
+\r
+ elem.removeData( "ui-tooltip-id" );\r
+ describedby = String.prototype.trim.call( describedby.join( " " ) );\r
+ if ( describedby ) {\r
+ elem.attr( "aria-describedby", describedby );\r
+ } else {\r
+ elem.removeAttr( "aria-describedby" );\r
+ }\r
+ },\r
+\r
+ _create: function() {\r
+ this._on( {\r
+ mouseover: "open",\r
+ focusin: "open"\r
+ } );\r
+\r
+ // IDs of generated tooltips, needed for destroy\r
+ this.tooltips = {};\r
+\r
+ // IDs of parent tooltips where we removed the title attribute\r
+ this.parents = {};\r
+\r
+ // Append the aria-live region so tooltips announce correctly\r
+ this.liveRegion = $( "<div>" )\r
+ .attr( {\r
+ role: "log",\r
+ "aria-live": "assertive",\r
+ "aria-relevant": "additions"\r
+ } )\r
+ .appendTo( this.document[ 0 ].body );\r
+ this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" );\r
+\r
+ this.disabledTitles = $( [] );\r
+ },\r
+\r
+ _setOption: function( key, value ) {\r
+ var that = this;\r
+\r
+ this._super( key, value );\r
+\r
+ if ( key === "content" ) {\r
+ $.each( this.tooltips, function( id, tooltipData ) {\r
+ that._updateContent( tooltipData.element );\r
+ } );\r
+ }\r
+ },\r
+\r
+ _setOptionDisabled: function( value ) {\r
+ this[ value ? "_disable" : "_enable" ]();\r
+ },\r
+\r
+ _disable: function() {\r
+ var that = this;\r
+\r
+ // Close open tooltips\r
+ $.each( this.tooltips, function( id, tooltipData ) {\r
+ var event = $.Event( "blur" );\r
+ event.target = event.currentTarget = tooltipData.element[ 0 ];\r
+ that.close( event, true );\r
+ } );\r
+\r
+ // Remove title attributes to prevent native tooltips\r
+ this.disabledTitles = this.disabledTitles.add(\r
+ this.element.find( this.options.items ).addBack()\r
+ .filter( function() {\r
+ var element = $( this );\r
+ if ( element.is( "[title]" ) ) {\r
+ return element\r
+ .data( "ui-tooltip-title", element.attr( "title" ) )\r
+ .removeAttr( "title" );\r
+ }\r
+ } )\r
+ );\r
+ },\r
+\r
+ _enable: function() {\r
+\r
+ // restore title attributes\r
+ this.disabledTitles.each( function() {\r
+ var element = $( this );\r
+ if ( element.data( "ui-tooltip-title" ) ) {\r
+ element.attr( "title", element.data( "ui-tooltip-title" ) );\r
+ }\r
+ } );\r
+ this.disabledTitles = $( [] );\r
+ },\r
+\r
+ open: function( event ) {\r
+ var that = this,\r
+ target = $( event ? event.target : this.element )\r
+\r
+ // we need closest here due to mouseover bubbling,\r
+ // but always pointing at the same event target\r
+ .closest( this.options.items );\r
+\r
+ // No element to show a tooltip for or the tooltip is already open\r
+ if ( !target.length || target.data( "ui-tooltip-id" ) ) {\r
+ return;\r
+ }\r
+\r
+ if ( target.attr( "title" ) ) {\r
+ target.data( "ui-tooltip-title", target.attr( "title" ) );\r
+ }\r
+\r
+ target.data( "ui-tooltip-open", true );\r
+\r
+ // Kill parent tooltips, custom or native, for hover\r
+ if ( event && event.type === "mouseover" ) {\r
+ target.parents().each( function() {\r
+ var parent = $( this ),\r
+ blurEvent;\r
+ if ( parent.data( "ui-tooltip-open" ) ) {\r
+ blurEvent = $.Event( "blur" );\r
+ blurEvent.target = blurEvent.currentTarget = this;\r
+ that.close( blurEvent, true );\r
+ }\r
+ if ( parent.attr( "title" ) ) {\r
+ parent.uniqueId();\r
+ that.parents[ this.id ] = {\r
+ element: this,\r
+ title: parent.attr( "title" )\r
+ };\r
+ parent.attr( "title", "" );\r
+ }\r
+ } );\r
+ }\r
+\r
+ this._registerCloseHandlers( event, target );\r
+ this._updateContent( target, event );\r
+ },\r
+\r
+ _updateContent: function( target, event ) {\r
+ var content,\r
+ contentOption = this.options.content,\r
+ that = this,\r
+ eventType = event ? event.type : null;\r
+\r
+ if ( typeof contentOption === "string" || contentOption.nodeType ||\r
+ contentOption.jquery ) {\r
+ return this._open( event, target, contentOption );\r
+ }\r
+\r
+ content = contentOption.call( target[ 0 ], function( response ) {\r
+\r
+ // IE may instantly serve a cached response for ajax requests\r
+ // delay this call to _open so the other call to _open runs first\r
+ that._delay( function() {\r
+\r
+ // Ignore async response if tooltip was closed already\r
+ if ( !target.data( "ui-tooltip-open" ) ) {\r
+ return;\r
+ }\r
+\r
+ // JQuery creates a special event for focusin when it doesn't\r
+ // exist natively. To improve performance, the native event\r
+ // object is reused and the type is changed. Therefore, we can't\r
+ // rely on the type being correct after the event finished\r
+ // bubbling, so we set it back to the previous value. (#8740)\r
+ if ( event ) {\r
+ event.type = eventType;\r
+ }\r
+ this._open( event, target, response );\r
+ } );\r
+ } );\r
+ if ( content ) {\r
+ this._open( event, target, content );\r
+ }\r
+ },\r
+\r
+ _open: function( event, target, content ) {\r
+ var tooltipData, tooltip, delayedShow, a11yContent,\r
+ positionOption = $.extend( {}, this.options.position );\r
+\r
+ if ( !content ) {\r
+ return;\r
+ }\r
+\r
+ // Content can be updated multiple times. If the tooltip already\r
+ // exists, then just update the content and bail.\r
+ tooltipData = this._find( target );\r
+ if ( tooltipData ) {\r
+ tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content );\r
+ return;\r
+ }\r
+\r
+ // If we have a title, clear it to prevent the native tooltip\r
+ // we have to check first to avoid defining a title if none exists\r
+ // (we don't want to cause an element to start matching [title])\r
+ //\r
+ // We use removeAttr only for key events, to allow IE to export the correct\r
+ // accessible attributes. For mouse events, set to empty string to avoid\r
+ // native tooltip showing up (happens only when removing inside mouseover).\r
+ if ( target.is( "[title]" ) ) {\r
+ if ( event && event.type === "mouseover" ) {\r
+ target.attr( "title", "" );\r
+ } else {\r
+ target.removeAttr( "title" );\r
+ }\r
+ }\r
+\r
+ tooltipData = this._tooltip( target );\r
+ tooltip = tooltipData.tooltip;\r
+ this._addDescribedBy( target, tooltip.attr( "id" ) );\r
+ tooltip.find( ".ui-tooltip-content" ).html( content );\r
+\r
+ // Support: Voiceover on OS X, JAWS on IE <= 9\r
+ // JAWS announces deletions even when aria-relevant="additions"\r
+ // Voiceover will sometimes re-read the entire log region's contents from the beginning\r
+ this.liveRegion.children().hide();\r
+ a11yContent = $( "<div>" ).html( tooltip.find( ".ui-tooltip-content" ).html() );\r
+ a11yContent.removeAttr( "name" ).find( "[name]" ).removeAttr( "name" );\r
+ a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" );\r
+ a11yContent.appendTo( this.liveRegion );\r
+\r
+ function position( event ) {\r
+ positionOption.of = event;\r
+ if ( tooltip.is( ":hidden" ) ) {\r
+ return;\r
+ }\r
+ tooltip.position( positionOption );\r
+ }\r
+ if ( this.options.track && event && /^mouse/.test( event.type ) ) {\r
+ this._on( this.document, {\r
+ mousemove: position\r
+ } );\r
+\r
+ // trigger once to override element-relative positioning\r
+ position( event );\r
+ } else {\r
+ tooltip.position( $.extend( {\r
+ of: target\r
+ }, this.options.position ) );\r
+ }\r
+\r
+ tooltip.hide();\r
+\r
+ this._show( tooltip, this.options.show );\r
+\r
+ // Handle tracking tooltips that are shown with a delay (#8644). As soon\r
+ // as the tooltip is visible, position the tooltip using the most recent\r
+ // event.\r
+ // Adds the check to add the timers only when both delay and track options are set (#14682)\r
+ if ( this.options.track && this.options.show && this.options.show.delay ) {\r
+ delayedShow = this.delayedShow = setInterval( function() {\r
+ if ( tooltip.is( ":visible" ) ) {\r
+ position( positionOption.of );\r
+ clearInterval( delayedShow );\r
+ }\r
+ }, 13 );\r
+ }\r
+\r
+ this._trigger( "open", event, { tooltip: tooltip } );\r
+ },\r
+\r
+ _registerCloseHandlers: function( event, target ) {\r
+ var events = {\r
+ keyup: function( event ) {\r
+ if ( event.keyCode === $.ui.keyCode.ESCAPE ) {\r
+ var fakeEvent = $.Event( event );\r
+ fakeEvent.currentTarget = target[ 0 ];\r
+ this.close( fakeEvent, true );\r
+ }\r
+ }\r
+ };\r
+\r
+ // Only bind remove handler for delegated targets. Non-delegated\r
+ // tooltips will handle this in destroy.\r
+ if ( target[ 0 ] !== this.element[ 0 ] ) {\r
+ events.remove = function() {\r
+ var targetElement = this._find( target );\r
+ if ( targetElement ) {\r
+ this._removeTooltip( targetElement.tooltip );\r
+ }\r
+ };\r
+ }\r
+\r
+ if ( !event || event.type === "mouseover" ) {\r
+ events.mouseleave = "close";\r
+ }\r
+ if ( !event || event.type === "focusin" ) {\r
+ events.focusout = "close";\r
+ }\r
+ this._on( true, target, events );\r
+ },\r
+\r
+ close: function( event ) {\r
+ var tooltip,\r
+ that = this,\r
+ target = $( event ? event.currentTarget : this.element ),\r
+ tooltipData = this._find( target );\r
+\r
+ // The tooltip may already be closed\r
+ if ( !tooltipData ) {\r
+\r
+ // We set ui-tooltip-open immediately upon open (in open()), but only set the\r
+ // additional data once there's actually content to show (in _open()). So even if the\r
+ // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in\r
+ // the period between open() and _open().\r
+ target.removeData( "ui-tooltip-open" );\r
+ return;\r
+ }\r
+\r
+ tooltip = tooltipData.tooltip;\r
+\r
+ // Disabling closes the tooltip, so we need to track when we're closing\r
+ // to avoid an infinite loop in case the tooltip becomes disabled on close\r
+ if ( tooltipData.closing ) {\r
+ return;\r
+ }\r
+\r
+ // Clear the interval for delayed tracking tooltips\r
+ clearInterval( this.delayedShow );\r
+\r
+ // Only set title if we had one before (see comment in _open())\r
+ // If the title attribute has changed since open(), don't restore\r
+ if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) {\r
+ target.attr( "title", target.data( "ui-tooltip-title" ) );\r
+ }\r
+\r
+ this._removeDescribedBy( target );\r
+\r
+ tooltipData.hiding = true;\r
+ tooltip.stop( true );\r
+ this._hide( tooltip, this.options.hide, function() {\r
+ that._removeTooltip( $( this ) );\r
+ } );\r
+\r
+ target.removeData( "ui-tooltip-open" );\r
+ this._off( target, "mouseleave focusout keyup" );\r
+\r
+ // Remove 'remove' binding only on delegated targets\r
+ if ( target[ 0 ] !== this.element[ 0 ] ) {\r
+ this._off( target, "remove" );\r
+ }\r
+ this._off( this.document, "mousemove" );\r
+\r
+ if ( event && event.type === "mouseleave" ) {\r
+ $.each( this.parents, function( id, parent ) {\r
+ $( parent.element ).attr( "title", parent.title );\r
+ delete that.parents[ id ];\r
+ } );\r
+ }\r
+\r
+ tooltipData.closing = true;\r
+ this._trigger( "close", event, { tooltip: tooltip } );\r
+ if ( !tooltipData.hiding ) {\r
+ tooltipData.closing = false;\r
+ }\r
+ },\r
+\r
+ _tooltip: function( element ) {\r
+ var tooltip = $( "<div>" ).attr( "role", "tooltip" ),\r
+ content = $( "<div>" ).appendTo( tooltip ),\r
+ id = tooltip.uniqueId().attr( "id" );\r
+\r
+ this._addClass( content, "ui-tooltip-content" );\r
+ this._addClass( tooltip, "ui-tooltip", "ui-widget ui-widget-content" );\r
+\r
+ tooltip.appendTo( this._appendTo( element ) );\r
+\r
+ return this.tooltips[ id ] = {\r
+ element: element,\r
+ tooltip: tooltip\r
+ };\r
+ },\r
+\r
+ _find: function( target ) {\r
+ var id = target.data( "ui-tooltip-id" );\r
+ return id ? this.tooltips[ id ] : null;\r
+ },\r
+\r
+ _removeTooltip: function( tooltip ) {\r
+\r
+ // Clear the interval for delayed tracking tooltips\r
+ clearInterval( this.delayedShow );\r
+\r
+ tooltip.remove();\r
+ delete this.tooltips[ tooltip.attr( "id" ) ];\r
+ },\r
+\r
+ _appendTo: function( target ) {\r
+ var element = target.closest( ".ui-front, dialog" );\r
+\r
+ if ( !element.length ) {\r
+ element = this.document[ 0 ].body;\r
+ }\r
+\r
+ return element;\r
+ },\r
+\r
+ _destroy: function() {\r
+ var that = this;\r
+\r
+ // Close open tooltips\r
+ $.each( this.tooltips, function( id, tooltipData ) {\r
+\r
+ // Delegate to close method to handle common cleanup\r
+ var event = $.Event( "blur" ),\r
+ element = tooltipData.element;\r
+ event.target = event.currentTarget = element[ 0 ];\r
+ that.close( event, true );\r
+\r
+ // Remove immediately; destroying an open tooltip doesn't use the\r
+ // hide animation\r
+ $( "#" + id ).remove();\r
+\r
+ // Restore the title\r
+ if ( element.data( "ui-tooltip-title" ) ) {\r
+\r
+ // If the title attribute has changed since open(), don't restore\r
+ if ( !element.attr( "title" ) ) {\r
+ element.attr( "title", element.data( "ui-tooltip-title" ) );\r
+ }\r
+ element.removeData( "ui-tooltip-title" );\r
+ }\r
+ } );\r
+ this.liveRegion.remove();\r
+ }\r
+} );\r
+\r
+// DEPRECATED\r
+// TODO: Switch return back to widget declaration at top of file when this is removed\r
+if ( $.uiBackCompat !== false ) {\r
+\r
+ // Backcompat for tooltipClass option\r
+ $.widget( "ui.tooltip", $.ui.tooltip, {\r
+ options: {\r
+ tooltipClass: null\r
+ },\r
+ _tooltip: function() {\r
+ var tooltipData = this._superApply( arguments );\r
+ if ( this.options.tooltipClass ) {\r
+ tooltipData.tooltip.addClass( this.options.tooltipClass );\r
+ }\r
+ return tooltipData;\r
+ }\r
+ } );\r
+}\r
+\r
+var widgetsTooltip = $.ui.tooltip;\r
+\r
+\r
+\r
+// Create a local jQuery because jQuery Color relies on it and the\r
+// global may not exist with AMD and a custom build (#10199).\r
+// This module is a noop if used as a regular AMD module.\r
+// eslint-disable-next-line no-unused-vars\r
+var jQuery = $;\r
+\r
+\r
+/*!\r
+ * jQuery Color Animations v2.2.0\r
+ * https://github.com/jquery/jquery-color\r
+ *\r
+ * Copyright OpenJS Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ *\r
+ * Date: Sun May 10 09:02:36 2020 +0200\r
+ */\r
+\r
+\r
+\r
+ var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " +\r
+ "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",\r
+\r
+ class2type = {},\r
+ toString = class2type.toString,\r
+\r
+ // plusequals test for += 100 -= 100\r
+ rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,\r
+\r
+ // a set of RE's that can match strings and generate color tuples.\r
+ stringParsers = [ {\r
+ re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,\r
+ parse: function( execResult ) {\r
+ return [\r
+ execResult[ 1 ],\r
+ execResult[ 2 ],\r
+ execResult[ 3 ],\r
+ execResult[ 4 ]\r
+ ];\r
+ }\r
+ }, {\r
+ re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,\r
+ parse: function( execResult ) {\r
+ return [\r
+ execResult[ 1 ] * 2.55,\r
+ execResult[ 2 ] * 2.55,\r
+ execResult[ 3 ] * 2.55,\r
+ execResult[ 4 ]\r
+ ];\r
+ }\r
+ }, {\r
+\r
+ // this regex ignores A-F because it's compared against an already lowercased string\r
+ re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/,\r
+ parse: function( execResult ) {\r
+ return [\r
+ parseInt( execResult[ 1 ], 16 ),\r
+ parseInt( execResult[ 2 ], 16 ),\r
+ parseInt( execResult[ 3 ], 16 ),\r
+ execResult[ 4 ] ?\r
+ ( parseInt( execResult[ 4 ], 16 ) / 255 ).toFixed( 2 ) :\r
+ 1\r
+ ];\r
+ }\r
+ }, {\r
+\r
+ // this regex ignores A-F because it's compared against an already lowercased string\r
+ re: /#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/,\r
+ parse: function( execResult ) {\r
+ return [\r
+ parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),\r
+ parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),\r
+ parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ),\r
+ execResult[ 4 ] ?\r
+ ( parseInt( execResult[ 4 ] + execResult[ 4 ], 16 ) / 255 )\r
+ .toFixed( 2 ) :\r
+ 1\r
+ ];\r
+ }\r
+ }, {\r
+ re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,\r
+ space: "hsla",\r
+ parse: function( execResult ) {\r
+ return [\r
+ execResult[ 1 ],\r
+ execResult[ 2 ] / 100,\r
+ execResult[ 3 ] / 100,\r
+ execResult[ 4 ]\r
+ ];\r
+ }\r
+ } ],\r
+\r
+ // jQuery.Color( )\r
+ color = jQuery.Color = function( color, green, blue, alpha ) {\r
+ return new jQuery.Color.fn.parse( color, green, blue, alpha );\r
+ },\r
+ spaces = {\r
+ rgba: {\r
+ props: {\r
+ red: {\r
+ idx: 0,\r
+ type: "byte"\r
+ },\r
+ green: {\r
+ idx: 1,\r
+ type: "byte"\r
+ },\r
+ blue: {\r
+ idx: 2,\r
+ type: "byte"\r
+ }\r
+ }\r
+ },\r
+\r
+ hsla: {\r
+ props: {\r
+ hue: {\r
+ idx: 0,\r
+ type: "degrees"\r
+ },\r
+ saturation: {\r
+ idx: 1,\r
+ type: "percent"\r
+ },\r
+ lightness: {\r
+ idx: 2,\r
+ type: "percent"\r
+ }\r
+ }\r
+ }\r
+ },\r
+ propTypes = {\r
+ "byte": {\r
+ floor: true,\r
+ max: 255\r
+ },\r
+ "percent": {\r
+ max: 1\r
+ },\r
+ "degrees": {\r
+ mod: 360,\r
+ floor: true\r
+ }\r
+ },\r
+ support = color.support = {},\r
+\r
+ // element for support tests\r
+ supportElem = jQuery( "<p>" )[ 0 ],\r
+\r
+ // colors = jQuery.Color.names\r
+ colors,\r
+\r
+ // local aliases of functions called often\r
+ each = jQuery.each;\r
+\r
+// determine rgba support immediately\r
+supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";\r
+support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;\r
+\r
+// define cache name and alpha properties\r
+// for rgba and hsla spaces\r
+each( spaces, function( spaceName, space ) {\r
+ space.cache = "_" + spaceName;\r
+ space.props.alpha = {\r
+ idx: 3,\r
+ type: "percent",\r
+ def: 1\r
+ };\r
+} );\r
+\r
+// Populate the class2type map\r
+jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),\r
+ function( _i, name ) {\r
+ class2type[ "[object " + name + "]" ] = name.toLowerCase();\r
+ } );\r
+\r
+function getType( obj ) {\r
+ if ( obj == null ) {\r
+ return obj + "";\r
+ }\r
+\r
+ return typeof obj === "object" ?\r
+ class2type[ toString.call( obj ) ] || "object" :\r
+ typeof obj;\r
+}\r
+\r
+function clamp( value, prop, allowEmpty ) {\r
+ var type = propTypes[ prop.type ] || {};\r
+\r
+ if ( value == null ) {\r
+ return ( allowEmpty || !prop.def ) ? null : prop.def;\r
+ }\r
+\r
+ // ~~ is an short way of doing floor for positive numbers\r
+ value = type.floor ? ~~value : parseFloat( value );\r
+\r
+ // IE will pass in empty strings as value for alpha,\r
+ // which will hit this case\r
+ if ( isNaN( value ) ) {\r
+ return prop.def;\r
+ }\r
+\r
+ if ( type.mod ) {\r
+\r
+ // we add mod before modding to make sure that negatives values\r
+ // get converted properly: -10 -> 350\r
+ return ( value + type.mod ) % type.mod;\r
+ }\r
+\r
+ // for now all property types without mod have min and max\r
+ return Math.min( type.max, Math.max( 0, value ) );\r
+}\r
+\r
+function stringParse( string ) {\r
+ var inst = color(),\r
+ rgba = inst._rgba = [];\r
+\r
+ string = string.toLowerCase();\r
+\r
+ each( stringParsers, function( _i, parser ) {\r
+ var parsed,\r
+ match = parser.re.exec( string ),\r
+ values = match && parser.parse( match ),\r
+ spaceName = parser.space || "rgba";\r
+\r
+ if ( values ) {\r
+ parsed = inst[ spaceName ]( values );\r
+\r
+ // if this was an rgba parse the assignment might happen twice\r
+ // oh well....\r
+ inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];\r
+ rgba = inst._rgba = parsed._rgba;\r
+\r
+ // exit each( stringParsers ) here because we matched\r
+ return false;\r
+ }\r
+ } );\r
+\r
+ // Found a stringParser that handled it\r
+ if ( rgba.length ) {\r
+\r
+ // if this came from a parsed string, force "transparent" when alpha is 0\r
+ // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)\r
+ if ( rgba.join() === "0,0,0,0" ) {\r
+ jQuery.extend( rgba, colors.transparent );\r
+ }\r
+ return inst;\r
+ }\r
+\r
+ // named colors\r
+ return colors[ string ];\r
+}\r
+\r
+color.fn = jQuery.extend( color.prototype, {\r
+ parse: function( red, green, blue, alpha ) {\r
+ if ( red === undefined ) {\r
+ this._rgba = [ null, null, null, null ];\r
+ return this;\r
+ }\r
+ if ( red.jquery || red.nodeType ) {\r
+ red = jQuery( red ).css( green );\r
+ green = undefined;\r
+ }\r
+\r
+ var inst = this,\r
+ type = getType( red ),\r
+ rgba = this._rgba = [];\r
+\r
+ // more than 1 argument specified - assume ( red, green, blue, alpha )\r
+ if ( green !== undefined ) {\r
+ red = [ red, green, blue, alpha ];\r
+ type = "array";\r
+ }\r
+\r
+ if ( type === "string" ) {\r
+ return this.parse( stringParse( red ) || colors._default );\r
+ }\r
+\r
+ if ( type === "array" ) {\r
+ each( spaces.rgba.props, function( _key, prop ) {\r
+ rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );\r
+ } );\r
+ return this;\r
+ }\r
+\r
+ if ( type === "object" ) {\r
+ if ( red instanceof color ) {\r
+ each( spaces, function( _spaceName, space ) {\r
+ if ( red[ space.cache ] ) {\r
+ inst[ space.cache ] = red[ space.cache ].slice();\r
+ }\r
+ } );\r
+ } else {\r
+ each( spaces, function( _spaceName, space ) {\r
+ var cache = space.cache;\r
+ each( space.props, function( key, prop ) {\r
+\r
+ // if the cache doesn't exist, and we know how to convert\r
+ if ( !inst[ cache ] && space.to ) {\r
+\r
+ // if the value was null, we don't need to copy it\r
+ // if the key was alpha, we don't need to copy it either\r
+ if ( key === "alpha" || red[ key ] == null ) {\r
+ return;\r
+ }\r
+ inst[ cache ] = space.to( inst._rgba );\r
+ }\r
+\r
+ // this is the only case where we allow nulls for ALL properties.\r
+ // call clamp with alwaysAllowEmpty\r
+ inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );\r
+ } );\r
+\r
+ // everything defined but alpha?\r
+ if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {\r
+\r
+ // use the default of 1\r
+ if ( inst[ cache ][ 3 ] == null ) {\r
+ inst[ cache ][ 3 ] = 1;\r
+ }\r
+\r
+ if ( space.from ) {\r
+ inst._rgba = space.from( inst[ cache ] );\r
+ }\r
+ }\r
+ } );\r
+ }\r
+ return this;\r
+ }\r
+ },\r
+ is: function( compare ) {\r
+ var is = color( compare ),\r
+ same = true,\r
+ inst = this;\r
+\r
+ each( spaces, function( _, space ) {\r
+ var localCache,\r
+ isCache = is[ space.cache ];\r
+ if ( isCache ) {\r
+ localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];\r
+ each( space.props, function( _, prop ) {\r
+ if ( isCache[ prop.idx ] != null ) {\r
+ same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );\r
+ return same;\r
+ }\r
+ } );\r
+ }\r
+ return same;\r
+ } );\r
+ return same;\r
+ },\r
+ _space: function() {\r
+ var used = [],\r
+ inst = this;\r
+ each( spaces, function( spaceName, space ) {\r
+ if ( inst[ space.cache ] ) {\r
+ used.push( spaceName );\r
+ }\r
+ } );\r
+ return used.pop();\r
+ },\r
+ transition: function( other, distance ) {\r
+ var end = color( other ),\r
+ spaceName = end._space(),\r
+ space = spaces[ spaceName ],\r
+ startColor = this.alpha() === 0 ? color( "transparent" ) : this,\r
+ start = startColor[ space.cache ] || space.to( startColor._rgba ),\r
+ result = start.slice();\r
+\r
+ end = end[ space.cache ];\r
+ each( space.props, function( _key, prop ) {\r
+ var index = prop.idx,\r
+ startValue = start[ index ],\r
+ endValue = end[ index ],\r
+ type = propTypes[ prop.type ] || {};\r
+\r
+ // if null, don't override start value\r
+ if ( endValue === null ) {\r
+ return;\r
+ }\r
+\r
+ // if null - use end\r
+ if ( startValue === null ) {\r
+ result[ index ] = endValue;\r
+ } else {\r
+ if ( type.mod ) {\r
+ if ( endValue - startValue > type.mod / 2 ) {\r
+ startValue += type.mod;\r
+ } else if ( startValue - endValue > type.mod / 2 ) {\r
+ startValue -= type.mod;\r
+ }\r
+ }\r
+ result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );\r
+ }\r
+ } );\r
+ return this[ spaceName ]( result );\r
+ },\r
+ blend: function( opaque ) {\r
+\r
+ // if we are already opaque - return ourself\r
+ if ( this._rgba[ 3 ] === 1 ) {\r
+ return this;\r
+ }\r
+\r
+ var rgb = this._rgba.slice(),\r
+ a = rgb.pop(),\r
+ blend = color( opaque )._rgba;\r
+\r
+ return color( jQuery.map( rgb, function( v, i ) {\r
+ return ( 1 - a ) * blend[ i ] + a * v;\r
+ } ) );\r
+ },\r
+ toRgbaString: function() {\r
+ var prefix = "rgba(",\r
+ rgba = jQuery.map( this._rgba, function( v, i ) {\r
+ if ( v != null ) {\r
+ return v;\r
+ }\r
+ return i > 2 ? 1 : 0;\r
+ } );\r
+\r
+ if ( rgba[ 3 ] === 1 ) {\r
+ rgba.pop();\r
+ prefix = "rgb(";\r
+ }\r
+\r
+ return prefix + rgba.join() + ")";\r
+ },\r
+ toHslaString: function() {\r
+ var prefix = "hsla(",\r
+ hsla = jQuery.map( this.hsla(), function( v, i ) {\r
+ if ( v == null ) {\r
+ v = i > 2 ? 1 : 0;\r
+ }\r
+\r
+ // catch 1 and 2\r
+ if ( i && i < 3 ) {\r
+ v = Math.round( v * 100 ) + "%";\r
+ }\r
+ return v;\r
+ } );\r
+\r
+ if ( hsla[ 3 ] === 1 ) {\r
+ hsla.pop();\r
+ prefix = "hsl(";\r
+ }\r
+ return prefix + hsla.join() + ")";\r
+ },\r
+ toHexString: function( includeAlpha ) {\r
+ var rgba = this._rgba.slice(),\r
+ alpha = rgba.pop();\r
+\r
+ if ( includeAlpha ) {\r
+ rgba.push( ~~( alpha * 255 ) );\r
+ }\r
+\r
+ return "#" + jQuery.map( rgba, function( v ) {\r
+\r
+ // default to 0 when nulls exist\r
+ v = ( v || 0 ).toString( 16 );\r
+ return v.length === 1 ? "0" + v : v;\r
+ } ).join( "" );\r
+ },\r
+ toString: function() {\r
+ return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();\r
+ }\r
+} );\r
+color.fn.parse.prototype = color.fn;\r
+\r
+// hsla conversions adapted from:\r
+// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021\r
+\r
+function hue2rgb( p, q, h ) {\r
+ h = ( h + 1 ) % 1;\r
+ if ( h * 6 < 1 ) {\r
+ return p + ( q - p ) * h * 6;\r
+ }\r
+ if ( h * 2 < 1 ) {\r
+ return q;\r
+ }\r
+ if ( h * 3 < 2 ) {\r
+ return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6;\r
+ }\r
+ return p;\r
+}\r
+\r
+spaces.hsla.to = function( rgba ) {\r
+ if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {\r
+ return [ null, null, null, rgba[ 3 ] ];\r
+ }\r
+ var r = rgba[ 0 ] / 255,\r
+ g = rgba[ 1 ] / 255,\r
+ b = rgba[ 2 ] / 255,\r
+ a = rgba[ 3 ],\r
+ max = Math.max( r, g, b ),\r
+ min = Math.min( r, g, b ),\r
+ diff = max - min,\r
+ add = max + min,\r
+ l = add * 0.5,\r
+ h, s;\r
+\r
+ if ( min === max ) {\r
+ h = 0;\r
+ } else if ( r === max ) {\r
+ h = ( 60 * ( g - b ) / diff ) + 360;\r
+ } else if ( g === max ) {\r
+ h = ( 60 * ( b - r ) / diff ) + 120;\r
+ } else {\r
+ h = ( 60 * ( r - g ) / diff ) + 240;\r
+ }\r
+\r
+ // chroma (diff) == 0 means greyscale which, by definition, saturation = 0%\r
+ // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)\r
+ if ( diff === 0 ) {\r
+ s = 0;\r
+ } else if ( l <= 0.5 ) {\r
+ s = diff / add;\r
+ } else {\r
+ s = diff / ( 2 - add );\r
+ }\r
+ return [ Math.round( h ) % 360, s, l, a == null ? 1 : a ];\r
+};\r
+\r
+spaces.hsla.from = function( hsla ) {\r
+ if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {\r
+ return [ null, null, null, hsla[ 3 ] ];\r
+ }\r
+ var h = hsla[ 0 ] / 360,\r
+ s = hsla[ 1 ],\r
+ l = hsla[ 2 ],\r
+ a = hsla[ 3 ],\r
+ q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,\r
+ p = 2 * l - q;\r
+\r
+ return [\r
+ Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),\r
+ Math.round( hue2rgb( p, q, h ) * 255 ),\r
+ Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),\r
+ a\r
+ ];\r
+};\r
+\r
+\r
+each( spaces, function( spaceName, space ) {\r
+ var props = space.props,\r
+ cache = space.cache,\r
+ to = space.to,\r
+ from = space.from;\r
+\r
+ // makes rgba() and hsla()\r
+ color.fn[ spaceName ] = function( value ) {\r
+\r
+ // generate a cache for this space if it doesn't exist\r
+ if ( to && !this[ cache ] ) {\r
+ this[ cache ] = to( this._rgba );\r
+ }\r
+ if ( value === undefined ) {\r
+ return this[ cache ].slice();\r
+ }\r
+\r
+ var ret,\r
+ type = getType( value ),\r
+ arr = ( type === "array" || type === "object" ) ? value : arguments,\r
+ local = this[ cache ].slice();\r
+\r
+ each( props, function( key, prop ) {\r
+ var val = arr[ type === "object" ? key : prop.idx ];\r
+ if ( val == null ) {\r
+ val = local[ prop.idx ];\r
+ }\r
+ local[ prop.idx ] = clamp( val, prop );\r
+ } );\r
+\r
+ if ( from ) {\r
+ ret = color( from( local ) );\r
+ ret[ cache ] = local;\r
+ return ret;\r
+ } else {\r
+ return color( local );\r
+ }\r
+ };\r
+\r
+ // makes red() green() blue() alpha() hue() saturation() lightness()\r
+ each( props, function( key, prop ) {\r
+\r
+ // alpha is included in more than one space\r
+ if ( color.fn[ key ] ) {\r
+ return;\r
+ }\r
+ color.fn[ key ] = function( value ) {\r
+ var local, cur, match, fn,\r
+ vtype = getType( value );\r
+\r
+ if ( key === "alpha" ) {\r
+ fn = this._hsla ? "hsla" : "rgba";\r
+ } else {\r
+ fn = spaceName;\r
+ }\r
+ local = this[ fn ]();\r
+ cur = local[ prop.idx ];\r
+\r
+ if ( vtype === "undefined" ) {\r
+ return cur;\r
+ }\r
+\r
+ if ( vtype === "function" ) {\r
+ value = value.call( this, cur );\r
+ vtype = getType( value );\r
+ }\r
+ if ( value == null && prop.empty ) {\r
+ return this;\r
+ }\r
+ if ( vtype === "string" ) {\r
+ match = rplusequals.exec( value );\r
+ if ( match ) {\r
+ value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );\r
+ }\r
+ }\r
+ local[ prop.idx ] = value;\r
+ return this[ fn ]( local );\r
+ };\r
+ } );\r
+} );\r
+\r
+// add cssHook and .fx.step function for each named hook.\r
+// accept a space separated string of properties\r
+color.hook = function( hook ) {\r
+ var hooks = hook.split( " " );\r
+ each( hooks, function( _i, hook ) {\r
+ jQuery.cssHooks[ hook ] = {\r
+ set: function( elem, value ) {\r
+ var parsed, curElem,\r
+ backgroundColor = "";\r
+\r
+ if ( value !== "transparent" && ( getType( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {\r
+ value = color( parsed || value );\r
+ if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {\r
+ curElem = hook === "backgroundColor" ? elem.parentNode : elem;\r
+ while (\r
+ ( backgroundColor === "" || backgroundColor === "transparent" ) &&\r
+ curElem && curElem.style\r
+ ) {\r
+ try {\r
+ backgroundColor = jQuery.css( curElem, "backgroundColor" );\r
+ curElem = curElem.parentNode;\r
+ } catch ( e ) {\r
+ }\r
+ }\r
+\r
+ value = value.blend( backgroundColor && backgroundColor !== "transparent" ?\r
+ backgroundColor :\r
+ "_default" );\r
+ }\r
+\r
+ value = value.toRgbaString();\r
+ }\r
+ try {\r
+ elem.style[ hook ] = value;\r
+ } catch ( e ) {\r
+\r
+ // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'\r
+ }\r
+ }\r
+ };\r
+ jQuery.fx.step[ hook ] = function( fx ) {\r
+ if ( !fx.colorInit ) {\r
+ fx.start = color( fx.elem, hook );\r
+ fx.end = color( fx.end );\r
+ fx.colorInit = true;\r
+ }\r
+ jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );\r
+ };\r
+ } );\r
+\r
+};\r
+\r
+color.hook( stepHooks );\r
+\r
+jQuery.cssHooks.borderColor = {\r
+ expand: function( value ) {\r
+ var expanded = {};\r
+\r
+ each( [ "Top", "Right", "Bottom", "Left" ], function( _i, part ) {\r
+ expanded[ "border" + part + "Color" ] = value;\r
+ } );\r
+ return expanded;\r
+ }\r
+};\r
+\r
+// Basic color names only.\r
+// Usage of any of the other color names requires adding yourself or including\r
+// jquery.color.svg-names.js.\r
+colors = jQuery.Color.names = {\r
+\r
+ // 4.1. Basic color keywords\r
+ aqua: "#00ffff",\r
+ black: "#000000",\r
+ blue: "#0000ff",\r
+ fuchsia: "#ff00ff",\r
+ gray: "#808080",\r
+ green: "#008000",\r
+ lime: "#00ff00",\r
+ maroon: "#800000",\r
+ navy: "#000080",\r
+ olive: "#808000",\r
+ purple: "#800080",\r
+ red: "#ff0000",\r
+ silver: "#c0c0c0",\r
+ teal: "#008080",\r
+ white: "#ffffff",\r
+ yellow: "#ffff00",\r
+\r
+ // 4.2.3. "transparent" color keyword\r
+ transparent: [ null, null, null, 0 ],\r
+\r
+ _default: "#ffffff"\r
+};\r
+\r
+\r
+/*!\r
+ * jQuery UI Effects 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Effects Core\r
+//>>group: Effects\r
+/* eslint-disable max-len */\r
+//>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects.\r
+/* eslint-enable max-len */\r
+//>>docs: http://api.jqueryui.com/category/effects-core/\r
+//>>demos: http://jqueryui.com/effect/\r
+\r
+\r
+var dataSpace = "ui-effects-",\r
+ dataSpaceStyle = "ui-effects-style",\r
+ dataSpaceAnimated = "ui-effects-animated";\r
+\r
+$.effects = {\r
+ effect: {}\r
+};\r
+\r
+/******************************************************************************/\r
+/****************************** CLASS ANIMATIONS ******************************/\r
+/******************************************************************************/\r
+( function() {\r
+\r
+var classAnimationActions = [ "add", "remove", "toggle" ],\r
+ shorthandStyles = {\r
+ border: 1,\r
+ borderBottom: 1,\r
+ borderColor: 1,\r
+ borderLeft: 1,\r
+ borderRight: 1,\r
+ borderTop: 1,\r
+ borderWidth: 1,\r
+ margin: 1,\r
+ padding: 1\r
+ };\r
+\r
+$.each(\r
+ [ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ],\r
+ function( _, prop ) {\r
+ $.fx.step[ prop ] = function( fx ) {\r
+ if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {\r
+ jQuery.style( fx.elem, prop, fx.end );\r
+ fx.setAttr = true;\r
+ }\r
+ };\r
+ }\r
+);\r
+\r
+function camelCase( string ) {\r
+ return string.replace( /-([\da-z])/gi, function( all, letter ) {\r
+ return letter.toUpperCase();\r
+ } );\r
+}\r
+\r
+function getElementStyles( elem ) {\r
+ var key, len,\r
+ style = elem.ownerDocument.defaultView ?\r
+ elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :\r
+ elem.currentStyle,\r
+ styles = {};\r
+\r
+ if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {\r
+ len = style.length;\r
+ while ( len-- ) {\r
+ key = style[ len ];\r
+ if ( typeof style[ key ] === "string" ) {\r
+ styles[ camelCase( key ) ] = style[ key ];\r
+ }\r
+ }\r
+\r
+ // Support: Opera, IE <9\r
+ } else {\r
+ for ( key in style ) {\r
+ if ( typeof style[ key ] === "string" ) {\r
+ styles[ key ] = style[ key ];\r
+ }\r
+ }\r
+ }\r
+\r
+ return styles;\r
+}\r
+\r
+function styleDifference( oldStyle, newStyle ) {\r
+ var diff = {},\r
+ name, value;\r
+\r
+ for ( name in newStyle ) {\r
+ value = newStyle[ name ];\r
+ if ( oldStyle[ name ] !== value ) {\r
+ if ( !shorthandStyles[ name ] ) {\r
+ if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {\r
+ diff[ name ] = value;\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ return diff;\r
+}\r
+\r
+// Support: jQuery <1.8\r
+if ( !$.fn.addBack ) {\r
+ $.fn.addBack = function( selector ) {\r
+ return this.add( selector == null ?\r
+ this.prevObject : this.prevObject.filter( selector )\r
+ );\r
+ };\r
+}\r
+\r
+$.effects.animateClass = function( value, duration, easing, callback ) {\r
+ var o = $.speed( duration, easing, callback );\r
+\r
+ return this.queue( function() {\r
+ var animated = $( this ),\r
+ baseClass = animated.attr( "class" ) || "",\r
+ applyClassChange,\r
+ allAnimations = o.children ? animated.find( "*" ).addBack() : animated;\r
+\r
+ // Map the animated objects to store the original styles.\r
+ allAnimations = allAnimations.map( function() {\r
+ var el = $( this );\r
+ return {\r
+ el: el,\r
+ start: getElementStyles( this )\r
+ };\r
+ } );\r
+\r
+ // Apply class change\r
+ applyClassChange = function() {\r
+ $.each( classAnimationActions, function( i, action ) {\r
+ if ( value[ action ] ) {\r
+ animated[ action + "Class" ]( value[ action ] );\r
+ }\r
+ } );\r
+ };\r
+ applyClassChange();\r
+\r
+ // Map all animated objects again - calculate new styles and diff\r
+ allAnimations = allAnimations.map( function() {\r
+ this.end = getElementStyles( this.el[ 0 ] );\r
+ this.diff = styleDifference( this.start, this.end );\r
+ return this;\r
+ } );\r
+\r
+ // Apply original class\r
+ animated.attr( "class", baseClass );\r
+\r
+ // Map all animated objects again - this time collecting a promise\r
+ allAnimations = allAnimations.map( function() {\r
+ var styleInfo = this,\r
+ dfd = $.Deferred(),\r
+ opts = $.extend( {}, o, {\r
+ queue: false,\r
+ complete: function() {\r
+ dfd.resolve( styleInfo );\r
+ }\r
+ } );\r
+\r
+ this.el.animate( this.diff, opts );\r
+ return dfd.promise();\r
+ } );\r
+\r
+ // Once all animations have completed:\r
+ $.when.apply( $, allAnimations.get() ).done( function() {\r
+\r
+ // Set the final class\r
+ applyClassChange();\r
+\r
+ // For each animated element,\r
+ // clear all css properties that were animated\r
+ $.each( arguments, function() {\r
+ var el = this.el;\r
+ $.each( this.diff, function( key ) {\r
+ el.css( key, "" );\r
+ } );\r
+ } );\r
+\r
+ // This is guarnteed to be there if you use jQuery.speed()\r
+ // it also handles dequeuing the next anim...\r
+ o.complete.call( animated[ 0 ] );\r
+ } );\r
+ } );\r
+};\r
+\r
+$.fn.extend( {\r
+ addClass: ( function( orig ) {\r
+ return function( classNames, speed, easing, callback ) {\r
+ return speed ?\r
+ $.effects.animateClass.call( this,\r
+ { add: classNames }, speed, easing, callback ) :\r
+ orig.apply( this, arguments );\r
+ };\r
+ } )( $.fn.addClass ),\r
+\r
+ removeClass: ( function( orig ) {\r
+ return function( classNames, speed, easing, callback ) {\r
+ return arguments.length > 1 ?\r
+ $.effects.animateClass.call( this,\r
+ { remove: classNames }, speed, easing, callback ) :\r
+ orig.apply( this, arguments );\r
+ };\r
+ } )( $.fn.removeClass ),\r
+\r
+ toggleClass: ( function( orig ) {\r
+ return function( classNames, force, speed, easing, callback ) {\r
+ if ( typeof force === "boolean" || force === undefined ) {\r
+ if ( !speed ) {\r
+\r
+ // Without speed parameter\r
+ return orig.apply( this, arguments );\r
+ } else {\r
+ return $.effects.animateClass.call( this,\r
+ ( force ? { add: classNames } : { remove: classNames } ),\r
+ speed, easing, callback );\r
+ }\r
+ } else {\r
+\r
+ // Without force parameter\r
+ return $.effects.animateClass.call( this,\r
+ { toggle: classNames }, force, speed, easing );\r
+ }\r
+ };\r
+ } )( $.fn.toggleClass ),\r
+\r
+ switchClass: function( remove, add, speed, easing, callback ) {\r
+ return $.effects.animateClass.call( this, {\r
+ add: add,\r
+ remove: remove\r
+ }, speed, easing, callback );\r
+ }\r
+} );\r
+\r
+} )();\r
+\r
+/******************************************************************************/\r
+/*********************************** EFFECTS **********************************/\r
+/******************************************************************************/\r
+\r
+( function() {\r
+\r
+if ( $.expr && $.expr.pseudos && $.expr.pseudos.animated ) {\r
+ $.expr.pseudos.animated = ( function( orig ) {\r
+ return function( elem ) {\r
+ return !!$( elem ).data( dataSpaceAnimated ) || orig( elem );\r
+ };\r
+ } )( $.expr.pseudos.animated );\r
+}\r
+\r
+if ( $.uiBackCompat !== false ) {\r
+ $.extend( $.effects, {\r
+\r
+ // Saves a set of properties in a data storage\r
+ save: function( element, set ) {\r
+ var i = 0, length = set.length;\r
+ for ( ; i < length; i++ ) {\r
+ if ( set[ i ] !== null ) {\r
+ element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );\r
+ }\r
+ }\r
+ },\r
+\r
+ // Restores a set of previously saved properties from a data storage\r
+ restore: function( element, set ) {\r
+ var val, i = 0, length = set.length;\r
+ for ( ; i < length; i++ ) {\r
+ if ( set[ i ] !== null ) {\r
+ val = element.data( dataSpace + set[ i ] );\r
+ element.css( set[ i ], val );\r
+ }\r
+ }\r
+ },\r
+\r
+ setMode: function( el, mode ) {\r
+ if ( mode === "toggle" ) {\r
+ mode = el.is( ":hidden" ) ? "show" : "hide";\r
+ }\r
+ return mode;\r
+ },\r
+\r
+ // Wraps the element around a wrapper that copies position properties\r
+ createWrapper: function( element ) {\r
+\r
+ // If the element is already wrapped, return it\r
+ if ( element.parent().is( ".ui-effects-wrapper" ) ) {\r
+ return element.parent();\r
+ }\r
+\r
+ // Wrap the element\r
+ var props = {\r
+ width: element.outerWidth( true ),\r
+ height: element.outerHeight( true ),\r
+ "float": element.css( "float" )\r
+ },\r
+ wrapper = $( "<div></div>" )\r
+ .addClass( "ui-effects-wrapper" )\r
+ .css( {\r
+ fontSize: "100%",\r
+ background: "transparent",\r
+ border: "none",\r
+ margin: 0,\r
+ padding: 0\r
+ } ),\r
+\r
+ // Store the size in case width/height are defined in % - Fixes #5245\r
+ size = {\r
+ width: element.width(),\r
+ height: element.height()\r
+ },\r
+ active = document.activeElement;\r
+\r
+ // Support: Firefox\r
+ // Firefox incorrectly exposes anonymous content\r
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=561664\r
+ try {\r
+ // eslint-disable-next-line no-unused-expressions\r
+ active.id;\r
+ } catch ( e ) {\r
+ active = document.body;\r
+ }\r
+\r
+ element.wrap( wrapper );\r
+\r
+ // Fixes #7595 - Elements lose focus when wrapped.\r
+ if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {\r
+ $( active ).trigger( "focus" );\r
+ }\r
+\r
+ // Hotfix for jQuery 1.4 since some change in wrap() seems to actually\r
+ // lose the reference to the wrapped element\r
+ wrapper = element.parent();\r
+\r
+ // Transfer positioning properties to the wrapper\r
+ if ( element.css( "position" ) === "static" ) {\r
+ wrapper.css( { position: "relative" } );\r
+ element.css( { position: "relative" } );\r
+ } else {\r
+ $.extend( props, {\r
+ position: element.css( "position" ),\r
+ zIndex: element.css( "z-index" )\r
+ } );\r
+ $.each( [ "top", "left", "bottom", "right" ], function( i, pos ) {\r
+ props[ pos ] = element.css( pos );\r
+ if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {\r
+ props[ pos ] = "auto";\r
+ }\r
+ } );\r
+ element.css( {\r
+ position: "relative",\r
+ top: 0,\r
+ left: 0,\r
+ right: "auto",\r
+ bottom: "auto"\r
+ } );\r
+ }\r
+ element.css( size );\r
+\r
+ return wrapper.css( props ).show();\r
+ },\r
+\r
+ removeWrapper: function( element ) {\r
+ var active = document.activeElement;\r
+\r
+ if ( element.parent().is( ".ui-effects-wrapper" ) ) {\r
+ element.parent().replaceWith( element );\r
+\r
+ // Fixes #7595 - Elements lose focus when wrapped.\r
+ if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {\r
+ $( active ).trigger( "focus" );\r
+ }\r
+ }\r
+\r
+ return element;\r
+ }\r
+ } );\r
+}\r
+\r
+$.extend( $.effects, {\r
+ version: "1.13.1",\r
+\r
+ define: function( name, mode, effect ) {\r
+ if ( !effect ) {\r
+ effect = mode;\r
+ mode = "effect";\r
+ }\r
+\r
+ $.effects.effect[ name ] = effect;\r
+ $.effects.effect[ name ].mode = mode;\r
+\r
+ return effect;\r
+ },\r
+\r
+ scaledDimensions: function( element, percent, direction ) {\r
+ if ( percent === 0 ) {\r
+ return {\r
+ height: 0,\r
+ width: 0,\r
+ outerHeight: 0,\r
+ outerWidth: 0\r
+ };\r
+ }\r
+\r
+ var x = direction !== "horizontal" ? ( ( percent || 100 ) / 100 ) : 1,\r
+ y = direction !== "vertical" ? ( ( percent || 100 ) / 100 ) : 1;\r
+\r
+ return {\r
+ height: element.height() * y,\r
+ width: element.width() * x,\r
+ outerHeight: element.outerHeight() * y,\r
+ outerWidth: element.outerWidth() * x\r
+ };\r
+\r
+ },\r
+\r
+ clipToBox: function( animation ) {\r
+ return {\r
+ width: animation.clip.right - animation.clip.left,\r
+ height: animation.clip.bottom - animation.clip.top,\r
+ left: animation.clip.left,\r
+ top: animation.clip.top\r
+ };\r
+ },\r
+\r
+ // Injects recently queued functions to be first in line (after "inprogress")\r
+ unshift: function( element, queueLength, count ) {\r
+ var queue = element.queue();\r
+\r
+ if ( queueLength > 1 ) {\r
+ queue.splice.apply( queue,\r
+ [ 1, 0 ].concat( queue.splice( queueLength, count ) ) );\r
+ }\r
+ element.dequeue();\r
+ },\r
+\r
+ saveStyle: function( element ) {\r
+ element.data( dataSpaceStyle, element[ 0 ].style.cssText );\r
+ },\r
+\r
+ restoreStyle: function( element ) {\r
+ element[ 0 ].style.cssText = element.data( dataSpaceStyle ) || "";\r
+ element.removeData( dataSpaceStyle );\r
+ },\r
+\r
+ mode: function( element, mode ) {\r
+ var hidden = element.is( ":hidden" );\r
+\r
+ if ( mode === "toggle" ) {\r
+ mode = hidden ? "show" : "hide";\r
+ }\r
+ if ( hidden ? mode === "hide" : mode === "show" ) {\r
+ mode = "none";\r
+ }\r
+ return mode;\r
+ },\r
+\r
+ // Translates a [top,left] array into a baseline value\r
+ getBaseline: function( origin, original ) {\r
+ var y, x;\r
+\r
+ switch ( origin[ 0 ] ) {\r
+ case "top":\r
+ y = 0;\r
+ break;\r
+ case "middle":\r
+ y = 0.5;\r
+ break;\r
+ case "bottom":\r
+ y = 1;\r
+ break;\r
+ default:\r
+ y = origin[ 0 ] / original.height;\r
+ }\r
+\r
+ switch ( origin[ 1 ] ) {\r
+ case "left":\r
+ x = 0;\r
+ break;\r
+ case "center":\r
+ x = 0.5;\r
+ break;\r
+ case "right":\r
+ x = 1;\r
+ break;\r
+ default:\r
+ x = origin[ 1 ] / original.width;\r
+ }\r
+\r
+ return {\r
+ x: x,\r
+ y: y\r
+ };\r
+ },\r
+\r
+ // Creates a placeholder element so that the original element can be made absolute\r
+ createPlaceholder: function( element ) {\r
+ var placeholder,\r
+ cssPosition = element.css( "position" ),\r
+ position = element.position();\r
+\r
+ // Lock in margins first to account for form elements, which\r
+ // will change margin if you explicitly set height\r
+ // see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380\r
+ // Support: Safari\r
+ element.css( {\r
+ marginTop: element.css( "marginTop" ),\r
+ marginBottom: element.css( "marginBottom" ),\r
+ marginLeft: element.css( "marginLeft" ),\r
+ marginRight: element.css( "marginRight" )\r
+ } )\r
+ .outerWidth( element.outerWidth() )\r
+ .outerHeight( element.outerHeight() );\r
+\r
+ if ( /^(static|relative)/.test( cssPosition ) ) {\r
+ cssPosition = "absolute";\r
+\r
+ placeholder = $( "<" + element[ 0 ].nodeName + ">" ).insertAfter( element ).css( {\r
+\r
+ // Convert inline to inline block to account for inline elements\r
+ // that turn to inline block based on content (like img)\r
+ display: /^(inline|ruby)/.test( element.css( "display" ) ) ?\r
+ "inline-block" :\r
+ "block",\r
+ visibility: "hidden",\r
+\r
+ // Margins need to be set to account for margin collapse\r
+ marginTop: element.css( "marginTop" ),\r
+ marginBottom: element.css( "marginBottom" ),\r
+ marginLeft: element.css( "marginLeft" ),\r
+ marginRight: element.css( "marginRight" ),\r
+ "float": element.css( "float" )\r
+ } )\r
+ .outerWidth( element.outerWidth() )\r
+ .outerHeight( element.outerHeight() )\r
+ .addClass( "ui-effects-placeholder" );\r
+\r
+ element.data( dataSpace + "placeholder", placeholder );\r
+ }\r
+\r
+ element.css( {\r
+ position: cssPosition,\r
+ left: position.left,\r
+ top: position.top\r
+ } );\r
+\r
+ return placeholder;\r
+ },\r
+\r
+ removePlaceholder: function( element ) {\r
+ var dataKey = dataSpace + "placeholder",\r
+ placeholder = element.data( dataKey );\r
+\r
+ if ( placeholder ) {\r
+ placeholder.remove();\r
+ element.removeData( dataKey );\r
+ }\r
+ },\r
+\r
+ // Removes a placeholder if it exists and restores\r
+ // properties that were modified during placeholder creation\r
+ cleanUp: function( element ) {\r
+ $.effects.restoreStyle( element );\r
+ $.effects.removePlaceholder( element );\r
+ },\r
+\r
+ setTransition: function( element, list, factor, value ) {\r
+ value = value || {};\r
+ $.each( list, function( i, x ) {\r
+ var unit = element.cssUnit( x );\r
+ if ( unit[ 0 ] > 0 ) {\r
+ value[ x ] = unit[ 0 ] * factor + unit[ 1 ];\r
+ }\r
+ } );\r
+ return value;\r
+ }\r
+} );\r
+\r
+// Return an effect options object for the given parameters:\r
+function _normalizeArguments( effect, options, speed, callback ) {\r
+\r
+ // Allow passing all options as the first parameter\r
+ if ( $.isPlainObject( effect ) ) {\r
+ options = effect;\r
+ effect = effect.effect;\r
+ }\r
+\r
+ // Convert to an object\r
+ effect = { effect: effect };\r
+\r
+ // Catch (effect, null, ...)\r
+ if ( options == null ) {\r
+ options = {};\r
+ }\r
+\r
+ // Catch (effect, callback)\r
+ if ( typeof options === "function" ) {\r
+ callback = options;\r
+ speed = null;\r
+ options = {};\r
+ }\r
+\r
+ // Catch (effect, speed, ?)\r
+ if ( typeof options === "number" || $.fx.speeds[ options ] ) {\r
+ callback = speed;\r
+ speed = options;\r
+ options = {};\r
+ }\r
+\r
+ // Catch (effect, options, callback)\r
+ if ( typeof speed === "function" ) {\r
+ callback = speed;\r
+ speed = null;\r
+ }\r
+\r
+ // Add options to effect\r
+ if ( options ) {\r
+ $.extend( effect, options );\r
+ }\r
+\r
+ speed = speed || options.duration;\r
+ effect.duration = $.fx.off ? 0 :\r
+ typeof speed === "number" ? speed :\r
+ speed in $.fx.speeds ? $.fx.speeds[ speed ] :\r
+ $.fx.speeds._default;\r
+\r
+ effect.complete = callback || options.complete;\r
+\r
+ return effect;\r
+}\r
+\r
+function standardAnimationOption( option ) {\r
+\r
+ // Valid standard speeds (nothing, number, named speed)\r
+ if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) {\r
+ return true;\r
+ }\r
+\r
+ // Invalid strings - treat as "normal" speed\r
+ if ( typeof option === "string" && !$.effects.effect[ option ] ) {\r
+ return true;\r
+ }\r
+\r
+ // Complete callback\r
+ if ( typeof option === "function" ) {\r
+ return true;\r
+ }\r
+\r
+ // Options hash (but not naming an effect)\r
+ if ( typeof option === "object" && !option.effect ) {\r
+ return true;\r
+ }\r
+\r
+ // Didn't match any standard API\r
+ return false;\r
+}\r
+\r
+$.fn.extend( {\r
+ effect: function( /* effect, options, speed, callback */ ) {\r
+ var args = _normalizeArguments.apply( this, arguments ),\r
+ effectMethod = $.effects.effect[ args.effect ],\r
+ defaultMode = effectMethod.mode,\r
+ queue = args.queue,\r
+ queueName = queue || "fx",\r
+ complete = args.complete,\r
+ mode = args.mode,\r
+ modes = [],\r
+ prefilter = function( next ) {\r
+ var el = $( this ),\r
+ normalizedMode = $.effects.mode( el, mode ) || defaultMode;\r
+\r
+ // Sentinel for duck-punching the :animated pseudo-selector\r
+ el.data( dataSpaceAnimated, true );\r
+\r
+ // Save effect mode for later use,\r
+ // we can't just call $.effects.mode again later,\r
+ // as the .show() below destroys the initial state\r
+ modes.push( normalizedMode );\r
+\r
+ // See $.uiBackCompat inside of run() for removal of defaultMode in 1.14\r
+ if ( defaultMode && ( normalizedMode === "show" ||\r
+ ( normalizedMode === defaultMode && normalizedMode === "hide" ) ) ) {\r
+ el.show();\r
+ }\r
+\r
+ if ( !defaultMode || normalizedMode !== "none" ) {\r
+ $.effects.saveStyle( el );\r
+ }\r
+\r
+ if ( typeof next === "function" ) {\r
+ next();\r
+ }\r
+ };\r
+\r
+ if ( $.fx.off || !effectMethod ) {\r
+\r
+ // Delegate to the original method (e.g., .show()) if possible\r
+ if ( mode ) {\r
+ return this[ mode ]( args.duration, complete );\r
+ } else {\r
+ return this.each( function() {\r
+ if ( complete ) {\r
+ complete.call( this );\r
+ }\r
+ } );\r
+ }\r
+ }\r
+\r
+ function run( next ) {\r
+ var elem = $( this );\r
+\r
+ function cleanup() {\r
+ elem.removeData( dataSpaceAnimated );\r
+\r
+ $.effects.cleanUp( elem );\r
+\r
+ if ( args.mode === "hide" ) {\r
+ elem.hide();\r
+ }\r
+\r
+ done();\r
+ }\r
+\r
+ function done() {\r
+ if ( typeof complete === "function" ) {\r
+ complete.call( elem[ 0 ] );\r
+ }\r
+\r
+ if ( typeof next === "function" ) {\r
+ next();\r
+ }\r
+ }\r
+\r
+ // Override mode option on a per element basis,\r
+ // as toggle can be either show or hide depending on element state\r
+ args.mode = modes.shift();\r
+\r
+ if ( $.uiBackCompat !== false && !defaultMode ) {\r
+ if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {\r
+\r
+ // Call the core method to track "olddisplay" properly\r
+ elem[ mode ]();\r
+ done();\r
+ } else {\r
+ effectMethod.call( elem[ 0 ], args, done );\r
+ }\r
+ } else {\r
+ if ( args.mode === "none" ) {\r
+\r
+ // Call the core method to track "olddisplay" properly\r
+ elem[ mode ]();\r
+ done();\r
+ } else {\r
+ effectMethod.call( elem[ 0 ], args, cleanup );\r
+ }\r
+ }\r
+ }\r
+\r
+ // Run prefilter on all elements first to ensure that\r
+ // any showing or hiding happens before placeholder creation,\r
+ // which ensures that any layout changes are correctly captured.\r
+ return queue === false ?\r
+ this.each( prefilter ).each( run ) :\r
+ this.queue( queueName, prefilter ).queue( queueName, run );\r
+ },\r
+\r
+ show: ( function( orig ) {\r
+ return function( option ) {\r
+ if ( standardAnimationOption( option ) ) {\r
+ return orig.apply( this, arguments );\r
+ } else {\r
+ var args = _normalizeArguments.apply( this, arguments );\r
+ args.mode = "show";\r
+ return this.effect.call( this, args );\r
+ }\r
+ };\r
+ } )( $.fn.show ),\r
+\r
+ hide: ( function( orig ) {\r
+ return function( option ) {\r
+ if ( standardAnimationOption( option ) ) {\r
+ return orig.apply( this, arguments );\r
+ } else {\r
+ var args = _normalizeArguments.apply( this, arguments );\r
+ args.mode = "hide";\r
+ return this.effect.call( this, args );\r
+ }\r
+ };\r
+ } )( $.fn.hide ),\r
+\r
+ toggle: ( function( orig ) {\r
+ return function( option ) {\r
+ if ( standardAnimationOption( option ) || typeof option === "boolean" ) {\r
+ return orig.apply( this, arguments );\r
+ } else {\r
+ var args = _normalizeArguments.apply( this, arguments );\r
+ args.mode = "toggle";\r
+ return this.effect.call( this, args );\r
+ }\r
+ };\r
+ } )( $.fn.toggle ),\r
+\r
+ cssUnit: function( key ) {\r
+ var style = this.css( key ),\r
+ val = [];\r
+\r
+ $.each( [ "em", "px", "%", "pt" ], function( i, unit ) {\r
+ if ( style.indexOf( unit ) > 0 ) {\r
+ val = [ parseFloat( style ), unit ];\r
+ }\r
+ } );\r
+ return val;\r
+ },\r
+\r
+ cssClip: function( clipObj ) {\r
+ if ( clipObj ) {\r
+ return this.css( "clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " +\r
+ clipObj.bottom + "px " + clipObj.left + "px)" );\r
+ }\r
+ return parseClip( this.css( "clip" ), this );\r
+ },\r
+\r
+ transfer: function( options, done ) {\r
+ var element = $( this ),\r
+ target = $( options.to ),\r
+ targetFixed = target.css( "position" ) === "fixed",\r
+ body = $( "body" ),\r
+ fixTop = targetFixed ? body.scrollTop() : 0,\r
+ fixLeft = targetFixed ? body.scrollLeft() : 0,\r
+ endPosition = target.offset(),\r
+ animation = {\r
+ top: endPosition.top - fixTop,\r
+ left: endPosition.left - fixLeft,\r
+ height: target.innerHeight(),\r
+ width: target.innerWidth()\r
+ },\r
+ startPosition = element.offset(),\r
+ transfer = $( "<div class='ui-effects-transfer'></div>" );\r
+\r
+ transfer\r
+ .appendTo( "body" )\r
+ .addClass( options.className )\r
+ .css( {\r
+ top: startPosition.top - fixTop,\r
+ left: startPosition.left - fixLeft,\r
+ height: element.innerHeight(),\r
+ width: element.innerWidth(),\r
+ position: targetFixed ? "fixed" : "absolute"\r
+ } )\r
+ .animate( animation, options.duration, options.easing, function() {\r
+ transfer.remove();\r
+ if ( typeof done === "function" ) {\r
+ done();\r
+ }\r
+ } );\r
+ }\r
+} );\r
+\r
+function parseClip( str, element ) {\r
+ var outerWidth = element.outerWidth(),\r
+ outerHeight = element.outerHeight(),\r
+ 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)\)$/,\r
+ values = clipRegex.exec( str ) || [ "", 0, outerWidth, outerHeight, 0 ];\r
+\r
+ return {\r
+ top: parseFloat( values[ 1 ] ) || 0,\r
+ right: values[ 2 ] === "auto" ? outerWidth : parseFloat( values[ 2 ] ),\r
+ bottom: values[ 3 ] === "auto" ? outerHeight : parseFloat( values[ 3 ] ),\r
+ left: parseFloat( values[ 4 ] ) || 0\r
+ };\r
+}\r
+\r
+$.fx.step.clip = function( fx ) {\r
+ if ( !fx.clipInit ) {\r
+ fx.start = $( fx.elem ).cssClip();\r
+ if ( typeof fx.end === "string" ) {\r
+ fx.end = parseClip( fx.end, fx.elem );\r
+ }\r
+ fx.clipInit = true;\r
+ }\r
+\r
+ $( fx.elem ).cssClip( {\r
+ top: fx.pos * ( fx.end.top - fx.start.top ) + fx.start.top,\r
+ right: fx.pos * ( fx.end.right - fx.start.right ) + fx.start.right,\r
+ bottom: fx.pos * ( fx.end.bottom - fx.start.bottom ) + fx.start.bottom,\r
+ left: fx.pos * ( fx.end.left - fx.start.left ) + fx.start.left\r
+ } );\r
+};\r
+\r
+} )();\r
+\r
+/******************************************************************************/\r
+/*********************************** EASING ***********************************/\r
+/******************************************************************************/\r
+\r
+( function() {\r
+\r
+// Based on easing equations from Robert Penner (http://www.robertpenner.com/easing)\r
+\r
+var baseEasings = {};\r
+\r
+$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {\r
+ baseEasings[ name ] = function( p ) {\r
+ return Math.pow( p, i + 2 );\r
+ };\r
+} );\r
+\r
+$.extend( baseEasings, {\r
+ Sine: function( p ) {\r
+ return 1 - Math.cos( p * Math.PI / 2 );\r
+ },\r
+ Circ: function( p ) {\r
+ return 1 - Math.sqrt( 1 - p * p );\r
+ },\r
+ Elastic: function( p ) {\r
+ return p === 0 || p === 1 ? p :\r
+ -Math.pow( 2, 8 * ( p - 1 ) ) * Math.sin( ( ( p - 1 ) * 80 - 7.5 ) * Math.PI / 15 );\r
+ },\r
+ Back: function( p ) {\r
+ return p * p * ( 3 * p - 2 );\r
+ },\r
+ Bounce: function( p ) {\r
+ var pow2,\r
+ bounce = 4;\r
+\r
+ while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}\r
+ return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );\r
+ }\r
+} );\r
+\r
+$.each( baseEasings, function( name, easeIn ) {\r
+ $.easing[ "easeIn" + name ] = easeIn;\r
+ $.easing[ "easeOut" + name ] = function( p ) {\r
+ return 1 - easeIn( 1 - p );\r
+ };\r
+ $.easing[ "easeInOut" + name ] = function( p ) {\r
+ return p < 0.5 ?\r
+ easeIn( p * 2 ) / 2 :\r
+ 1 - easeIn( p * -2 + 2 ) / 2;\r
+ };\r
+} );\r
+\r
+} )();\r
+\r
+var effect = $.effects;\r
+\r
+\r
+/*!\r
+ * jQuery UI Effects Blind 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Blind Effect\r
+//>>group: Effects\r
+//>>description: Blinds the element.\r
+//>>docs: http://api.jqueryui.com/blind-effect/\r
+//>>demos: http://jqueryui.com/effect/\r
+\r
+\r
+var effectsEffectBlind = $.effects.define( "blind", "hide", function( options, done ) {\r
+ var map = {\r
+ up: [ "bottom", "top" ],\r
+ vertical: [ "bottom", "top" ],\r
+ down: [ "top", "bottom" ],\r
+ left: [ "right", "left" ],\r
+ horizontal: [ "right", "left" ],\r
+ right: [ "left", "right" ]\r
+ },\r
+ element = $( this ),\r
+ direction = options.direction || "up",\r
+ start = element.cssClip(),\r
+ animate = { clip: $.extend( {}, start ) },\r
+ placeholder = $.effects.createPlaceholder( element );\r
+\r
+ animate.clip[ map[ direction ][ 0 ] ] = animate.clip[ map[ direction ][ 1 ] ];\r
+\r
+ if ( options.mode === "show" ) {\r
+ element.cssClip( animate.clip );\r
+ if ( placeholder ) {\r
+ placeholder.css( $.effects.clipToBox( animate ) );\r
+ }\r
+\r
+ animate.clip = start;\r
+ }\r
+\r
+ if ( placeholder ) {\r
+ placeholder.animate( $.effects.clipToBox( animate ), options.duration, options.easing );\r
+ }\r
+\r
+ element.animate( animate, {\r
+ queue: false,\r
+ duration: options.duration,\r
+ easing: options.easing,\r
+ complete: done\r
+ } );\r
+} );\r
+\r
+\r
+/*!\r
+ * jQuery UI Effects Bounce 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Bounce Effect\r
+//>>group: Effects\r
+//>>description: Bounces an element horizontally or vertically n times.\r
+//>>docs: http://api.jqueryui.com/bounce-effect/\r
+//>>demos: http://jqueryui.com/effect/\r
+\r
+\r
+var effectsEffectBounce = $.effects.define( "bounce", function( options, done ) {\r
+ var upAnim, downAnim, refValue,\r
+ element = $( this ),\r
+\r
+ // Defaults:\r
+ mode = options.mode,\r
+ hide = mode === "hide",\r
+ show = mode === "show",\r
+ direction = options.direction || "up",\r
+ distance = options.distance,\r
+ times = options.times || 5,\r
+\r
+ // Number of internal animations\r
+ anims = times * 2 + ( show || hide ? 1 : 0 ),\r
+ speed = options.duration / anims,\r
+ easing = options.easing,\r
+\r
+ // Utility:\r
+ ref = ( direction === "up" || direction === "down" ) ? "top" : "left",\r
+ motion = ( direction === "up" || direction === "left" ),\r
+ i = 0,\r
+\r
+ queuelen = element.queue().length;\r
+\r
+ $.effects.createPlaceholder( element );\r
+\r
+ refValue = element.css( ref );\r
+\r
+ // Default distance for the BIGGEST bounce is the outer Distance / 3\r
+ if ( !distance ) {\r
+ distance = element[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;\r
+ }\r
+\r
+ if ( show ) {\r
+ downAnim = { opacity: 1 };\r
+ downAnim[ ref ] = refValue;\r
+\r
+ // If we are showing, force opacity 0 and set the initial position\r
+ // then do the "first" animation\r
+ element\r
+ .css( "opacity", 0 )\r
+ .css( ref, motion ? -distance * 2 : distance * 2 )\r
+ .animate( downAnim, speed, easing );\r
+ }\r
+\r
+ // Start at the smallest distance if we are hiding\r
+ if ( hide ) {\r
+ distance = distance / Math.pow( 2, times - 1 );\r
+ }\r
+\r
+ downAnim = {};\r
+ downAnim[ ref ] = refValue;\r
+\r
+ // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here\r
+ for ( ; i < times; i++ ) {\r
+ upAnim = {};\r
+ upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;\r
+\r
+ element\r
+ .animate( upAnim, speed, easing )\r
+ .animate( downAnim, speed, easing );\r
+\r
+ distance = hide ? distance * 2 : distance / 2;\r
+ }\r
+\r
+ // Last Bounce when Hiding\r
+ if ( hide ) {\r
+ upAnim = { opacity: 0 };\r
+ upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;\r
+\r
+ element.animate( upAnim, speed, easing );\r
+ }\r
+\r
+ element.queue( done );\r
+\r
+ $.effects.unshift( element, queuelen, anims + 1 );\r
+} );\r
+\r
+\r
+/*!\r
+ * jQuery UI Effects Clip 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Clip Effect\r
+//>>group: Effects\r
+//>>description: Clips the element on and off like an old TV.\r
+//>>docs: http://api.jqueryui.com/clip-effect/\r
+//>>demos: http://jqueryui.com/effect/\r
+\r
+\r
+var effectsEffectClip = $.effects.define( "clip", "hide", function( options, done ) {\r
+ var start,\r
+ animate = {},\r
+ element = $( this ),\r
+ direction = options.direction || "vertical",\r
+ both = direction === "both",\r
+ horizontal = both || direction === "horizontal",\r
+ vertical = both || direction === "vertical";\r
+\r
+ start = element.cssClip();\r
+ animate.clip = {\r
+ top: vertical ? ( start.bottom - start.top ) / 2 : start.top,\r
+ right: horizontal ? ( start.right - start.left ) / 2 : start.right,\r
+ bottom: vertical ? ( start.bottom - start.top ) / 2 : start.bottom,\r
+ left: horizontal ? ( start.right - start.left ) / 2 : start.left\r
+ };\r
+\r
+ $.effects.createPlaceholder( element );\r
+\r
+ if ( options.mode === "show" ) {\r
+ element.cssClip( animate.clip );\r
+ animate.clip = start;\r
+ }\r
+\r
+ element.animate( animate, {\r
+ queue: false,\r
+ duration: options.duration,\r
+ easing: options.easing,\r
+ complete: done\r
+ } );\r
+\r
+} );\r
+\r
+\r
+/*!\r
+ * jQuery UI Effects Drop 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Drop Effect\r
+//>>group: Effects\r
+//>>description: Moves an element in one direction and hides it at the same time.\r
+//>>docs: http://api.jqueryui.com/drop-effect/\r
+//>>demos: http://jqueryui.com/effect/\r
+\r
+\r
+var effectsEffectDrop = $.effects.define( "drop", "hide", function( options, done ) {\r
+\r
+ var distance,\r
+ element = $( this ),\r
+ mode = options.mode,\r
+ show = mode === "show",\r
+ direction = options.direction || "left",\r
+ ref = ( direction === "up" || direction === "down" ) ? "top" : "left",\r
+ motion = ( direction === "up" || direction === "left" ) ? "-=" : "+=",\r
+ oppositeMotion = ( motion === "+=" ) ? "-=" : "+=",\r
+ animation = {\r
+ opacity: 0\r
+ };\r
+\r
+ $.effects.createPlaceholder( element );\r
+\r
+ distance = options.distance ||\r
+ element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2;\r
+\r
+ animation[ ref ] = motion + distance;\r
+\r
+ if ( show ) {\r
+ element.css( animation );\r
+\r
+ animation[ ref ] = oppositeMotion + distance;\r
+ animation.opacity = 1;\r
+ }\r
+\r
+ // Animate\r
+ element.animate( animation, {\r
+ queue: false,\r
+ duration: options.duration,\r
+ easing: options.easing,\r
+ complete: done\r
+ } );\r
+} );\r
+\r
+\r
+/*!\r
+ * jQuery UI Effects Explode 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Explode Effect\r
+//>>group: Effects\r
+/* eslint-disable max-len */\r
+//>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness.\r
+/* eslint-enable max-len */\r
+//>>docs: http://api.jqueryui.com/explode-effect/\r
+//>>demos: http://jqueryui.com/effect/\r
+\r
+\r
+var effectsEffectExplode = $.effects.define( "explode", "hide", function( options, done ) {\r
+\r
+ var i, j, left, top, mx, my,\r
+ rows = options.pieces ? Math.round( Math.sqrt( options.pieces ) ) : 3,\r
+ cells = rows,\r
+ element = $( this ),\r
+ mode = options.mode,\r
+ show = mode === "show",\r
+\r
+ // Show and then visibility:hidden the element before calculating offset\r
+ offset = element.show().css( "visibility", "hidden" ).offset(),\r
+\r
+ // Width and height of a piece\r
+ width = Math.ceil( element.outerWidth() / cells ),\r
+ height = Math.ceil( element.outerHeight() / rows ),\r
+ pieces = [];\r
+\r
+ // Children animate complete:\r
+ function childComplete() {\r
+ pieces.push( this );\r
+ if ( pieces.length === rows * cells ) {\r
+ animComplete();\r
+ }\r
+ }\r
+\r
+ // Clone the element for each row and cell.\r
+ for ( i = 0; i < rows; i++ ) { // ===>\r
+ top = offset.top + i * height;\r
+ my = i - ( rows - 1 ) / 2;\r
+\r
+ for ( j = 0; j < cells; j++ ) { // |||\r
+ left = offset.left + j * width;\r
+ mx = j - ( cells - 1 ) / 2;\r
+\r
+ // Create a clone of the now hidden main element that will be absolute positioned\r
+ // within a wrapper div off the -left and -top equal to size of our pieces\r
+ element\r
+ .clone()\r
+ .appendTo( "body" )\r
+ .wrap( "<div></div>" )\r
+ .css( {\r
+ position: "absolute",\r
+ visibility: "visible",\r
+ left: -j * width,\r
+ top: -i * height\r
+ } )\r
+\r
+ // Select the wrapper - make it overflow: hidden and absolute positioned based on\r
+ // where the original was located +left and +top equal to the size of pieces\r
+ .parent()\r
+ .addClass( "ui-effects-explode" )\r
+ .css( {\r
+ position: "absolute",\r
+ overflow: "hidden",\r
+ width: width,\r
+ height: height,\r
+ left: left + ( show ? mx * width : 0 ),\r
+ top: top + ( show ? my * height : 0 ),\r
+ opacity: show ? 0 : 1\r
+ } )\r
+ .animate( {\r
+ left: left + ( show ? 0 : mx * width ),\r
+ top: top + ( show ? 0 : my * height ),\r
+ opacity: show ? 1 : 0\r
+ }, options.duration || 500, options.easing, childComplete );\r
+ }\r
+ }\r
+\r
+ function animComplete() {\r
+ element.css( {\r
+ visibility: "visible"\r
+ } );\r
+ $( pieces ).remove();\r
+ done();\r
+ }\r
+} );\r
+\r
+\r
+/*!\r
+ * jQuery UI Effects Fade 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Fade Effect\r
+//>>group: Effects\r
+//>>description: Fades the element.\r
+//>>docs: http://api.jqueryui.com/fade-effect/\r
+//>>demos: http://jqueryui.com/effect/\r
+\r
+\r
+var effectsEffectFade = $.effects.define( "fade", "toggle", function( options, done ) {\r
+ var show = options.mode === "show";\r
+\r
+ $( this )\r
+ .css( "opacity", show ? 0 : 1 )\r
+ .animate( {\r
+ opacity: show ? 1 : 0\r
+ }, {\r
+ queue: false,\r
+ duration: options.duration,\r
+ easing: options.easing,\r
+ complete: done\r
+ } );\r
+} );\r
+\r
+\r
+/*!\r
+ * jQuery UI Effects Fold 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Fold Effect\r
+//>>group: Effects\r
+//>>description: Folds an element first horizontally and then vertically.\r
+//>>docs: http://api.jqueryui.com/fold-effect/\r
+//>>demos: http://jqueryui.com/effect/\r
+\r
+\r
+var effectsEffectFold = $.effects.define( "fold", "hide", function( options, done ) {\r
+\r
+ // Create element\r
+ var element = $( this ),\r
+ mode = options.mode,\r
+ show = mode === "show",\r
+ hide = mode === "hide",\r
+ size = options.size || 15,\r
+ percent = /([0-9]+)%/.exec( size ),\r
+ horizFirst = !!options.horizFirst,\r
+ ref = horizFirst ? [ "right", "bottom" ] : [ "bottom", "right" ],\r
+ duration = options.duration / 2,\r
+\r
+ placeholder = $.effects.createPlaceholder( element ),\r
+\r
+ start = element.cssClip(),\r
+ animation1 = { clip: $.extend( {}, start ) },\r
+ animation2 = { clip: $.extend( {}, start ) },\r
+\r
+ distance = [ start[ ref[ 0 ] ], start[ ref[ 1 ] ] ],\r
+\r
+ queuelen = element.queue().length;\r
+\r
+ if ( percent ) {\r
+ size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ];\r
+ }\r
+ animation1.clip[ ref[ 0 ] ] = size;\r
+ animation2.clip[ ref[ 0 ] ] = size;\r
+ animation2.clip[ ref[ 1 ] ] = 0;\r
+\r
+ if ( show ) {\r
+ element.cssClip( animation2.clip );\r
+ if ( placeholder ) {\r
+ placeholder.css( $.effects.clipToBox( animation2 ) );\r
+ }\r
+\r
+ animation2.clip = start;\r
+ }\r
+\r
+ // Animate\r
+ element\r
+ .queue( function( next ) {\r
+ if ( placeholder ) {\r
+ placeholder\r
+ .animate( $.effects.clipToBox( animation1 ), duration, options.easing )\r
+ .animate( $.effects.clipToBox( animation2 ), duration, options.easing );\r
+ }\r
+\r
+ next();\r
+ } )\r
+ .animate( animation1, duration, options.easing )\r
+ .animate( animation2, duration, options.easing )\r
+ .queue( done );\r
+\r
+ $.effects.unshift( element, queuelen, 4 );\r
+} );\r
+\r
+\r
+/*!\r
+ * jQuery UI Effects Highlight 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Highlight Effect\r
+//>>group: Effects\r
+//>>description: Highlights the background of an element in a defined color for a custom duration.\r
+//>>docs: http://api.jqueryui.com/highlight-effect/\r
+//>>demos: http://jqueryui.com/effect/\r
+\r
+\r
+var effectsEffectHighlight = $.effects.define( "highlight", "show", function( options, done ) {\r
+ var element = $( this ),\r
+ animation = {\r
+ backgroundColor: element.css( "backgroundColor" )\r
+ };\r
+\r
+ if ( options.mode === "hide" ) {\r
+ animation.opacity = 0;\r
+ }\r
+\r
+ $.effects.saveStyle( element );\r
+\r
+ element\r
+ .css( {\r
+ backgroundImage: "none",\r
+ backgroundColor: options.color || "#ffff99"\r
+ } )\r
+ .animate( animation, {\r
+ queue: false,\r
+ duration: options.duration,\r
+ easing: options.easing,\r
+ complete: done\r
+ } );\r
+} );\r
+\r
+\r
+/*!\r
+ * jQuery UI Effects Size 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Size Effect\r
+//>>group: Effects\r
+//>>description: Resize an element to a specified width and height.\r
+//>>docs: http://api.jqueryui.com/size-effect/\r
+//>>demos: http://jqueryui.com/effect/\r
+\r
+\r
+var effectsEffectSize = $.effects.define( "size", function( options, done ) {\r
+\r
+ // Create element\r
+ var baseline, factor, temp,\r
+ element = $( this ),\r
+\r
+ // Copy for children\r
+ cProps = [ "fontSize" ],\r
+ vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],\r
+ hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],\r
+\r
+ // Set options\r
+ mode = options.mode,\r
+ restore = mode !== "effect",\r
+ scale = options.scale || "both",\r
+ origin = options.origin || [ "middle", "center" ],\r
+ position = element.css( "position" ),\r
+ pos = element.position(),\r
+ original = $.effects.scaledDimensions( element ),\r
+ from = options.from || original,\r
+ to = options.to || $.effects.scaledDimensions( element, 0 );\r
+\r
+ $.effects.createPlaceholder( element );\r
+\r
+ if ( mode === "show" ) {\r
+ temp = from;\r
+ from = to;\r
+ to = temp;\r
+ }\r
+\r
+ // Set scaling factor\r
+ factor = {\r
+ from: {\r
+ y: from.height / original.height,\r
+ x: from.width / original.width\r
+ },\r
+ to: {\r
+ y: to.height / original.height,\r
+ x: to.width / original.width\r
+ }\r
+ };\r
+\r
+ // Scale the css box\r
+ if ( scale === "box" || scale === "both" ) {\r
+\r
+ // Vertical props scaling\r
+ if ( factor.from.y !== factor.to.y ) {\r
+ from = $.effects.setTransition( element, vProps, factor.from.y, from );\r
+ to = $.effects.setTransition( element, vProps, factor.to.y, to );\r
+ }\r
+\r
+ // Horizontal props scaling\r
+ if ( factor.from.x !== factor.to.x ) {\r
+ from = $.effects.setTransition( element, hProps, factor.from.x, from );\r
+ to = $.effects.setTransition( element, hProps, factor.to.x, to );\r
+ }\r
+ }\r
+\r
+ // Scale the content\r
+ if ( scale === "content" || scale === "both" ) {\r
+\r
+ // Vertical props scaling\r
+ if ( factor.from.y !== factor.to.y ) {\r
+ from = $.effects.setTransition( element, cProps, factor.from.y, from );\r
+ to = $.effects.setTransition( element, cProps, factor.to.y, to );\r
+ }\r
+ }\r
+\r
+ // Adjust the position properties based on the provided origin points\r
+ if ( origin ) {\r
+ baseline = $.effects.getBaseline( origin, original );\r
+ from.top = ( original.outerHeight - from.outerHeight ) * baseline.y + pos.top;\r
+ from.left = ( original.outerWidth - from.outerWidth ) * baseline.x + pos.left;\r
+ to.top = ( original.outerHeight - to.outerHeight ) * baseline.y + pos.top;\r
+ to.left = ( original.outerWidth - to.outerWidth ) * baseline.x + pos.left;\r
+ }\r
+ delete from.outerHeight;\r
+ delete from.outerWidth;\r
+ element.css( from );\r
+\r
+ // Animate the children if desired\r
+ if ( scale === "content" || scale === "both" ) {\r
+\r
+ vProps = vProps.concat( [ "marginTop", "marginBottom" ] ).concat( cProps );\r
+ hProps = hProps.concat( [ "marginLeft", "marginRight" ] );\r
+\r
+ // Only animate children with width attributes specified\r
+ // TODO: is this right? should we include anything with css width specified as well\r
+ element.find( "*[width]" ).each( function() {\r
+ var child = $( this ),\r
+ childOriginal = $.effects.scaledDimensions( child ),\r
+ childFrom = {\r
+ height: childOriginal.height * factor.from.y,\r
+ width: childOriginal.width * factor.from.x,\r
+ outerHeight: childOriginal.outerHeight * factor.from.y,\r
+ outerWidth: childOriginal.outerWidth * factor.from.x\r
+ },\r
+ childTo = {\r
+ height: childOriginal.height * factor.to.y,\r
+ width: childOriginal.width * factor.to.x,\r
+ outerHeight: childOriginal.height * factor.to.y,\r
+ outerWidth: childOriginal.width * factor.to.x\r
+ };\r
+\r
+ // Vertical props scaling\r
+ if ( factor.from.y !== factor.to.y ) {\r
+ childFrom = $.effects.setTransition( child, vProps, factor.from.y, childFrom );\r
+ childTo = $.effects.setTransition( child, vProps, factor.to.y, childTo );\r
+ }\r
+\r
+ // Horizontal props scaling\r
+ if ( factor.from.x !== factor.to.x ) {\r
+ childFrom = $.effects.setTransition( child, hProps, factor.from.x, childFrom );\r
+ childTo = $.effects.setTransition( child, hProps, factor.to.x, childTo );\r
+ }\r
+\r
+ if ( restore ) {\r
+ $.effects.saveStyle( child );\r
+ }\r
+\r
+ // Animate children\r
+ child.css( childFrom );\r
+ child.animate( childTo, options.duration, options.easing, function() {\r
+\r
+ // Restore children\r
+ if ( restore ) {\r
+ $.effects.restoreStyle( child );\r
+ }\r
+ } );\r
+ } );\r
+ }\r
+\r
+ // Animate\r
+ element.animate( to, {\r
+ queue: false,\r
+ duration: options.duration,\r
+ easing: options.easing,\r
+ complete: function() {\r
+\r
+ var offset = element.offset();\r
+\r
+ if ( to.opacity === 0 ) {\r
+ element.css( "opacity", from.opacity );\r
+ }\r
+\r
+ if ( !restore ) {\r
+ element\r
+ .css( "position", position === "static" ? "relative" : position )\r
+ .offset( offset );\r
+\r
+ // Need to save style here so that automatic style restoration\r
+ // doesn't restore to the original styles from before the animation.\r
+ $.effects.saveStyle( element );\r
+ }\r
+\r
+ done();\r
+ }\r
+ } );\r
+\r
+} );\r
+\r
+\r
+/*!\r
+ * jQuery UI Effects Scale 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Scale Effect\r
+//>>group: Effects\r
+//>>description: Grows or shrinks an element and its content.\r
+//>>docs: http://api.jqueryui.com/scale-effect/\r
+//>>demos: http://jqueryui.com/effect/\r
+\r
+\r
+var effectsEffectScale = $.effects.define( "scale", function( options, done ) {\r
+\r
+ // Create element\r
+ var el = $( this ),\r
+ mode = options.mode,\r
+ percent = parseInt( options.percent, 10 ) ||\r
+ ( parseInt( options.percent, 10 ) === 0 ? 0 : ( mode !== "effect" ? 0 : 100 ) ),\r
+\r
+ newOptions = $.extend( true, {\r
+ from: $.effects.scaledDimensions( el ),\r
+ to: $.effects.scaledDimensions( el, percent, options.direction || "both" ),\r
+ origin: options.origin || [ "middle", "center" ]\r
+ }, options );\r
+\r
+ // Fade option to support puff\r
+ if ( options.fade ) {\r
+ newOptions.from.opacity = 1;\r
+ newOptions.to.opacity = 0;\r
+ }\r
+\r
+ $.effects.effect.size.call( this, newOptions, done );\r
+} );\r
+\r
+\r
+/*!\r
+ * jQuery UI Effects Puff 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Puff Effect\r
+//>>group: Effects\r
+//>>description: Creates a puff effect by scaling the element up and hiding it at the same time.\r
+//>>docs: http://api.jqueryui.com/puff-effect/\r
+//>>demos: http://jqueryui.com/effect/\r
+\r
+\r
+var effectsEffectPuff = $.effects.define( "puff", "hide", function( options, done ) {\r
+ var newOptions = $.extend( true, {}, options, {\r
+ fade: true,\r
+ percent: parseInt( options.percent, 10 ) || 150\r
+ } );\r
+\r
+ $.effects.effect.scale.call( this, newOptions, done );\r
+} );\r
+\r
+\r
+/*!\r
+ * jQuery UI Effects Pulsate 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Pulsate Effect\r
+//>>group: Effects\r
+//>>description: Pulsates an element n times by changing the opacity to zero and back.\r
+//>>docs: http://api.jqueryui.com/pulsate-effect/\r
+//>>demos: http://jqueryui.com/effect/\r
+\r
+\r
+var effectsEffectPulsate = $.effects.define( "pulsate", "show", function( options, done ) {\r
+ var element = $( this ),\r
+ mode = options.mode,\r
+ show = mode === "show",\r
+ hide = mode === "hide",\r
+ showhide = show || hide,\r
+\r
+ // Showing or hiding leaves off the "last" animation\r
+ anims = ( ( options.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),\r
+ duration = options.duration / anims,\r
+ animateTo = 0,\r
+ i = 1,\r
+ queuelen = element.queue().length;\r
+\r
+ if ( show || !element.is( ":visible" ) ) {\r
+ element.css( "opacity", 0 ).show();\r
+ animateTo = 1;\r
+ }\r
+\r
+ // Anims - 1 opacity "toggles"\r
+ for ( ; i < anims; i++ ) {\r
+ element.animate( { opacity: animateTo }, duration, options.easing );\r
+ animateTo = 1 - animateTo;\r
+ }\r
+\r
+ element.animate( { opacity: animateTo }, duration, options.easing );\r
+\r
+ element.queue( done );\r
+\r
+ $.effects.unshift( element, queuelen, anims + 1 );\r
+} );\r
+\r
+\r
+/*!\r
+ * jQuery UI Effects Shake 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Shake Effect\r
+//>>group: Effects\r
+//>>description: Shakes an element horizontally or vertically n times.\r
+//>>docs: http://api.jqueryui.com/shake-effect/\r
+//>>demos: http://jqueryui.com/effect/\r
+\r
+\r
+var effectsEffectShake = $.effects.define( "shake", function( options, done ) {\r
+\r
+ var i = 1,\r
+ element = $( this ),\r
+ direction = options.direction || "left",\r
+ distance = options.distance || 20,\r
+ times = options.times || 3,\r
+ anims = times * 2 + 1,\r
+ speed = Math.round( options.duration / anims ),\r
+ ref = ( direction === "up" || direction === "down" ) ? "top" : "left",\r
+ positiveMotion = ( direction === "up" || direction === "left" ),\r
+ animation = {},\r
+ animation1 = {},\r
+ animation2 = {},\r
+\r
+ queuelen = element.queue().length;\r
+\r
+ $.effects.createPlaceholder( element );\r
+\r
+ // Animation\r
+ animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance;\r
+ animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2;\r
+ animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2;\r
+\r
+ // Animate\r
+ element.animate( animation, speed, options.easing );\r
+\r
+ // Shakes\r
+ for ( ; i < times; i++ ) {\r
+ element\r
+ .animate( animation1, speed, options.easing )\r
+ .animate( animation2, speed, options.easing );\r
+ }\r
+\r
+ element\r
+ .animate( animation1, speed, options.easing )\r
+ .animate( animation, speed / 2, options.easing )\r
+ .queue( done );\r
+\r
+ $.effects.unshift( element, queuelen, anims + 1 );\r
+} );\r
+\r
+\r
+/*!\r
+ * jQuery UI Effects Slide 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Slide Effect\r
+//>>group: Effects\r
+//>>description: Slides an element in and out of the viewport.\r
+//>>docs: http://api.jqueryui.com/slide-effect/\r
+//>>demos: http://jqueryui.com/effect/\r
+\r
+\r
+var effectsEffectSlide = $.effects.define( "slide", "show", function( options, done ) {\r
+ var startClip, startRef,\r
+ element = $( this ),\r
+ map = {\r
+ up: [ "bottom", "top" ],\r
+ down: [ "top", "bottom" ],\r
+ left: [ "right", "left" ],\r
+ right: [ "left", "right" ]\r
+ },\r
+ mode = options.mode,\r
+ direction = options.direction || "left",\r
+ ref = ( direction === "up" || direction === "down" ) ? "top" : "left",\r
+ positiveMotion = ( direction === "up" || direction === "left" ),\r
+ distance = options.distance ||\r
+ element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ),\r
+ animation = {};\r
+\r
+ $.effects.createPlaceholder( element );\r
+\r
+ startClip = element.cssClip();\r
+ startRef = element.position()[ ref ];\r
+\r
+ // Define hide animation\r
+ animation[ ref ] = ( positiveMotion ? -1 : 1 ) * distance + startRef;\r
+ animation.clip = element.cssClip();\r
+ animation.clip[ map[ direction ][ 1 ] ] = animation.clip[ map[ direction ][ 0 ] ];\r
+\r
+ // Reverse the animation if we're showing\r
+ if ( mode === "show" ) {\r
+ element.cssClip( animation.clip );\r
+ element.css( ref, animation[ ref ] );\r
+ animation.clip = startClip;\r
+ animation[ ref ] = startRef;\r
+ }\r
+\r
+ // Actually animate\r
+ element.animate( animation, {\r
+ queue: false,\r
+ duration: options.duration,\r
+ easing: options.easing,\r
+ complete: done\r
+ } );\r
+} );\r
+\r
+\r
+/*!\r
+ * jQuery UI Effects Transfer 1.13.1\r
+ * http://jqueryui.com\r
+ *\r
+ * Copyright jQuery Foundation and other contributors\r
+ * Released under the MIT license.\r
+ * http://jquery.org/license\r
+ */\r
+\r
+//>>label: Transfer Effect\r
+//>>group: Effects\r
+//>>description: Displays a transfer effect from one element to another.\r
+//>>docs: http://api.jqueryui.com/transfer-effect/\r
+//>>demos: http://jqueryui.com/effect/\r
+\r
+\r
+var effect;\r
+if ( $.uiBackCompat !== false ) {\r
+ effect = $.effects.define( "transfer", function( options, done ) {\r
+ $( this ).transfer( options, done );\r
+ } );\r
+}\r
+var effectsEffectTransfer = effect;\r
+\r
+\r
+\r
+\r
+} );
\ No newline at end of file