Вход Регистрация
Файл: contao-3.5.8/assets/jquery/ui/1.11.4/jquery-ui.js
Строк: 1693
<?php
/*! jQuery UI - v1.11.4 - 2015-03-23
* http://jqueryui.com
* Includes: core.js, widget.js, accordion.js
* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */

(function( factory ) {
    if ( 
typeof define === "function" && define.amd ) {

        
// AMD. Register as an anonymous module.
        
define([ "jquery" ], factory );
    } else {

        
// Browser globals
        
factoryjQuery );
    }
}(function( $ ) {
/*!
 * jQuery UI Core 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/category/ui-core/
 */


// $.ui might exist from components with no dependencies, e.g., $.ui.position
$.ui = $.ui || {};

$.
extend( $.ui, {
    
version"1.11.4",

    
keyCode: {
        
BACKSPACE8,
        
COMMA188,
        
DELETE46,
        
DOWN40,
        
END35,
        
ENTER13,
        
ESCAPE27,
        
HOME36,
        
LEFT37,
        
PAGE_DOWN34,
        
PAGE_UP33,
        
PERIOD190,
        
RIGHT39,
        
SPACE32,
        
TAB9,
        
UP38
    
}
});

// plugins
$.fn.extend({
    
scrollParent: function( includeHidden ) {
        var 
position this.css"position" ),
            
excludeStaticParent position === "absolute",
            
overflowRegex includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
            
scrollParent this.parents().filter( function() {
                var 
parent = $( this );
                if ( 
excludeStaticParent && parent.css"position" ) === "static" ) {
                    return 
false;
                }
                return 
overflowRegex.testparent.css"overflow" ) + parent.css"overflow-y" ) + parent.css"overflow-x" ) );
            }).
eq);

        return 
position === "fixed" || !scrollParent.length ? $( this].ownerDocument || document ) : scrollParent;
    },

    
uniqueId: (function() {
        var 
uuid 0;

        return function() {
            return 
this.each(function() {
                if ( !
this.id ) {
                    
this.id "ui-id-" + ( ++uuid );
                }
            });
        };
    })(),

    
removeUniqueId: function() {
        return 
this.each(function() {
            if ( /^
ui-id-d+$/.testthis.id ) ) {
                $( 
this ).removeAttr"id" );
            }
        });
    }
});

// selectors
function focusableelementisTabIndexNotNaN ) {
    var 
mapmapNameimg,
        
nodeName element.nodeName.toLowerCase();
    if ( 
"area" === nodeName ) {
        
map element.parentNode;
        
mapName map.name;
        if ( !
element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
            return 
false;
        }
        
img = $( "img[usemap='#" mapName "']" )[ ];
        return !!
img && visibleimg );
    }
    return ( /^(
input|select|textarea|button|object)$/.testnodeName ) ?
        !
element.disabled :
        
"a" === nodeName ?
            
element.href || isTabIndexNotNaN :
            
isTabIndexNotNaN) &&
        
// the element and all of its ancestors must be visible
        
visibleelement );
}

function 
visibleelement ) {
    return $.
expr.filters.visibleelement ) &&
        !$( 
element ).parents().addBack().filter(function() {
            return $.
cssthis"visibility" ) === "hidden";
        }).
length;
}

$.
extend( $.expr":" ], {
    
data: $.expr.createPseudo ?
        $.
expr.createPseudo(function( dataName ) {
            return function( 
elem ) {
                return !!$.
dataelemdataName );
            };
        }) :
        
// support: jQuery <1.8
        
function( elemimatch ) {
            return !!$.
dataelemmatch] );
        },

    
focusable: function( element ) {
        return 
focusableelement, !isNaN( $.attrelement"tabindex" ) ) );
    },

    
tabbable: function( element ) {
        var 
tabIndex = $.attrelement"tabindex" ),
            
isTabIndexNaN isNaNtabIndex );
        return ( 
isTabIndexNaN || tabIndex >= ) && focusableelement, !isTabIndexNaN );
    }
});

// support: jQuery <1.8
if ( !$( "<a>" ).outerWidth).jquery ) {
    $.
each( [ "Width""Height" ], function( iname ) {
        var 
side name === "Width" ? [ "Left""Right" ] : [ "Top""Bottom" ],
            
type name.toLowerCase(),
            
orig = {
                
innerWidth: $.fn.innerWidth,
                
innerHeight: $.fn.innerHeight,
                
outerWidth: $.fn.outerWidth,
                
outerHeight: $.fn.outerHeight
            
};

        function 
reduceelemsizebordermargin ) {
            $.
eachside, function() {
                
size -= parseFloat( $.csselem"padding" this ) ) || 0;
                if ( 
border ) {
                    
size -= parseFloat( $.csselem"border" this "Width" ) ) || 0;
                }
                if ( 
margin ) {
                    
size -= parseFloat( $.csselem"margin" this ) ) || 0;
                }
            });
            return 
size;
        }

        $.
fn"inner" name ] = function( size ) {
            if ( 
size === undefined ) {
                return 
orig"inner" name ].callthis );
            }

            return 
