" )
Daniel@0: .css({
Daniel@0: position: "absolute",
Daniel@0: width: iframe.outerWidth(),
Daniel@0: height: iframe.outerHeight()
Daniel@0: })
Daniel@0: .appendTo( iframe.parent() )
Daniel@0: .offset( iframe.offset() )[0];
Daniel@0: });
Daniel@0: },
Daniel@0:
Daniel@0: _unblockFrames: function() {
Daniel@0: if ( this.iframeBlocks ) {
Daniel@0: this.iframeBlocks.remove();
Daniel@0: delete this.iframeBlocks;
Daniel@0: }
Daniel@0: },
Daniel@0:
Daniel@0: _allowInteraction: function( event ) {
Daniel@0: if ( $( event.target ).closest( ".ui-dialog" ).length ) {
Daniel@0: return true;
Daniel@0: }
Daniel@0:
Daniel@0: // TODO: Remove hack when datepicker implements
Daniel@0: // the .ui-front logic (#8989)
Daniel@0: return !!$( event.target ).closest( ".ui-datepicker" ).length;
Daniel@0: },
Daniel@0:
Daniel@0: _createOverlay: function() {
Daniel@0: if ( !this.options.modal ) {
Daniel@0: return;
Daniel@0: }
Daniel@0:
Daniel@0: // We use a delay in case the overlay is created from an
Daniel@0: // event that we're going to be cancelling (#2804)
Daniel@0: var isOpening = true;
Daniel@0: this._delay(function() {
Daniel@0: isOpening = false;
Daniel@0: });
Daniel@0:
Daniel@0: if ( !this.document.data( "ui-dialog-overlays" ) ) {
Daniel@0:
Daniel@0: // Prevent use of anchors and inputs
Daniel@0: // Using _on() for an event handler shared across many instances is
Daniel@0: // safe because the dialogs stack and must be closed in reverse order
Daniel@0: this._on( this.document, {
Daniel@0: focusin: function( event ) {
Daniel@0: if ( isOpening ) {
Daniel@0: return;
Daniel@0: }
Daniel@0:
Daniel@0: if ( !this._allowInteraction( event ) ) {
Daniel@0: event.preventDefault();
Daniel@0: this._trackingInstances()[ 0 ]._focusTabbable();
Daniel@0: }
Daniel@0: }
Daniel@0: });
Daniel@0: }
Daniel@0:
Daniel@0: this.overlay = $( "
" )
Daniel@0: .addClass( "ui-widget-overlay ui-front" )
Daniel@0: .appendTo( this._appendTo() );
Daniel@0: this._on( this.overlay, {
Daniel@0: mousedown: "_keepFocus"
Daniel@0: });
Daniel@0: this.document.data( "ui-dialog-overlays",
Daniel@0: (this.document.data( "ui-dialog-overlays" ) || 0) + 1 );
Daniel@0: },
Daniel@0:
Daniel@0: _destroyOverlay: function() {
Daniel@0: if ( !this.options.modal ) {
Daniel@0: return;
Daniel@0: }
Daniel@0:
Daniel@0: if ( this.overlay ) {
Daniel@0: var overlays = this.document.data( "ui-dialog-overlays" ) - 1;
Daniel@0:
Daniel@0: if ( !overlays ) {
Daniel@0: this.document
Daniel@0: .unbind( "focusin" )
Daniel@0: .removeData( "ui-dialog-overlays" );
Daniel@0: } else {
Daniel@0: this.document.data( "ui-dialog-overlays", overlays );
Daniel@0: }
Daniel@0:
Daniel@0: this.overlay.remove();
Daniel@0: this.overlay = null;
Daniel@0: }
Daniel@0: }
Daniel@0: });
Daniel@0:
Daniel@0:
Daniel@0: /*!
Daniel@0: * jQuery UI Droppable 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/droppable/
Daniel@0: */
Daniel@0:
Daniel@0:
Daniel@0: $.widget( "ui.droppable", {
Daniel@0: version: "1.11.0",
Daniel@0: widgetEventPrefix: "drop",
Daniel@0: options: {
Daniel@0: accept: "*",
Daniel@0: activeClass: false,
Daniel@0: addClasses: true,
Daniel@0: greedy: false,
Daniel@0: hoverClass: false,
Daniel@0: scope: "default",
Daniel@0: tolerance: "intersect",
Daniel@0:
Daniel@0: // callbacks
Daniel@0: activate: null,
Daniel@0: deactivate: null,
Daniel@0: drop: null,
Daniel@0: out: null,
Daniel@0: over: null
Daniel@0: },
Daniel@0: _create: function() {
Daniel@0:
Daniel@0: var proportions,
Daniel@0: o = this.options,
Daniel@0: accept = o.accept;
Daniel@0:
Daniel@0: this.isover = false;
Daniel@0: this.isout = true;
Daniel@0:
Daniel@0: this.accept = $.isFunction( accept ) ? accept : function( d ) {
Daniel@0: return d.is( accept );
Daniel@0: };
Daniel@0:
Daniel@0: this.proportions = function( /* valueToWrite */ ) {
Daniel@0: if ( arguments.length ) {
Daniel@0: // Store the droppable's proportions
Daniel@0: proportions = arguments[ 0 ];
Daniel@0: } else {
Daniel@0: // Retrieve or derive the droppable's proportions
Daniel@0: return proportions ?
Daniel@0: proportions :
Daniel@0: proportions = {
Daniel@0: width: this.element[ 0 ].offsetWidth,
Daniel@0: height: this.element[ 0 ].offsetHeight
Daniel@0: };
Daniel@0: }
Daniel@0: };
Daniel@0:
Daniel@0: this._addToManager( o.scope );
Daniel@0:
Daniel@0: o.addClasses && this.element.addClass( "ui-droppable" );
Daniel@0:
Daniel@0: },
Daniel@0:
Daniel@0: _addToManager: function( scope ) {
Daniel@0: // Add the reference and positions to the manager
Daniel@0: $.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || [];
Daniel@0: $.ui.ddmanager.droppables[ scope ].push( this );
Daniel@0: },
Daniel@0:
Daniel@0: _splice: function( drop ) {
Daniel@0: var i = 0;
Daniel@0: for ( ; i < drop.length; i++ ) {
Daniel@0: if ( drop[ i ] === this ) {
Daniel@0: drop.splice( i, 1 );
Daniel@0: }
Daniel@0: }
Daniel@0: },
Daniel@0:
Daniel@0: _destroy: function() {
Daniel@0: var drop = $.ui.ddmanager.droppables[ this.options.scope ];
Daniel@0:
Daniel@0: this._splice( drop );
Daniel@0:
Daniel@0: this.element.removeClass( "ui-droppable ui-droppable-disabled" );
Daniel@0: },
Daniel@0:
Daniel@0: _setOption: function( key, value ) {
Daniel@0:
Daniel@0: if ( key === "accept" ) {
Daniel@0: this.accept = $.isFunction( value ) ? value : function( d ) {
Daniel@0: return d.is( value );
Daniel@0: };
Daniel@0: } else if ( key === "scope" ) {
Daniel@0: var drop = $.ui.ddmanager.droppables[ this.options.scope ];
Daniel@0:
Daniel@0: this._splice( drop );
Daniel@0: this._addToManager( value );
Daniel@0: }
Daniel@0:
Daniel@0: this._super( key, value );
Daniel@0: },
Daniel@0:
Daniel@0: _activate: function( event ) {
Daniel@0: var draggable = $.ui.ddmanager.current;
Daniel@0: if ( this.options.activeClass ) {
Daniel@0: this.element.addClass( this.options.activeClass );
Daniel@0: }
Daniel@0: if ( draggable ){
Daniel@0: this._trigger( "activate", event, this.ui( draggable ) );
Daniel@0: }
Daniel@0: },
Daniel@0:
Daniel@0: _deactivate: function( event ) {
Daniel@0: var draggable = $.ui.ddmanager.current;
Daniel@0: if ( this.options.activeClass ) {
Daniel@0: this.element.removeClass( this.options.activeClass );
Daniel@0: }
Daniel@0: if ( draggable ){
Daniel@0: this._trigger( "deactivate", event, this.ui( draggable ) );
Daniel@0: }
Daniel@0: },
Daniel@0:
Daniel@0: _over: function( event ) {
Daniel@0:
Daniel@0: var draggable = $.ui.ddmanager.current;
Daniel@0:
Daniel@0: // Bail if draggable and droppable are same element
Daniel@0: if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
Daniel@0: return;
Daniel@0: }
Daniel@0:
Daniel@0: if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
Daniel@0: if ( this.options.hoverClass ) {
Daniel@0: this.element.addClass( this.options.hoverClass );
Daniel@0: }
Daniel@0: this._trigger( "over", event, this.ui( draggable ) );
Daniel@0: }
Daniel@0:
Daniel@0: },
Daniel@0:
Daniel@0: _out: function( event ) {
Daniel@0:
Daniel@0: var draggable = $.ui.ddmanager.current;
Daniel@0:
Daniel@0: // Bail if draggable and droppable are same element
Daniel@0: if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
Daniel@0: return;
Daniel@0: }
Daniel@0:
Daniel@0: if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
Daniel@0: if ( this.options.hoverClass ) {
Daniel@0: this.element.removeClass( this.options.hoverClass );
Daniel@0: }
Daniel@0: this._trigger( "out", event, this.ui( draggable ) );
Daniel@0: }
Daniel@0:
Daniel@0: },
Daniel@0:
Daniel@0: _drop: function( event, custom ) {
Daniel@0:
Daniel@0: var draggable = custom || $.ui.ddmanager.current,
Daniel@0: childrenIntersection = false;
Daniel@0:
Daniel@0: // Bail if draggable and droppable are same element
Daniel@0: if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
Daniel@0: return false;
Daniel@0: }
Daniel@0:
Daniel@0: this.element.find( ":data(ui-droppable)" ).not( ".ui-draggable-dragging" ).each(function() {
Daniel@0: var inst = $( this ).droppable( "instance" );
Daniel@0: if (
Daniel@0: inst.options.greedy &&
Daniel@0: !inst.options.disabled &&
Daniel@0: inst.options.scope === draggable.options.scope &&
Daniel@0: inst.accept.call( inst.element[ 0 ], ( draggable.currentItem || draggable.element ) ) &&
Daniel@0: $.ui.intersect( draggable, $.extend( inst, { offset: inst.element.offset() } ), inst.options.tolerance )
Daniel@0: ) { childrenIntersection = true; return false; }
Daniel@0: });
Daniel@0: if ( childrenIntersection ) {
Daniel@0: return false;
Daniel@0: }
Daniel@0:
Daniel@0: if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
Daniel@0: if ( this.options.activeClass ) {
Daniel@0: this.element.removeClass( this.options.activeClass );
Daniel@0: }
Daniel@0: if ( this.options.hoverClass ) {
Daniel@0: this.element.removeClass( this.options.hoverClass );
Daniel@0: }
Daniel@0: this._trigger( "drop", event, this.ui( draggable ) );
Daniel@0: return this.element;
Daniel@0: }
Daniel@0:
Daniel@0: return false;
Daniel@0:
Daniel@0: },
Daniel@0:
Daniel@0: ui: function( c ) {
Daniel@0: return {
Daniel@0: draggable: ( c.currentItem || c.element ),
Daniel@0: helper: c.helper,
Daniel@0: position: c.position,
Daniel@0: offset: c.positionAbs
Daniel@0: };
Daniel@0: }
Daniel@0:
Daniel@0: });
Daniel@0:
Daniel@0: $.ui.intersect = (function() {
Daniel@0: function isOverAxis( x, reference, size ) {
Daniel@0: return ( x >= reference ) && ( x < ( reference + size ) );
Daniel@0: }
Daniel@0:
Daniel@0: return function( draggable, droppable, toleranceMode ) {
Daniel@0:
Daniel@0: if ( !droppable.offset ) {
Daniel@0: return false;
Daniel@0: }
Daniel@0:
Daniel@0: var draggableLeft, draggableTop,
Daniel@0: x1 = ( draggable.positionAbs || draggable.position.absolute ).left,
Daniel@0: y1 = ( draggable.positionAbs || draggable.position.absolute ).top,
Daniel@0: x2 = x1 + draggable.helperProportions.width,
Daniel@0: y2 = y1 + draggable.helperProportions.height,
Daniel@0: l = droppable.offset.left,
Daniel@0: t = droppable.offset.top,
Daniel@0: r = l + droppable.proportions().width,
Daniel@0: b = t + droppable.proportions().height;
Daniel@0:
Daniel@0: switch ( toleranceMode ) {
Daniel@0: case "fit":
Daniel@0: return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b );
Daniel@0: case "intersect":
Daniel@0: return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half
Daniel@0: x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half
Daniel@0: t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half
Daniel@0: y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half
Daniel@0: case "pointer":
Daniel@0: draggableLeft = ( ( draggable.positionAbs || draggable.position.absolute ).left + ( draggable.clickOffset || draggable.offset.click ).left );
Daniel@0: draggableTop = ( ( draggable.positionAbs || draggable.position.absolute ).top + ( draggable.clickOffset || draggable.offset.click ).top );
Daniel@0: return isOverAxis( draggableTop, t, droppable.proportions().height ) && isOverAxis( draggableLeft, l, droppable.proportions().width );
Daniel@0: case "touch":
Daniel@0: return (
Daniel@0: ( y1 >= t && y1 <= b ) || // Top edge touching
Daniel@0: ( y2 >= t && y2 <= b ) || // Bottom edge touching
Daniel@0: ( y1 < t && y2 > b ) // Surrounded vertically
Daniel@0: ) && (
Daniel@0: ( x1 >= l && x1 <= r ) || // Left edge touching
Daniel@0: ( x2 >= l && x2 <= r ) || // Right edge touching
Daniel@0: ( x1 < l && x2 > r ) // Surrounded horizontally
Daniel@0: );
Daniel@0: default:
Daniel@0: return false;
Daniel@0: }
Daniel@0: };
Daniel@0: })();
Daniel@0:
Daniel@0: /*
Daniel@0: This manager tracks offsets of draggables and droppables
Daniel@0: */
Daniel@0: $.ui.ddmanager = {
Daniel@0: current: null,
Daniel@0: droppables: { "default": [] },
Daniel@0: prepareOffsets: function( t, event ) {
Daniel@0:
Daniel@0: var i, j,
Daniel@0: m = $.ui.ddmanager.droppables[ t.options.scope ] || [],
Daniel@0: type = event ? event.type : null, // workaround for #2317
Daniel@0: list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack();
Daniel@0:
Daniel@0: droppablesLoop: for ( i = 0; i < m.length; i++ ) {
Daniel@0:
Daniel@0: // No disabled and non-accepted
Daniel@0: if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ], ( t.currentItem || t.element ) ) ) ) {
Daniel@0: continue;
Daniel@0: }
Daniel@0:
Daniel@0: // Filter out elements in the current dragged item
Daniel@0: for ( j = 0; j < list.length; j++ ) {
Daniel@0: if ( list[ j ] === m[ i ].element[ 0 ] ) {
Daniel@0: m[ i ].proportions().height = 0;
Daniel@0: continue droppablesLoop;
Daniel@0: }
Daniel@0: }
Daniel@0:
Daniel@0: m[ i ].visible = m[ i ].element.css( "display" ) !== "none";
Daniel@0: if ( !m[ i ].visible ) {
Daniel@0: continue;
Daniel@0: }
Daniel@0:
Daniel@0: // Activate the droppable if used directly from draggables
Daniel@0: if ( type === "mousedown" ) {
Daniel@0: m[ i ]._activate.call( m[ i ], event );
Daniel@0: }
Daniel@0:
Daniel@0: m[ i ].offset = m[ i ].element.offset();
Daniel@0: m[ i ].proportions({ width: m[ i ].element[ 0 ].offsetWidth, height: m[ i ].element[ 0 ].offsetHeight });
Daniel@0:
Daniel@0: }
Daniel@0:
Daniel@0: },
Daniel@0: drop: function( draggable, event ) {
Daniel@0:
Daniel@0: var dropped = false;
Daniel@0: // Create a copy of the droppables in case the list changes during the drop (#9116)
Daniel@0: $.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() {
Daniel@0:
Daniel@0: if ( !this.options ) {
Daniel@0: return;
Daniel@0: }
Daniel@0: if ( !this.options.disabled && this.visible && $.ui.intersect( draggable, this, this.options.tolerance ) ) {
Daniel@0: dropped = this._drop.call( this, event ) || dropped;
Daniel@0: }
Daniel@0:
Daniel@0: if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
Daniel@0: this.isout = true;
Daniel@0: this.isover = false;
Daniel@0: this._deactivate.call( this, event );
Daniel@0: }
Daniel@0:
Daniel@0: });
Daniel@0: return dropped;
Daniel@0:
Daniel@0: },
Daniel@0: dragStart: function( draggable, event ) {
Daniel@0: // Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
Daniel@0: draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() {
Daniel@0: if ( !draggable.options.refreshPositions ) {
Daniel@0: $.ui.ddmanager.prepareOffsets( draggable, event );
Daniel@0: }
Daniel@0: });
Daniel@0: },
Daniel@0: drag: function( draggable, event ) {
Daniel@0:
Daniel@0: // If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
Daniel@0: if ( draggable.options.refreshPositions ) {
Daniel@0: $.ui.ddmanager.prepareOffsets( draggable, event );
Daniel@0: }
Daniel@0:
Daniel@0: // Run through all droppables and check their positions based on specific tolerance options
Daniel@0: $.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() {
Daniel@0:
Daniel@0: if ( this.options.disabled || this.greedyChild || !this.visible ) {
Daniel@0: return;
Daniel@0: }
Daniel@0:
Daniel@0: var parentInstance, scope, parent,
Daniel@0: intersects = $.ui.intersect( draggable, this, this.options.tolerance ),
Daniel@0: c = !intersects && this.isover ? "isout" : ( intersects && !this.isover ? "isover" : null );
Daniel@0: if ( !c ) {
Daniel@0: return;
Daniel@0: }
Daniel@0:
Daniel@0: if ( this.options.greedy ) {
Daniel@0: // find droppable parents with same scope
Daniel@0: scope = this.options.scope;
Daniel@0: parent = this.element.parents( ":data(ui-droppable)" ).filter(function() {
Daniel@0: return $( this ).droppable( "instance" ).options.scope === scope;
Daniel@0: });
Daniel@0:
Daniel@0: if ( parent.length ) {
Daniel@0: parentInstance = $( parent[ 0 ] ).droppable( "instance" );
Daniel@0: parentInstance.greedyChild = ( c === "isover" );
Daniel@0: }
Daniel@0: }
Daniel@0:
Daniel@0: // we just moved into a greedy child
Daniel@0: if ( parentInstance && c === "isover" ) {
Daniel@0: parentInstance.isover = false;
Daniel@0: parentInstance.isout = true;
Daniel@0: parentInstance._out.call( parentInstance, event );
Daniel@0: }
Daniel@0:
Daniel@0: this[ c ] = true;
Daniel@0: this[c === "isout" ? "isover" : "isout"] = false;
Daniel@0: this[c === "isover" ? "_over" : "_out"].call( this, event );
Daniel@0:
Daniel@0: // we just moved out of a greedy child
Daniel@0: if ( parentInstance && c === "isout" ) {
Daniel@0: parentInstance.isout = false;
Daniel@0: parentInstance.isover = true;
Daniel@0: parentInstance._over.call( parentInstance, event );
Daniel@0: }
Daniel@0: });
Daniel@0:
Daniel@0: },
Daniel@0: dragStop: function( draggable, event ) {
Daniel@0: draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" );
Daniel@0: // Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
Daniel@0: if ( !draggable.options.refreshPositions ) {
Daniel@0: $.ui.ddmanager.prepareOffsets( draggable, event );
Daniel@0: }
Daniel@0: }
Daniel@0: };
Daniel@0:
Daniel@0: var droppable = $.ui.droppable;
Daniel@0:
Daniel@0:
Daniel@0: /*!
Daniel@0: * jQuery UI Effects 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/effects-core/
Daniel@0: */
Daniel@0:
Daniel@0:
Daniel@0: var dataSpace = "ui-effects-";
Daniel@0:
Daniel@0: $.effects = {
Daniel@0: effect: {}
Daniel@0: };
Daniel@0:
Daniel@0: /*!
Daniel@0: * jQuery Color Animations v2.1.2
Daniel@0: * https://github.com/jquery/jquery-color
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: * Date: Wed Jan 16 08:47:09 2013 -0600
Daniel@0: */
Daniel@0: (function( jQuery, undefined ) {
Daniel@0:
Daniel@0: var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
Daniel@0:
Daniel@0: // plusequals test for += 100 -= 100
Daniel@0: rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
Daniel@0: // a set of RE's that can match strings and generate color tuples.
Daniel@0: stringParsers = [ {
Daniel@0: re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
Daniel@0: parse: function( execResult ) {
Daniel@0: return [
Daniel@0: execResult[ 1 ],
Daniel@0: execResult[ 2 ],
Daniel@0: execResult[ 3 ],
Daniel@0: execResult[ 4 ]
Daniel@0: ];
Daniel@0: }
Daniel@0: }, {
Daniel@0: re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
Daniel@0: parse: function( execResult ) {
Daniel@0: return [
Daniel@0: execResult[ 1 ] * 2.55,
Daniel@0: execResult[ 2 ] * 2.55,
Daniel@0: execResult[ 3 ] * 2.55,
Daniel@0: execResult[ 4 ]
Daniel@0: ];
Daniel@0: }
Daniel@0: }, {
Daniel@0: // this regex ignores A-F because it's compared against an already lowercased string
Daniel@0: re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
Daniel@0: parse: function( execResult ) {
Daniel@0: return [
Daniel@0: parseInt( execResult[ 1 ], 16 ),
Daniel@0: parseInt( execResult[ 2 ], 16 ),
Daniel@0: parseInt( execResult[ 3 ], 16 )
Daniel@0: ];
Daniel@0: }
Daniel@0: }, {
Daniel@0: // this regex ignores A-F because it's compared against an already lowercased string
Daniel@0: re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
Daniel@0: parse: function( execResult ) {
Daniel@0: return [
Daniel@0: parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
Daniel@0: parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
Daniel@0: parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
Daniel@0: ];
Daniel@0: }
Daniel@0: }, {
Daniel@0: re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
Daniel@0: space: "hsla",
Daniel@0: parse: function( execResult ) {
Daniel@0: return [
Daniel@0: execResult[ 1 ],
Daniel@0: execResult[ 2 ] / 100,
Daniel@0: execResult[ 3 ] / 100,
Daniel@0: execResult[ 4 ]
Daniel@0: ];
Daniel@0: }
Daniel@0: } ],
Daniel@0:
Daniel@0: // jQuery.Color( )
Daniel@0: color = jQuery.Color = function( color, green, blue, alpha ) {
Daniel@0: return new jQuery.Color.fn.parse( color, green, blue, alpha );
Daniel@0: },
Daniel@0: spaces = {
Daniel@0: rgba: {
Daniel@0: props: {
Daniel@0: red: {
Daniel@0: idx: 0,
Daniel@0: type: "byte"
Daniel@0: },
Daniel@0: green: {
Daniel@0: idx: 1,
Daniel@0: type: "byte"
Daniel@0: },
Daniel@0: blue: {
Daniel@0: idx: 2,
Daniel@0: type: "byte"
Daniel@0: }
Daniel@0: }
Daniel@0: },
Daniel@0:
Daniel@0: hsla: {
Daniel@0: props: {
Daniel@0: hue: {
Daniel@0: idx: 0,
Daniel@0: type: "degrees"
Daniel@0: },
Daniel@0: saturation: {
Daniel@0: idx: 1,
Daniel@0: type: "percent"
Daniel@0: },
Daniel@0: lightness: {
Daniel@0: idx: 2,
Daniel@0: type: "percent"
Daniel@0: }
Daniel@0: }
Daniel@0: }
Daniel@0: },
Daniel@0: propTypes = {
Daniel@0: "byte": {
Daniel@0: floor: true,
Daniel@0: max: 255
Daniel@0: },
Daniel@0: "percent": {
Daniel@0: max: 1
Daniel@0: },
Daniel@0: "degrees": {
Daniel@0: mod: 360,
Daniel@0: floor: true
Daniel@0: }
Daniel@0: },
Daniel@0: support = color.support = {},
Daniel@0:
Daniel@0: // element for support tests
Daniel@0: supportElem = jQuery( "
" )[ 0 ],
Daniel@0:
Daniel@0: // colors = jQuery.Color.names
Daniel@0: colors,
Daniel@0:
Daniel@0: // local aliases of functions called often
Daniel@0: each = jQuery.each;
Daniel@0:
Daniel@0: // determine rgba support immediately
Daniel@0: supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
Daniel@0: support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
Daniel@0:
Daniel@0: // define cache name and alpha properties
Daniel@0: // for rgba and hsla spaces
Daniel@0: each( spaces, function( spaceName, space ) {
Daniel@0: space.cache = "_" + spaceName;
Daniel@0: space.props.alpha = {
Daniel@0: idx: 3,
Daniel@0: type: "percent",
Daniel@0: def: 1
Daniel@0: };
Daniel@0: });
Daniel@0:
Daniel@0: function clamp( value, prop, allowEmpty ) {
Daniel@0: var type = propTypes[ prop.type ] || {};
Daniel@0:
Daniel@0: if ( value == null ) {
Daniel@0: return (allowEmpty || !prop.def) ? null : prop.def;
Daniel@0: }
Daniel@0:
Daniel@0: // ~~ is an short way of doing floor for positive numbers
Daniel@0: value = type.floor ? ~~value : parseFloat( value );
Daniel@0:
Daniel@0: // IE will pass in empty strings as value for alpha,
Daniel@0: // which will hit this case
Daniel@0: if ( isNaN( value ) ) {
Daniel@0: return prop.def;
Daniel@0: }
Daniel@0:
Daniel@0: if ( type.mod ) {
Daniel@0: // we add mod before modding to make sure that negatives values
Daniel@0: // get converted properly: -10 -> 350
Daniel@0: return (value + type.mod) % type.mod;
Daniel@0: }
Daniel@0:
Daniel@0: // for now all property types without mod have min and max
Daniel@0: return 0 > value ? 0 : type.max < value ? type.max : value;
Daniel@0: }
Daniel@0:
Daniel@0: function stringParse( string ) {
Daniel@0: var inst = color(),
Daniel@0: rgba = inst._rgba = [];
Daniel@0:
Daniel@0: string = string.toLowerCase();
Daniel@0:
Daniel@0: each( stringParsers, function( i, parser ) {
Daniel@0: var parsed,
Daniel@0: match = parser.re.exec( string ),
Daniel@0: values = match && parser.parse( match ),
Daniel@0: spaceName = parser.space || "rgba";
Daniel@0:
Daniel@0: if ( values ) {
Daniel@0: parsed = inst[ spaceName ]( values );
Daniel@0:
Daniel@0: // if this was an rgba parse the assignment might happen twice
Daniel@0: // oh well....
Daniel@0: inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
Daniel@0: rgba = inst._rgba = parsed._rgba;
Daniel@0:
Daniel@0: // exit each( stringParsers ) here because we matched
Daniel@0: return false;
Daniel@0: }
Daniel@0: });
Daniel@0:
Daniel@0: // Found a stringParser that handled it
Daniel@0: if ( rgba.length ) {
Daniel@0:
Daniel@0: // if this came from a parsed string, force "transparent" when alpha is 0
Daniel@0: // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
Daniel@0: if ( rgba.join() === "0,0,0,0" ) {
Daniel@0: jQuery.extend( rgba, colors.transparent );
Daniel@0: }
Daniel@0: return inst;
Daniel@0: }
Daniel@0:
Daniel@0: // named colors
Daniel@0: return colors[ string ];
Daniel@0: }
Daniel@0:
Daniel@0: color.fn = jQuery.extend( color.prototype, {
Daniel@0: parse: function( red, green, blue, alpha ) {
Daniel@0: if ( red === undefined ) {
Daniel@0: this._rgba = [ null, null, null, null ];
Daniel@0: return this;
Daniel@0: }
Daniel@0: if ( red.jquery || red.nodeType ) {
Daniel@0: red = jQuery( red ).css( green );
Daniel@0: green = undefined;
Daniel@0: }
Daniel@0:
Daniel@0: var inst = this,
Daniel@0: type = jQuery.type( red ),
Daniel@0: rgba = this._rgba = [];
Daniel@0:
Daniel@0: // more than 1 argument specified - assume ( red, green, blue, alpha )
Daniel@0: if ( green !== undefined ) {
Daniel@0: red = [ red, green, blue, alpha ];
Daniel@0: type = "array";
Daniel@0: }
Daniel@0:
Daniel@0: if ( type === "string" ) {
Daniel@0: return this.parse( stringParse( red ) || colors._default );
Daniel@0: }
Daniel@0:
Daniel@0: if ( type === "array" ) {
Daniel@0: each( spaces.rgba.props, function( key, prop ) {
Daniel@0: rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
Daniel@0: });
Daniel@0: return this;
Daniel@0: }
Daniel@0:
Daniel@0: if ( type === "object" ) {
Daniel@0: if ( red instanceof color ) {
Daniel@0: each( spaces, function( spaceName, space ) {
Daniel@0: if ( red[ space.cache ] ) {
Daniel@0: inst[ space.cache ] = red[ space.cache ].slice();
Daniel@0: }
Daniel@0: });
Daniel@0: } else {
Daniel@0: each( spaces, function( spaceName, space ) {
Daniel@0: var cache = space.cache;
Daniel@0: each( space.props, function( key, prop ) {
Daniel@0:
Daniel@0: // if the cache doesn't exist, and we know how to convert
Daniel@0: if ( !inst[ cache ] && space.to ) {
Daniel@0:
Daniel@0: // if the value was null, we don't need to copy it
Daniel@0: // if the key was alpha, we don't need to copy it either
Daniel@0: if ( key === "alpha" || red[ key ] == null ) {
Daniel@0: return;
Daniel@0: }
Daniel@0: inst[ cache ] = space.to( inst._rgba );
Daniel@0: }
Daniel@0:
Daniel@0: // this is the only case where we allow nulls for ALL properties.
Daniel@0: // call clamp with alwaysAllowEmpty
Daniel@0: inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
Daniel@0: });
Daniel@0:
Daniel@0: // everything defined but alpha?
Daniel@0: if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
Daniel@0: // use the default of 1
Daniel@0: inst[ cache ][ 3 ] = 1;
Daniel@0: if ( space.from ) {
Daniel@0: inst._rgba = space.from( inst[ cache ] );
Daniel@0: }
Daniel@0: }
Daniel@0: });
Daniel@0: }
Daniel@0: return this;
Daniel@0: }
Daniel@0: },
Daniel@0: is: function( compare ) {
Daniel@0: var is = color( compare ),
Daniel@0: same = true,
Daniel@0: inst = this;
Daniel@0:
Daniel@0: each( spaces, function( _, space ) {
Daniel@0: var localCache,
Daniel@0: isCache = is[ space.cache ];
Daniel@0: if (isCache) {
Daniel@0: localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
Daniel@0: each( space.props, function( _, prop ) {
Daniel@0: if ( isCache[ prop.idx ] != null ) {
Daniel@0: same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
Daniel@0: return same;
Daniel@0: }
Daniel@0: });
Daniel@0: }
Daniel@0: return same;
Daniel@0: });
Daniel@0: return same;
Daniel@0: },
Daniel@0: _space: function() {
Daniel@0: var used = [],
Daniel@0: inst = this;
Daniel@0: each( spaces, function( spaceName, space ) {
Daniel@0: if ( inst[ space.cache ] ) {
Daniel@0: used.push( spaceName );
Daniel@0: }
Daniel@0: });
Daniel@0: return used.pop();
Daniel@0: },
Daniel@0: transition: function( other, distance ) {
Daniel@0: var end = color( other ),
Daniel@0: spaceName = end._space(),
Daniel@0: space = spaces[ spaceName ],
Daniel@0: startColor = this.alpha() === 0 ? color( "transparent" ) : this,
Daniel@0: start = startColor[ space.cache ] || space.to( startColor._rgba ),
Daniel@0: result = start.slice();
Daniel@0:
Daniel@0: end = end[ space.cache ];
Daniel@0: each( space.props, function( key, prop ) {
Daniel@0: var index = prop.idx,
Daniel@0: startValue = start[ index ],
Daniel@0: endValue = end[ index ],
Daniel@0: type = propTypes[ prop.type ] || {};
Daniel@0:
Daniel@0: // if null, don't override start value
Daniel@0: if ( endValue === null ) {
Daniel@0: return;
Daniel@0: }
Daniel@0: // if null - use end
Daniel@0: if ( startValue === null ) {
Daniel@0: result[ index ] = endValue;
Daniel@0: } else {
Daniel@0: if ( type.mod ) {
Daniel@0: if ( endValue - startValue > type.mod / 2 ) {
Daniel@0: startValue += type.mod;
Daniel@0: } else if ( startValue - endValue > type.mod / 2 ) {
Daniel@0: startValue -= type.mod;
Daniel@0: }
Daniel@0: }
Daniel@0: result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
Daniel@0: }
Daniel@0: });
Daniel@0: return this[ spaceName ]( result );
Daniel@0: },
Daniel@0: blend: function( opaque ) {
Daniel@0: // if we are already opaque - return ourself
Daniel@0: if ( this._rgba[ 3 ] === 1 ) {
Daniel@0: return this;
Daniel@0: }
Daniel@0:
Daniel@0: var rgb = this._rgba.slice(),
Daniel@0: a = rgb.pop(),
Daniel@0: blend = color( opaque )._rgba;
Daniel@0:
Daniel@0: return color( jQuery.map( rgb, function( v, i ) {
Daniel@0: return ( 1 - a ) * blend[ i ] + a * v;
Daniel@0: }));
Daniel@0: },
Daniel@0: toRgbaString: function() {
Daniel@0: var prefix = "rgba(",
Daniel@0: rgba = jQuery.map( this._rgba, function( v, i ) {
Daniel@0: return v == null ? ( i > 2 ? 1 : 0 ) : v;
Daniel@0: });
Daniel@0:
Daniel@0: if ( rgba[ 3 ] === 1 ) {
Daniel@0: rgba.pop();
Daniel@0: prefix = "rgb(";
Daniel@0: }
Daniel@0:
Daniel@0: return prefix + rgba.join() + ")";
Daniel@0: },
Daniel@0: toHslaString: function() {
Daniel@0: var prefix = "hsla(",
Daniel@0: hsla = jQuery.map( this.hsla(), function( v, i ) {
Daniel@0: if ( v == null ) {
Daniel@0: v = i > 2 ? 1 : 0;
Daniel@0: }
Daniel@0:
Daniel@0: // catch 1 and 2
Daniel@0: if ( i && i < 3 ) {
Daniel@0: v = Math.round( v * 100 ) + "%";
Daniel@0: }
Daniel@0: return v;
Daniel@0: });
Daniel@0:
Daniel@0: if ( hsla[ 3 ] === 1 ) {
Daniel@0: hsla.pop();
Daniel@0: prefix = "hsl(";
Daniel@0: }
Daniel@0: return prefix + hsla.join() + ")";
Daniel@0: },
Daniel@0: toHexString: function( includeAlpha ) {
Daniel@0: var rgba = this._rgba.slice(),
Daniel@0: alpha = rgba.pop();
Daniel@0:
Daniel@0: if ( includeAlpha ) {
Daniel@0: rgba.push( ~~( alpha * 255 ) );
Daniel@0: }
Daniel@0:
Daniel@0: return "#" + jQuery.map( rgba, function( v ) {
Daniel@0:
Daniel@0: // default to 0 when nulls exist
Daniel@0: v = ( v || 0 ).toString( 16 );
Daniel@0: return v.length === 1 ? "0" + v : v;
Daniel@0: }).join("");
Daniel@0: },
Daniel@0: toString: function() {
Daniel@0: return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
Daniel@0: }
Daniel@0: });
Daniel@0: color.fn.parse.prototype = color.fn;
Daniel@0:
Daniel@0: // hsla conversions adapted from:
Daniel@0: // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
Daniel@0:
Daniel@0: function hue2rgb( p, q, h ) {
Daniel@0: h = ( h + 1 ) % 1;
Daniel@0: if ( h * 6 < 1 ) {
Daniel@0: return p + ( q - p ) * h * 6;
Daniel@0: }
Daniel@0: if ( h * 2 < 1) {
Daniel@0: return q;
Daniel@0: }
Daniel@0: if ( h * 3 < 2 ) {
Daniel@0: return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6;
Daniel@0: }
Daniel@0: return p;
Daniel@0: }
Daniel@0:
Daniel@0: spaces.hsla.to = function( rgba ) {
Daniel@0: if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
Daniel@0: return [ null, null, null, rgba[ 3 ] ];
Daniel@0: }
Daniel@0: var r = rgba[ 0 ] / 255,
Daniel@0: g = rgba[ 1 ] / 255,
Daniel@0: b = rgba[ 2 ] / 255,
Daniel@0: a = rgba[ 3 ],
Daniel@0: max = Math.max( r, g, b ),
Daniel@0: min = Math.min( r, g, b ),
Daniel@0: diff = max - min,
Daniel@0: add = max + min,
Daniel@0: l = add * 0.5,
Daniel@0: h, s;
Daniel@0:
Daniel@0: if ( min === max ) {
Daniel@0: h = 0;
Daniel@0: } else if ( r === max ) {
Daniel@0: h = ( 60 * ( g - b ) / diff ) + 360;
Daniel@0: } else if ( g === max ) {
Daniel@0: h = ( 60 * ( b - r ) / diff ) + 120;
Daniel@0: } else {
Daniel@0: h = ( 60 * ( r - g ) / diff ) + 240;
Daniel@0: }
Daniel@0:
Daniel@0: // chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
Daniel@0: // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
Daniel@0: if ( diff === 0 ) {
Daniel@0: s = 0;
Daniel@0: } else if ( l <= 0.5 ) {
Daniel@0: s = diff / add;
Daniel@0: } else {
Daniel@0: s = diff / ( 2 - add );
Daniel@0: }
Daniel@0: return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
Daniel@0: };
Daniel@0:
Daniel@0: spaces.hsla.from = function( hsla ) {
Daniel@0: if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
Daniel@0: return [ null, null, null, hsla[ 3 ] ];
Daniel@0: }
Daniel@0: var h = hsla[ 0 ] / 360,
Daniel@0: s = hsla[ 1 ],
Daniel@0: l = hsla[ 2 ],
Daniel@0: a = hsla[ 3 ],
Daniel@0: q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
Daniel@0: p = 2 * l - q;
Daniel@0:
Daniel@0: return [
Daniel@0: Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
Daniel@0: Math.round( hue2rgb( p, q, h ) * 255 ),
Daniel@0: Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
Daniel@0: a
Daniel@0: ];
Daniel@0: };
Daniel@0:
Daniel@0: each( spaces, function( spaceName, space ) {
Daniel@0: var props = space.props,
Daniel@0: cache = space.cache,
Daniel@0: to = space.to,
Daniel@0: from = space.from;
Daniel@0:
Daniel@0: // makes rgba() and hsla()
Daniel@0: color.fn[ spaceName ] = function( value ) {
Daniel@0:
Daniel@0: // generate a cache for this space if it doesn't exist
Daniel@0: if ( to && !this[ cache ] ) {
Daniel@0: this[ cache ] = to( this._rgba );
Daniel@0: }
Daniel@0: if ( value === undefined ) {
Daniel@0: return this[ cache ].slice();
Daniel@0: }
Daniel@0:
Daniel@0: var ret,
Daniel@0: type = jQuery.type( value ),
Daniel@0: arr = ( type === "array" || type === "object" ) ? value : arguments,
Daniel@0: local = this[ cache ].slice();
Daniel@0:
Daniel@0: each( props, function( key, prop ) {
Daniel@0: var val = arr[ type === "object" ? key : prop.idx ];
Daniel@0: if ( val == null ) {
Daniel@0: val = local[ prop.idx ];
Daniel@0: }
Daniel@0: local[ prop.idx ] = clamp( val, prop );
Daniel@0: });
Daniel@0:
Daniel@0: if ( from ) {
Daniel@0: ret = color( from( local ) );
Daniel@0: ret[ cache ] = local;
Daniel@0: return ret;
Daniel@0: } else {
Daniel@0: return color( local );
Daniel@0: }
Daniel@0: };
Daniel@0:
Daniel@0: // makes red() green() blue() alpha() hue() saturation() lightness()
Daniel@0: each( props, function( key, prop ) {
Daniel@0: // alpha is included in more than one space
Daniel@0: if ( color.fn[ key ] ) {
Daniel@0: return;
Daniel@0: }
Daniel@0: color.fn[ key ] = function( value ) {
Daniel@0: var vtype = jQuery.type( value ),
Daniel@0: fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
Daniel@0: local = this[ fn ](),
Daniel@0: cur = local[ prop.idx ],
Daniel@0: match;
Daniel@0:
Daniel@0: if ( vtype === "undefined" ) {
Daniel@0: return cur;
Daniel@0: }
Daniel@0:
Daniel@0: if ( vtype === "function" ) {
Daniel@0: value = value.call( this, cur );
Daniel@0: vtype = jQuery.type( value );
Daniel@0: }
Daniel@0: if ( value == null && prop.empty ) {
Daniel@0: return this;
Daniel@0: }
Daniel@0: if ( vtype === "string" ) {
Daniel@0: match = rplusequals.exec( value );
Daniel@0: if ( match ) {
Daniel@0: value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
Daniel@0: }
Daniel@0: }
Daniel@0: local[ prop.idx ] = value;
Daniel@0: return this[ fn ]( local );
Daniel@0: };
Daniel@0: });
Daniel@0: });
Daniel@0:
Daniel@0: // add cssHook and .fx.step function for each named hook.
Daniel@0: // accept a space separated string of properties
Daniel@0: color.hook = function( hook ) {
Daniel@0: var hooks = hook.split( " " );
Daniel@0: each( hooks, function( i, hook ) {
Daniel@0: jQuery.cssHooks[ hook ] = {
Daniel@0: set: function( elem, value ) {
Daniel@0: var parsed, curElem,
Daniel@0: backgroundColor = "";
Daniel@0:
Daniel@0: if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {
Daniel@0: value = color( parsed || value );
Daniel@0: if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
Daniel@0: curElem = hook === "backgroundColor" ? elem.parentNode : elem;
Daniel@0: while (
Daniel@0: (backgroundColor === "" || backgroundColor === "transparent") &&
Daniel@0: curElem && curElem.style
Daniel@0: ) {
Daniel@0: try {
Daniel@0: backgroundColor = jQuery.css( curElem, "backgroundColor" );
Daniel@0: curElem = curElem.parentNode;
Daniel@0: } catch ( e ) {
Daniel@0: }
Daniel@0: }
Daniel@0:
Daniel@0: value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
Daniel@0: backgroundColor :
Daniel@0: "_default" );
Daniel@0: }
Daniel@0:
Daniel@0: value = value.toRgbaString();
Daniel@0: }
Daniel@0: try {
Daniel@0: elem.style[ hook ] = value;
Daniel@0: } catch( e ) {
Daniel@0: // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
Daniel@0: }
Daniel@0: }
Daniel@0: };
Daniel@0: jQuery.fx.step[ hook ] = function( fx ) {
Daniel@0: if ( !fx.colorInit ) {
Daniel@0: fx.start = color( fx.elem, hook );
Daniel@0: fx.end = color( fx.end );
Daniel@0: fx.colorInit = true;
Daniel@0: }
Daniel@0: jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
Daniel@0: };
Daniel@0: });
Daniel@0:
Daniel@0: };
Daniel@0:
Daniel@0: color.hook( stepHooks );
Daniel@0:
Daniel@0: jQuery.cssHooks.borderColor = {
Daniel@0: expand: function( value ) {
Daniel@0: var expanded = {};
Daniel@0:
Daniel@0: each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
Daniel@0: expanded[ "border" + part + "Color" ] = value;
Daniel@0: });
Daniel@0: return expanded;
Daniel@0: }
Daniel@0: };
Daniel@0:
Daniel@0: // Basic color names only.
Daniel@0: // Usage of any of the other color names requires adding yourself or including
Daniel@0: // jquery.color.svg-names.js.
Daniel@0: colors = jQuery.Color.names = {
Daniel@0: // 4.1. Basic color keywords
Daniel@0: aqua: "#00ffff",
Daniel@0: black: "#000000",
Daniel@0: blue: "#0000ff",
Daniel@0: fuchsia: "#ff00ff",
Daniel@0: gray: "#808080",
Daniel@0: green: "#008000",
Daniel@0: lime: "#00ff00",
Daniel@0: maroon: "#800000",
Daniel@0: navy: "#000080",
Daniel@0: olive: "#808000",
Daniel@0: purple: "#800080",
Daniel@0: red: "#ff0000",
Daniel@0: silver: "#c0c0c0",
Daniel@0: teal: "#008080",
Daniel@0: white: "#ffffff",
Daniel@0: yellow: "#ffff00",
Daniel@0:
Daniel@0: // 4.2.3. "transparent" color keyword
Daniel@0: transparent: [ null, null, null, 0 ],
Daniel@0:
Daniel@0: _default: "#ffffff"
Daniel@0: };
Daniel@0:
Daniel@0: })( jQuery );
Daniel@0:
Daniel@0: /******************************************************************************/
Daniel@0: /****************************** CLASS ANIMATIONS ******************************/
Daniel@0: /******************************************************************************/
Daniel@0: (function() {
Daniel@0:
Daniel@0: var classAnimationActions = [ "add", "remove", "toggle" ],
Daniel@0: shorthandStyles = {
Daniel@0: border: 1,
Daniel@0: borderBottom: 1,
Daniel@0: borderColor: 1,
Daniel@0: borderLeft: 1,
Daniel@0: borderRight: 1,
Daniel@0: borderTop: 1,
Daniel@0: borderWidth: 1,
Daniel@0: margin: 1,
Daniel@0: padding: 1
Daniel@0: };
Daniel@0:
Daniel@0: $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) {
Daniel@0: $.fx.step[ prop ] = function( fx ) {
Daniel@0: if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
Daniel@0: jQuery.style( fx.elem, prop, fx.end );
Daniel@0: fx.setAttr = true;
Daniel@0: }
Daniel@0: };
Daniel@0: });
Daniel@0:
Daniel@0: function getElementStyles( elem ) {
Daniel@0: var key, len,
Daniel@0: style = elem.ownerDocument.defaultView ?
Daniel@0: elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
Daniel@0: elem.currentStyle,
Daniel@0: styles = {};
Daniel@0:
Daniel@0: if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
Daniel@0: len = style.length;
Daniel@0: while ( len-- ) {
Daniel@0: key = style[ len ];
Daniel@0: if ( typeof style[ key ] === "string" ) {
Daniel@0: styles[ $.camelCase( key ) ] = style[ key ];
Daniel@0: }
Daniel@0: }
Daniel@0: // support: Opera, IE <9
Daniel@0: } else {
Daniel@0: for ( key in style ) {
Daniel@0: if ( typeof style[ key ] === "string" ) {
Daniel@0: styles[ key ] = style[ key ];
Daniel@0: }
Daniel@0: }
Daniel@0: }
Daniel@0:
Daniel@0: return styles;
Daniel@0: }
Daniel@0:
Daniel@0: function styleDifference( oldStyle, newStyle ) {
Daniel@0: var diff = {},
Daniel@0: name, value;
Daniel@0:
Daniel@0: for ( name in newStyle ) {
Daniel@0: value = newStyle[ name ];
Daniel@0: if ( oldStyle[ name ] !== value ) {
Daniel@0: if ( !shorthandStyles[ name ] ) {
Daniel@0: if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
Daniel@0: diff[ name ] = value;
Daniel@0: }
Daniel@0: }
Daniel@0: }
Daniel@0: }
Daniel@0:
Daniel@0: return diff;
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: $.effects.animateClass = function( value, duration, easing, callback ) {
Daniel@0: var o = $.speed( duration, easing, callback );
Daniel@0:
Daniel@0: return this.queue( function() {
Daniel@0: var animated = $( this ),
Daniel@0: baseClass = animated.attr( "class" ) || "",
Daniel@0: applyClassChange,
Daniel@0: allAnimations = o.children ? animated.find( "*" ).addBack() : animated;
Daniel@0:
Daniel@0: // map the animated objects to store the original styles.
Daniel@0: allAnimations = allAnimations.map(function() {
Daniel@0: var el = $( this );
Daniel@0: return {
Daniel@0: el: el,
Daniel@0: start: getElementStyles( this )
Daniel@0: };
Daniel@0: });
Daniel@0:
Daniel@0: // apply class change
Daniel@0: applyClassChange = function() {
Daniel@0: $.each( classAnimationActions, function(i, action) {
Daniel@0: if ( value[ action ] ) {
Daniel@0: animated[ action + "Class" ]( value[ action ] );
Daniel@0: }
Daniel@0: });
Daniel@0: };
Daniel@0: applyClassChange();
Daniel@0:
Daniel@0: // map all animated objects again - calculate new styles and diff
Daniel@0: allAnimations = allAnimations.map(function() {
Daniel@0: this.end = getElementStyles( this.el[ 0 ] );
Daniel@0: this.diff = styleDifference( this.start, this.end );
Daniel@0: return this;
Daniel@0: });
Daniel@0:
Daniel@0: // apply original class
Daniel@0: animated.attr( "class", baseClass );
Daniel@0:
Daniel@0: // map all animated objects again - this time collecting a promise
Daniel@0: allAnimations = allAnimations.map(function() {
Daniel@0: var styleInfo = this,
Daniel@0: dfd = $.Deferred(),
Daniel@0: opts = $.extend({}, o, {
Daniel@0: queue: false,
Daniel@0: complete: function() {
Daniel@0: dfd.resolve( styleInfo );
Daniel@0: }
Daniel@0: });
Daniel@0:
Daniel@0: this.el.animate( this.diff, opts );
Daniel@0: return dfd.promise();
Daniel@0: });
Daniel@0:
Daniel@0: // once all animations have completed:
Daniel@0: $.when.apply( $, allAnimations.get() ).done(function() {
Daniel@0:
Daniel@0: // set the final class
Daniel@0: applyClassChange();
Daniel@0:
Daniel@0: // for each animated element,
Daniel@0: // clear all css properties that were animated
Daniel@0: $.each( arguments, function() {
Daniel@0: var el = this.el;
Daniel@0: $.each( this.diff, function(key) {
Daniel@0: el.css( key, "" );
Daniel@0: });
Daniel@0: });
Daniel@0:
Daniel@0: // this is guarnteed to be there if you use jQuery.speed()
Daniel@0: // it also handles dequeuing the next anim...
Daniel@0: o.complete.call( animated[ 0 ] );
Daniel@0: });
Daniel@0: });
Daniel@0: };
Daniel@0:
Daniel@0: $.fn.extend({
Daniel@0: addClass: (function( orig ) {
Daniel@0: return function( classNames, speed, easing, callback ) {
Daniel@0: return speed ?
Daniel@0: $.effects.animateClass.call( this,
Daniel@0: { add: classNames }, speed, easing, callback ) :
Daniel@0: orig.apply( this, arguments );
Daniel@0: };
Daniel@0: })( $.fn.addClass ),
Daniel@0:
Daniel@0: removeClass: (function( orig ) {
Daniel@0: return function( classNames, speed, easing, callback ) {
Daniel@0: return arguments.length > 1 ?
Daniel@0: $.effects.animateClass.call( this,
Daniel@0: { remove: classNames }, speed, easing, callback ) :
Daniel@0: orig.apply( this, arguments );
Daniel@0: };
Daniel@0: })( $.fn.removeClass ),
Daniel@0:
Daniel@0: toggleClass: (function( orig ) {
Daniel@0: return function( classNames, force, speed, easing, callback ) {
Daniel@0: if ( typeof force === "boolean" || force === undefined ) {
Daniel@0: if ( !speed ) {
Daniel@0: // without speed parameter
Daniel@0: return orig.apply( this, arguments );
Daniel@0: } else {
Daniel@0: return $.effects.animateClass.call( this,
Daniel@0: (force ? { add: classNames } : { remove: classNames }),
Daniel@0: speed, easing, callback );
Daniel@0: }
Daniel@0: } else {
Daniel@0: // without force parameter
Daniel@0: return $.effects.animateClass.call( this,
Daniel@0: { toggle: classNames }, force, speed, easing );
Daniel@0: }
Daniel@0: };
Daniel@0: })( $.fn.toggleClass ),
Daniel@0:
Daniel@0: switchClass: function( remove, add, speed, easing, callback) {
Daniel@0: return $.effects.animateClass.call( this, {
Daniel@0: add: add,
Daniel@0: remove: remove
Daniel@0: }, speed, easing, callback );
Daniel@0: }
Daniel@0: });
Daniel@0:
Daniel@0: })();
Daniel@0:
Daniel@0: /******************************************************************************/
Daniel@0: /*********************************** EFFECTS **********************************/
Daniel@0: /******************************************************************************/
Daniel@0:
Daniel@0: (function() {
Daniel@0:
Daniel@0: $.extend( $.effects, {
Daniel@0: version: "1.11.0",
Daniel@0:
Daniel@0: // Saves a set of properties in a data storage
Daniel@0: save: function( element, set ) {
Daniel@0: for ( var i = 0; i < set.length; i++ ) {
Daniel@0: if ( set[ i ] !== null ) {
Daniel@0: element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
Daniel@0: }
Daniel@0: }
Daniel@0: },
Daniel@0:
Daniel@0: // Restores a set of previously saved properties from a data storage
Daniel@0: restore: function( element, set ) {
Daniel@0: var val, i;
Daniel@0: for ( i = 0; i < set.length; i++ ) {
Daniel@0: if ( set[ i ] !== null ) {
Daniel@0: val = element.data( dataSpace + set[ i ] );
Daniel@0: // support: jQuery 1.6.2
Daniel@0: // http://bugs.jquery.com/ticket/9917
Daniel@0: // jQuery 1.6.2 incorrectly returns undefined for any falsy value.
Daniel@0: // We can't differentiate between "" and 0 here, so we just assume
Daniel@0: // empty string since it's likely to be a more common value...
Daniel@0: if ( val === undefined ) {
Daniel@0: val = "";
Daniel@0: }
Daniel@0: element.css( set[ i ], val );
Daniel@0: }
Daniel@0: }
Daniel@0: },
Daniel@0:
Daniel@0: setMode: function( el, mode ) {
Daniel@0: if (mode === "toggle") {
Daniel@0: mode = el.is( ":hidden" ) ? "show" : "hide";
Daniel@0: }
Daniel@0: return mode;
Daniel@0: },
Daniel@0:
Daniel@0: // Translates a [top,left] array into a baseline value
Daniel@0: // this should be a little more flexible in the future to handle a string & hash
Daniel@0: getBaseline: function( origin, original ) {
Daniel@0: var y, x;
Daniel@0: switch ( origin[ 0 ] ) {
Daniel@0: case "top": y = 0; break;
Daniel@0: case "middle": y = 0.5; break;
Daniel@0: case "bottom": y = 1; break;
Daniel@0: default: y = origin[ 0 ] / original.height;
Daniel@0: }
Daniel@0: switch ( origin[ 1 ] ) {
Daniel@0: case "left": x = 0; break;
Daniel@0: case "center": x = 0.5; break;
Daniel@0: case "right": x = 1; break;
Daniel@0: default: x = origin[ 1 ] / original.width;
Daniel@0: }
Daniel@0: return {
Daniel@0: x: x,
Daniel@0: y: y
Daniel@0: };
Daniel@0: },
Daniel@0:
Daniel@0: // Wraps the element around a wrapper that copies position properties
Daniel@0: createWrapper: function( element ) {
Daniel@0:
Daniel@0: // if the element is already wrapped, return it
Daniel@0: if ( element.parent().is( ".ui-effects-wrapper" )) {
Daniel@0: return element.parent();
Daniel@0: }
Daniel@0:
Daniel@0: // wrap the element
Daniel@0: var props = {
Daniel@0: width: element.outerWidth(true),
Daniel@0: height: element.outerHeight(true),
Daniel@0: "float": element.css( "float" )
Daniel@0: },
Daniel@0: wrapper = $( "
" )
Daniel@0: .addClass( "ui-effects-wrapper" )
Daniel@0: .css({
Daniel@0: fontSize: "100%",
Daniel@0: background: "transparent",
Daniel@0: border: "none",
Daniel@0: margin: 0,
Daniel@0: padding: 0
Daniel@0: }),
Daniel@0: // Store the size in case width/height are defined in % - Fixes #5245
Daniel@0: size = {
Daniel@0: width: element.width(),
Daniel@0: height: element.height()
Daniel@0: },
Daniel@0: active = document.activeElement;
Daniel@0:
Daniel@0: // support: Firefox
Daniel@0: // Firefox incorrectly exposes anonymous content
Daniel@0: // https://bugzilla.mozilla.org/show_bug.cgi?id=561664
Daniel@0: try {
Daniel@0: active.id;
Daniel@0: } catch( e ) {
Daniel@0: active = document.body;
Daniel@0: }
Daniel@0:
Daniel@0: element.wrap( wrapper );
Daniel@0:
Daniel@0: // Fixes #7595 - Elements lose focus when wrapped.
Daniel@0: if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
Daniel@0: $( active ).focus();
Daniel@0: }
Daniel@0:
Daniel@0: wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element
Daniel@0:
Daniel@0: // transfer positioning properties to the wrapper
Daniel@0: if ( element.css( "position" ) === "static" ) {
Daniel@0: wrapper.css({ position: "relative" });
Daniel@0: element.css({ position: "relative" });
Daniel@0: } else {
Daniel@0: $.extend( props, {
Daniel@0: position: element.css( "position" ),
Daniel@0: zIndex: element.css( "z-index" )
Daniel@0: });
Daniel@0: $.each([ "top", "left", "bottom", "right" ], function(i, pos) {
Daniel@0: props[ pos ] = element.css( pos );
Daniel@0: if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
Daniel@0: props[ pos ] = "auto";
Daniel@0: }
Daniel@0: });
Daniel@0: element.css({
Daniel@0: position: "relative",
Daniel@0: top: 0,
Daniel@0: left: 0,
Daniel@0: right: "auto",
Daniel@0: bottom: "auto"
Daniel@0: });
Daniel@0: }
Daniel@0: element.css(size);
Daniel@0:
Daniel@0: return wrapper.css( props ).show();
Daniel@0: },
Daniel@0:
Daniel@0: removeWrapper: function( element ) {
Daniel@0: var active = document.activeElement;
Daniel@0:
Daniel@0: if ( element.parent().is( ".ui-effects-wrapper" ) ) {
Daniel@0: element.parent().replaceWith( element );
Daniel@0:
Daniel@0: // Fixes #7595 - Elements lose focus when wrapped.
Daniel@0: if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
Daniel@0: $( active ).focus();
Daniel@0: }
Daniel@0: }
Daniel@0:
Daniel@0: return element;
Daniel@0: },
Daniel@0:
Daniel@0: setTransition: function( element, list, factor, value ) {
Daniel@0: value = value || {};
Daniel@0: $.each( list, function( i, x ) {
Daniel@0: var unit = element.cssUnit( x );
Daniel@0: if ( unit[ 0 ] > 0 ) {
Daniel@0: value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
Daniel@0: }
Daniel@0: });
Daniel@0: return value;
Daniel@0: }
Daniel@0: });
Daniel@0:
Daniel@0: // return an effect options object for the given parameters:
Daniel@0: function _normalizeArguments( effect, options, speed, callback ) {
Daniel@0:
Daniel@0: // allow passing all options as the first parameter
Daniel@0: if ( $.isPlainObject( effect ) ) {
Daniel@0: options = effect;
Daniel@0: effect = effect.effect;
Daniel@0: }
Daniel@0:
Daniel@0: // convert to an object
Daniel@0: effect = { effect: effect };
Daniel@0:
Daniel@0: // catch (effect, null, ...)
Daniel@0: if ( options == null ) {
Daniel@0: options = {};
Daniel@0: }
Daniel@0:
Daniel@0: // catch (effect, callback)
Daniel@0: if ( $.isFunction( options ) ) {
Daniel@0: callback = options;
Daniel@0: speed = null;
Daniel@0: options = {};
Daniel@0: }
Daniel@0:
Daniel@0: // catch (effect, speed, ?)
Daniel@0: if ( typeof options === "number" || $.fx.speeds[ options ] ) {
Daniel@0: callback = speed;
Daniel@0: speed = options;
Daniel@0: options = {};
Daniel@0: }
Daniel@0:
Daniel@0: // catch (effect, options, callback)
Daniel@0: if ( $.isFunction( speed ) ) {
Daniel@0: callback = speed;
Daniel@0: speed = null;
Daniel@0: }
Daniel@0:
Daniel@0: // add options to effect
Daniel@0: if ( options ) {
Daniel@0: $.extend( effect, options );
Daniel@0: }
Daniel@0:
Daniel@0: speed = speed || options.duration;
Daniel@0: effect.duration = $.fx.off ? 0 :
Daniel@0: typeof speed === "number" ? speed :
Daniel@0: speed in $.fx.speeds ? $.fx.speeds[ speed ] :
Daniel@0: $.fx.speeds._default;
Daniel@0:
Daniel@0: effect.complete = callback || options.complete;
Daniel@0:
Daniel@0: return effect;
Daniel@0: }
Daniel@0:
Daniel@0: function standardAnimationOption( option ) {
Daniel@0: // Valid standard speeds (nothing, number, named speed)
Daniel@0: if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) {
Daniel@0: return true;
Daniel@0: }
Daniel@0:
Daniel@0: // Invalid strings - treat as "normal" speed
Daniel@0: if ( typeof option === "string" && !$.effects.effect[ option ] ) {
Daniel@0: return true;
Daniel@0: }
Daniel@0:
Daniel@0: // Complete callback
Daniel@0: if ( $.isFunction( option ) ) {
Daniel@0: return true;
Daniel@0: }
Daniel@0:
Daniel@0: // Options hash (but not naming an effect)
Daniel@0: if ( typeof option === "object" && !option.effect ) {
Daniel@0: return true;
Daniel@0: }
Daniel@0:
Daniel@0: // Didn't match any standard API
Daniel@0: return false;
Daniel@0: }
Daniel@0:
Daniel@0: $.fn.extend({
Daniel@0: effect: function( /* effect, options, speed, callback */ ) {
Daniel@0: var args = _normalizeArguments.apply( this, arguments ),
Daniel@0: mode = args.mode,
Daniel@0: queue = args.queue,
Daniel@0: effectMethod = $.effects.effect[ args.effect ];
Daniel@0:
Daniel@0: if ( $.fx.off || !effectMethod ) {
Daniel@0: // delegate to the original method (e.g., .show()) if possible
Daniel@0: if ( mode ) {
Daniel@0: return this[ mode ]( args.duration, args.complete );
Daniel@0: } else {
Daniel@0: return this.each( function() {
Daniel@0: if ( args.complete ) {
Daniel@0: args.complete.call( this );
Daniel@0: }
Daniel@0: });
Daniel@0: }
Daniel@0: }
Daniel@0:
Daniel@0: function run( next ) {
Daniel@0: var elem = $( this ),
Daniel@0: complete = args.complete,
Daniel@0: mode = args.mode;
Daniel@0:
Daniel@0: function done() {
Daniel@0: if ( $.isFunction( complete ) ) {
Daniel@0: complete.call( elem[0] );
Daniel@0: }
Daniel@0: if ( $.isFunction( next ) ) {
Daniel@0: next();
Daniel@0: }
Daniel@0: }
Daniel@0:
Daniel@0: // If the element already has the correct final state, delegate to
Daniel@0: // the core methods so the internal tracking of "olddisplay" works.
Daniel@0: if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
Daniel@0: elem[ mode ]();
Daniel@0: done();
Daniel@0: } else {
Daniel@0: effectMethod.call( elem[0], args, done );
Daniel@0: }
Daniel@0: }
Daniel@0:
Daniel@0: return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
Daniel@0: },
Daniel@0:
Daniel@0: show: (function( orig ) {
Daniel@0: return function( option ) {
Daniel@0: if ( standardAnimationOption( option ) ) {
Daniel@0: return orig.apply( this, arguments );
Daniel@0: } else {
Daniel@0: var args = _normalizeArguments.apply( this, arguments );
Daniel@0: args.mode = "show";
Daniel@0: return this.effect.call( this, args );
Daniel@0: }
Daniel@0: };
Daniel@0: })( $.fn.show ),
Daniel@0:
Daniel@0: hide: (function( orig ) {
Daniel@0: return function( option ) {
Daniel@0: if ( standardAnimationOption( option ) ) {
Daniel@0: return orig.apply( this, arguments );
Daniel@0: } else {
Daniel@0: var args = _normalizeArguments.apply( this, arguments );
Daniel@0: args.mode = "hide";
Daniel@0: return this.effect.call( this, args );
Daniel@0: }
Daniel@0: };
Daniel@0: })( $.fn.hide ),
Daniel@0:
Daniel@0: toggle: (function( orig ) {
Daniel@0: return function( option ) {
Daniel@0: if ( standardAnimationOption( option ) || typeof option === "boolean" ) {
Daniel@0: return orig.apply( this, arguments );
Daniel@0: } else {
Daniel@0: var args = _normalizeArguments.apply( this, arguments );
Daniel@0: args.mode = "toggle";
Daniel@0: return this.effect.call( this, args );
Daniel@0: }
Daniel@0: };
Daniel@0: })( $.fn.toggle ),
Daniel@0:
Daniel@0: // helper functions
Daniel@0: cssUnit: function(key) {
Daniel@0: var style = this.css( key ),
Daniel@0: val = [];
Daniel@0:
Daniel@0: $.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
Daniel@0: if ( style.indexOf( unit ) > 0 ) {
Daniel@0: val = [ parseFloat( style ), unit ];
Daniel@0: }
Daniel@0: });
Daniel@0: return val;
Daniel@0: }
Daniel@0: });
Daniel@0:
Daniel@0: })();
Daniel@0:
Daniel@0: /******************************************************************************/
Daniel@0: /*********************************** EASING ***********************************/
Daniel@0: /******************************************************************************/
Daniel@0:
Daniel@0: (function() {
Daniel@0:
Daniel@0: // based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
Daniel@0:
Daniel@0: var baseEasings = {};
Daniel@0:
Daniel@0: $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
Daniel@0: baseEasings[ name ] = function( p ) {
Daniel@0: return Math.pow( p, i + 2 );
Daniel@0: };
Daniel@0: });
Daniel@0:
Daniel@0: $.extend( baseEasings, {
Daniel@0: Sine: function( p ) {
Daniel@0: return 1 - Math.cos( p * Math.PI / 2 );
Daniel@0: },
Daniel@0: Circ: function( p ) {
Daniel@0: return 1 - Math.sqrt( 1 - p * p );
Daniel@0: },
Daniel@0: Elastic: function( p ) {
Daniel@0: return p === 0 || p === 1 ? p :
Daniel@0: -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 );
Daniel@0: },
Daniel@0: Back: function( p ) {
Daniel@0: return p * p * ( 3 * p - 2 );
Daniel@0: },
Daniel@0: Bounce: function( p ) {
Daniel@0: var pow2,
Daniel@0: bounce = 4;
Daniel@0:
Daniel@0: while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
Daniel@0: return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
Daniel@0: }
Daniel@0: });
Daniel@0:
Daniel@0: $.each( baseEasings, function( name, easeIn ) {
Daniel@0: $.easing[ "easeIn" + name ] = easeIn;
Daniel@0: $.easing[ "easeOut" + name ] = function( p ) {
Daniel@0: return 1 - easeIn( 1 - p );
Daniel@0: };
Daniel@0: $.easing[ "easeInOut" + name ] = function( p ) {
Daniel@0: return p < 0.5 ?
Daniel@0: easeIn( p * 2 ) / 2 :
Daniel@0: 1 - easeIn( p * -2 + 2 ) / 2;
Daniel@0: };
Daniel@0: });
Daniel@0:
Daniel@0: })();
Daniel@0:
Daniel@0: var effect = $.effects;
Daniel@0:
Daniel@0:
Daniel@0: /*!
Daniel@0: * jQuery UI Effects Blind 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/blind-effect/
Daniel@0: */
Daniel@0:
Daniel@0:
Daniel@0: var effectBlind = $.effects.effect.blind = function( o, done ) {
Daniel@0: // Create element
Daniel@0: var el = $( this ),
Daniel@0: rvertical = /up|down|vertical/,
Daniel@0: rpositivemotion = /up|left|vertical|horizontal/,
Daniel@0: props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
Daniel@0: mode = $.effects.setMode( el, o.mode || "hide" ),
Daniel@0: direction = o.direction || "up",
Daniel@0: vertical = rvertical.test( direction ),
Daniel@0: ref = vertical ? "height" : "width",
Daniel@0: ref2 = vertical ? "top" : "left",
Daniel@0: motion = rpositivemotion.test( direction ),
Daniel@0: animation = {},
Daniel@0: show = mode === "show",
Daniel@0: wrapper, distance, margin;
Daniel@0:
Daniel@0: // if already wrapped, the wrapper's properties are my property. #6245
Daniel@0: if ( el.parent().is( ".ui-effects-wrapper" ) ) {
Daniel@0: $.effects.save( el.parent(), props );
Daniel@0: } else {
Daniel@0: $.effects.save( el, props );
Daniel@0: }
Daniel@0: el.show();
Daniel@0: wrapper = $.effects.createWrapper( el ).css({
Daniel@0: overflow: "hidden"
Daniel@0: });
Daniel@0:
Daniel@0: distance = wrapper[ ref ]();
Daniel@0: margin = parseFloat( wrapper.css( ref2 ) ) || 0;
Daniel@0:
Daniel@0: animation[ ref ] = show ? distance : 0;
Daniel@0: if ( !motion ) {
Daniel@0: el
Daniel@0: .css( vertical ? "bottom" : "right", 0 )
Daniel@0: .css( vertical ? "top" : "left", "auto" )
Daniel@0: .css({ position: "absolute" });
Daniel@0:
Daniel@0: animation[ ref2 ] = show ? margin : distance + margin;
Daniel@0: }
Daniel@0:
Daniel@0: // start at 0 if we are showing
Daniel@0: if ( show ) {
Daniel@0: wrapper.css( ref, 0 );
Daniel@0: if ( !motion ) {
Daniel@0: wrapper.css( ref2, margin + distance );
Daniel@0: }
Daniel@0: }
Daniel@0:
Daniel@0: // Animate
Daniel@0: wrapper.animate( animation, {
Daniel@0: duration: o.duration,
Daniel@0: easing: o.easing,
Daniel@0: queue: false,
Daniel@0: complete: function() {
Daniel@0: if ( mode === "hide" ) {
Daniel@0: el.hide();
Daniel@0: }
Daniel@0: $.effects.restore( el, props );
Daniel@0: $.effects.removeWrapper( el );
Daniel@0: done();
Daniel@0: }
Daniel@0: });
Daniel@0: };
Daniel@0:
Daniel@0:
Daniel@0: /*!
Daniel@0: * jQuery UI Effects Bounce 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/bounce-effect/
Daniel@0: */
Daniel@0:
Daniel@0:
Daniel@0: var effectBounce = $.effects.effect.bounce = function( o, done ) {
Daniel@0: var el = $( this ),
Daniel@0: props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
Daniel@0:
Daniel@0: // defaults:
Daniel@0: mode = $.effects.setMode( el, o.mode || "effect" ),
Daniel@0: hide = mode === "hide",
Daniel@0: show = mode === "show",
Daniel@0: direction = o.direction || "up",
Daniel@0: distance = o.distance,
Daniel@0: times = o.times || 5,
Daniel@0:
Daniel@0: // number of internal animations
Daniel@0: anims = times * 2 + ( show || hide ? 1 : 0 ),
Daniel@0: speed = o.duration / anims,
Daniel@0: easing = o.easing,
Daniel@0:
Daniel@0: // utility:
Daniel@0: ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
Daniel@0: motion = ( direction === "up" || direction === "left" ),
Daniel@0: i,
Daniel@0: upAnim,
Daniel@0: downAnim,
Daniel@0:
Daniel@0: // we will need to re-assemble the queue to stack our animations in place
Daniel@0: queue = el.queue(),
Daniel@0: queuelen = queue.length;
Daniel@0:
Daniel@0: // Avoid touching opacity to prevent clearType and PNG issues in IE
Daniel@0: if ( show || hide ) {
Daniel@0: props.push( "opacity" );
Daniel@0: }
Daniel@0:
Daniel@0: $.effects.save( el, props );
Daniel@0: el.show();
Daniel@0: $.effects.createWrapper( el ); // Create Wrapper
Daniel@0:
Daniel@0: // default distance for the BIGGEST bounce is the outer Distance / 3
Daniel@0: if ( !distance ) {
Daniel@0: distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
Daniel@0: }
Daniel@0:
Daniel@0: if ( show ) {
Daniel@0: downAnim = { opacity: 1 };
Daniel@0: downAnim[ ref ] = 0;
Daniel@0:
Daniel@0: // if we are showing, force opacity 0 and set the initial position
Daniel@0: // then do the "first" animation
Daniel@0: el.css( "opacity", 0 )
Daniel@0: .css( ref, motion ? -distance * 2 : distance * 2 )
Daniel@0: .animate( downAnim, speed, easing );
Daniel@0: }
Daniel@0:
Daniel@0: // start at the smallest distance if we are hiding
Daniel@0: if ( hide ) {
Daniel@0: distance = distance / Math.pow( 2, times - 1 );
Daniel@0: }
Daniel@0:
Daniel@0: downAnim = {};
Daniel@0: downAnim[ ref ] = 0;
Daniel@0: // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
Daniel@0: for ( i = 0; i < times; i++ ) {
Daniel@0: upAnim = {};
Daniel@0: upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
Daniel@0:
Daniel@0: el.animate( upAnim, speed, easing )
Daniel@0: .animate( downAnim, speed, easing );
Daniel@0:
Daniel@0: distance = hide ? distance * 2 : distance / 2;
Daniel@0: }
Daniel@0:
Daniel@0: // Last Bounce when Hiding
Daniel@0: if ( hide ) {
Daniel@0: upAnim = { opacity: 0 };
Daniel@0: upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
Daniel@0:
Daniel@0: el.animate( upAnim, speed, easing );
Daniel@0: }
Daniel@0:
Daniel@0: el.queue(function() {
Daniel@0: if ( hide ) {
Daniel@0: el.hide();
Daniel@0: }
Daniel@0: $.effects.restore( el, props );
Daniel@0: $.effects.removeWrapper( el );
Daniel@0: done();
Daniel@0: });
Daniel@0:
Daniel@0: // inject all the animations we just queued to be first in line (after "inprogress")
Daniel@0: if ( queuelen > 1) {
Daniel@0: queue.splice.apply( queue,
Daniel@0: [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
Daniel@0: }
Daniel@0: el.dequeue();
Daniel@0:
Daniel@0: };
Daniel@0:
Daniel@0:
Daniel@0: /*!
Daniel@0: * jQuery UI Effects Clip 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/clip-effect/
Daniel@0: */
Daniel@0:
Daniel@0:
Daniel@0: var effectClip = $.effects.effect.clip = function( o, done ) {
Daniel@0: // Create element
Daniel@0: var el = $( this ),
Daniel@0: props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
Daniel@0: mode = $.effects.setMode( el, o.mode || "hide" ),
Daniel@0: show = mode === "show",
Daniel@0: direction = o.direction || "vertical",
Daniel@0: vert = direction === "vertical",
Daniel@0: size = vert ? "height" : "width",
Daniel@0: position = vert ? "top" : "left",
Daniel@0: animation = {},
Daniel@0: wrapper, animate, distance;
Daniel@0:
Daniel@0: // Save & Show
Daniel@0: $.effects.save( el, props );
Daniel@0: el.show();
Daniel@0:
Daniel@0: // Create Wrapper
Daniel@0: wrapper = $.effects.createWrapper( el ).css({
Daniel@0: overflow: "hidden"
Daniel@0: });
Daniel@0: animate = ( el[0].tagName === "IMG" ) ? wrapper : el;
Daniel@0: distance = animate[ size ]();
Daniel@0:
Daniel@0: // Shift
Daniel@0: if ( show ) {
Daniel@0: animate.css( size, 0 );
Daniel@0: animate.css( position, distance / 2 );
Daniel@0: }
Daniel@0:
Daniel@0: // Create Animation Object:
Daniel@0: animation[ size ] = show ? distance : 0;
Daniel@0: animation[ position ] = show ? 0 : distance / 2;
Daniel@0:
Daniel@0: // Animate
Daniel@0: animate.animate( animation, {
Daniel@0: queue: false,
Daniel@0: duration: o.duration,
Daniel@0: easing: o.easing,
Daniel@0: complete: function() {
Daniel@0: if ( !show ) {
Daniel@0: el.hide();
Daniel@0: }
Daniel@0: $.effects.restore( el, props );
Daniel@0: $.effects.removeWrapper( el );
Daniel@0: done();
Daniel@0: }
Daniel@0: });
Daniel@0:
Daniel@0: };
Daniel@0:
Daniel@0:
Daniel@0: /*!
Daniel@0: * jQuery UI Effects Drop 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/drop-effect/
Daniel@0: */
Daniel@0:
Daniel@0:
Daniel@0: var effectDrop = $.effects.effect.drop = function( o, done ) {
Daniel@0:
Daniel@0: var el = $( this ),
Daniel@0: props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ],
Daniel@0: mode = $.effects.setMode( el, o.mode || "hide" ),
Daniel@0: show = mode === "show",
Daniel@0: direction = o.direction || "left",
Daniel@0: ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
Daniel@0: motion = ( direction === "up" || direction === "left" ) ? "pos" : "neg",
Daniel@0: animation = {
Daniel@0: opacity: show ? 1 : 0
Daniel@0: },
Daniel@0: distance;
Daniel@0:
Daniel@0: // Adjust
Daniel@0: $.effects.save( el, props );
Daniel@0: el.show();
Daniel@0: $.effects.createWrapper( el );
Daniel@0:
Daniel@0: distance = o.distance || el[ ref === "top" ? "outerHeight": "outerWidth" ]( true ) / 2;
Daniel@0:
Daniel@0: if ( show ) {
Daniel@0: el
Daniel@0: .css( "opacity", 0 )
Daniel@0: .css( ref, motion === "pos" ? -distance : distance );
Daniel@0: }
Daniel@0:
Daniel@0: // Animation
Daniel@0: animation[ ref ] = ( show ?
Daniel@0: ( motion === "pos" ? "+=" : "-=" ) :
Daniel@0: ( motion === "pos" ? "-=" : "+=" ) ) +
Daniel@0: distance;
Daniel@0:
Daniel@0: // Animate
Daniel@0: el.animate( animation, {
Daniel@0: queue: false,
Daniel@0: duration: o.duration,
Daniel@0: easing: o.easing,
Daniel@0: complete: function() {
Daniel@0: if ( mode === "hide" ) {
Daniel@0: el.hide();
Daniel@0: }
Daniel@0: $.effects.restore( el, props );
Daniel@0: $.effects.removeWrapper( el );
Daniel@0: done();
Daniel@0: }
Daniel@0: });
Daniel@0: };
Daniel@0:
Daniel@0:
Daniel@0: /*!
Daniel@0: * jQuery UI Effects Explode 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/explode-effect/
Daniel@0: */
Daniel@0:
Daniel@0:
Daniel@0: var effectExplode = $.effects.effect.explode = function( o, done ) {
Daniel@0:
Daniel@0: var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3,
Daniel@0: cells = rows,
Daniel@0: el = $( this ),
Daniel@0: mode = $.effects.setMode( el, o.mode || "hide" ),
Daniel@0: show = mode === "show",
Daniel@0:
Daniel@0: // show and then visibility:hidden the element before calculating offset
Daniel@0: offset = el.show().css( "visibility", "hidden" ).offset(),
Daniel@0:
Daniel@0: // width and height of a piece
Daniel@0: width = Math.ceil( el.outerWidth() / cells ),
Daniel@0: height = Math.ceil( el.outerHeight() / rows ),
Daniel@0: pieces = [],
Daniel@0:
Daniel@0: // loop
Daniel@0: i, j, left, top, mx, my;
Daniel@0:
Daniel@0: // children animate complete:
Daniel@0: function childComplete() {
Daniel@0: pieces.push( this );
Daniel@0: if ( pieces.length === rows * cells ) {
Daniel@0: animComplete();
Daniel@0: }
Daniel@0: }
Daniel@0:
Daniel@0: // clone the element for each row and cell.
Daniel@0: for ( i = 0; i < rows ; i++ ) { // ===>
Daniel@0: top = offset.top + i * height;
Daniel@0: my = i - ( rows - 1 ) / 2 ;
Daniel@0:
Daniel@0: for ( j = 0; j < cells ; j++ ) { // |||
Daniel@0: left = offset.left + j * width;
Daniel@0: mx = j - ( cells - 1 ) / 2 ;
Daniel@0:
Daniel@0: // Create a clone of the now hidden main element that will be absolute positioned
Daniel@0: // within a wrapper div off the -left and -top equal to size of our pieces
Daniel@0: el
Daniel@0: .clone()
Daniel@0: .appendTo( "body" )
Daniel@0: .wrap( "
" )
Daniel@0: .css({
Daniel@0: position: "absolute",
Daniel@0: visibility: "visible",
Daniel@0: left: -j * width,
Daniel@0: top: -i * height
Daniel@0: })
Daniel@0:
Daniel@0: // select the wrapper - make it overflow: hidden and absolute positioned based on
Daniel@0: // where the original was located +left and +top equal to the size of pieces
Daniel@0: .parent()
Daniel@0: .addClass( "ui-effects-explode" )
Daniel@0: .css({
Daniel@0: position: "absolute",
Daniel@0: overflow: "hidden",
Daniel@0: width: width,
Daniel@0: height: height,
Daniel@0: left: left + ( show ? mx * width : 0 ),
Daniel@0: top: top + ( show ? my * height : 0 ),
Daniel@0: opacity: show ? 0 : 1
Daniel@0: }).animate({
Daniel@0: left: left + ( show ? 0 : mx * width ),
Daniel@0: top: top + ( show ? 0 : my * height ),
Daniel@0: opacity: show ? 1 : 0
Daniel@0: }, o.duration || 500, o.easing, childComplete );
Daniel@0: }
Daniel@0: }
Daniel@0:
Daniel@0: function animComplete() {
Daniel@0: el.css({
Daniel@0: visibility: "visible"
Daniel@0: });
Daniel@0: $( pieces ).remove();
Daniel@0: if ( !show ) {
Daniel@0: el.hide();
Daniel@0: }
Daniel@0: done();
Daniel@0: }
Daniel@0: };
Daniel@0:
Daniel@0:
Daniel@0: /*!
Daniel@0: * jQuery UI Effects Fade 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/fade-effect/
Daniel@0: */
Daniel@0:
Daniel@0:
Daniel@0: var effectFade = $.effects.effect.fade = function( o, done ) {
Daniel@0: var el = $( this ),
Daniel@0: mode = $.effects.setMode( el, o.mode || "toggle" );
Daniel@0:
Daniel@0: el.animate({
Daniel@0: opacity: mode
Daniel@0: }, {
Daniel@0: queue: false,
Daniel@0: duration: o.duration,
Daniel@0: easing: o.easing,
Daniel@0: complete: done
Daniel@0: });
Daniel@0: };
Daniel@0:
Daniel@0:
Daniel@0: /*!
Daniel@0: * jQuery UI Effects Fold 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/fold-effect/
Daniel@0: */
Daniel@0:
Daniel@0:
Daniel@0: var effectFold = $.effects.effect.fold = function( o, done ) {
Daniel@0:
Daniel@0: // Create element
Daniel@0: var el = $( this ),
Daniel@0: props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
Daniel@0: mode = $.effects.setMode( el, o.mode || "hide" ),
Daniel@0: show = mode === "show",
Daniel@0: hide = mode === "hide",
Daniel@0: size = o.size || 15,
Daniel@0: percent = /([0-9]+)%/.exec( size ),
Daniel@0: horizFirst = !!o.horizFirst,
Daniel@0: widthFirst = show !== horizFirst,
Daniel@0: ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ],
Daniel@0: duration = o.duration / 2,
Daniel@0: wrapper, distance,
Daniel@0: animation1 = {},
Daniel@0: animation2 = {};
Daniel@0:
Daniel@0: $.effects.save( el, props );
Daniel@0: el.show();
Daniel@0:
Daniel@0: // Create Wrapper
Daniel@0: wrapper = $.effects.createWrapper( el ).css({
Daniel@0: overflow: "hidden"
Daniel@0: });
Daniel@0: distance = widthFirst ?
Daniel@0: [ wrapper.width(), wrapper.height() ] :
Daniel@0: [ wrapper.height(), wrapper.width() ];
Daniel@0:
Daniel@0: if ( percent ) {
Daniel@0: size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ];
Daniel@0: }
Daniel@0: if ( show ) {
Daniel@0: wrapper.css( horizFirst ? {
Daniel@0: height: 0,
Daniel@0: width: size
Daniel@0: } : {
Daniel@0: height: size,
Daniel@0: width: 0
Daniel@0: });
Daniel@0: }
Daniel@0:
Daniel@0: // Animation
Daniel@0: animation1[ ref[ 0 ] ] = show ? distance[ 0 ] : size;
Daniel@0: animation2[ ref[ 1 ] ] = show ? distance[ 1 ] : 0;
Daniel@0:
Daniel@0: // Animate
Daniel@0: wrapper
Daniel@0: .animate( animation1, duration, o.easing )
Daniel@0: .animate( animation2, duration, o.easing, function() {
Daniel@0: if ( hide ) {
Daniel@0: el.hide();
Daniel@0: }
Daniel@0: $.effects.restore( el, props );
Daniel@0: $.effects.removeWrapper( el );
Daniel@0: done();
Daniel@0: });
Daniel@0:
Daniel@0: };
Daniel@0:
Daniel@0:
Daniel@0: /*!
Daniel@0: * jQuery UI Effects Highlight 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/highlight-effect/
Daniel@0: */
Daniel@0:
Daniel@0:
Daniel@0: var effectHighlight = $.effects.effect.highlight = function( o, done ) {
Daniel@0: var elem = $( this ),
Daniel@0: props = [ "backgroundImage", "backgroundColor", "opacity" ],
Daniel@0: mode = $.effects.setMode( elem, o.mode || "show" ),
Daniel@0: animation = {
Daniel@0: backgroundColor: elem.css( "backgroundColor" )
Daniel@0: };
Daniel@0:
Daniel@0: if (mode === "hide") {
Daniel@0: animation.opacity = 0;
Daniel@0: }
Daniel@0:
Daniel@0: $.effects.save( elem, props );
Daniel@0:
Daniel@0: elem
Daniel@0: .show()
Daniel@0: .css({
Daniel@0: backgroundImage: "none",
Daniel@0: backgroundColor: o.color || "#ffff99"
Daniel@0: })
Daniel@0: .animate( animation, {
Daniel@0: queue: false,
Daniel@0: duration: o.duration,
Daniel@0: easing: o.easing,
Daniel@0: complete: function() {
Daniel@0: if ( mode === "hide" ) {
Daniel@0: elem.hide();
Daniel@0: }
Daniel@0: $.effects.restore( elem, props );
Daniel@0: done();
Daniel@0: }
Daniel@0: });
Daniel@0: };
Daniel@0:
Daniel@0:
Daniel@0: /*!
Daniel@0: * jQuery UI Effects Size 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/size-effect/
Daniel@0: */
Daniel@0:
Daniel@0:
Daniel@0: var effectSize = $.effects.effect.size = function( o, done ) {
Daniel@0:
Daniel@0: // Create element
Daniel@0: var original, baseline, factor,
Daniel@0: el = $( this ),
Daniel@0: props0 = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ],
Daniel@0:
Daniel@0: // Always restore
Daniel@0: props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ],
Daniel@0:
Daniel@0: // Copy for children
Daniel@0: props2 = [ "width", "height", "overflow" ],
Daniel@0: cProps = [ "fontSize" ],
Daniel@0: vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
Daniel@0: hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
Daniel@0:
Daniel@0: // Set options
Daniel@0: mode = $.effects.setMode( el, o.mode || "effect" ),
Daniel@0: restore = o.restore || mode !== "effect",
Daniel@0: scale = o.scale || "both",
Daniel@0: origin = o.origin || [ "middle", "center" ],
Daniel@0: position = el.css( "position" ),
Daniel@0: props = restore ? props0 : props1,
Daniel@0: zero = {
Daniel@0: height: 0,
Daniel@0: width: 0,
Daniel@0: outerHeight: 0,
Daniel@0: outerWidth: 0
Daniel@0: };
Daniel@0:
Daniel@0: if ( mode === "show" ) {
Daniel@0: el.show();
Daniel@0: }
Daniel@0: original = {
Daniel@0: height: el.height(),
Daniel@0: width: el.width(),
Daniel@0: outerHeight: el.outerHeight(),
Daniel@0: outerWidth: el.outerWidth()
Daniel@0: };
Daniel@0:
Daniel@0: if ( o.mode === "toggle" && mode === "show" ) {
Daniel@0: el.from = o.to || zero;
Daniel@0: el.to = o.from || original;
Daniel@0: } else {
Daniel@0: el.from = o.from || ( mode === "show" ? zero : original );
Daniel@0: el.to = o.to || ( mode === "hide" ? zero : original );
Daniel@0: }
Daniel@0:
Daniel@0: // Set scaling factor
Daniel@0: factor = {
Daniel@0: from: {
Daniel@0: y: el.from.height / original.height,
Daniel@0: x: el.from.width / original.width
Daniel@0: },
Daniel@0: to: {
Daniel@0: y: el.to.height / original.height,
Daniel@0: x: el.to.width / original.width
Daniel@0: }
Daniel@0: };
Daniel@0:
Daniel@0: // Scale the css box
Daniel@0: if ( scale === "box" || scale === "both" ) {
Daniel@0:
Daniel@0: // Vertical props scaling
Daniel@0: if ( factor.from.y !== factor.to.y ) {
Daniel@0: props = props.concat( vProps );
Daniel@0: el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from );
Daniel@0: el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to );
Daniel@0: }
Daniel@0:
Daniel@0: // Horizontal props scaling
Daniel@0: if ( factor.from.x !== factor.to.x ) {
Daniel@0: props = props.concat( hProps );
Daniel@0: el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from );
Daniel@0: el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to );
Daniel@0: }
Daniel@0: }
Daniel@0:
Daniel@0: // Scale the content
Daniel@0: if ( scale === "content" || scale === "both" ) {
Daniel@0:
Daniel@0: // Vertical props scaling
Daniel@0: if ( factor.from.y !== factor.to.y ) {
Daniel@0: props = props.concat( cProps ).concat( props2 );
Daniel@0: el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from );
Daniel@0: el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to );
Daniel@0: }
Daniel@0: }
Daniel@0:
Daniel@0: $.effects.save( el, props );
Daniel@0: el.show();
Daniel@0: $.effects.createWrapper( el );
Daniel@0: el.css( "overflow", "hidden" ).css( el.from );
Daniel@0:
Daniel@0: // Adjust
Daniel@0: if (origin) { // Calculate baseline shifts
Daniel@0: baseline = $.effects.getBaseline( origin, original );
Daniel@0: el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y;
Daniel@0: el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x;
Daniel@0: el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y;
Daniel@0: el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x;
Daniel@0: }
Daniel@0: el.css( el.from ); // set top & left
Daniel@0:
Daniel@0: // Animate
Daniel@0: if ( scale === "content" || scale === "both" ) { // Scale the children
Daniel@0:
Daniel@0: // Add margins/font-size
Daniel@0: vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps);
Daniel@0: hProps = hProps.concat([ "marginLeft", "marginRight" ]);
Daniel@0: props2 = props0.concat(vProps).concat(hProps);
Daniel@0:
Daniel@0: el.find( "*[width]" ).each( function() {
Daniel@0: var child = $( this ),
Daniel@0: c_original = {
Daniel@0: height: child.height(),
Daniel@0: width: child.width(),
Daniel@0: outerHeight: child.outerHeight(),
Daniel@0: outerWidth: child.outerWidth()
Daniel@0: };
Daniel@0: if (restore) {
Daniel@0: $.effects.save(child, props2);
Daniel@0: }
Daniel@0:
Daniel@0: child.from = {
Daniel@0: height: c_original.height * factor.from.y,
Daniel@0: width: c_original.width * factor.from.x,
Daniel@0: outerHeight: c_original.outerHeight * factor.from.y,
Daniel@0: outerWidth: c_original.outerWidth * factor.from.x
Daniel@0: };
Daniel@0: child.to = {
Daniel@0: height: c_original.height * factor.to.y,
Daniel@0: width: c_original.width * factor.to.x,
Daniel@0: outerHeight: c_original.height * factor.to.y,
Daniel@0: outerWidth: c_original.width * factor.to.x
Daniel@0: };
Daniel@0:
Daniel@0: // Vertical props scaling
Daniel@0: if ( factor.from.y !== factor.to.y ) {
Daniel@0: child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from );
Daniel@0: child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to );
Daniel@0: }
Daniel@0:
Daniel@0: // Horizontal props scaling
Daniel@0: if ( factor.from.x !== factor.to.x ) {
Daniel@0: child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from );
Daniel@0: child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to );
Daniel@0: }
Daniel@0:
Daniel@0: // Animate children
Daniel@0: child.css( child.from );
Daniel@0: child.animate( child.to, o.duration, o.easing, function() {
Daniel@0:
Daniel@0: // Restore children
Daniel@0: if ( restore ) {
Daniel@0: $.effects.restore( child, props2 );
Daniel@0: }
Daniel@0: });
Daniel@0: });
Daniel@0: }
Daniel@0:
Daniel@0: // Animate
Daniel@0: el.animate( el.to, {
Daniel@0: queue: false,
Daniel@0: duration: o.duration,
Daniel@0: easing: o.easing,
Daniel@0: complete: function() {
Daniel@0: if ( el.to.opacity === 0 ) {
Daniel@0: el.css( "opacity", el.from.opacity );
Daniel@0: }
Daniel@0: if ( mode === "hide" ) {
Daniel@0: el.hide();
Daniel@0: }
Daniel@0: $.effects.restore( el, props );
Daniel@0: if ( !restore ) {
Daniel@0:
Daniel@0: // we need to calculate our new positioning based on the scaling
Daniel@0: if ( position === "static" ) {
Daniel@0: el.css({
Daniel@0: position: "relative",
Daniel@0: top: el.to.top,
Daniel@0: left: el.to.left
Daniel@0: });
Daniel@0: } else {
Daniel@0: $.each([ "top", "left" ], function( idx, pos ) {
Daniel@0: el.css( pos, function( _, str ) {
Daniel@0: var val = parseInt( str, 10 ),
Daniel@0: toRef = idx ? el.to.left : el.to.top;
Daniel@0:
Daniel@0: // if original was "auto", recalculate the new value from wrapper
Daniel@0: if ( str === "auto" ) {
Daniel@0: return toRef + "px";
Daniel@0: }
Daniel@0:
Daniel@0: return val + toRef + "px";
Daniel@0: });
Daniel@0: });
Daniel@0: }
Daniel@0: }
Daniel@0:
Daniel@0: $.effects.removeWrapper( el );
Daniel@0: done();
Daniel@0: }
Daniel@0: });
Daniel@0:
Daniel@0: };
Daniel@0:
Daniel@0:
Daniel@0: /*!
Daniel@0: * jQuery UI Effects Scale 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/scale-effect/
Daniel@0: */
Daniel@0:
Daniel@0:
Daniel@0: var effectScale = $.effects.effect.scale = function( o, done ) {
Daniel@0:
Daniel@0: // Create element
Daniel@0: var el = $( this ),
Daniel@0: options = $.extend( true, {}, o ),
Daniel@0: mode = $.effects.setMode( el, o.mode || "effect" ),
Daniel@0: percent = parseInt( o.percent, 10 ) ||
Daniel@0: ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ),
Daniel@0: direction = o.direction || "both",
Daniel@0: origin = o.origin,
Daniel@0: original = {
Daniel@0: height: el.height(),
Daniel@0: width: el.width(),
Daniel@0: outerHeight: el.outerHeight(),
Daniel@0: outerWidth: el.outerWidth()
Daniel@0: },
Daniel@0: factor = {
Daniel@0: y: direction !== "horizontal" ? (percent / 100) : 1,
Daniel@0: x: direction !== "vertical" ? (percent / 100) : 1
Daniel@0: };
Daniel@0:
Daniel@0: // We are going to pass this effect to the size effect:
Daniel@0: options.effect = "size";
Daniel@0: options.queue = false;
Daniel@0: options.complete = done;
Daniel@0:
Daniel@0: // Set default origin and restore for show/hide
Daniel@0: if ( mode !== "effect" ) {
Daniel@0: options.origin = origin || [ "middle", "center" ];
Daniel@0: options.restore = true;
Daniel@0: }
Daniel@0:
Daniel@0: options.from = o.from || ( mode === "show" ? {
Daniel@0: height: 0,
Daniel@0: width: 0,
Daniel@0: outerHeight: 0,
Daniel@0: outerWidth: 0
Daniel@0: } : original );
Daniel@0: options.to = {
Daniel@0: height: original.height * factor.y,
Daniel@0: width: original.width * factor.x,
Daniel@0: outerHeight: original.outerHeight * factor.y,
Daniel@0: outerWidth: original.outerWidth * factor.x
Daniel@0: };
Daniel@0:
Daniel@0: // Fade option to support puff
Daniel@0: if ( options.fade ) {
Daniel@0: if ( mode === "show" ) {
Daniel@0: options.from.opacity = 0;
Daniel@0: options.to.opacity = 1;
Daniel@0: }
Daniel@0: if ( mode === "hide" ) {
Daniel@0: options.from.opacity = 1;
Daniel@0: options.to.opacity = 0;
Daniel@0: }
Daniel@0: }
Daniel@0:
Daniel@0: // Animate
Daniel@0: el.effect( options );
Daniel@0:
Daniel@0: };
Daniel@0:
Daniel@0:
Daniel@0: /*!
Daniel@0: * jQuery UI Effects Puff 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/puff-effect/
Daniel@0: */
Daniel@0:
Daniel@0:
Daniel@0: var effectPuff = $.effects.effect.puff = function( o, done ) {
Daniel@0: var elem = $( this ),
Daniel@0: mode = $.effects.setMode( elem, o.mode || "hide" ),
Daniel@0: hide = mode === "hide",
Daniel@0: percent = parseInt( o.percent, 10 ) || 150,
Daniel@0: factor = percent / 100,
Daniel@0: original = {
Daniel@0: height: elem.height(),
Daniel@0: width: elem.width(),
Daniel@0: outerHeight: elem.outerHeight(),
Daniel@0: outerWidth: elem.outerWidth()
Daniel@0: };
Daniel@0:
Daniel@0: $.extend( o, {
Daniel@0: effect: "scale",
Daniel@0: queue: false,
Daniel@0: fade: true,
Daniel@0: mode: mode,
Daniel@0: complete: done,
Daniel@0: percent: hide ? percent : 100,
Daniel@0: from: hide ?
Daniel@0: original :
Daniel@0: {
Daniel@0: height: original.height * factor,
Daniel@0: width: original.width * factor,
Daniel@0: outerHeight: original.outerHeight * factor,
Daniel@0: outerWidth: original.outerWidth * factor
Daniel@0: }
Daniel@0: });
Daniel@0:
Daniel@0: elem.effect( o );
Daniel@0: };
Daniel@0:
Daniel@0:
Daniel@0: /*!
Daniel@0: * jQuery UI Effects Pulsate 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/pulsate-effect/
Daniel@0: */
Daniel@0:
Daniel@0:
Daniel@0: var effectPulsate = $.effects.effect.pulsate = function( o, done ) {
Daniel@0: var elem = $( this ),
Daniel@0: mode = $.effects.setMode( elem, o.mode || "show" ),
Daniel@0: show = mode === "show",
Daniel@0: hide = mode === "hide",
Daniel@0: showhide = ( show || mode === "hide" ),
Daniel@0:
Daniel@0: // showing or hiding leaves of the "last" animation
Daniel@0: anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
Daniel@0: duration = o.duration / anims,
Daniel@0: animateTo = 0,
Daniel@0: queue = elem.queue(),
Daniel@0: queuelen = queue.length,
Daniel@0: i;
Daniel@0:
Daniel@0: if ( show || !elem.is(":visible")) {
Daniel@0: elem.css( "opacity", 0 ).show();
Daniel@0: animateTo = 1;
Daniel@0: }
Daniel@0:
Daniel@0: // anims - 1 opacity "toggles"
Daniel@0: for ( i = 1; i < anims; i++ ) {
Daniel@0: elem.animate({
Daniel@0: opacity: animateTo
Daniel@0: }, duration, o.easing );
Daniel@0: animateTo = 1 - animateTo;
Daniel@0: }
Daniel@0:
Daniel@0: elem.animate({
Daniel@0: opacity: animateTo
Daniel@0: }, duration, o.easing);
Daniel@0:
Daniel@0: elem.queue(function() {
Daniel@0: if ( hide ) {
Daniel@0: elem.hide();
Daniel@0: }
Daniel@0: done();
Daniel@0: });
Daniel@0:
Daniel@0: // We just queued up "anims" animations, we need to put them next in the queue
Daniel@0: if ( queuelen > 1 ) {
Daniel@0: queue.splice.apply( queue,
Daniel@0: [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
Daniel@0: }
Daniel@0: elem.dequeue();
Daniel@0: };
Daniel@0:
Daniel@0:
Daniel@0: /*!
Daniel@0: * jQuery UI Effects Shake 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/shake-effect/
Daniel@0: */
Daniel@0:
Daniel@0:
Daniel@0: var effectShake = $.effects.effect.shake = function( o, done ) {
Daniel@0:
Daniel@0: var el = $( this ),
Daniel@0: props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
Daniel@0: mode = $.effects.setMode( el, o.mode || "effect" ),
Daniel@0: direction = o.direction || "left",
Daniel@0: distance = o.distance || 20,
Daniel@0: times = o.times || 3,
Daniel@0: anims = times * 2 + 1,
Daniel@0: speed = Math.round( o.duration / anims ),
Daniel@0: ref = (direction === "up" || direction === "down") ? "top" : "left",
Daniel@0: positiveMotion = (direction === "up" || direction === "left"),
Daniel@0: animation = {},
Daniel@0: animation1 = {},
Daniel@0: animation2 = {},
Daniel@0: i,
Daniel@0:
Daniel@0: // we will need to re-assemble the queue to stack our animations in place
Daniel@0: queue = el.queue(),
Daniel@0: queuelen = queue.length;
Daniel@0:
Daniel@0: $.effects.save( el, props );
Daniel@0: el.show();
Daniel@0: $.effects.createWrapper( el );
Daniel@0:
Daniel@0: // Animation
Daniel@0: animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance;
Daniel@0: animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2;
Daniel@0: animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2;
Daniel@0:
Daniel@0: // Animate
Daniel@0: el.animate( animation, speed, o.easing );
Daniel@0:
Daniel@0: // Shakes
Daniel@0: for ( i = 1; i < times; i++ ) {
Daniel@0: el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing );
Daniel@0: }
Daniel@0: el
Daniel@0: .animate( animation1, speed, o.easing )
Daniel@0: .animate( animation, speed / 2, o.easing )
Daniel@0: .queue(function() {
Daniel@0: if ( mode === "hide" ) {
Daniel@0: el.hide();
Daniel@0: }
Daniel@0: $.effects.restore( el, props );
Daniel@0: $.effects.removeWrapper( el );
Daniel@0: done();
Daniel@0: });
Daniel@0:
Daniel@0: // inject all the animations we just queued to be first in line (after "inprogress")
Daniel@0: if ( queuelen > 1) {
Daniel@0: queue.splice.apply( queue,
Daniel@0: [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
Daniel@0: }
Daniel@0: el.dequeue();
Daniel@0:
Daniel@0: };
Daniel@0:
Daniel@0:
Daniel@0: /*!
Daniel@0: * jQuery UI Effects Slide 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/slide-effect/
Daniel@0: */
Daniel@0:
Daniel@0:
Daniel@0: var effectSlide = $.effects.effect.slide = function( o, done ) {
Daniel@0:
Daniel@0: // Create element
Daniel@0: var el = $( this ),
Daniel@0: props = [ "position", "top", "bottom", "left", "right", "width", "height" ],
Daniel@0: mode = $.effects.setMode( el, o.mode || "show" ),
Daniel@0: show = mode === "show",
Daniel@0: direction = o.direction || "left",
Daniel@0: ref = (direction === "up" || direction === "down") ? "top" : "left",
Daniel@0: positiveMotion = (direction === "up" || direction === "left"),
Daniel@0: distance,
Daniel@0: animation = {};
Daniel@0:
Daniel@0: // Adjust
Daniel@0: $.effects.save( el, props );
Daniel@0: el.show();
Daniel@0: distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true );
Daniel@0:
Daniel@0: $.effects.createWrapper( el ).css({
Daniel@0: overflow: "hidden"
Daniel@0: });
Daniel@0:
Daniel@0: if ( show ) {
Daniel@0: el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance );
Daniel@0: }
Daniel@0:
Daniel@0: // Animation
Daniel@0: animation[ ref ] = ( show ?
Daniel@0: ( positiveMotion ? "+=" : "-=") :
Daniel@0: ( positiveMotion ? "-=" : "+=")) +
Daniel@0: distance;
Daniel@0:
Daniel@0: // Animate
Daniel@0: el.animate( animation, {
Daniel@0: queue: false,
Daniel@0: duration: o.duration,
Daniel@0: easing: o.easing,
Daniel@0: complete: function() {
Daniel@0: if ( mode === "hide" ) {
Daniel@0: el.hide();
Daniel@0: }
Daniel@0: $.effects.restore( el, props );
Daniel@0: $.effects.removeWrapper( el );
Daniel@0: done();
Daniel@0: }
Daniel@0: });
Daniel@0: };
Daniel@0:
Daniel@0:
Daniel@0: /*!
Daniel@0: * jQuery UI Effects Transfer 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/transfer-effect/
Daniel@0: */
Daniel@0:
Daniel@0:
Daniel@0: var effectTransfer = $.effects.effect.transfer = function( o, done ) {
Daniel@0: var elem = $( this ),
Daniel@0: target = $( o.to ),
Daniel@0: targetFixed = target.css( "position" ) === "fixed",
Daniel@0: body = $("body"),
Daniel@0: fixTop = targetFixed ? body.scrollTop() : 0,
Daniel@0: fixLeft = targetFixed ? body.scrollLeft() : 0,
Daniel@0: endPosition = target.offset(),
Daniel@0: animation = {
Daniel@0: top: endPosition.top - fixTop,
Daniel@0: left: endPosition.left - fixLeft,
Daniel@0: height: target.innerHeight(),
Daniel@0: width: target.innerWidth()
Daniel@0: },
Daniel@0: startPosition = elem.offset(),
Daniel@0: transfer = $( "
" )
Daniel@0: .appendTo( document.body )
Daniel@0: .addClass( o.className )
Daniel@0: .css({
Daniel@0: top: startPosition.top - fixTop,
Daniel@0: left: startPosition.left - fixLeft,
Daniel@0: height: elem.innerHeight(),
Daniel@0: width: elem.innerWidth(),
Daniel@0: position: targetFixed ? "fixed" : "absolute"
Daniel@0: })
Daniel@0: .animate( animation, o.duration, o.easing, function() {
Daniel@0: transfer.remove();
Daniel@0: done();
Daniel@0: });
Daniel@0: };
Daniel@0:
Daniel@0:
Daniel@0: /*!
Daniel@0: * jQuery UI Progressbar 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/progressbar/
Daniel@0: */
Daniel@0:
Daniel@0:
Daniel@0: var progressbar = $.widget( "ui.progressbar", {
Daniel@0: version: "1.11.0",
Daniel@0: options: {
Daniel@0: max: 100,
Daniel@0: value: 0,
Daniel@0:
Daniel@0: change: null,
Daniel@0: complete: null
Daniel@0: },
Daniel@0:
Daniel@0: min: 0,
Daniel@0:
Daniel@0: _create: function() {
Daniel@0: // Constrain initial value
Daniel@0: this.oldValue = this.options.value = this._constrainedValue();
Daniel@0:
Daniel@0: this.element
Daniel@0: .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
Daniel@0: .attr({
Daniel@0: // Only set static values, aria-valuenow and aria-valuemax are
Daniel@0: // set inside _refreshValue()
Daniel@0: role: "progressbar",
Daniel@0: "aria-valuemin": this.min
Daniel@0: });
Daniel@0:
Daniel@0: this.valueDiv = $( "" )
Daniel@0: .appendTo( this.element );
Daniel@0:
Daniel@0: this._refreshValue();
Daniel@0: },
Daniel@0:
Daniel@0: _destroy: function() {
Daniel@0: this.element
Daniel@0: .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
Daniel@0: .removeAttr( "role" )
Daniel@0: .removeAttr( "aria-valuemin" )
Daniel@0: .removeAttr( "aria-valuemax" )
Daniel@0: .removeAttr( "aria-valuenow" );
Daniel@0:
Daniel@0: this.valueDiv.remove();
Daniel@0: },
Daniel@0:
Daniel@0: value: function( newValue ) {
Daniel@0: if ( newValue === undefined ) {
Daniel@0: return this.options.value;
Daniel@0: }
Daniel@0:
Daniel@0: this.options.value = this._constrainedValue( newValue );
Daniel@0: this._refreshValue();
Daniel@0: },
Daniel@0:
Daniel@0: _constrainedValue: function( newValue ) {
Daniel@0: if ( newValue === undefined ) {
Daniel@0: newValue = this.options.value;
Daniel@0: }
Daniel@0:
Daniel@0: this.indeterminate = newValue === false;
Daniel@0:
Daniel@0: // sanitize value
Daniel@0: if ( typeof newValue !== "number" ) {
Daniel@0: newValue = 0;
Daniel@0: }
Daniel@0:
Daniel@0: return this.indeterminate ? false :
Daniel@0: Math.min( this.options.max, Math.max( this.min, newValue ) );
Daniel@0: },
Daniel@0:
Daniel@0: _setOptions: function( options ) {
Daniel@0: // Ensure "value" option is set after other values (like max)
Daniel@0: var value = options.value;
Daniel@0: delete options.value;
Daniel@0:
Daniel@0: this._super( options );
Daniel@0:
Daniel@0: this.options.value = this._constrainedValue( value );
Daniel@0: this._refreshValue();
Daniel@0: },
Daniel@0:
Daniel@0: _setOption: function( key, value ) {
Daniel@0: if ( key === "max" ) {
Daniel@0: // Don't allow a max less than min
Daniel@0: value = Math.max( this.min, value );
Daniel@0: }
Daniel@0: if ( key === "disabled" ) {
Daniel@0: this.element
Daniel@0: .toggleClass( "ui-state-disabled", !!value )
Daniel@0: .attr( "aria-disabled", value );
Daniel@0: }
Daniel@0: this._super( key, value );
Daniel@0: },
Daniel@0:
Daniel@0: _percentage: function() {
Daniel@0: return this.indeterminate ? 100 : 100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
Daniel@0: },
Daniel@0:
Daniel@0: _refreshValue: function() {
Daniel@0: var value = this.options.value,
Daniel@0: percentage = this._percentage();
Daniel@0:
Daniel@0: this.valueDiv
Daniel@0: .toggle( this.indeterminate || value > this.min )
Daniel@0: .toggleClass( "ui-corner-right", value === this.options.max )
Daniel@0: .width( percentage.toFixed(0) + "%" );
Daniel@0:
Daniel@0: this.element.toggleClass( "ui-progressbar-indeterminate", this.indeterminate );
Daniel@0:
Daniel@0: if ( this.indeterminate ) {
Daniel@0: this.element.removeAttr( "aria-valuenow" );
Daniel@0: if ( !this.overlayDiv ) {
Daniel@0: this.overlayDiv = $( "
" ).appendTo( this.valueDiv );
Daniel@0: }
Daniel@0: } else {
Daniel@0: this.element.attr({
Daniel@0: "aria-valuemax": this.options.max,
Daniel@0: "aria-valuenow": value
Daniel@0: });
Daniel@0: if ( this.overlayDiv ) {
Daniel@0: this.overlayDiv.remove();
Daniel@0: this.overlayDiv = null;
Daniel@0: }
Daniel@0: }
Daniel@0:
Daniel@0: if ( this.oldValue !== value ) {
Daniel@0: this.oldValue = value;
Daniel@0: this._trigger( "change" );
Daniel@0: }
Daniel@0: if ( value === this.options.max ) {
Daniel@0: this._trigger( "complete" );
Daniel@0: }
Daniel@0: }
Daniel@0: });
Daniel@0:
Daniel@0:
Daniel@0: /*!
Daniel@0: * jQuery UI Selectable 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/selectable/
Daniel@0: */
Daniel@0:
Daniel@0:
Daniel@0: var selectable = $.widget("ui.selectable", $.ui.mouse, {
Daniel@0: version: "1.11.0",
Daniel@0: options: {
Daniel@0: appendTo: "body",
Daniel@0: autoRefresh: true,
Daniel@0: distance: 0,
Daniel@0: filter: "*",
Daniel@0: tolerance: "touch",
Daniel@0:
Daniel@0: // callbacks
Daniel@0: selected: null,
Daniel@0: selecting: null,
Daniel@0: start: null,
Daniel@0: stop: null,
Daniel@0: unselected: null,
Daniel@0: unselecting: null
Daniel@0: },
Daniel@0: _create: function() {
Daniel@0: var selectees,
Daniel@0: that = this;
Daniel@0:
Daniel@0: this.element.addClass("ui-selectable");
Daniel@0:
Daniel@0: this.dragged = false;
Daniel@0:
Daniel@0: // cache selectee children based on filter
Daniel@0: this.refresh = function() {
Daniel@0: selectees = $(that.options.filter, that.element[0]);
Daniel@0: selectees.addClass("ui-selectee");
Daniel@0: selectees.each(function() {
Daniel@0: var $this = $(this),
Daniel@0: pos = $this.offset();
Daniel@0: $.data(this, "selectable-item", {
Daniel@0: element: this,
Daniel@0: $element: $this,
Daniel@0: left: pos.left,
Daniel@0: top: pos.top,
Daniel@0: right: pos.left + $this.outerWidth(),
Daniel@0: bottom: pos.top + $this.outerHeight(),
Daniel@0: startselected: false,
Daniel@0: selected: $this.hasClass("ui-selected"),
Daniel@0: selecting: $this.hasClass("ui-selecting"),
Daniel@0: unselecting: $this.hasClass("ui-unselecting")
Daniel@0: });
Daniel@0: });
Daniel@0: };
Daniel@0: this.refresh();
Daniel@0:
Daniel@0: this.selectees = selectees.addClass("ui-selectee");
Daniel@0:
Daniel@0: this._mouseInit();
Daniel@0:
Daniel@0: this.helper = $("
");
Daniel@0: },
Daniel@0:
Daniel@0: _destroy: function() {
Daniel@0: this.selectees
Daniel@0: .removeClass("ui-selectee")
Daniel@0: .removeData("selectable-item");
Daniel@0: this.element
Daniel@0: .removeClass("ui-selectable ui-selectable-disabled");
Daniel@0: this._mouseDestroy();
Daniel@0: },
Daniel@0:
Daniel@0: _mouseStart: function(event) {
Daniel@0: var that = this,
Daniel@0: options = this.options;
Daniel@0:
Daniel@0: this.opos = [ event.pageX, event.pageY ];
Daniel@0:
Daniel@0: if (this.options.disabled) {
Daniel@0: return;
Daniel@0: }
Daniel@0:
Daniel@0: this.selectees = $(options.filter, this.element[0]);
Daniel@0:
Daniel@0: this._trigger("start", event);
Daniel@0:
Daniel@0: $(options.appendTo).append(this.helper);
Daniel@0: // position helper (lasso)
Daniel@0: this.helper.css({
Daniel@0: "left": event.pageX,
Daniel@0: "top": event.pageY,
Daniel@0: "width": 0,
Daniel@0: "height": 0
Daniel@0: });
Daniel@0:
Daniel@0: if (options.autoRefresh) {
Daniel@0: this.refresh();
Daniel@0: }
Daniel@0:
Daniel@0: this.selectees.filter(".ui-selected").each(function() {
Daniel@0: var selectee = $.data(this, "selectable-item");
Daniel@0: selectee.startselected = true;
Daniel@0: if (!event.metaKey && !event.ctrlKey) {
Daniel@0: selectee.$element.removeClass("ui-selected");
Daniel@0: selectee.selected = false;
Daniel@0: selectee.$element.addClass("ui-unselecting");
Daniel@0: selectee.unselecting = true;
Daniel@0: // selectable UNSELECTING callback
Daniel@0: that._trigger("unselecting", event, {
Daniel@0: unselecting: selectee.element
Daniel@0: });
Daniel@0: }
Daniel@0: });
Daniel@0:
Daniel@0: $(event.target).parents().addBack().each(function() {
Daniel@0: var doSelect,
Daniel@0: selectee = $.data(this, "selectable-item");
Daniel@0: if (selectee) {
Daniel@0: doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass("ui-selected");
Daniel@0: selectee.$element
Daniel@0: .removeClass(doSelect ? "ui-unselecting" : "ui-selected")
Daniel@0: .addClass(doSelect ? "ui-selecting" : "ui-unselecting");
Daniel@0: selectee.unselecting = !doSelect;
Daniel@0: selectee.selecting = doSelect;
Daniel@0: selectee.selected = doSelect;
Daniel@0: // selectable (UN)SELECTING callback
Daniel@0: if (doSelect) {
Daniel@0: that._trigger("selecting", event, {
Daniel@0: selecting: selectee.element
Daniel@0: });
Daniel@0: } else {
Daniel@0: that._trigger("unselecting", event, {
Daniel@0: unselecting: selectee.element
Daniel@0: });
Daniel@0: }
Daniel@0: return false;
Daniel@0: }
Daniel@0: });
Daniel@0:
Daniel@0: },
Daniel@0:
Daniel@0: _mouseDrag: function(event) {
Daniel@0:
Daniel@0: this.dragged = true;
Daniel@0:
Daniel@0: if (this.options.disabled) {
Daniel@0: return;
Daniel@0: }
Daniel@0:
Daniel@0: var tmp,
Daniel@0: that = this,
Daniel@0: options = this.options,
Daniel@0: x1 = this.opos[0],
Daniel@0: y1 = this.opos[1],
Daniel@0: x2 = event.pageX,
Daniel@0: y2 = event.pageY;
Daniel@0:
Daniel@0: if (x1 > x2) { tmp = x2; x2 = x1; x1 = tmp; }
Daniel@0: if (y1 > y2) { tmp = y2; y2 = y1; y1 = tmp; }
Daniel@0: this.helper.css({ left: x1, top: y1, width: x2 - x1, height: y2 - y1 });
Daniel@0:
Daniel@0: this.selectees.each(function() {
Daniel@0: var selectee = $.data(this, "selectable-item"),
Daniel@0: hit = false;
Daniel@0:
Daniel@0: //prevent helper from being selected if appendTo: selectable
Daniel@0: if (!selectee || selectee.element === that.element[0]) {
Daniel@0: return;
Daniel@0: }
Daniel@0:
Daniel@0: if (options.tolerance === "touch") {
Daniel@0: hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
Daniel@0: } else if (options.tolerance === "fit") {
Daniel@0: hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
Daniel@0: }
Daniel@0:
Daniel@0: if (hit) {
Daniel@0: // SELECT
Daniel@0: if (selectee.selected) {
Daniel@0: selectee.$element.removeClass("ui-selected");
Daniel@0: selectee.selected = false;
Daniel@0: }
Daniel@0: if (selectee.unselecting) {
Daniel@0: selectee.$element.removeClass("ui-unselecting");
Daniel@0: selectee.unselecting = false;
Daniel@0: }
Daniel@0: if (!selectee.selecting) {
Daniel@0: selectee.$element.addClass("ui-selecting");
Daniel@0: selectee.selecting = true;
Daniel@0: // selectable SELECTING callback
Daniel@0: that._trigger("selecting", event, {
Daniel@0: selecting: selectee.element
Daniel@0: });
Daniel@0: }
Daniel@0: } else {
Daniel@0: // UNSELECT
Daniel@0: if (selectee.selecting) {
Daniel@0: if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
Daniel@0: selectee.$element.removeClass("ui-selecting");
Daniel@0: selectee.selecting = false;
Daniel@0: selectee.$element.addClass("ui-selected");
Daniel@0: selectee.selected = true;
Daniel@0: } else {
Daniel@0: selectee.$element.removeClass("ui-selecting");
Daniel@0: selectee.selecting = false;
Daniel@0: if (selectee.startselected) {
Daniel@0: selectee.$element.addClass("ui-unselecting");
Daniel@0: selectee.unselecting = true;
Daniel@0: }
Daniel@0: // selectable UNSELECTING callback
Daniel@0: that._trigger("unselecting", event, {
Daniel@0: unselecting: selectee.element
Daniel@0: });
Daniel@0: }
Daniel@0: }
Daniel@0: if (selectee.selected) {
Daniel@0: if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
Daniel@0: selectee.$element.removeClass("ui-selected");
Daniel@0: selectee.selected = false;
Daniel@0:
Daniel@0: selectee.$element.addClass("ui-unselecting");
Daniel@0: selectee.unselecting = true;
Daniel@0: // selectable UNSELECTING callback
Daniel@0: that._trigger("unselecting", event, {
Daniel@0: unselecting: selectee.element
Daniel@0: });
Daniel@0: }
Daniel@0: }
Daniel@0: }
Daniel@0: });
Daniel@0:
Daniel@0: return false;
Daniel@0: },
Daniel@0:
Daniel@0: _mouseStop: function(event) {
Daniel@0: var that = this;
Daniel@0:
Daniel@0: this.dragged = false;
Daniel@0:
Daniel@0: $(".ui-unselecting", this.element[0]).each(function() {
Daniel@0: var selectee = $.data(this, "selectable-item");
Daniel@0: selectee.$element.removeClass("ui-unselecting");
Daniel@0: selectee.unselecting = false;
Daniel@0: selectee.startselected = false;
Daniel@0: that._trigger("unselected", event, {
Daniel@0: unselected: selectee.element
Daniel@0: });
Daniel@0: });
Daniel@0: $(".ui-selecting", this.element[0]).each(function() {
Daniel@0: var selectee = $.data(this, "selectable-item");
Daniel@0: selectee.$element.removeClass("ui-selecting").addClass("ui-selected");
Daniel@0: selectee.selecting = false;
Daniel@0: selectee.selected = true;
Daniel@0: selectee.startselected = true;
Daniel@0: that._trigger("selected", event, {
Daniel@0: selected: selectee.element
Daniel@0: });
Daniel@0: });
Daniel@0: this._trigger("stop", event);
Daniel@0:
Daniel@0: this.helper.remove();
Daniel@0:
Daniel@0: return false;
Daniel@0: }
Daniel@0:
Daniel@0: });
Daniel@0:
Daniel@0:
Daniel@0: /*!
Daniel@0: * jQuery UI Selectmenu 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/selectmenu
Daniel@0: */
Daniel@0:
Daniel@0:
Daniel@0: var selectmenu = $.widget( "ui.selectmenu", {
Daniel@0: version: "1.11.0",
Daniel@0: defaultElement: "