CLICK HERE TO BUY IT TODAY! OR GET IT FREE VIA TRIALPAY  

PHP Demo Application - Source Code

/Framework/Model/Vendor/jquery-ui/development-bundle/ui/jquery.ui.accordion.js



/*
 * jQuery UI Accordion 1.8.4
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Accordion
 *
 * Depends:
 *    jquery.ui.core.js
 *    jquery.ui.widget.js
 */
(function( $, undefined ) {
	$.widget"ui.accordion", {
		    options: {
			        active0,
			        animated"slide",
			        autoHeighttrue,
			        clearStylefalse,
			        collapsiblefalse,
			        event"click",
			        fillSpacefalse,
			        header"> li > :first-child,> :not(li):even",
			        icons: {
				            header"ui-icon-triangle-1-e",
				            headerSelected"ui-icon-triangle-1-s"
				        },
			        navigationfalse,
			        navigationFilter: function() {
				            return this.href.toLowerCase() === location.href.toLowerCase();
				        }
			    },
		    _create: function() {
			        var self this,
			            options self.options;
			        self.running 0;
			        self.element
			            .addClass"ui-accordion ui-widget ui-helper-reset" )
			            // in lack of child-selectors in CSS
			            // we need to mark top-LIs in a UL-accordion for some IE-fix
			            .children"li" )
			                .addClass"ui-accordion-li-fix" );
			        self.headers self.element.findoptions.header )
			            .addClass"ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" )
			            .bind"mouseenter.accordion", function() {
				                if ( options.disabled ) {
					                    return;
					                }
				                $( this ).addClass"ui-state-hover" );
				            })
			            .bind"mouseleave.accordion", function() {
				                if ( options.disabled ) {
					                    return;
					                }
				                $( this ).removeClass"ui-state-hover" );
				            })
			            .bind"focus.accordion", function() {
				                if ( options.disabled ) {
					                    return;
					                }
				                $( this ).addClass"ui-state-focus" );
				            })
			            .bind"blur.accordion", function() {
				                if ( options.disabled ) {
					                    return;
					                }
				                $( this ).removeClass"ui-state-focus" );
				            });
			        self.headers.next()
			            .addClass"ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" );
			        if ( options.navigation ) {
				            var current self.element.find"a" ).filteroptions.navigationFilter ).eq);
				            if ( current.length ) {
					                var header current.closest".ui-accordion-header" );
					                if ( header.length ) {
						                    // anchor within header
						                    self.active header;
						                } else {
						                    // anchor within content
						                    self.active current.closest".ui-accordion-content" ).prev();
						                }
					            }
				        }
			        self.active self._findActiveself.active || options.active )
			            .addClass"ui-state-default ui-state-active" )
			            .toggleClass"ui-corner-all ui-corner-top" );
			        self.active.next().addClass"ui-accordion-content-active" );
			        self._createIcons();
			        self.resize();
			        // ARIA
			        self.element.attr"role""tablist" );
			        self.headers
			            .attr"role""tab" )
			            .bind"keydown.accordion", function( event ) {
				                return self._keydownevent );
				            })
			            .next()
			                .attr"role""tabpanel" );
			        self.headers
			            .notself.active || "" )
			            .attr({
				                "aria-expanded""false",
				                tabIndex: -1
				            })
			            .next()
			                .hide();
			        // make sure at least one header is in the tab order
			        if ( !self.active.length ) {
				            self.headers.eq).attr"tabIndex");
				        } else {
				            self.active
				                .attr({
					                    "aria-expanded""true",
					                    tabIndex0
					                });
				        }
			        // only need links in tab order for Safari
			        if ( !$.browser.safari ) {
				            self.headers.find"a" ).attr"tabIndex", -);
				        }
			        if ( options.event ) {
				            self.headers.bindoptions.event.split(" ").join(".accordion ") + ".accordion", function(event) {
					                self._clickHandler.callselfeventthis );
					                event.preventDefault();
					            });
				        }
			    },
		    _createIcons: function() {
			        var options this.options;
			        if ( options.icons ) {
				            $( "<span></span>" )
				                .addClass"ui-icon " options.icons.header )
				                .prependTothis.headers );
				            this.active.children".ui-icon" )
				                .toggleClass(options.icons.header)
				                .toggleClass(options.icons.headerSelected);
				            this.element.addClass"ui-accordion-icons" );
				        }
			    },
		    _destroyIcons: function() {
			        this.headers.children".ui-icon" ).remove();
			        this.element.removeClass"ui-accordion-icons" );
			    },
		    destroy: function() {
			        var options this.options;
			        this.element
			            .removeClass"ui-accordion ui-widget ui-helper-reset" )
			            .removeAttr"role" );
			        this.headers
			            .unbind".accordion" )
			            .removeClass"ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
			            .removeAttr"role" )
			            .removeAttr"aria-expanded" )
			            .removeAttr"tabIndex" );
			        this.headers.find"a" ).removeAttr"tabIndex" );
			        this._destroyIcons();
			        var contents this.headers.next()
			            .css"display""" )
			            .removeAttr"role" )
			            .removeClass"ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled" );
			        if ( options.autoHeight || options.fillHeight ) {
				            contents.css"height""" );
				        }
			        return $.Widget.prototype.destroy.callthis );
			    },
		    _setOption: function( keyvalue ) {
			        $.Widget.prototype._setOption.applythisarguments );
			        if ( key == "active" ) {
				            this.activatevalue );
				        }
			        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.headers.add(this.headers.next())
				                [ value "addClass" "removeClass" ](
				                    "ui-accordion-disabled ui-state-disabled" );
				        }
			    },
		    _keydown: function( event ) {
			        if ( this.options.disabled || 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._clickHandler( { targetevent.target
					}, event.target );
				                event.preventDefault();
				        }
			        if ( toFocus ) {
				            $( event.target ).attr"tabIndex", -);
				            $( toFocus ).attr"tabIndex");
				            toFocus.focus();
				            return false;
				        }
			        return true;
			    },
		    resize: function() {
			        var options this.options,
			            maxHeight;
			        if ( options.fillSpace ) {
				            if ( $.browser.msie ) {
					                var defOverflow this.element.parent().css"overflow" );
					                this.element.parent().css"overflow""hidden");
					            }
				            maxHeight this.element.parent().height();
				            if ($.browser.msie) {
					                this.element.parent().css"overflow"defOverflow );
					            }
				            this.headers.each(function() {
					                maxHeight -= $( this ).outerHeighttrue );
					            });
				            this.headers.next()
				                .each(function() {
					                    $( this ).heightMath.max0maxHeight -
					                        $( this ).innerHeight() + $( this ).height() ) );
					                })
				                .css"overflow""auto" );
				        } else if ( options.autoHeight ) {
				            maxHeight 0;
				            this.headers.next()
				                .each(function() {
					                    maxHeight Math.maxmaxHeight, $( this ).height"" ).height() );
					                })
				                .heightmaxHeight );
				        }
			        return this;
			    },
		    activate: function( index ) {
			        // TODO this gets called on init, changing the option without an explicit call for that
			        this.options.active index;
			        // call clickHandler with custom event
			        var active this._findActiveindex )[ ];
			        this._clickHandler( { targetactive
				}, active );
			        return this;
			    },
		    _findActive: function( selector ) {
			        return selector
			            typeof selector === "number"
			                this.headers.filter":eq(" selector ")" )
			                : this.headers.notthis.headers.notselector ) )
			            : selector === false
			                ? $( [] )
			                : this.headers.filter":eq(0)" );
			    },
		    // TODO isn't event.target enough? why the separate target argument?
		    _clickHandler: function( eventtarget ) {
			        var options this.options;
			        if ( options.disabled ) {
				            return;
				        }
			        // called only when using activate(false) to close all parts programmatically
			        if ( !event.target ) {
				            if ( !options.collapsible ) {
					                return;
					            }
				            this.active
				                .removeClass"ui-state-active ui-corner-top" )
				                .addClass"ui-state-default ui-corner-all" )
				                .children".ui-icon" )
				                    .removeClassoptions.icons.headerSelected )
				                    .addClassoptions.icons.header );
				            this.active.next().addClass"ui-accordion-content-active" );
				            var toHide this.active.next(),
				                data = {
					                    optionsoptions,
					                    newHeader: $( [] ),
					                    oldHeaderoptions.active,
					                    newContent: $( [] ),
					                    oldContenttoHide
					                },
				                toShow = ( this.active = $( [] ) );
				            this._toggletoShowtoHidedata );
				            return;
				        }
			        // get the click target
			        var clicked = $( event.currentTarget || target ),
			            clickedIsActive clicked[0] === this.active[0];
			        // TODO the option is changed, is that correct?
			        // TODO if it is correct, shouldn't that happen after determining that the click is valid?
			        options.active options.collapsible && clickedIsActive ?
			            false :
			            this.headers.indexclicked );
			        // if animations are still active, or the active header is the target, ignore click
			        if ( this.running || ( !options.collapsible && clickedIsActive ) ) {
				            return;
				        }
			        // switch classes
			        this.active
			            .removeClass"ui-state-active ui-corner-top" )
			            .addClass"ui-state-default ui-corner-all" )
			            .children".ui-icon" )
			                .removeClassoptions.icons.headerSelected )
			                .addClassoptions.icons.header );
			        if ( !clickedIsActive ) {
				            clicked
				                .removeClass"ui-state-default ui-corner-all" )
				                .addClass"ui-state-active ui-corner-top" )
				                .children".ui-icon" )
				                    .removeClassoptions.icons.header )
				                    .addClassoptions.icons.headerSelected );
				            clicked
				                .next()
				                .addClass"ui-accordion-content-active" );
				        }
			        // find elements to show and hide
			        var toShow clicked.next(),
			            toHide this.active.next(),
			            data = {
				                optionsoptions,
				                newHeaderclickedIsActive && options.collapsible ? $([]) : clicked,
				                oldHeaderthis.active,
				                newContentclickedIsActive && options.collapsible ? $([]) : toShow,
				                oldContenttoHide
				            },
			            down this.headers.indexthis.active[0] ) > this.headers.indexclicked[0] );
			        this.active clickedIsActive ? $([]) : clicked;
			        this._toggletoShowtoHidedataclickedIsActivedown );
			        return;
			    },
		    _toggle: function( toShowtoHidedataclickedIsActivedown ) {
			        var self this,
			            options self.options;
			        self.toShow toShow;
			        self.toHide toHide;
			        self.data data;
			        var complete = function() {
				            if ( !self ) {
					                return;
					            }
				            return self._completed.applyselfarguments );
				        };
			        // trigger changestart event
			        self._trigger"changestart"nullself.data );
			        // count elements to animate
			        self.running toHide.size() === toShow.size() : toHide.size();
			        if ( options.animated ) {
				            var animOptions {};
				            if ( options.collapsible && clickedIsActive ) {
					                animOptions = {
						                    toShow: $( [] ),
						                    toHidetoHide,
						                    completecomplete,
						                    downdown,
						                    autoHeightoptions.autoHeight || options.fillSpace
						                };
					            } else {
					                animOptions = {
						                    toShowtoShow,
						                    toHidetoHide,
						                    completecomplete,
						                    downdown,
						                    autoHeightoptions.autoHeight || options.fillSpace
						                };
					            }
				            if ( !options.proxied ) {
					                options.proxied options.animated;
					            }
				            if ( !options.proxiedDuration ) {
					                options.proxiedDuration options.duration;
					            }
				            options.animated = $.isFunctionoptions.proxied ) ?
				                options.proxiedanimOptions ) :
				                options.proxied;
				            options.duration = $.isFunctionoptions.proxiedDuration ) ?
				                options.proxiedDurationanimOptions ) :
				                options.proxiedDuration;
				            var animations = $.ui.accordion.animations,
				                duration options.duration,
				                easing options.animated;
				            if ( easing && !animationseasing ] && !$.easingeasing ] ) {
					                easing "slide";
					            }
				            if ( !animationseasing ] ) {
					                animationseasing ] = function( options ) {
						                    this.slideoptions, {
							                        easingeasing,
							                        durationduration || 700
							                    });
						                };
					            }
				            animationseasing ]( animOptions );
				        } else {
				            if ( options.collapsible && clickedIsActive ) {
					                toShow.toggle();
					            } else {
					                toHide.hide();
					                toShow.show();
					            }
				            completetrue );
				        }
			        // TODO assert that the blur and focus triggers are really necessary, remove otherwise
			        toHide.prev()
			            .attr({
				                "aria-expanded""false",
				                tabIndex: -1
				            })
			            .blur();
			        toShow.prev()
			            .attr({
				                "aria-expanded""true",
				                tabIndex0
				            })
			            .focus();
			    },
		    _completed: function( cancel ) {
			        this.running cancel : --this.running;
			        if ( this.running ) {
				            return;
				        }
			        if ( this.options.clearStyle ) {
				            this.toShow.addthis.toHide ).css({
					                height"",
					                overflow""
					            });
				        }
			        // other classes are removed before the animation;
			 this one needs to stay until completed
			        this.toHide.removeClass"ui-accordion-content-active" );
			        this._trigger"change"nullthis.data );
			    }
		});
	$.extend( $.ui.accordion, {
		    version"1.8.4",
		    animations: {
			        slide: function( optionsadditions ) {
				            options = $.extend({
					                easing"swing",
					                duration300
					            }, optionsadditions );
				            if ( !options.toHide.size() ) {
					                options.toShow.animate({
						                    height"show",
						                    paddingTop"show",
						                    paddingBottom"show"
						                }, options );
					                return;
					            }
				            if ( !options.toShow.size() ) {
					                options.toHide.animate({
						                    height"hide",
						                    paddingTop"hide",
						                    paddingBottom"hide"
						                }, options );
					                return;
					            }
				            var overflow options.toShow.css"overflow" ),
				                percentDone 0,
				                showProps {},
				                hideProps {},
				                fxAttrs = [ "height""paddingTop""paddingBottom" ],
				                originalWidth;
				            // fix width before calculating height of hidden element
				            var options.toShow;
				            originalWidth s[0].style.width;
				            s.widthparseInts.parent().width(), 10 )
				                - parseInts.css"paddingLeft" ), 10 )
				                - parseInts.css"paddingRight" ), 10 )
				                - ( parseInts.css"borderLeftWidth" ), 10 ) || )
				                - ( parseInts.css"borderRightWidth" ), 10) || ) );
				            $.eachfxAttrs, function( iprop ) {
					                hidePropsprop ] = "hide";
					                var parts = ( "" + $.cssoptions.toShow[0], prop ) ).match( /^([\d+-.]+)(.*)$/ );
					                showPropsprop ] = {
						                    valueparts],
						                    unitparts] || "px"
						                };
					            });
				            options.toShow.css({ height0overflow"hidden"
					}).show();
				            options.toHide
				                .filter":hidden" )
				                    .eachoptions.complete )
				                .end()
				                .filter":visible" )
				                .animatehideProps, {
					                step: function( nowsettings ) {
						                    // only calculate the percent when animating height
						                    // IE gets very inconsistent results when animating elements
						                    // with small values, which is common for padding
						                    if ( settings.prop == "height" ) {
							                        percentDone = ( settings.end settings.start === ) ? :
							                            ( settings.now settings.start ) / ( settings.end settings.start );
							                    }
						                    options.toShow].stylesettings.prop ] =
						                        ( percentDone showPropssettings.prop ].value )
						                        + showPropssettings.prop ].unit;
						                },
					                durationoptions.duration,
					                easingoptions.easing,
					                complete: function() {
						                    if ( !options.autoHeight ) {
							                        options.toShow.css"height""" );
							                    }
						                    options.toShow.css({
							                        widthoriginalWidth,
							                        overflowoverflow
							                    });
						                    options.complete();
						                }
					            });
				        },
			        bounceslide: function( options ) {
				            this.slideoptions, {
					                easingoptions.down "easeOutBounce" "swing",
					                durationoptions.down 1000 200
					            });
				        }
			    }
		});
	})( jQuery );





PHP Demo Source Code Index