Daniel@0: /*! jQuery UI - v1.11.0 - 2014-06-26 Daniel@0: * http://jqueryui.com Daniel@0: * Includes: core.js, widget.js, mouse.js, position.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, draggable.js, droppable.js, effect.js, effect-blind.js, effect-bounce.js, effect-clip.js, effect-drop.js, effect-explode.js, effect-fade.js, effect-fold.js, effect-highlight.js, effect-puff.js, effect-pulsate.js, effect-scale.js, effect-shake.js, effect-size.js, effect-slide.js, effect-transfer.js, menu.js, progressbar.js, resizable.js, selectable.js, selectmenu.js, slider.js, sortable.js, spinner.js, tabs.js, tooltip.js Daniel@0: * Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */ Daniel@0: Daniel@0: (function( factory ) { Daniel@0: if ( typeof define === "function" && define.amd ) { Daniel@0: Daniel@0: // AMD. Register as an anonymous module. Daniel@0: define([ "jquery" ], factory ); Daniel@0: } else { Daniel@0: Daniel@0: // Browser globals Daniel@0: factory( jQuery ); Daniel@0: } Daniel@0: }(function( $ ) { Daniel@0: /*! Daniel@0: * jQuery UI Core 1.11.0 Daniel@0: * http://jqueryui.com Daniel@0: * Daniel@0: * Copyright 2014 jQuery Foundation and other contributors Daniel@0: * Released under the MIT license. Daniel@0: * http://jquery.org/license Daniel@0: * Daniel@0: * http://api.jqueryui.com/category/ui-core/ Daniel@0: */ Daniel@0: Daniel@0: Daniel@0: // $.ui might exist from components with no dependencies, e.g., $.ui.position Daniel@0: $.ui = $.ui || {}; Daniel@0: Daniel@0: $.extend( $.ui, { Daniel@0: version: "1.11.0", Daniel@0: Daniel@0: keyCode: { Daniel@0: BACKSPACE: 8, Daniel@0: COMMA: 188, Daniel@0: DELETE: 46, Daniel@0: DOWN: 40, Daniel@0: END: 35, Daniel@0: ENTER: 13, Daniel@0: ESCAPE: 27, Daniel@0: HOME: 36, Daniel@0: LEFT: 37, Daniel@0: PAGE_DOWN: 34, Daniel@0: PAGE_UP: 33, Daniel@0: PERIOD: 190, Daniel@0: RIGHT: 39, Daniel@0: SPACE: 32, Daniel@0: TAB: 9, Daniel@0: UP: 38 Daniel@0: } Daniel@0: }); Daniel@0: Daniel@0: // plugins Daniel@0: $.fn.extend({ Daniel@0: scrollParent: function() { Daniel@0: var position = this.css( "position" ), Daniel@0: excludeStaticParent = position === "absolute", Daniel@0: scrollParent = this.parents().filter( function() { Daniel@0: var parent = $( this ); Daniel@0: if ( excludeStaticParent && parent.css( "position" ) === "static" ) { Daniel@0: return false; Daniel@0: } Daniel@0: return (/(auto|scroll)/).test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) ); Daniel@0: }).eq( 0 ); Daniel@0: Daniel@0: return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent; Daniel@0: }, Daniel@0: Daniel@0: uniqueId: (function() { Daniel@0: var uuid = 0; Daniel@0: Daniel@0: return function() { Daniel@0: return this.each(function() { Daniel@0: if ( !this.id ) { Daniel@0: this.id = "ui-id-" + ( ++uuid ); Daniel@0: } Daniel@0: }); Daniel@0: }; Daniel@0: })(), Daniel@0: Daniel@0: removeUniqueId: function() { Daniel@0: return this.each(function() { Daniel@0: if ( /^ui-id-\d+$/.test( this.id ) ) { Daniel@0: $( this ).removeAttr( "id" ); Daniel@0: } Daniel@0: }); Daniel@0: } Daniel@0: }); Daniel@0: Daniel@0: // selectors Daniel@0: function focusable( element, isTabIndexNotNaN ) { Daniel@0: var map, mapName, img, Daniel@0: nodeName = element.nodeName.toLowerCase(); Daniel@0: if ( "area" === nodeName ) { Daniel@0: map = element.parentNode; Daniel@0: mapName = map.name; Daniel@0: if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { Daniel@0: return false; Daniel@0: } Daniel@0: img = $( "img[usemap=#" + mapName + "]" )[0]; Daniel@0: return !!img && visible( img ); Daniel@0: } Daniel@0: return ( /input|select|textarea|button|object/.test( nodeName ) ? Daniel@0: !element.disabled : Daniel@0: "a" === nodeName ? Daniel@0: element.href || isTabIndexNotNaN : Daniel@0: isTabIndexNotNaN) && Daniel@0: // the element and all of its ancestors must be visible Daniel@0: visible( element ); Daniel@0: } Daniel@0: Daniel@0: function visible( element ) { Daniel@0: return $.expr.filters.visible( element ) && Daniel@0: !$( element ).parents().addBack().filter(function() { Daniel@0: return $.css( this, "visibility" ) === "hidden"; Daniel@0: }).length; Daniel@0: } Daniel@0: Daniel@0: $.extend( $.expr[ ":" ], { Daniel@0: data: $.expr.createPseudo ? Daniel@0: $.expr.createPseudo(function( dataName ) { Daniel@0: return function( elem ) { Daniel@0: return !!$.data( elem, dataName ); Daniel@0: }; Daniel@0: }) : Daniel@0: // support: jQuery <1.8 Daniel@0: function( elem, i, match ) { Daniel@0: return !!$.data( elem, match[ 3 ] ); Daniel@0: }, Daniel@0: Daniel@0: focusable: function( element ) { Daniel@0: return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) ); Daniel@0: }, Daniel@0: Daniel@0: tabbable: function( element ) { Daniel@0: var tabIndex = $.attr( element, "tabindex" ), Daniel@0: isTabIndexNaN = isNaN( tabIndex ); Daniel@0: return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN ); Daniel@0: } Daniel@0: }); Daniel@0: Daniel@0: // support: jQuery <1.8 Daniel@0: if ( !$( "" ).outerWidth( 1 ).jquery ) { Daniel@0: $.each( [ "Width", "Height" ], function( i, name ) { Daniel@0: var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], Daniel@0: type = name.toLowerCase(), Daniel@0: orig = { Daniel@0: innerWidth: $.fn.innerWidth, Daniel@0: innerHeight: $.fn.innerHeight, Daniel@0: outerWidth: $.fn.outerWidth, Daniel@0: outerHeight: $.fn.outerHeight Daniel@0: }; Daniel@0: Daniel@0: function reduce( elem, size, border, margin ) { Daniel@0: $.each( side, function() { Daniel@0: size -= parseFloat( $.css( elem, "padding" + this ) ) || 0; Daniel@0: if ( border ) { Daniel@0: size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0; Daniel@0: } Daniel@0: if ( margin ) { Daniel@0: size -= parseFloat( $.css( elem, "margin" + this ) ) || 0; Daniel@0: } Daniel@0: }); Daniel@0: return size; Daniel@0: } Daniel@0: Daniel@0: $.fn[ "inner" + name ] = function( size ) { Daniel@0: if ( size === undefined ) { Daniel@0: return orig[ "inner" + name ].call( this ); Daniel@0: } Daniel@0: Daniel@0: return this.each(function() { Daniel@0: $( this ).css( type, reduce( this, size ) + "px" ); Daniel@0: }); Daniel@0: }; Daniel@0: Daniel@0: $.fn[ "outer" + name] = function( size, margin ) { Daniel@0: if ( typeof size !== "number" ) { Daniel@0: return orig[ "outer" + name ].call( this, size ); Daniel@0: } Daniel@0: Daniel@0: return this.each(function() { Daniel@0: $( this).css( type, reduce( this, size, true, margin ) + "px" ); Daniel@0: }); Daniel@0: }; Daniel@0: }); Daniel@0: } Daniel@0: Daniel@0: // support: jQuery <1.8 Daniel@0: if ( !$.fn.addBack ) { Daniel@0: $.fn.addBack = function( selector ) { Daniel@0: return this.add( selector == null ? Daniel@0: this.prevObject : this.prevObject.filter( selector ) Daniel@0: ); Daniel@0: }; Daniel@0: } Daniel@0: Daniel@0: // support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413) Daniel@0: if ( $( "" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) { Daniel@0: $.fn.removeData = (function( removeData ) { Daniel@0: return function( key ) { Daniel@0: if ( arguments.length ) { Daniel@0: return removeData.call( this, $.camelCase( key ) ); Daniel@0: } else { Daniel@0: return removeData.call( this ); Daniel@0: } Daniel@0: }; Daniel@0: })( $.fn.removeData ); Daniel@0: } Daniel@0: Daniel@0: // deprecated Daniel@0: $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); Daniel@0: Daniel@0: $.fn.extend({ Daniel@0: focus: (function( orig ) { Daniel@0: return function( delay, fn ) { Daniel@0: return typeof delay === "number" ? Daniel@0: this.each(function() { Daniel@0: var elem = this; Daniel@0: setTimeout(function() { Daniel@0: $( elem ).focus(); Daniel@0: if ( fn ) { Daniel@0: fn.call( elem ); Daniel@0: } Daniel@0: }, delay ); Daniel@0: }) : Daniel@0: orig.apply( this, arguments ); Daniel@0: }; Daniel@0: })( $.fn.focus ), Daniel@0: Daniel@0: disableSelection: (function() { Daniel@0: var eventType = "onselectstart" in document.createElement( "div" ) ? Daniel@0: "selectstart" : Daniel@0: "mousedown"; Daniel@0: Daniel@0: return function() { Daniel@0: return this.bind( eventType + ".ui-disableSelection", function( event ) { Daniel@0: event.preventDefault(); Daniel@0: }); Daniel@0: }; Daniel@0: })(), Daniel@0: Daniel@0: enableSelection: function() { Daniel@0: return this.unbind( ".ui-disableSelection" ); Daniel@0: }, Daniel@0: Daniel@0: zIndex: function( zIndex ) { Daniel@0: if ( zIndex !== undefined ) { Daniel@0: return this.css( "zIndex", zIndex ); Daniel@0: } Daniel@0: Daniel@0: if ( this.length ) { Daniel@0: var elem = $( this[ 0 ] ), position, value; Daniel@0: while ( elem.length && elem[ 0 ] !== document ) { Daniel@0: // Ignore z-index if position is set to a value where z-index is ignored by the browser Daniel@0: // This makes behavior of this function consistent across browsers Daniel@0: // WebKit always returns auto if the element is positioned Daniel@0: position = elem.css( "position" ); Daniel@0: if ( position === "absolute" || position === "relative" || position === "fixed" ) { Daniel@0: // IE returns 0 when zIndex is not specified Daniel@0: // other browsers return a string Daniel@0: // we ignore the case of nested elements with an explicit value of 0 Daniel@0: //
Daniel@0: value = parseInt( elem.css( "zIndex" ), 10 ); Daniel@0: if ( !isNaN( value ) && value !== 0 ) { Daniel@0: return value; Daniel@0: } Daniel@0: } Daniel@0: elem = elem.parent(); Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return 0; Daniel@0: } Daniel@0: }); Daniel@0: Daniel@0: // $.ui.plugin is deprecated. Use $.widget() extensions instead. Daniel@0: $.ui.plugin = { Daniel@0: add: function( module, option, set ) { Daniel@0: var i, Daniel@0: proto = $.ui[ module ].prototype; Daniel@0: for ( i in set ) { Daniel@0: proto.plugins[ i ] = proto.plugins[ i ] || []; Daniel@0: proto.plugins[ i ].push( [ option, set[ i ] ] ); Daniel@0: } Daniel@0: }, Daniel@0: call: function( instance, name, args, allowDisconnected ) { Daniel@0: var i, Daniel@0: set = instance.plugins[ name ]; Daniel@0: Daniel@0: if ( !set ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: for ( i = 0; i < set.length; i++ ) { Daniel@0: if ( instance.options[ set[ i ][ 0 ] ] ) { Daniel@0: set[ i ][ 1 ].apply( instance.element, args ); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: }; Daniel@0: Daniel@0: Daniel@0: /*! Daniel@0: * jQuery UI Widget 1.11.0 Daniel@0: * http://jqueryui.com Daniel@0: * Daniel@0: * Copyright 2014 jQuery Foundation and other contributors Daniel@0: * Released under the MIT license. Daniel@0: * http://jquery.org/license Daniel@0: * Daniel@0: * http://api.jqueryui.com/jQuery.widget/ Daniel@0: */ Daniel@0: Daniel@0: Daniel@0: var widget_uuid = 0, Daniel@0: widget_slice = Array.prototype.slice; Daniel@0: Daniel@0: $.cleanData = (function( orig ) { Daniel@0: return function( elems ) { Daniel@0: for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { Daniel@0: try { Daniel@0: $( elem ).triggerHandler( "remove" ); Daniel@0: // http://bugs.jquery.com/ticket/8235 Daniel@0: } catch( e ) {} Daniel@0: } Daniel@0: orig( elems ); Daniel@0: }; Daniel@0: })( $.cleanData ); Daniel@0: Daniel@0: $.widget = function( name, base, prototype ) { Daniel@0: var fullName, existingConstructor, constructor, basePrototype, Daniel@0: // proxiedPrototype allows the provided prototype to remain unmodified Daniel@0: // so that it can be used as a mixin for multiple widgets (#8876) Daniel@0: proxiedPrototype = {}, Daniel@0: namespace = name.split( "." )[ 0 ]; Daniel@0: Daniel@0: name = name.split( "." )[ 1 ]; Daniel@0: fullName = namespace + "-" + name; Daniel@0: Daniel@0: if ( !prototype ) { Daniel@0: prototype = base; Daniel@0: base = $.Widget; Daniel@0: } Daniel@0: Daniel@0: // create selector for plugin Daniel@0: $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { Daniel@0: return !!$.data( elem, fullName ); Daniel@0: }; Daniel@0: Daniel@0: $[ namespace ] = $[ namespace ] || {}; Daniel@0: existingConstructor = $[ namespace ][ name ]; Daniel@0: constructor = $[ namespace ][ name ] = function( options, element ) { Daniel@0: // allow instantiation without "new" keyword Daniel@0: if ( !this._createWidget ) { Daniel@0: return new constructor( options, element ); Daniel@0: } Daniel@0: Daniel@0: // allow instantiation without initializing for simple inheritance Daniel@0: // must use "new" keyword (the code above always passes args) Daniel@0: if ( arguments.length ) { Daniel@0: this._createWidget( options, element ); Daniel@0: } Daniel@0: }; Daniel@0: // extend with the existing constructor to carry over any static properties Daniel@0: $.extend( constructor, existingConstructor, { Daniel@0: version: prototype.version, Daniel@0: // copy the object used to create the prototype in case we need to Daniel@0: // redefine the widget later Daniel@0: _proto: $.extend( {}, prototype ), Daniel@0: // track widgets that inherit from this widget in case this widget is Daniel@0: // redefined after a widget inherits from it Daniel@0: _childConstructors: [] Daniel@0: }); Daniel@0: Daniel@0: basePrototype = new base(); Daniel@0: // we need to make the options hash a property directly on the new instance Daniel@0: // otherwise we'll modify the options hash on the prototype that we're Daniel@0: // inheriting from Daniel@0: basePrototype.options = $.widget.extend( {}, basePrototype.options ); Daniel@0: $.each( prototype, function( prop, value ) { Daniel@0: if ( !$.isFunction( value ) ) { Daniel@0: proxiedPrototype[ prop ] = value; Daniel@0: return; Daniel@0: } Daniel@0: proxiedPrototype[ prop ] = (function() { Daniel@0: var _super = function() { Daniel@0: return base.prototype[ prop ].apply( this, arguments ); Daniel@0: }, Daniel@0: _superApply = function( args ) { Daniel@0: return base.prototype[ prop ].apply( this, args ); Daniel@0: }; Daniel@0: return function() { Daniel@0: var __super = this._super, Daniel@0: __superApply = this._superApply, Daniel@0: returnValue; Daniel@0: Daniel@0: this._super = _super; Daniel@0: this._superApply = _superApply; Daniel@0: Daniel@0: returnValue = value.apply( this, arguments ); Daniel@0: Daniel@0: this._super = __super; Daniel@0: this._superApply = __superApply; Daniel@0: Daniel@0: return returnValue; Daniel@0: }; Daniel@0: })(); Daniel@0: }); Daniel@0: constructor.prototype = $.widget.extend( basePrototype, { Daniel@0: // TODO: remove support for widgetEventPrefix Daniel@0: // always use the name + a colon as the prefix, e.g., draggable:start Daniel@0: // don't prefix for widgets that aren't DOM-based Daniel@0: widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name Daniel@0: }, proxiedPrototype, { Daniel@0: constructor: constructor, Daniel@0: namespace: namespace, Daniel@0: widgetName: name, Daniel@0: widgetFullName: fullName Daniel@0: }); Daniel@0: Daniel@0: // If this widget is being redefined then we need to find all widgets that Daniel@0: // are inheriting from it and redefine all of them so that they inherit from Daniel@0: // the new version of this widget. We're essentially trying to replace one Daniel@0: // level in the prototype chain. Daniel@0: if ( existingConstructor ) { Daniel@0: $.each( existingConstructor._childConstructors, function( i, child ) { Daniel@0: var childPrototype = child.prototype; Daniel@0: Daniel@0: // redefine the child widget using the same prototype that was Daniel@0: // originally used, but inherit from the new version of the base Daniel@0: $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto ); Daniel@0: }); Daniel@0: // remove the list of existing child constructors from the old constructor Daniel@0: // so the old child constructors can be garbage collected Daniel@0: delete existingConstructor._childConstructors; Daniel@0: } else { Daniel@0: base._childConstructors.push( constructor ); Daniel@0: } Daniel@0: Daniel@0: $.widget.bridge( name, constructor ); Daniel@0: Daniel@0: return constructor; Daniel@0: }; Daniel@0: Daniel@0: $.widget.extend = function( target ) { Daniel@0: var input = widget_slice.call( arguments, 1 ), Daniel@0: inputIndex = 0, Daniel@0: inputLength = input.length, Daniel@0: key, Daniel@0: value; Daniel@0: for ( ; inputIndex < inputLength; inputIndex++ ) { Daniel@0: for ( key in input[ inputIndex ] ) { Daniel@0: value = input[ inputIndex ][ key ]; Daniel@0: if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { Daniel@0: // Clone objects Daniel@0: if ( $.isPlainObject( value ) ) { Daniel@0: target[ key ] = $.isPlainObject( target[ key ] ) ? Daniel@0: $.widget.extend( {}, target[ key ], value ) : Daniel@0: // Don't extend strings, arrays, etc. with objects Daniel@0: $.widget.extend( {}, value ); Daniel@0: // Copy everything else by reference Daniel@0: } else { Daniel@0: target[ key ] = value; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: return target; Daniel@0: }; Daniel@0: Daniel@0: $.widget.bridge = function( name, object ) { Daniel@0: var fullName = object.prototype.widgetFullName || name; Daniel@0: $.fn[ name ] = function( options ) { Daniel@0: var isMethodCall = typeof options === "string", Daniel@0: args = widget_slice.call( arguments, 1 ), Daniel@0: returnValue = this; Daniel@0: Daniel@0: // allow multiple hashes to be passed on init Daniel@0: options = !isMethodCall && args.length ? Daniel@0: $.widget.extend.apply( null, [ options ].concat(args) ) : Daniel@0: options; Daniel@0: Daniel@0: if ( isMethodCall ) { Daniel@0: this.each(function() { Daniel@0: var methodValue, Daniel@0: instance = $.data( this, fullName ); Daniel@0: if ( options === "instance" ) { Daniel@0: returnValue = instance; Daniel@0: return false; Daniel@0: } Daniel@0: if ( !instance ) { Daniel@0: return $.error( "cannot call methods on " + name + " prior to initialization; " + Daniel@0: "attempted to call method '" + options + "'" ); Daniel@0: } Daniel@0: if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) { Daniel@0: return $.error( "no such method '" + options + "' for " + name + " widget instance" ); Daniel@0: } Daniel@0: methodValue = instance[ options ].apply( instance, args ); Daniel@0: if ( methodValue !== instance && methodValue !== undefined ) { Daniel@0: returnValue = methodValue && methodValue.jquery ? Daniel@0: returnValue.pushStack( methodValue.get() ) : Daniel@0: methodValue; Daniel@0: return false; Daniel@0: } Daniel@0: }); Daniel@0: } else { Daniel@0: this.each(function() { Daniel@0: var instance = $.data( this, fullName ); Daniel@0: if ( instance ) { Daniel@0: instance.option( options || {} ); Daniel@0: if ( instance._init ) { Daniel@0: instance._init(); Daniel@0: } Daniel@0: } else { Daniel@0: $.data( this, fullName, new object( options, this ) ); Daniel@0: } Daniel@0: }); Daniel@0: } Daniel@0: Daniel@0: return returnValue; Daniel@0: }; Daniel@0: }; Daniel@0: Daniel@0: $.Widget = function( /* options, element */ ) {}; Daniel@0: $.Widget._childConstructors = []; Daniel@0: Daniel@0: $.Widget.prototype = { Daniel@0: widgetName: "widget", Daniel@0: widgetEventPrefix: "", Daniel@0: defaultElement: "
", Daniel@0: options: { Daniel@0: disabled: false, Daniel@0: Daniel@0: // callbacks Daniel@0: create: null Daniel@0: }, Daniel@0: _createWidget: function( options, element ) { Daniel@0: element = $( element || this.defaultElement || this )[ 0 ]; Daniel@0: this.element = $( element ); Daniel@0: this.uuid = widget_uuid++; Daniel@0: this.eventNamespace = "." + this.widgetName + this.uuid; Daniel@0: this.options = $.widget.extend( {}, Daniel@0: this.options, Daniel@0: this._getCreateOptions(), Daniel@0: options ); Daniel@0: Daniel@0: this.bindings = $(); Daniel@0: this.hoverable = $(); Daniel@0: this.focusable = $(); Daniel@0: Daniel@0: if ( element !== this ) { Daniel@0: $.data( element, this.widgetFullName, this ); Daniel@0: this._on( true, this.element, { Daniel@0: remove: function( event ) { Daniel@0: if ( event.target === element ) { Daniel@0: this.destroy(); Daniel@0: } Daniel@0: } Daniel@0: }); Daniel@0: this.document = $( element.style ? Daniel@0: // element within the document Daniel@0: element.ownerDocument : Daniel@0: // element is window or document Daniel@0: element.document || element ); Daniel@0: this.window = $( this.document[0].defaultView || this.document[0].parentWindow ); Daniel@0: } Daniel@0: Daniel@0: this._create(); Daniel@0: this._trigger( "create", null, this._getCreateEventData() ); Daniel@0: this._init(); Daniel@0: }, Daniel@0: _getCreateOptions: $.noop, Daniel@0: _getCreateEventData: $.noop, Daniel@0: _create: $.noop, Daniel@0: _init: $.noop, Daniel@0: Daniel@0: destroy: function() { Daniel@0: this._destroy(); Daniel@0: // we can probably remove the unbind calls in 2.0 Daniel@0: // all event bindings should go through this._on() Daniel@0: this.element Daniel@0: .unbind( this.eventNamespace ) Daniel@0: .removeData( this.widgetFullName ) Daniel@0: // support: jquery <1.6.3 Daniel@0: // http://bugs.jquery.com/ticket/9413 Daniel@0: .removeData( $.camelCase( this.widgetFullName ) ); Daniel@0: this.widget() Daniel@0: .unbind( this.eventNamespace ) Daniel@0: .removeAttr( "aria-disabled" ) Daniel@0: .removeClass( Daniel@0: this.widgetFullName + "-disabled " + Daniel@0: "ui-state-disabled" ); Daniel@0: Daniel@0: // clean up events and states Daniel@0: this.bindings.unbind( this.eventNamespace ); Daniel@0: this.hoverable.removeClass( "ui-state-hover" ); Daniel@0: this.focusable.removeClass( "ui-state-focus" ); Daniel@0: }, Daniel@0: _destroy: $.noop, Daniel@0: Daniel@0: widget: function() { Daniel@0: return this.element; Daniel@0: }, Daniel@0: Daniel@0: option: function( key, value ) { Daniel@0: var options = key, Daniel@0: parts, Daniel@0: curOption, Daniel@0: i; Daniel@0: Daniel@0: if ( arguments.length === 0 ) { Daniel@0: // don't return a reference to the internal hash Daniel@0: return $.widget.extend( {}, this.options ); Daniel@0: } Daniel@0: Daniel@0: if ( typeof key === "string" ) { Daniel@0: // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } Daniel@0: options = {}; Daniel@0: parts = key.split( "." ); Daniel@0: key = parts.shift(); Daniel@0: if ( parts.length ) { Daniel@0: curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); Daniel@0: for ( i = 0; i < parts.length - 1; i++ ) { Daniel@0: curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; Daniel@0: curOption = curOption[ parts[ i ] ]; Daniel@0: } Daniel@0: key = parts.pop(); Daniel@0: if ( arguments.length === 1 ) { Daniel@0: return curOption[ key ] === undefined ? null : curOption[ key ]; Daniel@0: } Daniel@0: curOption[ key ] = value; Daniel@0: } else { Daniel@0: if ( arguments.length === 1 ) { Daniel@0: return this.options[ key ] === undefined ? null : this.options[ key ]; Daniel@0: } Daniel@0: options[ key ] = value; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: this._setOptions( options ); Daniel@0: Daniel@0: return this; Daniel@0: }, Daniel@0: _setOptions: function( options ) { Daniel@0: var key; Daniel@0: Daniel@0: for ( key in options ) { Daniel@0: this._setOption( key, options[ key ] ); Daniel@0: } Daniel@0: Daniel@0: return this; Daniel@0: }, Daniel@0: _setOption: function( key, value ) { Daniel@0: this.options[ key ] = value; Daniel@0: Daniel@0: if ( key === "disabled" ) { Daniel@0: this.widget() Daniel@0: .toggleClass( this.widgetFullName + "-disabled", !!value ); Daniel@0: Daniel@0: // If the widget is becoming disabled, then nothing is interactive Daniel@0: if ( value ) { Daniel@0: this.hoverable.removeClass( "ui-state-hover" ); Daniel@0: this.focusable.removeClass( "ui-state-focus" ); Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return this; Daniel@0: }, Daniel@0: Daniel@0: enable: function() { Daniel@0: return this._setOptions({ disabled: false }); Daniel@0: }, Daniel@0: disable: function() { Daniel@0: return this._setOptions({ disabled: true }); Daniel@0: }, Daniel@0: Daniel@0: _on: function( suppressDisabledCheck, element, handlers ) { Daniel@0: var delegateElement, Daniel@0: instance = this; Daniel@0: Daniel@0: // no suppressDisabledCheck flag, shuffle arguments Daniel@0: if ( typeof suppressDisabledCheck !== "boolean" ) { Daniel@0: handlers = element; Daniel@0: element = suppressDisabledCheck; Daniel@0: suppressDisabledCheck = false; Daniel@0: } Daniel@0: Daniel@0: // no element argument, shuffle and use this.element Daniel@0: if ( !handlers ) { Daniel@0: handlers = element; Daniel@0: element = this.element; Daniel@0: delegateElement = this.widget(); Daniel@0: } else { Daniel@0: element = delegateElement = $( element ); Daniel@0: this.bindings = this.bindings.add( element ); Daniel@0: } Daniel@0: Daniel@0: $.each( handlers, function( event, handler ) { Daniel@0: function handlerProxy() { Daniel@0: // allow widgets to customize the disabled handling Daniel@0: // - disabled as an array instead of boolean Daniel@0: // - disabled class as method for disabling individual parts Daniel@0: if ( !suppressDisabledCheck && Daniel@0: ( instance.options.disabled === true || Daniel@0: $( this ).hasClass( "ui-state-disabled" ) ) ) { Daniel@0: return; Daniel@0: } Daniel@0: return ( typeof handler === "string" ? instance[ handler ] : handler ) Daniel@0: .apply( instance, arguments ); Daniel@0: } Daniel@0: Daniel@0: // copy the guid so direct unbinding works Daniel@0: if ( typeof handler !== "string" ) { Daniel@0: handlerProxy.guid = handler.guid = Daniel@0: handler.guid || handlerProxy.guid || $.guid++; Daniel@0: } Daniel@0: Daniel@0: var match = event.match( /^([\w:-]*)\s*(.*)$/ ), Daniel@0: eventName = match[1] + instance.eventNamespace, Daniel@0: selector = match[2]; Daniel@0: if ( selector ) { Daniel@0: delegateElement.delegate( selector, eventName, handlerProxy ); Daniel@0: } else { Daniel@0: element.bind( eventName, handlerProxy ); Daniel@0: } Daniel@0: }); Daniel@0: }, Daniel@0: Daniel@0: _off: function( element, eventName ) { Daniel@0: eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace; Daniel@0: element.unbind( eventName ).undelegate( eventName ); Daniel@0: }, Daniel@0: Daniel@0: _delay: function( handler, delay ) { Daniel@0: function handlerProxy() { Daniel@0: return ( typeof handler === "string" ? instance[ handler ] : handler ) Daniel@0: .apply( instance, arguments ); Daniel@0: } Daniel@0: var instance = this; Daniel@0: return setTimeout( handlerProxy, delay || 0 ); Daniel@0: }, Daniel@0: Daniel@0: _hoverable: function( element ) { Daniel@0: this.hoverable = this.hoverable.add( element ); Daniel@0: this._on( element, { Daniel@0: mouseenter: function( event ) { Daniel@0: $( event.currentTarget ).addClass( "ui-state-hover" ); Daniel@0: }, Daniel@0: mouseleave: function( event ) { Daniel@0: $( event.currentTarget ).removeClass( "ui-state-hover" ); Daniel@0: } Daniel@0: }); Daniel@0: }, Daniel@0: Daniel@0: _focusable: function( element ) { Daniel@0: this.focusable = this.focusable.add( element ); Daniel@0: this._on( element, { Daniel@0: focusin: function( event ) { Daniel@0: $( event.currentTarget ).addClass( "ui-state-focus" ); Daniel@0: }, Daniel@0: focusout: function( event ) { Daniel@0: $( event.currentTarget ).removeClass( "ui-state-focus" ); Daniel@0: } Daniel@0: }); Daniel@0: }, Daniel@0: Daniel@0: _trigger: function( type, event, data ) { Daniel@0: var prop, orig, Daniel@0: callback = this.options[ type ]; Daniel@0: Daniel@0: data = data || {}; Daniel@0: event = $.Event( event ); Daniel@0: event.type = ( type === this.widgetEventPrefix ? Daniel@0: type : Daniel@0: this.widgetEventPrefix + type ).toLowerCase(); Daniel@0: // the original event may come from any element Daniel@0: // so we need to reset the target on the new event Daniel@0: event.target = this.element[ 0 ]; Daniel@0: Daniel@0: // copy original event properties over to the new event Daniel@0: orig = event.originalEvent; Daniel@0: if ( orig ) { Daniel@0: for ( prop in orig ) { Daniel@0: if ( !( prop in event ) ) { Daniel@0: event[ prop ] = orig[ prop ]; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: this.element.trigger( event, data ); Daniel@0: return !( $.isFunction( callback ) && Daniel@0: callback.apply( this.element[0], [ event ].concat( data ) ) === false || Daniel@0: event.isDefaultPrevented() ); Daniel@0: } Daniel@0: }; Daniel@0: Daniel@0: $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { Daniel@0: $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { Daniel@0: if ( typeof options === "string" ) { Daniel@0: options = { effect: options }; Daniel@0: } Daniel@0: var hasOptions, Daniel@0: effectName = !options ? Daniel@0: method : Daniel@0: options === true || typeof options === "number" ? Daniel@0: defaultEffect : Daniel@0: options.effect || defaultEffect; Daniel@0: options = options || {}; Daniel@0: if ( typeof options === "number" ) { Daniel@0: options = { duration: options }; Daniel@0: } Daniel@0: hasOptions = !$.isEmptyObject( options ); Daniel@0: options.complete = callback; Daniel@0: if ( options.delay ) { Daniel@0: element.delay( options.delay ); Daniel@0: } Daniel@0: if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { Daniel@0: element[ method ]( options ); Daniel@0: } else if ( effectName !== method && element[ effectName ] ) { Daniel@0: element[ effectName ]( options.duration, options.easing, callback ); Daniel@0: } else { Daniel@0: element.queue(function( next ) { Daniel@0: $( this )[ method ](); Daniel@0: if ( callback ) { Daniel@0: callback.call( element[ 0 ] ); Daniel@0: } Daniel@0: next(); Daniel@0: }); Daniel@0: } Daniel@0: }; Daniel@0: }); Daniel@0: Daniel@0: var widget = $.widget; Daniel@0: Daniel@0: Daniel@0: /*! Daniel@0: * jQuery UI Mouse 1.11.0 Daniel@0: * http://jqueryui.com Daniel@0: * Daniel@0: * Copyright 2014 jQuery Foundation and other contributors Daniel@0: * Released under the MIT license. Daniel@0: * http://jquery.org/license Daniel@0: * Daniel@0: * http://api.jqueryui.com/mouse/ Daniel@0: */ Daniel@0: Daniel@0: Daniel@0: var mouseHandled = false; Daniel@0: $( document ).mouseup( function() { Daniel@0: mouseHandled = false; Daniel@0: }); Daniel@0: Daniel@0: var mouse = $.widget("ui.mouse", { Daniel@0: version: "1.11.0", Daniel@0: options: { Daniel@0: cancel: "input,textarea,button,select,option", Daniel@0: distance: 1, Daniel@0: delay: 0 Daniel@0: }, Daniel@0: _mouseInit: function() { Daniel@0: var that = this; Daniel@0: Daniel@0: this.element Daniel@0: .bind("mousedown." + this.widgetName, function(event) { Daniel@0: return that._mouseDown(event); Daniel@0: }) Daniel@0: .bind("click." + this.widgetName, function(event) { Daniel@0: if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) { Daniel@0: $.removeData(event.target, that.widgetName + ".preventClickEvent"); Daniel@0: event.stopImmediatePropagation(); Daniel@0: return false; Daniel@0: } Daniel@0: }); Daniel@0: Daniel@0: this.started = false; Daniel@0: }, Daniel@0: Daniel@0: // TODO: make sure destroying one instance of mouse doesn't mess with Daniel@0: // other instances of mouse Daniel@0: _mouseDestroy: function() { Daniel@0: this.element.unbind("." + this.widgetName); Daniel@0: if ( this._mouseMoveDelegate ) { Daniel@0: this.document Daniel@0: .unbind("mousemove." + this.widgetName, this._mouseMoveDelegate) Daniel@0: .unbind("mouseup." + this.widgetName, this._mouseUpDelegate); Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: _mouseDown: function(event) { Daniel@0: // don't let more than one widget handle mouseStart Daniel@0: if ( mouseHandled ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: // we may have missed mouseup (out of window) Daniel@0: (this._mouseStarted && this._mouseUp(event)); Daniel@0: Daniel@0: this._mouseDownEvent = event; Daniel@0: Daniel@0: var that = this, Daniel@0: btnIsLeft = (event.which === 1), Daniel@0: // event.target.nodeName works around a bug in IE 8 with Daniel@0: // disabled inputs (#7620) Daniel@0: elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false); Daniel@0: if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { Daniel@0: return true; Daniel@0: } Daniel@0: Daniel@0: this.mouseDelayMet = !this.options.delay; Daniel@0: if (!this.mouseDelayMet) { Daniel@0: this._mouseDelayTimer = setTimeout(function() { Daniel@0: that.mouseDelayMet = true; Daniel@0: }, this.options.delay); Daniel@0: } Daniel@0: Daniel@0: if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { Daniel@0: this._mouseStarted = (this._mouseStart(event) !== false); Daniel@0: if (!this._mouseStarted) { Daniel@0: event.preventDefault(); Daniel@0: return true; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Click event may never have fired (Gecko & Opera) Daniel@0: if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) { Daniel@0: $.removeData(event.target, this.widgetName + ".preventClickEvent"); Daniel@0: } Daniel@0: Daniel@0: // these delegates are required to keep context Daniel@0: this._mouseMoveDelegate = function(event) { Daniel@0: return that._mouseMove(event); Daniel@0: }; Daniel@0: this._mouseUpDelegate = function(event) { Daniel@0: return that._mouseUp(event); Daniel@0: }; Daniel@0: Daniel@0: this.document Daniel@0: .bind( "mousemove." + this.widgetName, this._mouseMoveDelegate ) Daniel@0: .bind( "mouseup." + this.widgetName, this._mouseUpDelegate ); Daniel@0: Daniel@0: event.preventDefault(); Daniel@0: Daniel@0: mouseHandled = true; Daniel@0: return true; Daniel@0: }, Daniel@0: Daniel@0: _mouseMove: function(event) { Daniel@0: // IE mouseup check - mouseup happened when mouse was out of window Daniel@0: if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) { Daniel@0: return this._mouseUp(event); Daniel@0: Daniel@0: // Iframe mouseup check - mouseup occurred in another document Daniel@0: } else if ( !event.which ) { Daniel@0: return this._mouseUp( event ); Daniel@0: } Daniel@0: Daniel@0: if (this._mouseStarted) { Daniel@0: this._mouseDrag(event); Daniel@0: return event.preventDefault(); Daniel@0: } Daniel@0: Daniel@0: if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { Daniel@0: this._mouseStarted = Daniel@0: (this._mouseStart(this._mouseDownEvent, event) !== false); Daniel@0: (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)); Daniel@0: } Daniel@0: Daniel@0: return !this._mouseStarted; Daniel@0: }, Daniel@0: Daniel@0: _mouseUp: function(event) { Daniel@0: this.document Daniel@0: .unbind( "mousemove." + this.widgetName, this._mouseMoveDelegate ) Daniel@0: .unbind( "mouseup." + this.widgetName, this._mouseUpDelegate ); Daniel@0: Daniel@0: if (this._mouseStarted) { Daniel@0: this._mouseStarted = false; Daniel@0: Daniel@0: if (event.target === this._mouseDownEvent.target) { Daniel@0: $.data(event.target, this.widgetName + ".preventClickEvent", true); Daniel@0: } Daniel@0: Daniel@0: this._mouseStop(event); Daniel@0: } Daniel@0: Daniel@0: mouseHandled = false; Daniel@0: return false; Daniel@0: }, Daniel@0: Daniel@0: _mouseDistanceMet: function(event) { Daniel@0: return (Math.max( Daniel@0: Math.abs(this._mouseDownEvent.pageX - event.pageX), Daniel@0: Math.abs(this._mouseDownEvent.pageY - event.pageY) Daniel@0: ) >= this.options.distance Daniel@0: ); Daniel@0: }, Daniel@0: Daniel@0: _mouseDelayMet: function(/* event */) { Daniel@0: return this.mouseDelayMet; Daniel@0: }, Daniel@0: Daniel@0: // These are placeholder methods, to be overriden by extending plugin Daniel@0: _mouseStart: function(/* event */) {}, Daniel@0: _mouseDrag: function(/* event */) {}, Daniel@0: _mouseStop: function(/* event */) {}, Daniel@0: _mouseCapture: function(/* event */) { return true; } Daniel@0: }); Daniel@0: Daniel@0: Daniel@0: /*! Daniel@0: * jQuery UI Position 1.11.0 Daniel@0: * http://jqueryui.com Daniel@0: * Daniel@0: * Copyright 2014 jQuery Foundation and other contributors Daniel@0: * Released under the MIT license. Daniel@0: * http://jquery.org/license Daniel@0: * Daniel@0: * http://api.jqueryui.com/position/ Daniel@0: */ Daniel@0: Daniel@0: (function() { Daniel@0: Daniel@0: $.ui = $.ui || {}; Daniel@0: Daniel@0: var cachedScrollbarWidth, supportsOffsetFractions, Daniel@0: max = Math.max, Daniel@0: abs = Math.abs, Daniel@0: round = Math.round, Daniel@0: rhorizontal = /left|center|right/, Daniel@0: rvertical = /top|center|bottom/, Daniel@0: roffset = /[\+\-]\d+(\.[\d]+)?%?/, Daniel@0: rposition = /^\w+/, Daniel@0: rpercent = /%$/, Daniel@0: _position = $.fn.position; Daniel@0: Daniel@0: function getOffsets( offsets, width, height ) { Daniel@0: return [ Daniel@0: parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), Daniel@0: parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) Daniel@0: ]; Daniel@0: } Daniel@0: Daniel@0: function parseCss( element, property ) { Daniel@0: return parseInt( $.css( element, property ), 10 ) || 0; Daniel@0: } Daniel@0: Daniel@0: function getDimensions( elem ) { Daniel@0: var raw = elem[0]; Daniel@0: if ( raw.nodeType === 9 ) { Daniel@0: return { Daniel@0: width: elem.width(), Daniel@0: height: elem.height(), Daniel@0: offset: { top: 0, left: 0 } Daniel@0: }; Daniel@0: } Daniel@0: if ( $.isWindow( raw ) ) { Daniel@0: return { Daniel@0: width: elem.width(), Daniel@0: height: elem.height(), Daniel@0: offset: { top: elem.scrollTop(), left: elem.scrollLeft() } Daniel@0: }; Daniel@0: } Daniel@0: if ( raw.preventDefault ) { Daniel@0: return { Daniel@0: width: 0, Daniel@0: height: 0, Daniel@0: offset: { top: raw.pageY, left: raw.pageX } Daniel@0: }; Daniel@0: } Daniel@0: return { Daniel@0: width: elem.outerWidth(), Daniel@0: height: elem.outerHeight(), Daniel@0: offset: elem.offset() Daniel@0: }; Daniel@0: } Daniel@0: Daniel@0: $.position = { Daniel@0: scrollbarWidth: function() { Daniel@0: if ( cachedScrollbarWidth !== undefined ) { Daniel@0: return cachedScrollbarWidth; Daniel@0: } Daniel@0: var w1, w2, Daniel@0: div = $( "
" ), Daniel@0: innerDiv = div.children()[0]; Daniel@0: Daniel@0: $( "body" ).append( div ); Daniel@0: w1 = innerDiv.offsetWidth; Daniel@0: div.css( "overflow", "scroll" ); Daniel@0: Daniel@0: w2 = innerDiv.offsetWidth; Daniel@0: Daniel@0: if ( w1 === w2 ) { Daniel@0: w2 = div[0].clientWidth; Daniel@0: } Daniel@0: Daniel@0: div.remove(); Daniel@0: Daniel@0: return (cachedScrollbarWidth = w1 - w2); Daniel@0: }, Daniel@0: getScrollInfo: function( within ) { Daniel@0: var overflowX = within.isWindow || within.isDocument ? "" : Daniel@0: within.element.css( "overflow-x" ), Daniel@0: overflowY = within.isWindow || within.isDocument ? "" : Daniel@0: within.element.css( "overflow-y" ), Daniel@0: hasOverflowX = overflowX === "scroll" || Daniel@0: ( overflowX === "auto" && within.width < within.element[0].scrollWidth ), Daniel@0: hasOverflowY = overflowY === "scroll" || Daniel@0: ( overflowY === "auto" && within.height < within.element[0].scrollHeight ); Daniel@0: return { Daniel@0: width: hasOverflowY ? $.position.scrollbarWidth() : 0, Daniel@0: height: hasOverflowX ? $.position.scrollbarWidth() : 0 Daniel@0: }; Daniel@0: }, Daniel@0: getWithinInfo: function( element ) { Daniel@0: var withinElement = $( element || window ), Daniel@0: isWindow = $.isWindow( withinElement[0] ), Daniel@0: isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9; Daniel@0: return { Daniel@0: element: withinElement, Daniel@0: isWindow: isWindow, Daniel@0: isDocument: isDocument, Daniel@0: offset: withinElement.offset() || { left: 0, top: 0 }, Daniel@0: scrollLeft: withinElement.scrollLeft(), Daniel@0: scrollTop: withinElement.scrollTop(), Daniel@0: width: isWindow ? withinElement.width() : withinElement.outerWidth(), Daniel@0: height: isWindow ? withinElement.height() : withinElement.outerHeight() Daniel@0: }; Daniel@0: } Daniel@0: }; Daniel@0: Daniel@0: $.fn.position = function( options ) { Daniel@0: if ( !options || !options.of ) { Daniel@0: return _position.apply( this, arguments ); Daniel@0: } Daniel@0: Daniel@0: // make a copy, we don't want to modify arguments Daniel@0: options = $.extend( {}, options ); Daniel@0: Daniel@0: var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, Daniel@0: target = $( options.of ), Daniel@0: within = $.position.getWithinInfo( options.within ), Daniel@0: scrollInfo = $.position.getScrollInfo( within ), Daniel@0: collision = ( options.collision || "flip" ).split( " " ), Daniel@0: offsets = {}; Daniel@0: Daniel@0: dimensions = getDimensions( target ); Daniel@0: if ( target[0].preventDefault ) { Daniel@0: // force left top to allow flipping Daniel@0: options.at = "left top"; Daniel@0: } Daniel@0: targetWidth = dimensions.width; Daniel@0: targetHeight = dimensions.height; Daniel@0: targetOffset = dimensions.offset; Daniel@0: // clone to reuse original targetOffset later Daniel@0: basePosition = $.extend( {}, targetOffset ); Daniel@0: Daniel@0: // force my and at to have valid horizontal and vertical positions Daniel@0: // if a value is missing or invalid, it will be converted to center Daniel@0: $.each( [ "my", "at" ], function() { Daniel@0: var pos = ( options[ this ] || "" ).split( " " ), Daniel@0: horizontalOffset, Daniel@0: verticalOffset; Daniel@0: Daniel@0: if ( pos.length === 1) { Daniel@0: pos = rhorizontal.test( pos[ 0 ] ) ? Daniel@0: pos.concat( [ "center" ] ) : Daniel@0: rvertical.test( pos[ 0 ] ) ? Daniel@0: [ "center" ].concat( pos ) : Daniel@0: [ "center", "center" ]; Daniel@0: } Daniel@0: pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center"; Daniel@0: pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center"; Daniel@0: Daniel@0: // calculate offsets Daniel@0: horizontalOffset = roffset.exec( pos[ 0 ] ); Daniel@0: verticalOffset = roffset.exec( pos[ 1 ] ); Daniel@0: offsets[ this ] = [ Daniel@0: horizontalOffset ? horizontalOffset[ 0 ] : 0, Daniel@0: verticalOffset ? verticalOffset[ 0 ] : 0 Daniel@0: ]; Daniel@0: Daniel@0: // reduce to just the positions without the offsets Daniel@0: options[ this ] = [ Daniel@0: rposition.exec( pos[ 0 ] )[ 0 ], Daniel@0: rposition.exec( pos[ 1 ] )[ 0 ] Daniel@0: ]; Daniel@0: }); Daniel@0: Daniel@0: // normalize collision option Daniel@0: if ( collision.length === 1 ) { Daniel@0: collision[ 1 ] = collision[ 0 ]; Daniel@0: } Daniel@0: Daniel@0: if ( options.at[ 0 ] === "right" ) { Daniel@0: basePosition.left += targetWidth; Daniel@0: } else if ( options.at[ 0 ] === "center" ) { Daniel@0: basePosition.left += targetWidth / 2; Daniel@0: } Daniel@0: Daniel@0: if ( options.at[ 1 ] === "bottom" ) { Daniel@0: basePosition.top += targetHeight; Daniel@0: } else if ( options.at[ 1 ] === "center" ) { Daniel@0: basePosition.top += targetHeight / 2; Daniel@0: } Daniel@0: Daniel@0: atOffset = getOffsets( offsets.at, targetWidth, targetHeight ); Daniel@0: basePosition.left += atOffset[ 0 ]; Daniel@0: basePosition.top += atOffset[ 1 ]; Daniel@0: Daniel@0: return this.each(function() { Daniel@0: var collisionPosition, using, Daniel@0: elem = $( this ), Daniel@0: elemWidth = elem.outerWidth(), Daniel@0: elemHeight = elem.outerHeight(), Daniel@0: marginLeft = parseCss( this, "marginLeft" ), Daniel@0: marginTop = parseCss( this, "marginTop" ), Daniel@0: collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width, Daniel@0: collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height, Daniel@0: position = $.extend( {}, basePosition ), Daniel@0: myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ); Daniel@0: Daniel@0: if ( options.my[ 0 ] === "right" ) { Daniel@0: position.left -= elemWidth; Daniel@0: } else if ( options.my[ 0 ] === "center" ) { Daniel@0: position.left -= elemWidth / 2; Daniel@0: } Daniel@0: Daniel@0: if ( options.my[ 1 ] === "bottom" ) { Daniel@0: position.top -= elemHeight; Daniel@0: } else if ( options.my[ 1 ] === "center" ) { Daniel@0: position.top -= elemHeight / 2; Daniel@0: } Daniel@0: Daniel@0: position.left += myOffset[ 0 ]; Daniel@0: position.top += myOffset[ 1 ]; Daniel@0: Daniel@0: // if the browser doesn't support fractions, then round for consistent results Daniel@0: if ( !supportsOffsetFractions ) { Daniel@0: position.left = round( position.left ); Daniel@0: position.top = round( position.top ); Daniel@0: } Daniel@0: Daniel@0: collisionPosition = { Daniel@0: marginLeft: marginLeft, Daniel@0: marginTop: marginTop Daniel@0: }; Daniel@0: Daniel@0: $.each( [ "left", "top" ], function( i, dir ) { Daniel@0: if ( $.ui.position[ collision[ i ] ] ) { Daniel@0: $.ui.position[ collision[ i ] ][ dir ]( position, { Daniel@0: targetWidth: targetWidth, Daniel@0: targetHeight: targetHeight, Daniel@0: elemWidth: elemWidth, Daniel@0: elemHeight: elemHeight, Daniel@0: collisionPosition: collisionPosition, Daniel@0: collisionWidth: collisionWidth, Daniel@0: collisionHeight: collisionHeight, Daniel@0: offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ], Daniel@0: my: options.my, Daniel@0: at: options.at, Daniel@0: within: within, Daniel@0: elem: elem Daniel@0: }); Daniel@0: } Daniel@0: }); Daniel@0: Daniel@0: if ( options.using ) { Daniel@0: // adds feedback as second argument to using callback, if present Daniel@0: using = function( props ) { Daniel@0: var left = targetOffset.left - position.left, Daniel@0: right = left + targetWidth - elemWidth, Daniel@0: top = targetOffset.top - position.top, Daniel@0: bottom = top + targetHeight - elemHeight, Daniel@0: feedback = { Daniel@0: target: { Daniel@0: element: target, Daniel@0: left: targetOffset.left, Daniel@0: top: targetOffset.top, Daniel@0: width: targetWidth, Daniel@0: height: targetHeight Daniel@0: }, Daniel@0: element: { Daniel@0: element: elem, Daniel@0: left: position.left, Daniel@0: top: position.top, Daniel@0: width: elemWidth, Daniel@0: height: elemHeight Daniel@0: }, Daniel@0: horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", Daniel@0: vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" Daniel@0: }; Daniel@0: if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) { Daniel@0: feedback.horizontal = "center"; Daniel@0: } Daniel@0: if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) { Daniel@0: feedback.vertical = "middle"; Daniel@0: } Daniel@0: if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) { Daniel@0: feedback.important = "horizontal"; Daniel@0: } else { Daniel@0: feedback.important = "vertical"; Daniel@0: } Daniel@0: options.using.call( this, props, feedback ); Daniel@0: }; Daniel@0: } Daniel@0: Daniel@0: elem.offset( $.extend( position, { using: using } ) ); Daniel@0: }); Daniel@0: }; Daniel@0: Daniel@0: $.ui.position = { Daniel@0: fit: { Daniel@0: left: function( position, data ) { Daniel@0: var within = data.within, Daniel@0: withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, Daniel@0: outerWidth = within.width, Daniel@0: collisionPosLeft = position.left - data.collisionPosition.marginLeft, Daniel@0: overLeft = withinOffset - collisionPosLeft, Daniel@0: overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, Daniel@0: newOverRight; Daniel@0: Daniel@0: // element is wider than within Daniel@0: if ( data.collisionWidth > outerWidth ) { Daniel@0: // element is initially over the left side of within Daniel@0: if ( overLeft > 0 && overRight <= 0 ) { Daniel@0: newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset; Daniel@0: position.left += overLeft - newOverRight; Daniel@0: // element is initially over right side of within Daniel@0: } else if ( overRight > 0 && overLeft <= 0 ) { Daniel@0: position.left = withinOffset; Daniel@0: // element is initially over both left and right sides of within Daniel@0: } else { Daniel@0: if ( overLeft > overRight ) { Daniel@0: position.left = withinOffset + outerWidth - data.collisionWidth; Daniel@0: } else { Daniel@0: position.left = withinOffset; Daniel@0: } Daniel@0: } Daniel@0: // too far left -> align with left edge Daniel@0: } else if ( overLeft > 0 ) { Daniel@0: position.left += overLeft; Daniel@0: // too far right -> align with right edge Daniel@0: } else if ( overRight > 0 ) { Daniel@0: position.left -= overRight; Daniel@0: // adjust based on position and margin Daniel@0: } else { Daniel@0: position.left = max( position.left - collisionPosLeft, position.left ); Daniel@0: } Daniel@0: }, Daniel@0: top: function( position, data ) { Daniel@0: var within = data.within, Daniel@0: withinOffset = within.isWindow ? within.scrollTop : within.offset.top, Daniel@0: outerHeight = data.within.height, Daniel@0: collisionPosTop = position.top - data.collisionPosition.marginTop, Daniel@0: overTop = withinOffset - collisionPosTop, Daniel@0: overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, Daniel@0: newOverBottom; Daniel@0: Daniel@0: // element is taller than within Daniel@0: if ( data.collisionHeight > outerHeight ) { Daniel@0: // element is initially over the top of within Daniel@0: if ( overTop > 0 && overBottom <= 0 ) { Daniel@0: newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset; Daniel@0: position.top += overTop - newOverBottom; Daniel@0: // element is initially over bottom of within Daniel@0: } else if ( overBottom > 0 && overTop <= 0 ) { Daniel@0: position.top = withinOffset; Daniel@0: // element is initially over both top and bottom of within Daniel@0: } else { Daniel@0: if ( overTop > overBottom ) { Daniel@0: position.top = withinOffset + outerHeight - data.collisionHeight; Daniel@0: } else { Daniel@0: position.top = withinOffset; Daniel@0: } Daniel@0: } Daniel@0: // too far up -> align with top Daniel@0: } else if ( overTop > 0 ) { Daniel@0: position.top += overTop; Daniel@0: // too far down -> align with bottom edge Daniel@0: } else if ( overBottom > 0 ) { Daniel@0: position.top -= overBottom; Daniel@0: // adjust based on position and margin Daniel@0: } else { Daniel@0: position.top = max( position.top - collisionPosTop, position.top ); Daniel@0: } Daniel@0: } Daniel@0: }, Daniel@0: flip: { Daniel@0: left: function( position, data ) { Daniel@0: var within = data.within, Daniel@0: withinOffset = within.offset.left + within.scrollLeft, Daniel@0: outerWidth = within.width, Daniel@0: offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, Daniel@0: collisionPosLeft = position.left - data.collisionPosition.marginLeft, Daniel@0: overLeft = collisionPosLeft - offsetLeft, Daniel@0: overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, Daniel@0: myOffset = data.my[ 0 ] === "left" ? Daniel@0: -data.elemWidth : Daniel@0: data.my[ 0 ] === "right" ? Daniel@0: data.elemWidth : Daniel@0: 0, Daniel@0: atOffset = data.at[ 0 ] === "left" ? Daniel@0: data.targetWidth : Daniel@0: data.at[ 0 ] === "right" ? Daniel@0: -data.targetWidth : Daniel@0: 0, Daniel@0: offset = -2 * data.offset[ 0 ], Daniel@0: newOverRight, Daniel@0: newOverLeft; Daniel@0: Daniel@0: if ( overLeft < 0 ) { Daniel@0: newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset; Daniel@0: if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { Daniel@0: position.left += myOffset + atOffset + offset; Daniel@0: } Daniel@0: } else if ( overRight > 0 ) { Daniel@0: newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft; Daniel@0: if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { Daniel@0: position.left += myOffset + atOffset + offset; Daniel@0: } Daniel@0: } Daniel@0: }, Daniel@0: top: function( position, data ) { Daniel@0: var within = data.within, Daniel@0: withinOffset = within.offset.top + within.scrollTop, Daniel@0: outerHeight = within.height, Daniel@0: offsetTop = within.isWindow ? within.scrollTop : within.offset.top, Daniel@0: collisionPosTop = position.top - data.collisionPosition.marginTop, Daniel@0: overTop = collisionPosTop - offsetTop, Daniel@0: overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, Daniel@0: top = data.my[ 1 ] === "top", Daniel@0: myOffset = top ? Daniel@0: -data.elemHeight : Daniel@0: data.my[ 1 ] === "bottom" ? Daniel@0: data.elemHeight : Daniel@0: 0, Daniel@0: atOffset = data.at[ 1 ] === "top" ? Daniel@0: data.targetHeight : Daniel@0: data.at[ 1 ] === "bottom" ? Daniel@0: -data.targetHeight : Daniel@0: 0, Daniel@0: offset = -2 * data.offset[ 1 ], Daniel@0: newOverTop, Daniel@0: newOverBottom; Daniel@0: if ( overTop < 0 ) { Daniel@0: newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset; Daniel@0: if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) { Daniel@0: position.top += myOffset + atOffset + offset; Daniel@0: } Daniel@0: } else if ( overBottom > 0 ) { Daniel@0: newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop; Daniel@0: if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) { Daniel@0: position.top += myOffset + atOffset + offset; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: }, Daniel@0: flipfit: { Daniel@0: left: function() { Daniel@0: $.ui.position.flip.left.apply( this, arguments ); Daniel@0: $.ui.position.fit.left.apply( this, arguments ); Daniel@0: }, Daniel@0: top: function() { Daniel@0: $.ui.position.flip.top.apply( this, arguments ); Daniel@0: $.ui.position.fit.top.apply( this, arguments ); Daniel@0: } Daniel@0: } Daniel@0: }; Daniel@0: Daniel@0: // fraction support test Daniel@0: (function() { Daniel@0: var testElement, testElementParent, testElementStyle, offsetLeft, i, Daniel@0: body = document.getElementsByTagName( "body" )[ 0 ], Daniel@0: div = document.createElement( "div" ); Daniel@0: Daniel@0: //Create a "fake body" for testing based on method used in jQuery.support Daniel@0: testElement = document.createElement( body ? "div" : "body" ); Daniel@0: testElementStyle = { Daniel@0: visibility: "hidden", Daniel@0: width: 0, Daniel@0: height: 0, Daniel@0: border: 0, Daniel@0: margin: 0, Daniel@0: background: "none" Daniel@0: }; Daniel@0: if ( body ) { Daniel@0: $.extend( testElementStyle, { Daniel@0: position: "absolute", Daniel@0: left: "-1000px", Daniel@0: top: "-1000px" Daniel@0: }); Daniel@0: } Daniel@0: for ( i in testElementStyle ) { Daniel@0: testElement.style[ i ] = testElementStyle[ i ]; Daniel@0: } Daniel@0: testElement.appendChild( div ); Daniel@0: testElementParent = body || document.documentElement; Daniel@0: testElementParent.insertBefore( testElement, testElementParent.firstChild ); Daniel@0: Daniel@0: div.style.cssText = "position: absolute; left: 10.7432222px;"; Daniel@0: Daniel@0: offsetLeft = $( div ).offset().left; Daniel@0: supportsOffsetFractions = offsetLeft > 10 && offsetLeft < 11; Daniel@0: Daniel@0: testElement.innerHTML = ""; Daniel@0: testElementParent.removeChild( testElement ); Daniel@0: })(); Daniel@0: Daniel@0: })(); Daniel@0: Daniel@0: var position = $.ui.position; Daniel@0: Daniel@0: Daniel@0: /*! Daniel@0: * jQuery UI Accordion 1.11.0 Daniel@0: * http://jqueryui.com Daniel@0: * Daniel@0: * Copyright 2014 jQuery Foundation and other contributors Daniel@0: * Released under the MIT license. Daniel@0: * http://jquery.org/license Daniel@0: * Daniel@0: * http://api.jqueryui.com/accordion/ Daniel@0: */ Daniel@0: Daniel@0: Daniel@0: var accordion = $.widget( "ui.accordion", { Daniel@0: version: "1.11.0", Daniel@0: options: { Daniel@0: active: 0, Daniel@0: animate: {}, Daniel@0: collapsible: false, Daniel@0: event: "click", Daniel@0: header: "> li > :first-child,> :not(li):even", Daniel@0: heightStyle: "auto", Daniel@0: icons: { Daniel@0: activeHeader: "ui-icon-triangle-1-s", Daniel@0: header: "ui-icon-triangle-1-e" Daniel@0: }, Daniel@0: Daniel@0: // callbacks Daniel@0: activate: null, Daniel@0: beforeActivate: null Daniel@0: }, Daniel@0: Daniel@0: hideProps: { Daniel@0: borderTopWidth: "hide", Daniel@0: borderBottomWidth: "hide", Daniel@0: paddingTop: "hide", Daniel@0: paddingBottom: "hide", Daniel@0: height: "hide" Daniel@0: }, Daniel@0: Daniel@0: showProps: { Daniel@0: borderTopWidth: "show", Daniel@0: borderBottomWidth: "show", Daniel@0: paddingTop: "show", Daniel@0: paddingBottom: "show", Daniel@0: height: "show" Daniel@0: }, Daniel@0: Daniel@0: _create: function() { Daniel@0: var options = this.options; Daniel@0: this.prevShow = this.prevHide = $(); Daniel@0: this.element.addClass( "ui-accordion ui-widget ui-helper-reset" ) Daniel@0: // ARIA Daniel@0: .attr( "role", "tablist" ); Daniel@0: Daniel@0: // don't allow collapsible: false and active: false / null Daniel@0: if ( !options.collapsible && (options.active === false || options.active == null) ) { Daniel@0: options.active = 0; Daniel@0: } Daniel@0: Daniel@0: this._processPanels(); Daniel@0: // handle negative values Daniel@0: if ( options.active < 0 ) { Daniel@0: options.active += this.headers.length; Daniel@0: } Daniel@0: this._refresh(); Daniel@0: }, Daniel@0: Daniel@0: _getCreateEventData: function() { Daniel@0: return { Daniel@0: header: this.active, Daniel@0: panel: !this.active.length ? $() : this.active.next() Daniel@0: }; Daniel@0: }, Daniel@0: Daniel@0: _createIcons: function() { Daniel@0: var icons = this.options.icons; Daniel@0: if ( icons ) { Daniel@0: $( "" ) Daniel@0: .addClass( "ui-accordion-header-icon ui-icon " + icons.header ) Daniel@0: .prependTo( this.headers ); Daniel@0: this.active.children( ".ui-accordion-header-icon" ) Daniel@0: .removeClass( icons.header ) Daniel@0: .addClass( icons.activeHeader ); Daniel@0: this.headers.addClass( "ui-accordion-icons" ); Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: _destroyIcons: function() { Daniel@0: this.headers Daniel@0: .removeClass( "ui-accordion-icons" ) Daniel@0: .children( ".ui-accordion-header-icon" ) Daniel@0: .remove(); Daniel@0: }, Daniel@0: Daniel@0: _destroy: function() { Daniel@0: var contents; Daniel@0: Daniel@0: // clean up main element Daniel@0: this.element Daniel@0: .removeClass( "ui-accordion ui-widget ui-helper-reset" ) Daniel@0: .removeAttr( "role" ); Daniel@0: Daniel@0: // clean up headers Daniel@0: this.headers Daniel@0: .removeClass( "ui-accordion-header ui-accordion-header-active ui-state-default " + Daniel@0: "ui-corner-all ui-state-active ui-state-disabled ui-corner-top" ) Daniel@0: .removeAttr( "role" ) Daniel@0: .removeAttr( "aria-expanded" ) Daniel@0: .removeAttr( "aria-selected" ) Daniel@0: .removeAttr( "aria-controls" ) Daniel@0: .removeAttr( "tabIndex" ) Daniel@0: .removeUniqueId(); Daniel@0: Daniel@0: this._destroyIcons(); Daniel@0: Daniel@0: // clean up content panels Daniel@0: contents = this.headers.next() Daniel@0: .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom " + Daniel@0: "ui-accordion-content ui-accordion-content-active ui-state-disabled" ) Daniel@0: .css( "display", "" ) Daniel@0: .removeAttr( "role" ) Daniel@0: .removeAttr( "aria-hidden" ) Daniel@0: .removeAttr( "aria-labelledby" ) Daniel@0: .removeUniqueId(); Daniel@0: Daniel@0: if ( this.options.heightStyle !== "content" ) { Daniel@0: contents.css( "height", "" ); Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: _setOption: function( key, value ) { Daniel@0: if ( key === "active" ) { Daniel@0: // _activate() will handle invalid values and update this.options Daniel@0: this._activate( value ); Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: if ( key === "event" ) { Daniel@0: if ( this.options.event ) { Daniel@0: this._off( this.headers, this.options.event ); Daniel@0: } Daniel@0: this._setupEvents( value ); Daniel@0: } Daniel@0: Daniel@0: this._super( key, value ); Daniel@0: Daniel@0: // setting collapsible: false while collapsed; open first panel Daniel@0: if ( key === "collapsible" && !value && this.options.active === false ) { Daniel@0: this._activate( 0 ); Daniel@0: } Daniel@0: Daniel@0: if ( key === "icons" ) { Daniel@0: this._destroyIcons(); Daniel@0: if ( value ) { Daniel@0: this._createIcons(); Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // #5332 - opacity doesn't cascade to positioned elements in IE Daniel@0: // so we need to add the disabled class to the headers and panels Daniel@0: if ( key === "disabled" ) { Daniel@0: this.element Daniel@0: .toggleClass( "ui-state-disabled", !!value ) Daniel@0: .attr( "aria-disabled", value ); Daniel@0: this.headers.add( this.headers.next() ) Daniel@0: .toggleClass( "ui-state-disabled", !!value ); Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: _keydown: function( event ) { Daniel@0: if ( event.altKey || event.ctrlKey ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: var keyCode = $.ui.keyCode, Daniel@0: length = this.headers.length, Daniel@0: currentIndex = this.headers.index( event.target ), Daniel@0: toFocus = false; Daniel@0: Daniel@0: switch ( event.keyCode ) { Daniel@0: case keyCode.RIGHT: Daniel@0: case keyCode.DOWN: Daniel@0: toFocus = this.headers[ ( currentIndex + 1 ) % length ]; Daniel@0: break; Daniel@0: case keyCode.LEFT: Daniel@0: case keyCode.UP: Daniel@0: toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; Daniel@0: break; Daniel@0: case keyCode.SPACE: Daniel@0: case keyCode.ENTER: Daniel@0: this._eventHandler( event ); Daniel@0: break; Daniel@0: case keyCode.HOME: Daniel@0: toFocus = this.headers[ 0 ]; Daniel@0: break; Daniel@0: case keyCode.END: Daniel@0: toFocus = this.headers[ length - 1 ]; Daniel@0: break; Daniel@0: } Daniel@0: Daniel@0: if ( toFocus ) { Daniel@0: $( event.target ).attr( "tabIndex", -1 ); Daniel@0: $( toFocus ).attr( "tabIndex", 0 ); Daniel@0: toFocus.focus(); Daniel@0: event.preventDefault(); Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: _panelKeyDown: function( event ) { Daniel@0: if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) { Daniel@0: $( event.currentTarget ).prev().focus(); Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: refresh: function() { Daniel@0: var options = this.options; Daniel@0: this._processPanels(); Daniel@0: Daniel@0: // was collapsed or no panel Daniel@0: if ( ( options.active === false && options.collapsible === true ) || !this.headers.length ) { Daniel@0: options.active = false; Daniel@0: this.active = $(); Daniel@0: // active false only when collapsible is true Daniel@0: } else if ( options.active === false ) { Daniel@0: this._activate( 0 ); Daniel@0: // was active, but active panel is gone Daniel@0: } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { Daniel@0: // all remaining panel are disabled Daniel@0: if ( this.headers.length === this.headers.find(".ui-state-disabled").length ) { Daniel@0: options.active = false; Daniel@0: this.active = $(); Daniel@0: // activate previous panel Daniel@0: } else { Daniel@0: this._activate( Math.max( 0, options.active - 1 ) ); Daniel@0: } Daniel@0: // was active, active panel still exists Daniel@0: } else { Daniel@0: // make sure active index is correct Daniel@0: options.active = this.headers.index( this.active ); Daniel@0: } Daniel@0: Daniel@0: this._destroyIcons(); Daniel@0: Daniel@0: this._refresh(); Daniel@0: }, Daniel@0: Daniel@0: _processPanels: function() { Daniel@0: this.headers = this.element.find( this.options.header ) Daniel@0: .addClass( "ui-accordion-header ui-state-default ui-corner-all" ); Daniel@0: Daniel@0: this.headers.next() Daniel@0: .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" ) Daniel@0: .filter( ":not(.ui-accordion-content-active)" ) Daniel@0: .hide(); Daniel@0: }, Daniel@0: Daniel@0: _refresh: function() { Daniel@0: var maxHeight, Daniel@0: options = this.options, Daniel@0: heightStyle = options.heightStyle, Daniel@0: parent = this.element.parent(); Daniel@0: Daniel@0: this.active = this._findActive( options.active ) Daniel@0: .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" ) Daniel@0: .removeClass( "ui-corner-all" ); Daniel@0: this.active.next() Daniel@0: .addClass( "ui-accordion-content-active" ) Daniel@0: .show(); Daniel@0: Daniel@0: this.headers Daniel@0: .attr( "role", "tab" ) Daniel@0: .each(function() { Daniel@0: var header = $( this ), Daniel@0: headerId = header.uniqueId().attr( "id" ), Daniel@0: panel = header.next(), Daniel@0: panelId = panel.uniqueId().attr( "id" ); Daniel@0: header.attr( "aria-controls", panelId ); Daniel@0: panel.attr( "aria-labelledby", headerId ); Daniel@0: }) Daniel@0: .next() Daniel@0: .attr( "role", "tabpanel" ); Daniel@0: Daniel@0: this.headers Daniel@0: .not( this.active ) Daniel@0: .attr({ Daniel@0: "aria-selected": "false", Daniel@0: "aria-expanded": "false", Daniel@0: tabIndex: -1 Daniel@0: }) Daniel@0: .next() Daniel@0: .attr({ Daniel@0: "aria-hidden": "true" Daniel@0: }) Daniel@0: .hide(); Daniel@0: Daniel@0: // make sure at least one header is in the tab order Daniel@0: if ( !this.active.length ) { Daniel@0: this.headers.eq( 0 ).attr( "tabIndex", 0 ); Daniel@0: } else { Daniel@0: this.active.attr({ Daniel@0: "aria-selected": "true", Daniel@0: "aria-expanded": "true", Daniel@0: tabIndex: 0 Daniel@0: }) Daniel@0: .next() Daniel@0: .attr({ Daniel@0: "aria-hidden": "false" Daniel@0: }); Daniel@0: } Daniel@0: Daniel@0: this._createIcons(); Daniel@0: Daniel@0: this._setupEvents( options.event ); Daniel@0: Daniel@0: if ( heightStyle === "fill" ) { Daniel@0: maxHeight = parent.height(); Daniel@0: this.element.siblings( ":visible" ).each(function() { Daniel@0: var elem = $( this ), Daniel@0: position = elem.css( "position" ); Daniel@0: Daniel@0: if ( position === "absolute" || position === "fixed" ) { Daniel@0: return; Daniel@0: } Daniel@0: maxHeight -= elem.outerHeight( true ); Daniel@0: }); Daniel@0: Daniel@0: this.headers.each(function() { Daniel@0: maxHeight -= $( this ).outerHeight( true ); Daniel@0: }); Daniel@0: Daniel@0: this.headers.next() Daniel@0: .each(function() { Daniel@0: $( this ).height( Math.max( 0, maxHeight - Daniel@0: $( this ).innerHeight() + $( this ).height() ) ); Daniel@0: }) Daniel@0: .css( "overflow", "auto" ); Daniel@0: } else if ( heightStyle === "auto" ) { Daniel@0: maxHeight = 0; Daniel@0: this.headers.next() Daniel@0: .each(function() { Daniel@0: maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() ); Daniel@0: }) Daniel@0: .height( maxHeight ); Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: _activate: function( index ) { Daniel@0: var active = this._findActive( index )[ 0 ]; Daniel@0: Daniel@0: // trying to activate the already active panel Daniel@0: if ( active === this.active[ 0 ] ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: // trying to collapse, simulate a click on the currently active header Daniel@0: active = active || this.active[ 0 ]; Daniel@0: Daniel@0: this._eventHandler({ Daniel@0: target: active, Daniel@0: currentTarget: active, Daniel@0: preventDefault: $.noop Daniel@0: }); Daniel@0: }, Daniel@0: Daniel@0: _findActive: function( selector ) { Daniel@0: return typeof selector === "number" ? this.headers.eq( selector ) : $(); Daniel@0: }, Daniel@0: Daniel@0: _setupEvents: function( event ) { Daniel@0: var events = { Daniel@0: keydown: "_keydown" Daniel@0: }; Daniel@0: if ( event ) { Daniel@0: $.each( event.split( " " ), function( index, eventName ) { Daniel@0: events[ eventName ] = "_eventHandler"; Daniel@0: }); Daniel@0: } Daniel@0: Daniel@0: this._off( this.headers.add( this.headers.next() ) ); Daniel@0: this._on( this.headers, events ); Daniel@0: this._on( this.headers.next(), { keydown: "_panelKeyDown" }); Daniel@0: this._hoverable( this.headers ); Daniel@0: this._focusable( this.headers ); Daniel@0: }, Daniel@0: Daniel@0: _eventHandler: function( event ) { Daniel@0: var options = this.options, Daniel@0: active = this.active, Daniel@0: clicked = $( event.currentTarget ), Daniel@0: clickedIsActive = clicked[ 0 ] === active[ 0 ], Daniel@0: collapsing = clickedIsActive && options.collapsible, Daniel@0: toShow = collapsing ? $() : clicked.next(), Daniel@0: toHide = active.next(), Daniel@0: eventData = { Daniel@0: oldHeader: active, Daniel@0: oldPanel: toHide, Daniel@0: newHeader: collapsing ? $() : clicked, Daniel@0: newPanel: toShow Daniel@0: }; Daniel@0: Daniel@0: event.preventDefault(); Daniel@0: Daniel@0: if ( Daniel@0: // click on active header, but not collapsible Daniel@0: ( clickedIsActive && !options.collapsible ) || Daniel@0: // allow canceling activation Daniel@0: ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: options.active = collapsing ? false : this.headers.index( clicked ); Daniel@0: Daniel@0: // when the call to ._toggle() comes after the class changes Daniel@0: // it causes a very odd bug in IE 8 (see #6720) Daniel@0: this.active = clickedIsActive ? $() : clicked; Daniel@0: this._toggle( eventData ); Daniel@0: Daniel@0: // switch classes Daniel@0: // corner classes on the previously active header stay after the animation Daniel@0: active.removeClass( "ui-accordion-header-active ui-state-active" ); Daniel@0: if ( options.icons ) { Daniel@0: active.children( ".ui-accordion-header-icon" ) Daniel@0: .removeClass( options.icons.activeHeader ) Daniel@0: .addClass( options.icons.header ); Daniel@0: } Daniel@0: Daniel@0: if ( !clickedIsActive ) { Daniel@0: clicked Daniel@0: .removeClass( "ui-corner-all" ) Daniel@0: .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" ); Daniel@0: if ( options.icons ) { Daniel@0: clicked.children( ".ui-accordion-header-icon" ) Daniel@0: .removeClass( options.icons.header ) Daniel@0: .addClass( options.icons.activeHeader ); Daniel@0: } Daniel@0: Daniel@0: clicked Daniel@0: .next() Daniel@0: .addClass( "ui-accordion-content-active" ); Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: _toggle: function( data ) { Daniel@0: var toShow = data.newPanel, Daniel@0: toHide = this.prevShow.length ? this.prevShow : data.oldPanel; Daniel@0: Daniel@0: // handle activating a panel during the animation for another activation Daniel@0: this.prevShow.add( this.prevHide ).stop( true, true ); Daniel@0: this.prevShow = toShow; Daniel@0: this.prevHide = toHide; Daniel@0: Daniel@0: if ( this.options.animate ) { Daniel@0: this._animate( toShow, toHide, data ); Daniel@0: } else { Daniel@0: toHide.hide(); Daniel@0: toShow.show(); Daniel@0: this._toggleComplete( data ); Daniel@0: } Daniel@0: Daniel@0: toHide.attr({ Daniel@0: "aria-hidden": "true" Daniel@0: }); Daniel@0: toHide.prev().attr( "aria-selected", "false" ); Daniel@0: // if we're switching panels, remove the old header from the tab order Daniel@0: // if we're opening from collapsed state, remove the previous header from the tab order Daniel@0: // if we're collapsing, then keep the collapsing header in the tab order Daniel@0: if ( toShow.length && toHide.length ) { Daniel@0: toHide.prev().attr({ Daniel@0: "tabIndex": -1, Daniel@0: "aria-expanded": "false" Daniel@0: }); Daniel@0: } else if ( toShow.length ) { Daniel@0: this.headers.filter(function() { Daniel@0: return $( this ).attr( "tabIndex" ) === 0; Daniel@0: }) Daniel@0: .attr( "tabIndex", -1 ); Daniel@0: } Daniel@0: Daniel@0: toShow Daniel@0: .attr( "aria-hidden", "false" ) Daniel@0: .prev() Daniel@0: .attr({ Daniel@0: "aria-selected": "true", Daniel@0: tabIndex: 0, Daniel@0: "aria-expanded": "true" Daniel@0: }); Daniel@0: }, Daniel@0: Daniel@0: _animate: function( toShow, toHide, data ) { Daniel@0: var total, easing, duration, Daniel@0: that = this, Daniel@0: adjust = 0, Daniel@0: down = toShow.length && Daniel@0: ( !toHide.length || ( toShow.index() < toHide.index() ) ), Daniel@0: animate = this.options.animate || {}, Daniel@0: options = down && animate.down || animate, Daniel@0: complete = function() { Daniel@0: that._toggleComplete( data ); Daniel@0: }; Daniel@0: Daniel@0: if ( typeof options === "number" ) { Daniel@0: duration = options; Daniel@0: } Daniel@0: if ( typeof options === "string" ) { Daniel@0: easing = options; Daniel@0: } Daniel@0: // fall back from options to animation in case of partial down settings Daniel@0: easing = easing || options.easing || animate.easing; Daniel@0: duration = duration || options.duration || animate.duration; Daniel@0: Daniel@0: if ( !toHide.length ) { Daniel@0: return toShow.animate( this.showProps, duration, easing, complete ); Daniel@0: } Daniel@0: if ( !toShow.length ) { Daniel@0: return toHide.animate( this.hideProps, duration, easing, complete ); Daniel@0: } Daniel@0: Daniel@0: total = toShow.show().outerHeight(); Daniel@0: toHide.animate( this.hideProps, { Daniel@0: duration: duration, Daniel@0: easing: easing, Daniel@0: step: function( now, fx ) { Daniel@0: fx.now = Math.round( now ); Daniel@0: } Daniel@0: }); Daniel@0: toShow Daniel@0: .hide() Daniel@0: .animate( this.showProps, { Daniel@0: duration: duration, Daniel@0: easing: easing, Daniel@0: complete: complete, Daniel@0: step: function( now, fx ) { Daniel@0: fx.now = Math.round( now ); Daniel@0: if ( fx.prop !== "height" ) { Daniel@0: adjust += fx.now; Daniel@0: } else if ( that.options.heightStyle !== "content" ) { Daniel@0: fx.now = Math.round( total - toHide.outerHeight() - adjust ); Daniel@0: adjust = 0; Daniel@0: } Daniel@0: } Daniel@0: }); Daniel@0: }, Daniel@0: Daniel@0: _toggleComplete: function( data ) { Daniel@0: var toHide = data.oldPanel; Daniel@0: Daniel@0: toHide Daniel@0: .removeClass( "ui-accordion-content-active" ) Daniel@0: .prev() Daniel@0: .removeClass( "ui-corner-top" ) Daniel@0: .addClass( "ui-corner-all" ); Daniel@0: Daniel@0: // Work around for rendering bug in IE (#5421) Daniel@0: if ( toHide.length ) { Daniel@0: toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className; Daniel@0: } Daniel@0: this._trigger( "activate", null, data ); Daniel@0: } Daniel@0: }); Daniel@0: Daniel@0: Daniel@0: /*! Daniel@0: * jQuery UI Menu 1.11.0 Daniel@0: * http://jqueryui.com Daniel@0: * Daniel@0: * Copyright 2014 jQuery Foundation and other contributors Daniel@0: * Released under the MIT license. Daniel@0: * http://jquery.org/license Daniel@0: * Daniel@0: * http://api.jqueryui.com/menu/ Daniel@0: */ Daniel@0: Daniel@0: Daniel@0: var menu = $.widget( "ui.menu", { Daniel@0: version: "1.11.0", Daniel@0: defaultElement: "