this.each(function() {
                $( 
this ).csstypereducethissize ) + "px" );
            });
        };

        $.
fn"outer" name] = function( sizemargin ) {
            if ( 
typeof size !== "number" ) {
                return 
orig"outer" name ].callthissize );
            }

            return 
this.each(function() {
                $( 
this).csstypereducethissizetruemargin ) + "px" );
            });
        };
    });
}

// support: jQuery <1.8
if ( !$.fn.addBack ) {
    $.
fn.addBack = function( selector ) {
        return 
this.addselector == null ?
            
this.prevObject this.prevObject.filterselector )
        );
    };
}

// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
if ( $( "<a>" ).data"a-b""a" ).removeData"a-b" ).data"a-b" ) ) {
    $.
fn.removeData = (function( removeData ) {
        return function( 
key ) {
            if ( 
arguments.length ) {
                return 
removeData.callthis, $.camelCasekey ) );
            } else {
                return 
removeData.callthis );
            }
        };
    })( $.
fn.removeData );
}

// deprecated
$.ui.ie = !!/msie [w.]+/.execnavigator.userAgent.toLowerCase() );

$.
fn.extend({
    
focus: (function( orig ) {
        return function( 
delayfn ) {
            return 
typeof delay === "number" ?
                
this.each(function() {
                    var 
elem this;
                    
setTimeout(function() {
                        $( 
elem ).focus();
                        if ( 
fn ) {
                            
fn.callelem );
                        }
                    }, 
delay );
                }) :
                
orig.applythisarguments );
        };
    })( $.
fn.focus ),

    
disableSelection: (function() {
        var 
eventType "onselectstart" in document.createElement"div" ) ?
            
"selectstart" :
            
"mousedown";

        return function() {
            return 
this.bindeventType ".ui-disableSelection", function( event ) {
                
event.preventDefault();
            });
        };
    })(),

    
enableSelection: function() {
        return 
this.unbind".ui-disableSelection" );
    },

    
zIndex: function( zIndex ) {
        if ( 
zIndex !== undefined ) {
            return 
this.css"zIndex"zIndex );
        }

        if ( 
this.length ) {
            var 
elem = $( this] ), positionvalue;
            while ( 
elem.length && elem] !== document ) {
                
// Ignore z-index if position is set to a value where z-index is ignored by the browser
                // This makes behavior of this function consistent across browsers
                // WebKit always returns auto if the element is positioned
                
position elem.css"position" );
                if ( 
position === "absolute" || position === "relative" || position === "fixed" ) {
                    
// IE returns 0 when zIndex is not specified
                    // other browsers return a string
                    // we ignore the case of nested elements with an explicit value of 0
                    // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
                    
value parseIntelem.css"zIndex" ), 10 );
                    if ( !
isNaNvalue ) && value !== ) {
                        return 
value;
                    }
                }
                
elem elem.parent();
            }
        }

        return 
0;
    }
});

// $.ui.plugin is deprecated. Use $.widget() extensions instead.
$.ui.plugin = {
    
add: function( moduleoptionset ) {
        var 
i,
            
proto = $.uimodule ].prototype;
        for ( 
i in set ) {
            
proto.plugins] = proto.plugins] || [];
            
proto.plugins].push( [ optionset] ] );
        }
    },
    
call: function( instancenameargsallowDisconnected ) {
        var 
i,
            
set instance.pluginsname ];

        if ( !
set ) {
            return;
        }

        if ( !
allowDisconnected && ( !instance.element].parentNode || instance.element].parentNode.nodeType === 11 ) ) {
            return;
        }

        for ( 
0set.lengthi++ ) {
            if ( 
instance.optionsset][ ] ] ) {
                
set][ ].applyinstance.elementargs );
            }
        }
    }
};


/*!
 * jQuery UI Widget 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/jQuery.widget/
 */


var widget_uuid 0,
    
widget_slice = Array.prototype.slice;

$.
cleanData = (function( orig ) {
    return function( 
elems ) {
        var 
eventselemi;
        for ( 
0; (elem elems[i]) != nulli++ ) {
            try {

                
// Only trigger remove when necessary to save time
                
events = $._dataelem"events" );
                if ( 
events && events.remove ) {
                    $( 
elem ).triggerHandler"remove" );
                }

            
// http://bugs.jquery.com/ticket/8235
            
} catch ( ) {}
        }
        
origelems );
    };
})( $.
cleanData );

$.
widget = function( namebaseprototype ) {
    var 
fullNameexistingConstructorconstructorbasePrototype,
        
// proxiedPrototype allows the provided prototype to remain unmodified
        // so that it can be used as a mixin for multiple widgets (#8876)
        
proxiedPrototype = {},
        namespace = 
name.split"." )[ ];

    
name name.split"." )[ ];
    
fullName = namespace + "-" name;

    if ( !
prototype ) {
        
prototype base;
        
base = $.Widget;
    }

    
// create selector for plugin
    
$.expr":" ][ fullName.toLowerCase() ] = function( elem ) {
        return !!$.
dataelemfullName );
    };

    $[ namespace ] = $[ namespace ] || {};
    
existingConstructor = $[ namespace ][ name ];
    
constructor = $[ namespace ][ name ] = function( optionselement ) {
        
// allow instantiation without "new" keyword
        
if ( !this._createWidget ) {
            return new 
constructoroptionselement );
        }

        
// allow instantiation without initializing for simple inheritance
        // must use "new" keyword (the code above always passes args)
        
if ( arguments.length ) {
            
this._createWidgetoptionselement );
        }
    };
    
// extend with the existing constructor to carry over any static properties
    
$.extendconstructorexistingConstructor, {
        
versionprototype.version,
        
// copy the object used to create the prototype in case we need to
        // redefine the widget later
        
_proto: $.extend( {}, prototype ),
        
// track widgets that inherit from this widget in case this widget is
        // redefined after a widget inherits from it
        
_childConstructors: []
    });

    
basePrototype = new base();
    
// we need to make the options hash a property directly on the new instance
    // otherwise we'll modify the options hash on the prototype that we're
    // inheriting from
    
basePrototype.options = $.widget.extend( {}, basePrototype.options );
    $.
eachprototype, function( propvalue ) {
        if ( !$.
isFunctionvalue ) ) {
            
proxiedPrototypeprop ] = value;
            return;
        }
        
proxiedPrototypeprop ] = (function() {
            var 
_super = function() {
                    return 
base.prototypeprop ].applythisarguments );
                },
                
_superApply = function( args ) {
                    return 
base.prototypeprop ].applythisargs );
                };
            return function() {
                var 
__super this._super,
                    
__superApply this._superApply,
                    
returnValue;

                
this._super _super;
                
this._superApply _superApply;

                
returnValue value.applythisarguments );

                
this._super __super;
                
this._superApply __superApply;

                return 
returnValue;
            };
        })();
    });
    
constructor.prototype = $.widget.extendbasePrototype, {
        
// TODO: remove support for widgetEventPrefix
        // always use the name + a colon as the prefix, e.g., draggable:start
        // don't prefix for widgets that aren't DOM-based
        
widgetEventPrefixexistingConstructor ? (basePrototype.widgetEventPrefix || name) : name
    
}, proxiedPrototype, {
        
constructorconstructor,
        namespace: namespace,
        
widgetNamename,
        
widgetFullNamefullName
    
});

    
// If this widget is being redefined then we need to find all widgets that
    // are inheriting from it and redefine all of them so that they inherit from
    // the new version of this widget. We're essentially trying to replace one
    // level in the prototype chain.
    
if ( existingConstructor ) {
        $.
eachexistingConstructor._childConstructors, function( ichild ) {
            var 
childPrototype child.prototype;

            
// redefine the child widget using the same prototype that was
            // originally used, but inherit from the new version of the base
            
$.widgetchildPrototype.namespace + "." childPrototype.widgetNameconstructorchild._proto );
        });
        
// remove the list of existing child constructors from the old constructor
        // so the old child constructors can be garbage collected
        
delete existingConstructor._childConstructors;
    } else {
        
base._childConstructors.pushconstructor );
    }

    $.
widget.bridgenameconstructor );

    return 
constructor;
};

$.
widget.extend = function( target ) {
    var 
input widget_slice.callarguments),
        
inputIndex 0,
        
inputLength input.length,
        
key,
        
value;
    for ( ; 
inputIndex inputLengthinputIndex++ ) {
        for ( 
key in inputinputIndex ] ) {
            
value inputinputIndex ][ key ];
            if ( 
inputinputIndex ].hasOwnPropertykey ) && value !== undefined ) {
                
// Clone objects
                
if ( $.isPlainObjectvalue ) ) {
                    
targetkey ] = $.isPlainObjecttargetkey ] ) ?
                        $.
widget.extend( {}, targetkey ], value ) :
                        
// Don't extend strings, arrays, etc. with objects
                        
$.widget.extend( {}, value );
                
// Copy everything else by reference
                
} else {
                    
targetkey ] = value;
                }
            }
        }
    }
    return 
target;
};

$.
widget.bridge = function( nameobject ) {
    var 
fullName object.prototype.widgetFullName || name;
    $.
fnname ] = function( options ) {
        var 
isMethodCall typeof options === "string",
            
args widget_slice.callarguments),
            
returnValue this;

        if ( 
isMethodCall ) {
            
this.each(function() {
                var 
methodValue,
                    
instance = $.datathisfullName );
                if ( 
options === "instance" ) {
                    
returnValue instance;
                    return 
false;
                }
                if ( !
instance ) {
                    return $.
error"cannot call methods on " name " prior to initialization; " +
                        
"attempted to call method '" options "'" );
                }
                if ( !$.
isFunctioninstance[options] ) || options.charAt) === "_" ) {
                    return $.
error"no such method '" options "' for " name " widget instance" );
                }
                
methodValue instanceoptions ].applyinstanceargs );
                if ( 
methodValue !== instance && methodValue !== undefined ) {
                    
returnValue methodValue && methodValue.jquery ?
                        
returnValue.pushStackmethodValue.get() ) :
                        
methodValue;
                    return 
false;
                }
            });
        } else {

            
// Allow multiple hashes to be passed on init
            
if ( args.length ) {
                
options = $.widget.extend.applynull, [ options ].concat(args) );
            }

            
this.each(function() {
                var 
instance = $.datathisfullName );
                if ( 
instance ) {
                    
instance.optionoptions || {} );
                    if ( 
instance._init ) {
                        
instance._init();
                    }
                } else {
                    $.
datathisfullName, new objectoptionsthis ) );
                }
            });
        }

        return 
returnValue;
    };
};

$.
Widget = function( /* options, element */ ) {};
$.
Widget._childConstructors = [];

$.
Widget.prototype = {
    
widgetName"widget",
    
widgetEventPrefix"",
    
defaultElement"<div>",
    
options: {
        
disabledfalse,

        
// callbacks
        
createnull
    
},
    
_createWidget: function( optionselement ) {
        
element = $( element || this.defaultElement || this )[ ];
        
this.element = $( element );
        
this.uuid widget_uuid++;
        
this.eventNamespace "." this.widgetName this.uuid;

        
this.bindings = $();
        
this.hoverable = $();
        
this.focusable = $();

        if ( 
element !== this ) {
            $.
dataelementthis.widgetFullNamethis );
            
this._ontruethis.element, {
                
remove: function( event ) {
                    if ( 
event.target === element ) {
                        
this.destroy();
                    }
                }
            });
            
this.document = $( element.style ?
                
// element within the document
                
element.ownerDocument :
                
// element is window or document
                
element.document || element );
            
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
        }

        
this.options = $.widget.extend( {},
            
this.options,
            
this._getCreateOptions(),
            
options );

        
this._create();
        
this._trigger"create"nullthis._getCreateEventData() );
        
this._init();
    },
    
_getCreateOptions: $.noop,
    
_getCreateEventData: $.noop,
    
_create: $.noop,
    
_init: $.noop,

    
destroy: function() {
        
this._destroy();
        
// we can probably remove the unbind calls in 2.0
        // all event bindings should go through this._on()
        
this.element
            
.unbindthis.eventNamespace )
            .
removeDatathis.widgetFullName )
            
// support: jquery <1.6.3
            // http://bugs.jquery.com/ticket/9413
            
.removeData( $.camelCasethis.widgetFullName ) );
        
this.widget()
            .
unbindthis.eventNamespace )
            .
removeAttr"aria-disabled" )
            .
removeClass(
                
this.widgetFullName "-disabled " +
                
"ui-state-disabled" );

        
// clean up events and states
        
this.bindings.unbindthis.eventNamespace );
        
this.hoverable.removeClass"ui-state-hover" );
        
this.focusable.removeClass"ui-state-focus" );
    },
    
_destroy: $.noop,

    
widget: function() {
        return 
this.element;
    },

    
option: function( keyvalue ) {
        var 
options key,
            
parts,
            
curOption,
            
i;

        if ( 
arguments.length === ) {
            
// don't return a reference to the internal hash
            
return $.widget.extend( {}, this.options );
        }

        if ( 
typeof key === "string" ) {
            
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
            
options = {};
            
parts key.split"." );
            
key parts.shift();
            if ( 
parts.length ) {
                
curOption optionskey ] = $.widget.extend( {}, this.optionskey ] );
                for ( 
0parts.length 1i++ ) {
                    
curOptionparts] ] = curOptionparts] ] || {};
                    
curOption curOptionparts] ];
                }
                
key parts.pop();
                if ( 
arguments.length === ) {
                    return 
curOptionkey ] === undefined null curOptionkey ];
                }
                
curOptionkey ] = value;
            } else {
                if ( 
arguments.length === ) {
                    return 
this.optionskey ] === undefined null this.optionskey ];
                }
                
optionskey ] = value;
            }
        }

        
this._setOptionsoptions );

        return 
this;
    },
    
_setOptions: function( options ) {
        var 
key;

        for ( 
key in options ) {
            
this._setOptionkeyoptionskey ] );
        }

        return 
this;
    },
    
_setOption: function( keyvalue ) {
        
this.optionskey ] = value;

        if ( 
key === "disabled" ) {
            
this.widget()
                .
toggleClassthis.widgetFullName "-disabled", !!value );

            
// If the widget is becoming disabled, then nothing is interactive
            
if ( value ) {
                
this.hoverable.removeClass"ui-state-hover" );
                
this.focusable.removeClass"ui-state-focus" );
            }
        }

        return 
this;
    },

    
enable: function() {
        return 
this._setOptions({ disabledfalse });
    },
    
disable: function() {
        return 
this._setOptions({ disabledtrue });
    },

    
_on: function( suppressDisabledCheckelementhandlers ) {
        var 
delegateElement,
            
instance this;

        
// no suppressDisabledCheck flag, shuffle arguments
        
if ( typeof suppressDisabledCheck !== "boolean" ) {
            
handlers element;
            
element suppressDisabledCheck;
            
suppressDisabledCheck false;
        }

        
// no element argument, shuffle and use this.element
        
if ( !handlers ) {
            
handlers element;
            
element this.element;
            
delegateElement this.widget();
        } else {
            
element delegateElement = $( element );
            
this.bindings this.bindings.addelement );
        }

        $.
eachhandlers, function( eventhandler ) {
            function 
handlerProxy() {
                
// allow widgets to customize the disabled handling
                // - disabled as an array instead of boolean
                // - disabled class as method for disabling individual parts
                
if ( !suppressDisabledCheck &&
                        ( 
instance.options.disabled === true ||
                            $( 
this ).hasClass"ui-state-disabled" ) ) ) {
                    return;
                }
                return ( 
typeof handler === "string" instancehandler ] : handler )
                    .
applyinstancearguments );
            }

            
// copy the guid so direct unbinding works
            
if ( typeof handler !== "string" ) {
                
handlerProxy.guid handler.guid =
                    
handler.guid || handlerProxy.guid || $.guid++;
            }

            var 
match event.match( /^([w:-]*)s*(.*)$/ ),
                
eventName match[1] + instance.eventNamespace,
                
selector match[2];
            if ( 
selector ) {
                
delegateElement.delegateselectoreventNamehandlerProxy );
            } else {
                
element.bindeventNamehandlerProxy );
            }
        });
    },

    
_off: function( elementeventName ) {
        
eventName = (eventName || "").split" " ).jointhis.eventNamespace " " ) +
            
this.eventNamespace;
        
element.unbindeventName ).undelegateeventName );

        
// Clear the stack to avoid memory leaks (#10056)
        
this.bindings = $( this.bindings.notelement ).get() );
        
this.focusable = $( this.focusable.notelement ).get() );
        
this.hoverable = $( this.hoverable.notelement ).get() );
    },

    
_delay: function( handlerdelay ) {
        function 
handlerProxy() {
            return ( 
typeof handler === "string" instancehandler ] : handler )
                .
applyinstancearguments );
        }
        var 
instance this;
        return 
setTimeouthandlerProxydelay || );
    },

    
_hoverable: function( element ) {
        
this.hoverable this.hoverable.addelement );
        
this._onelement, {
            
mouseenter: function( event ) {
                $( 
event.currentTarget ).addClass"ui-state-hover" );
            },
            
mouseleave: function( event ) {
                $( 
event.currentTarget ).removeClass"ui-state-hover" );
            }
        });
    },

    
_focusable: function( element ) {
        
this.focusable this.focusable.addelement );
        
this._onelement, {
            
focusin: function( event ) {
                $( 
event.currentTarget ).addClass"ui-state-focus" );
            },
            
focusout: function( event ) {
                $( 
event.currentTarget ).removeClass"ui-state-focus" );
            }
        });
    },

    
_trigger: function( typeeventdata ) {
        var 
proporig,
            
callback this.optionstype ];

        
data data || {};
        
event = $.Eventevent );
        
event.type = ( type === this.widgetEventPrefix ?
            
type :
            
this.widgetEventPrefix type ).toLowerCase();
        
// the original event may come from any element
        // so we need to reset the target on the new event
        
event.target this.element];

        
// copy original event properties over to the new event
        
orig event.originalEvent;
        if ( 
orig ) {
            for ( 
prop in orig ) {
                if ( !( 
prop in event ) ) {
                    
eventprop ] = origprop ];
                }
            }
        }

        
this.element.triggereventdata );
        return !( $.
isFunctioncallback ) &&
            
callback.applythis.element[0], [ event ].concatdata ) ) === false ||
            
event.isDefaultPrevented() );
    }
};

$.
each( { show"fadeIn"hide"fadeOut" }, function( methoddefaultEffect ) {
    $.
Widget.prototype"_" method ] = function( elementoptionscallback ) {
        if ( 
typeof options === "string" ) {
            
options = { effectoptions };
        }
        var 
hasOptions,
            
effectName = !options ?
                
method :
                
options === true || typeof options === "number" ?
                    
defaultEffect :
                    
options.effect || defaultEffect;
        
options options || {};
        if ( 
typeof options === "number" ) {
            
options = { durationoptions };
        }
        
hasOptions = !$.isEmptyObjectoptions );
        
options.complete callback;
        if ( 
options.delay ) {
            
element.delayoptions.delay );
        }
        if ( 
hasOptions && $.effects && $.effects.effecteffectName ] ) {
            
elementmethod ]( options );
        } else if ( 
effectName !== method && elementeffectName ] ) {
            
elementeffectName ]( options.durationoptions.easingcallback );
        } else {
            
element.queue(function( next ) {
                $( 
this )[ method ]();
                if ( 
callback ) {
                    
callback.callelement] );
                }
                
next();
            });
        }
    };
});

var 
widget = $.widget;


/*!
 * jQuery UI Accordion 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/accordion/
 */


var accordion = $.widget"ui.accordion", {
    
version"1.11.4",
    
options: {
        
active0,
        
animate: {},
        
collapsiblefalse,
        
event"click",
        
header"> li > :first-child,> :not(li):even",
        
heightStyle"auto",
        
icons: {
            
activeHeader"ui-icon-triangle-1-s",
            
header"ui-icon-triangle-1-e"
        
},

        
// callbacks
        
activatenull,
        
beforeActivatenull
    
},

    
hideProps: {
        
borderTopWidth"hide",
        
borderBottomWidth"hide",
        
paddingTop"hide",
        
paddingBottom"hide",
        
height"hide"
    
},

    
showProps: {
        
borderTopWidth"show",
        
borderBottomWidth"show",
        
paddingTop"show",
        
paddingBottom"show",
        
height"show"
    
},

    
_create: function() {
        var 
options this.options;
        
this.prevShow this.prevHide = $();
        
this.element.addClass"ui-accordion ui-widget ui-helper-reset" )
            
// ARIA
            
.attr"role""tablist" );

        
// don't allow collapsible: false and active: false / null
        
if ( !options.collapsible && (options.active === false || options.active == null) ) {
            
options.active 0;
        }

        
this._processPanels();
        
// handle negative values
        
if ( options.active ) {
            
options.active += this.headers.length;
        }
        
this._refresh();
    },

    
_getCreateEventData: function() {
        return {
            
headerthis.active,
            
panel: !this.active.length ? $() : this.active.next()
        };
    },

    
_createIcons: function() {
        var 
icons this.options.icons;
        if ( 
icons ) {
            $( 
"<span>" )
                .
addClass"ui-accordion-header-icon ui-icon " icons.header )
                .
prependTothis.headers );
            
this.active.children".ui-accordion-header-icon" )
                .
removeClassicons.header )
                .
addClassicons.activeHeader );
            
this.headers.addClass"ui-accordion-icons" );
        }
    },

    
_destroyIcons: function() {
        
this.headers
            
.removeClass"ui-accordion-icons" )
            .
children".ui-accordion-header-icon" )
                .
remove();
    },

    
_destroy: function() {
        var 
contents;

        
// clean up main element
        
this.element
            
.removeClass"ui-accordion ui-widget ui-helper-reset" )
            .
removeAttr"role" );

        
// clean up headers
        
this.headers
            
.removeClass"ui-accordion-header ui-accordion-header-active ui-state-default " +
                
"ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
            .
removeAttr"role" )
            .
removeAttr"aria-expanded" )
            .
removeAttr"aria-selected" )
            .
removeAttr"aria-controls" )
            .
removeAttr"tabIndex" )
            .
removeUniqueId();

        
this._destroyIcons();

        
// clean up content panels
        
contents this.headers.next()
            .
removeClass"ui-helper-reset ui-widget-content ui-corner-bottom " +
                
"ui-accordion-content ui-accordion-content-active ui-state-disabled" )
            .
css"display""" )
            .
removeAttr"role" )
            .
removeAttr"aria-hidden" )
            .
removeAttr"aria-labelledby" )
            .
removeUniqueId();

        if ( 
this.options.heightStyle !== "content" ) {
            
contents.css"height""" );
        }
    },

    
_setOption: function( keyvalue ) {
        if ( 
key === "active" ) {
            
// _activate() will handle invalid values and update this.options
            
this._activatevalue );
            return;
        }

        if ( 
key === "event" ) {
            if ( 
this.options.event ) {
                
this._offthis.headersthis.options.event );
            }
            
this._setupEventsvalue );
        }

        
this._superkeyvalue );

        
// setting collapsible: false while collapsed; open first panel
        
if ( key === "collapsible" && !value && this.options.active === false ) {
            
this._activate);
        }

        if ( 
key === "icons" ) {
            
this._destroyIcons();
            if ( 
value ) {
                
this._createIcons();
            }
        }

        
// #5332 - opacity doesn't cascade to positioned elements in IE
        // so we need to add the disabled class to the headers and panels
        
if ( key === "disabled" ) {
            
this.element
                
.toggleClass"ui-state-disabled", !!value )
                .
attr"aria-disabled"value );
            
this.headers.addthis.headers.next() )
                .
toggleClass"ui-state-disabled", !!value );
        }
    },

    
_keydown: function( event ) {
        if ( 
event.altKey || event.ctrlKey ) {
            return;
        }

        var 
keyCode = $.ui.keyCode,
            
length this.headers.length,
            
currentIndex this.headers.indexevent.target ),
            
toFocus false;

        switch ( 
event.keyCode ) {
            case 
keyCode.RIGHT:
            case 
keyCode.DOWN:
                
toFocus this.headers[ ( currentIndex ) % length ];
                break;
            case 
keyCode.LEFT:
            case 
keyCode.UP:
                
toFocus this.headers[ ( currentIndex length ) % length ];
                break;
            case 
keyCode.SPACE:
            case 
keyCode.ENTER:
                
this._eventHandlerevent );
                break;
            case 
keyCode.HOME:
                
toFocus this.headers];
                break;
            case 
keyCode.END:
                
toFocus this.headerslength ];
                break;
        }

        if ( 
toFocus ) {
            $( 
event.target ).attr"tabIndex", -);
            $( 
toFocus ).attr"tabIndex");
            
toFocus.focus();
            
event.preventDefault();
        }
    },

    
_panelKeyDown: function( event ) {
        if ( 
event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
            $( 
event.currentTarget ).prev().focus();
        }
    },

    
refresh: function() {
        var 
options this.options;
        
this._processPanels();

        
// was collapsed or no panel
        
if ( ( options.active === false && options.collapsible === true ) || !this.headers.length ) {
            
options.active false;
            
this.active = $();
        
// active false only when collapsible is true
        
} else if ( options.active === false ) {
            
this._activate);
        
// was active, but active panel is gone
        
} else if ( this.active.length && !$.containsthis.element], this.active] ) ) {
            
// all remaining panel are disabled
            
if ( this.headers.length === this.headers.find(".ui-state-disabled").length ) {
                
options.active false;
                
this.active = $();
            
// activate previous panel
            
} else {
                
this._activateMath.max0options.active ) );
            }
        
// was active, active panel still exists
        
} else {
            
// make sure active index is correct
            
options.active this.headers.indexthis.active );
        }

        
this._destroyIcons();

        
this._refresh();
    },

    
_processPanels: function() {
        var 
prevHeaders this.headers,
            
prevPanels this.panels;

        
this.headers this.element.findthis.options.header )
            .
addClass"ui-accordion-header ui-state-default ui-corner-all" );

        
this.panels this.headers.next()
            .
addClass"ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
            .
filter":not(.ui-accordion-content-active)" )
            .
hide();

        
// Avoid memory leaks (#10056)
        
if ( prevPanels ) {
            
this._offprevHeaders.notthis.headers ) );
            
this._offprevPanels.notthis.panels ) );
        }
    },

    
_refresh: function() {
        var 
maxHeight,
            
options this.options,
            
heightStyle options.heightStyle,
            
parent this.element.parent();

        
this.active this._findActiveoptions.active )
            .
addClass"ui-accordion-header-active ui-state-active ui-corner-top" )
            .
removeClass"ui-corner-all" );
        
this.active.next()
            .
addClass"ui-accordion-content-active" )
            .
show();

        
this.headers
            
.attr"role""tab" )
            .
each(function() {
                var 
header = $( this ),
                    
headerId header.uniqueId().attr"id" ),
                    
panel header.next(),
                    
panelId panel.uniqueId().attr"id" );
                
header.attr"aria-controls"panelId );
                
panel.attr"aria-labelledby"headerId );
            })
            .
next()
                .
attr"role""tabpanel" );

        
this.headers
            
.notthis.active )
            .
attr({
                
"aria-selected""false",
                
"aria-expanded""false",
                
tabIndex: -1
            
})
            .
next()
                .
attr({
                    
"aria-hidden""true"
                
})
                .
hide();

        
// make sure at least one header is in the tab order
        
if ( !this.active.length ) {
            
this.headers.eq).attr"tabIndex");
        } else {
            
this.active.attr({
                
"aria-selected""true",
                
"aria-expanded""true",
                
tabIndex0
            
})
            .
next()
                .
attr({
                    
"aria-hidden""false"
                
});
        }

        
this._createIcons();

        
this._setupEventsoptions.event );

        if ( 
heightStyle === "fill" ) {
            
maxHeight parent.height();
            
this.element.siblings":visible" ).each(function() {
                var 
elem = $( this ),
                    
position elem.css"position" );

                if ( 
position === "absolute" || position === "fixed" ) {
                    return;
                }
                
maxHeight -= elem.outerHeighttrue );
            });

            
this.headers.each(function() {
                
maxHeight -= $( this ).outerHeighttrue );
            });

            
this.headers.next()
                .
each(function() {
                    $( 
this ).heightMath.max0maxHeight -
                        $( 
this ).innerHeight() + $( this ).height() ) );
                })
                .
css"overflow""auto" );
        } else if ( 
heightStyle === "auto" ) {
            
maxHeight 0;
            
this.headers.next()
                .
each(function() {
                    
maxHeight Math.maxmaxHeight, $( this ).css"height""" ).height() );
                })
                .
heightmaxHeight );
        }
    },

    
_activate: function( index ) {
        var 
active this._findActiveindex )[ ];

        
// trying to activate the already active panel
        
if ( active === this.active] ) {
            return;
        }

        
// trying to collapse, simulate a click on the currently active header
        
active active || this.active];

        
this._eventHandler({
            
targetactive,
            
currentTargetactive,
            
preventDefault: $.noop
        
});
    },

    
_findActive: function( selector ) {
        return 
typeof selector === "number" this.headers.eqselector ) : $();
    },

    
_setupEvents: function( event ) {
        var 
events = {
            
keydown"_keydown"
        
};
        if ( 
event ) {
            $.
eachevent.split" " ), function( indexeventName ) {
                
eventseventName ] = "_eventHandler";
            });
        }

        
this._offthis.headers.addthis.headers.next() ) );
        
this._onthis.headersevents );
        
this._onthis.headers.next(), { keydown"_panelKeyDown" });
        
this._hoverablethis.headers );
        
this._focusablethis.headers );
    },

    
_eventHandler: function( event ) {
        var 
options this.options,
            
active this.active,
            
clicked = $( event.currentTarget ),
            
clickedIsActive clicked] === active],
            
collapsing clickedIsActive && options.collapsible,
            
toShow collapsing ? $() : clicked.next(),
            
toHide active.next(),
            
eventData = {
                
oldHeaderactive,
                
oldPaneltoHide,
                
newHeadercollapsing ? $() : clicked,
                
newPaneltoShow
            
};

        
event.preventDefault();

        if (
                
// click on active header, but not collapsible
                
clickedIsActive && !options.collapsible ) ||
                
// allow canceling activation
                
this._trigger"beforeActivate"eventeventData ) === false ) ) {
            return;
        }

        
options.active collapsing false this.headers.indexclicked );

        
// when the call to ._toggle() comes after the class changes
        // it causes a very odd bug in IE 8 (see #6720)
        
this.active clickedIsActive ? $() : clicked;
        
this._toggleeventData );

        
// switch classes
        // corner classes on the previously active header stay after the animation
        
active.removeClass"ui-accordion-header-active ui-state-active" );
        if ( 
options.icons ) {
            
active.children".ui-accordion-header-icon" )
                .
removeClassoptions.icons.activeHeader )
                .
addClassoptions.icons.header );
        }

        if ( !
clickedIsActive ) {
            
clicked
                
.removeClass"ui-corner-all" )
                .
addClass"ui-accordion-header-active ui-state-active ui-corner-top" );
            if ( 
options.icons ) {
                
clicked.children".ui-accordion-header-icon" )
                    .
removeClassoptions.icons.header )
                    .
addClassoptions.icons.activeHeader );
            }

            
clicked
                
.next()
                .
addClass"ui-accordion-content-active" );
        }
    },

    
_toggle: function( data ) {
        var 
toShow data.newPanel,
            
toHide this.prevShow.length this.prevShow data.oldPanel;

        
// handle activating a panel during the animation for another activation
        
this.prevShow.addthis.prevHide ).stoptruetrue );
        
this.prevShow toShow;
        
this.prevHide toHide;

        if ( 
this.options.animate ) {
            
this._animatetoShowtoHidedata );
        } else {
            
toHide.hide();
            
toShow.show();
            
this._toggleCompletedata );
        }

        
toHide.attr({
            
"aria-hidden""true"
        
});
        
toHide.prev().attr({
            
"aria-selected""false",
            
"aria-expanded""false"
        
});
        
// if we're switching panels, remove the old header from the tab order
        // if we're opening from collapsed state, remove the previous header from the tab order
        // if we're collapsing, then keep the collapsing header in the tab order
        
if ( toShow.length && toHide.length ) {
            
toHide.prev().attr({
                
"tabIndex": -1,
                
"aria-expanded""false"
            
});
        } else if ( 
toShow.length ) {
            
this.headers.filter(function() {
                return 
parseInt( $( this ).attr"tabIndex" ), 10 ) === 0;
            })
            .
attr"tabIndex", -);
        }

        
toShow
            
.attr"aria-hidden""false" )
            .
prev()
                .
attr({
                    
"aria-selected""true",
                    
"aria-expanded""true",
                    
tabIndex0
                
});
    },

    
_animate: function( toShowtoHidedata ) {
        var 
totaleasingduration,
            
that this,
            
adjust 0,
            
boxSizing toShow.css"box-sizing" ),
            
down toShow.length &&
                ( !
toHide.length || ( toShow.index() < toHide.index() ) ),
            
animate this.options.animate || {},
            
options down && animate.down || animate,
            
complete = function() {
                
that._toggleCompletedata );
            };

        if ( 
typeof options === "number" ) {
            
duration options;
        }
        if ( 
typeof options === "string" ) {
            
easing options;
        }
        
// fall back from options to animation in case of partial down settings
        
easing easing || options.easing || animate.easing;
        
duration duration || options.duration || animate.duration;

        if ( !
toHide.length ) {
            return 
toShow.animatethis.showPropsdurationeasingcomplete );
        }
        if ( !
toShow.length ) {
            return 
toHide.animatethis.hidePropsdurationeasingcomplete );
        }

        
total toShow.show().outerHeight();
        
toHide.animatethis.hideProps, {
            
durationduration,
            
easingeasing,
            
step: function( nowfx ) {
                
fx.now Math.roundnow );
            }
        });
        
toShow
            
.hide()
            .
animatethis.showProps, {
                
durationduration,
                
easingeasing,
                
completecomplete,
                
step: function( nowfx ) {
                    
fx.now Math.roundnow );
                    if ( 
fx.prop !== "height" ) {
                        if ( 
boxSizing === "content-box" ) {
                            
adjust += fx.now;
                        }
                    } else if ( 
that.options.heightStyle !== "content" ) {
                        
fx.now Math.roundtotal toHide.outerHeight() - adjust );
                        
adjust 0;
                    }
                }
            });
    },

    
_toggleComplete: function( data ) {
        var 
toHide data.oldPanel;

        
toHide
            
.removeClass"ui-accordion-content-active" )
            .
prev()
                .
removeClass"ui-corner-top" )
                .
addClass"ui-corner-all" );

        
// Work around for rendering bug in IE (#5421)
        
if ( toHide.length ) {
            
toHide.parent()[ ].className toHide.parent()[ ].className;
        }
        
this._trigger"activate"nulldata );
    }
});



}));
?>
Онлайн: 0
Реклама