2019-07-17 20:08:50 +00:00
/ *
2019-07-17 20:16:19 +00:00
Copyright ( c ) 2009 , Yahoo ! Inc . All rights reserved .
2019-07-17 20:08:50 +00:00
Code licensed under the BSD License :
http : //developer.yahoo.net/yui/license.txt
2019-07-17 20:16:19 +00:00
version : 2.7 . 0
2019-07-17 20:08:50 +00:00
* /
2019-07-17 20:16:19 +00:00
( function ( ) { var G = YAHOO . util . Dom , M = YAHOO . util . Event , I = YAHOO . lang , L = YAHOO . env . ua , B = YAHOO . widget . Overlay , J = YAHOO . widget . Menu , D = { } , K = null , E = null , C = null ; function F ( O , N , R , P ) { var S , Q ; if ( I . isString ( O ) && I . isString ( N ) ) { if ( L . ie ) { Q = '<input type="' + O + '" name="' + N + '"' ; if ( P ) { Q += " checked" ; } Q += ">" ; S = document . createElement ( Q ) ; } else { S = document . createElement ( "input" ) ; S . name = N ; S . type = O ; if ( P ) { S . checked = true ; } } S . value = R ; } return S ; } function H ( O , U ) { var N = O . nodeName . toUpperCase ( ) , S = this , T , P , Q ; function V ( W ) { if ( ! ( W in U ) ) { T = O . getAttributeNode ( W ) ; if ( T && ( "value" in T ) ) { U [ W ] = T . value ; } } } function R ( ) { V ( "type" ) ; if ( U . type == "button" ) { U . type = "push" ; } if ( ! ( "disabled" in U ) ) { U . disabled = O . disabled ; } V ( "name" ) ; V ( "value" ) ; V ( "title" ) ; } switch ( N ) { case "A" : U . type = "link" ; V ( "href" ) ; V ( "target" ) ; break ; case "INPUT" : R ( ) ; if ( ! ( "checked" in U ) ) { U . checked = O . checked ; } break ; case "BUTTON" : R ( ) ; P = O . parentNode . parentNode ; if ( G . hasClass ( P , this . CSS _CLASS _NAME + "-checked" ) ) { U . checked = true ; } if ( G . hasClass ( P , this . CSS _CLASS _NAME + "-disabled" ) ) { U . disabled = true ; } O . removeAttribute ( "value" ) ; O . setAttribute ( "type" , "button" ) ; break ; } O . removeAttribute ( "id" ) ; O . removeAttribute ( "name" ) ; if ( ! ( "tabindex" in U ) ) { U . tabindex = O . tabIndex ; } if ( ! ( "label" in U ) ) { Q = N == "INPUT" ? O . value : O . innerHTML ; if ( Q && Q . length > 0 ) { U . label = Q ; } } } function A ( P ) { var O = P . attributes , N = O . srcelement , R = N . nodeName . toUpperCase ( ) , Q = this ; if ( R == this . NODE _NAME ) { P . element = N ; P . id = N . id ; G . getElementsBy ( function ( S ) { switch ( S . nodeName . toUpperCase ( ) ) { case "BUTTON" : case "A" : case "INPUT" : H . call ( Q , S , O ) ; break ; } } , "*" , N ) ; } else { switch ( R ) { case "BUTTON" : case "A" : case "INPUT" : H . call ( this , N , O ) ; break ; } } } YAHOO . widget . Button = function ( R , O ) { if ( ! B && YAHOO . widget . Overlay ) { B = YAHOO . widget . Overlay ; } if ( ! J && YAHOO . widget . Menu ) { J = YAHOO . widget . Menu ; } var Q = YAHOO . widget . Button . superclass . constructor , P , N ; if ( arguments . length == 1 && ! I . isString ( R ) && ! R . nodeName ) { if ( ! R . id ) { R . id = G . generateId ( ) ; } Q . call ( this , ( this . createButtonElement ( R . type ) ) , R ) ; } else { P = { element : null , attributes : ( O || { } ) } ; if ( I . isString ( R ) ) { N = G . get ( R ) ; if ( N ) { if ( ! P . attributes . id ) { P . attributes . id = R ; } P . attributes . srcelement = N ; A . call ( this , P ) ; if ( ! P . element ) { P . element = this . createButtonElement ( P . attributes . type ) ; } Q . call ( this , P . element , P . attributes ) ; } } else { if ( R . nodeName ) { if ( ! P . attributes . id ) { if ( R . id ) { P . attributes . id = R . id ; } else { P . attributes . id = G . generateId ( ) ; } } P . attributes . srcelement = R ; A . call ( this , P ) ; if ( ! P . element ) { P . element = this . createButtonElement ( P . attributes . type ) ; } Q . call ( this , P . element , P . attributes ) ; } } } } ; YAHOO . extend ( YAHOO . widget . Button , YAHOO . util . Element , { _button : null , _menu : null , _hiddenFields : null , _onclickAttributeValue : null , _activationKeyPressed : false , _activationButtonPressed : false , _hasKeyEventHandlers : false , _hasMouseEventHandlers : false , _nOptionRegionX : 0 , NODE _NAME : "SPAN" , CHECK _ACTIVATION _KEYS : [ 32 ] , ACTIVATION _KEYS : [ 13 , 32 ] , OPTION _AREA _WIDTH : 20 , CSS _CLASS _NAME : "yui-button" , RADIO _DEFAULT _TITLE : "Unchecked. Click to check." , RADIO _CHECKED _TITLE : "Checked. Click another button to uncheck" , CHECKBOX _DEFAULT _TITLE : "Unchecked. Click to check." , CHECKBOX _CHECKED _TITLE : "Checked. Click to uncheck." , MENUBUTTON _DEFAULT _TITLE : "Menu collapsed. Click to expand." , MENUBUTTON _MENU _VISIBLE _TITLE : "Menu expanded. Click or press Esc to collapse." , SPLITBUTTON _DEFAULT _TITLE : ( "Menu collapsed. Click inside option " + "region or press down arrow key to show the menu." ) , SPLITBUTTON _OPTION _VISIBLE _TITLE : "Menu expanded. Press Esc to hide the menu." , SUBMIT _TITLE : "Click to submit form." , _setType : function ( N ) { if ( N == "split" ) { this . on ( "option" , this . _onOption ) ; } } , _setLabel : function ( O ) { this . _button . innerHTML = O ; var P , N = L . gecko ; if ( N && N < 1.9 && G . inDocument ( this . get ( "element" ) ) ) { P = this . CSS _CLASS _NAME ; this . removeClass ( P ) ; I . later ( 0 , this , this . addClass , P ) ; } } , _setTabIndex : function ( N ) { this . _button . tabIndex = N ; } , _setTitle : function ( O ) { var N = O ; if ( this . get ( "type" ) != "link" ) { if ( ! N ) { switch ( this . get ( "type" ) ) { case "radio" : N = this . RADIO _DEFAULT _TITLE ; break ; case "checkbox" : N = this . CHECKBOX _DEFAULT _TITLE ; break ; case "menu" : N = this . MENUBUTTON _DEFAULT _TITLE ; break ; case "split" : N = this . SPLITBUTTON _DEFAULT _TITLE ; break ; case "submit" : N = this . SUBMIT _TITLE ; break ; } } this . _button . title = N ; } } , _setDisabled : function ( N ) { if ( this . get ( " ty
} K . register ( X ) ; } } this . _menu = X ; if ( ! W && ! P ) { if ( G . inDocument ( R ) ) { X . render ( R . parentNode ) ; } else { this . on ( "appendTo" , V ) ; } } } } if ( B ) { if ( J ) { N = J . prototype . CSS _CLASS _NAME ; } if ( U && J && ( U instanceof J ) ) { X = U ; W = true ; S . call ( this ) ; } else { if ( B && U && ( U instanceof B ) ) { X = U ; W = true ; X . cfg . queueProperty ( "visible" , false ) ; S . call ( this ) ; } else { if ( J && I . isArray ( U ) ) { X = new J ( G . generateId ( ) , { lazyload : P , itemdata : U } ) ; this . _menu = X ; this . on ( "appendTo" , S ) ; } else { if ( I . isString ( U ) ) { O = G . get ( U ) ; if ( O ) { if ( J && G . hasClass ( O , N ) || O . nodeName . toUpperCase ( ) == "SELECT" ) { X = new J ( U , { lazyload : P } ) ; S . call ( this ) ; } else { if ( B ) { X = new B ( U , { visible : false } ) ; S . call ( this ) ; } } } } else { if ( U && U . nodeName ) { if ( J && G . hasClass ( U , N ) || U . nodeName . toUpperCase ( ) == "SELECT" ) { X = new J ( U , { lazyload : P } ) ; S . call ( this ) ; } else { if ( B ) { if ( ! U . id ) { G . generateId ( U ) ; } X = new B ( U , { visible : false } ) ; S . call ( this ) ; } } } } } } } } } , _setOnClick : function ( N ) { if ( this . _onclickAttributeValue && ( this . _onclickAttributeValue != N ) ) { this . removeListener ( "click" , this . _onclickAttributeValue . fn ) ; this . _onclickAttributeValue = null ; } if ( ! this . _onclickAttributeValue && I . isObject ( N ) && I . isFunction ( N . fn ) ) { this . on ( "click" , N . fn , N . obj , N . scope ) ; this . _onclickAttributeValue = N ; } } , _isActivationKey : function ( N ) { var S = this . get ( "type" ) , O = ( S == "checkbox" || S == "radio" ) ? this . CHECK _ACTIVATION _KEYS : this . ACTIVATION _KEYS , Q = O . length , R = false , P ; if ( Q > 0 ) { P = Q - 1 ; do { if ( N == O [ P ] ) { R = true ; break ; } } while ( P -- ) ; } return R ; } , _isSplitButtonOptionKey : function ( P ) { var O = ( M . getCharCode ( P ) == 40 ) ; var N = function ( Q ) { M . preventDefault ( Q ) ; this . removeListener ( "keypress" , N ) ; } ; if ( O ) { if ( L . opera ) { this . on ( "keypress" , N ) ; } M . preventDefault ( P ) ; } return O ; } , _addListenersToForm : function ( ) { var T = this . getForm ( ) , S = YAHOO . widget . Button . onFormKeyPress , R , N , Q , P , O ; if ( T ) { M . on ( T , "reset" , this . _onFormReset , null , this ) ; M . on ( T , "submit" , this . _onFormSubmit , null , this ) ; N = this . get ( "srcelement" ) ; if ( this . get ( "type" ) == "submit" || ( N && N . type == "submit" ) ) { Q = M . getListeners ( T , "keypress" ) ; R = false ; if ( Q ) { P = Q . length ; if ( P > 0 ) { O = P - 1 ; do { if ( Q [ O ] . fn == S ) { R = true ; break ; } } while ( O -- ) ; } } if ( ! R ) { M . on ( T , "keypress" , S ) ; } } } } , _showMenu : function ( R ) { if ( YAHOO . widget . MenuManager ) { YAHOO . widget . MenuManager . hideVisible ( ) ; } if ( K ) { K . hideAll ( ) ; } var N = this . _menu , Q = this . get ( "menualignment" ) , P = this . get ( "focusmenu" ) , O ; if ( this . _renderedMenu ) { N . cfg . setProperty ( "context" , [ this . get ( "element" ) , Q [ 0 ] , Q [ 1 ] ] ) ; N . cfg . setProperty ( "preventcontextoverlap" , true ) ; N . cfg . setProperty ( "constraintoviewport" , true ) ; } else { N . cfg . queueProperty ( "context" , [ this . get ( "element" ) , Q [ 0 ] , Q [ 1 ] ] ) ; N . cfg . queueProperty ( "preventcontextoverlap" , true ) ; N . cfg . queueProperty ( "constraintoviewport" , true ) ; } this . focus ( ) ; if ( J && N && ( N instanceof J ) ) { O = N . focus ; N . focus = function ( ) { } ; if ( this . _renderedMenu ) { N . cfg . setProperty ( "minscrollheight" , this . get ( "menuminscrollheight" ) ) ; N . cfg . setProperty ( "maxheight" , this . get ( "menumaxheight" ) ) ; } else { N . cfg . queueProperty ( "minscrollheight" , this . get ( "menuminscrollheight" ) ) ; N . cfg . queueProperty ( "maxheight" , this . get ( "menumaxheight" ) ) ; } N . show ( ) ; N . focus = O ; N . align ( ) ; if ( R . type == "mousedown" ) { M . stopPropagation ( R ) ; } if ( P ) { N . focus ( ) ; } } else { if ( B && N && ( N instanceof B ) ) { if ( ! this . _renderedMenu ) { N . render ( this . get ( "element" ) . parentNode ) ; } N . show ( ) ; N . align ( ) ; } } } , _hideMenu : function ( ) { var N = this . _menu ; if ( N ) { N . hide ( ) ; } } , _onMouseOver : function ( O ) { var Q = this . get ( "type" ) , N , P ; if ( Q === "split" ) { N = this . get ( "element" ) ; P = ( G . getX ( N ) + ( N . offsetWidth - this . OPTION _AREA _WIDTH ) ) ; this . _nOptionRegionX = P ; } if ( ! this . _hasMouseEventHandlers ) { if ( Q === "split" ) { this . on ( "mousemove" , this . _onMouseMove ) ; } this . on ( "mouseout" , this . _onMouseOut ) ; this . _hasMouseEventHandlers = true ; } this . addStateCSSClasses ( "hover" ) ; if ( Q === "split" && ( M . getPageX ( O ) > P ) ) { this . addStateCSSClasses ( "hoveroption" ) ; } if ( this . _activationButtonPressed ) { this . addStateCSSClasses ( "active" ) ; } if ( this . _bOptionPressed ) { this . addStateCSSClasses ( "activeoption" ) ; } if ( this . _activationButtonPressed || this . _bOptionPressed ) { M . removeListener ( document , "mouseup" , this . _onDocumentMouseUp ) ; } } , _onMouseMove : function ( N ) { var O = this . _nOptionRegionX ; if ( O ) { if ( M . getPageX ( N ) > O ) { this . addStateCSSClasses ( "hoveroption" ) ; } else { this . removeStateCSSClasses ( "hoveroption" ) ; } } } , _onMouseOut : function ( N ) { var O = this . get ( "type" ) ; this . removeStateCSSClasses ( "hover" ) ; if ( O != "menu"
this . _hasKeyEventHandlers = true ; } this . fireEvent ( "focus" , O ) ; } , _onBlur : function ( N ) { this . removeStateCSSClasses ( "focus" ) ; if ( this . get ( "type" ) != "menu" ) { this . removeStateCSSClasses ( "active" ) ; } if ( this . _activationKeyPressed ) { M . on ( document , "keyup" , this . _onDocumentKeyUp , null , this ) ; } C = null ; this . fireEvent ( "blur" , N ) ; } , _onDocumentKeyUp : function ( N ) { if ( this . _isActivationKey ( M . getCharCode ( N ) ) ) { this . _activationKeyPressed = false ; M . removeListener ( document , "keyup" , this . _onDocumentKeyUp ) ; } } , _onKeyDown : function ( O ) { var N = this . _menu ; if ( this . get ( "type" ) == "split" && this . _isSplitButtonOptionKey ( O ) ) { this . fireEvent ( "option" , O ) ; } else { if ( this . _isActivationKey ( M . getCharCode ( O ) ) ) { if ( this . get ( "type" ) == "menu" ) { this . _showMenu ( O ) ; } else { this . _activationKeyPressed = true ; this . addStateCSSClasses ( "active" ) ; } } } if ( N && N . cfg . getProperty ( "visible" ) && M . getCharCode ( O ) == 27 ) { N . hide ( ) ; this . focus ( ) ; } } , _onKeyUp : function ( N ) { var O ; if ( this . _isActivationKey ( M . getCharCode ( N ) ) ) { O = this . get ( "type" ) ; if ( O == "checkbox" || O == "radio" ) { this . set ( "checked" , ! ( this . get ( "checked" ) ) ) ; } this . _activationKeyPressed = false ; if ( this . get ( "type" ) != "menu" ) { this . removeStateCSSClasses ( "active" ) ; } } } , _onClick : function ( Q ) { var S = this . get ( "type" ) , N , R , O , P ; switch ( S ) { case "radio" : case "checkbox" : if ( ! this . _hasDefaultTitle ) { if ( this . get ( "checked" ) ) { N = ( S == "radio" ) ? this . RADIO _CHECKED _TITLE : this . CHECKBOX _CHECKED _TITLE ; } else { N = ( S == "radio" ) ? this . RADIO _DEFAULT _TITLE : this . CHECKBOX _DEFAULT _TITLE ; } this . set ( "title" , N ) ; } break ; case "submit" : if ( Q . returnValue !== false ) { this . submitForm ( ) ; } break ; case "reset" : R = this . getForm ( ) ; if ( R ) { R . reset ( ) ; } break ; case "menu" : N = this . _menu . cfg . getProperty ( "visible" ) ? this . MENUBUTTON _MENU _VISIBLE _TITLE : this . MENUBUTTON _DEFAULT _TITLE ; this . set ( "title" , N ) ; break ; case "split" : if ( this . _nOptionRegionX > 0 && ( M . getPageX ( Q ) > this . _nOptionRegionX ) ) { P = false ; } else { this . _hideMenu ( ) ; O = this . get ( "srcelement" ) ; if ( O && O . type == "submit" && Q . returnValue !== false ) { this . submitForm ( ) ; } } N = this . _menu . cfg . getProperty ( "visible" ) ? this . SPLITBUTTON _OPTION _VISIBLE _TITLE : this . SPLITBUTTON _DEFAULT _TITLE ; this . set ( "title" , N ) ; break ; } return P ; } , _onDblClick : function ( O ) { var N = true ; if ( this . get ( "type" ) == "split" && M . getPageX ( O ) > this . _nOptionRegionX ) { N = false ; } return N ; } , _onAppendTo : function ( N ) { I . later ( 0 , this , this . _addListenersToForm ) ; } , _onFormReset : function ( O ) { var P = this . get ( "type" ) , N = this . _menu ; if ( P == "checkbox" || P == "radio" ) { this . resetValue ( "checked" ) ; } if ( J && N && ( N instanceof J ) ) { this . resetValue ( "selectedMenuItem" ) ; } } , _onFormSubmit : function ( N ) { this . createHiddenFields ( ) ; } , _onDocumentMouseDown : function ( Q ) { var N = M . getTarget ( Q ) , P = this . get ( "element" ) , O = this . _menu . element ; if ( N != P && ! G . isAncestor ( P , N ) && N != O && ! G . isAncestor ( O , N ) ) { this . _hideMenu ( ) ; M . removeListener ( document , "mousedown" , this . _onDocumentMouseDown ) ; } } , _onOption : function ( N ) { if ( this . hasClass ( "yui-split-button-activeoption" ) ) { this . _hideMenu ( ) ; this . _bOptionPressed = false ; } else { this . _showMenu ( N ) ; this . _bOptionPressed = true ; } } , _onMenuShow : function ( O ) { M . on ( document , "mousedown" , this . _onDocumentMouseDown , null , this ) ; var N , P ; if ( this . get ( "type" ) == "split" ) { N = this . SPLITBUTTON _OPTION _VISIBLE _TITLE ; P = "activeoption" ; } else { N = this . MENUBUTTON _MENU _VISIBLE _TITLE ; P = "active" ; } this . addStateCSSClasses ( P ) ; this . set ( "title" , N ) ; } , _onMenuHide : function ( P ) { var O = this . _menu , N , Q ; if ( this . get ( "type" ) == "split" ) { N = this . SPLITBUTTON _DEFAULT _TITLE ; Q = "activeoption" ; } else { N = this . MENUBUTTON _DEFAULT _TITLE ; Q = "active" ; } this . removeStateCSSClasses ( Q ) ; this . set ( "title" , N ) ; if ( this . get ( "type" ) == "split" ) { this . _bOptionPressed = false ; } } , _onMenuKeyDown : function ( P , O ) { var N = O [ 0 ] ; if ( M . getCharCode ( N ) == 27 ) { this . focus ( ) ; if ( this . get ( "type" ) == "split" ) { this . _bOptionPressed = false ; } } } , _onMenuRender : function ( P ) { var S = this . get ( "element" ) , O = S . parentNode , N = this . _menu , R = N . element , Q = N . srcElement ; if ( O != R . parentNode ) { O . appendChild ( R ) ; } this . _renderedMenu = true ; if ( Q && Q . nodeName . toLowerCase ( ) === "select" && Q . value ) { this . set ( "selectedMenuItem" , N . getItem ( Q . selectedIndex ) ) ; } } , _onMenuClick : function ( O , N ) { var Q = N [ 1 ] , P ; if ( Q ) { this . set ( "selectedMenuItem" , Q ) ; P = this . get ( "srcelement" ) ; if ( P && P . type == "submit" ) { this . submitForm ( ) ; } this . _hideMenu ( ) ; } } , _onSelectedMenuItemChange : function ( N ) { var O = N . prevValue , P = N . newValue ;
} if ( L . ie ) { O = Q . fireEvent ( "onsubmit" ) ; } else { N = document . createEvent ( "HTMLEvents" ) ; N . initEvent ( "submit" , true , true ) ; O = Q . dispatchEvent ( N ) ; } if ( ( L . ie || L . webkit ) && O ) { Q . submit ( ) ; } } return O ; } , init : function ( O , a ) { var Q = a . type == "link" ? "a" : "button" , V = a . srcelement , Z = O . getElementsByTagName ( Q ) [ 0 ] , X ; if ( ! Z ) { X = O . getElementsByTagName ( "input" ) [ 0 ] ; if ( X ) { Z = document . createElement ( "button" ) ; Z . setAttribute ( "type" , "button" ) ; X . parentNode . replaceChild ( Z , X ) ; } } this . _button = Z ; this . _hasDefaultTitle = ( a . title && a . title . length > 0 ) ; YAHOO . widget . Button . superclass . init . call ( this , O , a ) ; var T = this . get ( "id" ) , N = T + "-button" ; Z . id = N ; var U , W ; var d = function ( e ) { return ( e . htmlFor === T ) ; } ; var S = function ( ) { W . setAttribute ( ( L . ie ? "htmlFor" : "for" ) , N ) ; } ; if ( V && this . get ( "type" ) != "link" ) { U = G . getElementsBy ( d , "label" ) ; if ( I . isArray ( U ) && U . length > 0 ) { W = U [ 0 ] ; } } D [ T ] = this ; this . addClass ( this . CSS _CLASS _NAME ) ; this . addClass ( "yui-" + this . get ( "type" ) + "-button" ) ; M . on ( this . _button , "focus" , this . _onFocus , null , this ) ; this . on ( "mouseover" , this . _onMouseOver ) ; this . on ( "mousedown" , this . _onMouseDown ) ; this . on ( "mouseup" , this . _onMouseUp ) ; this . on ( "click" , this . _onClick ) ; var Y = this . get ( "onclick" ) ; this . set ( "onclick" , null ) ; this . set ( "onclick" , Y ) ; this . on ( "dblclick" , this . _onDblClick ) ; if ( W ) { this . on ( "appendTo" , S ) ; } this . on ( "appendTo" , this . _onAppendTo ) ; var c = this . get ( "container" ) , P = this . get ( "element" ) , b = G . inDocument ( P ) , R ; if ( c ) { if ( V && V != P ) { R = V . parentNode ; if ( R ) { R . removeChild ( V ) ; } } if ( I . isString ( c ) ) { M . onContentReady ( c , this . appendTo , c , this ) ; } else { this . on ( "init" , function ( ) { I . later ( 0 , this , this . appendTo , c ) ; } ) ; } } else { if ( ! b && V && V != P ) { R = V . parentNode ; if ( R ) { this . fireEvent ( "beforeAppendTo" , { type : "beforeAppendTo" , target : R } ) ; R . replaceChild ( P , V ) ; this . fireEvent ( "appendTo" , { type : "appendTo" , target : R } ) ; } } else { if ( this . get ( "type" ) != "link" && b && V && V == P ) { this . _addListenersToForm ( ) ; } } } this . fireEvent ( "init" , { type : "init" , target : this } ) ; } , initAttributes : function ( O ) { var N = O || { } ; YAHOO . widget . Button . superclass . initAttributes . call ( this , N ) ; this . setAttributeConfig ( "type" , { value : ( N . type || "push" ) , validator : I . isString , writeOnce : true , method : this . _setType } ) ; this . setAttributeConfig ( "label" , { value : N . label , validator : I . isString , method : this . _setLabel } ) ; this . setAttributeConfig ( "value" , { value : N . value } ) ; this . setAttributeConfig ( "name" , { value : N . name , validator : I . isString } ) ; this . setAttributeConfig ( "tabindex" , { value : N . tabindex , validator : I . isNumber , method : this . _setTabIndex } ) ; this . configureAttribute ( "title" , { value : N . title , validator : I . isString , method : this . _setTitle } ) ; this . setAttributeConfig ( "disabled" , { value : ( N . disabled || false ) , validator : I . isBoolean , method : this . _setDisabled } ) ; this . setAttributeConfig ( "href" , { value : N . href , validator : I . isString , method : this . _setHref } ) ; this . setAttributeConfig ( "target" , { value : N . target , validator : I . isString , method : this . _setTarget } ) ; this . setAttributeConfig ( "checked" , { value : ( N . checked || false ) , validator : I . isBoolean , method : this . _setChecked } ) ; this . setAttributeConfig ( "container" , { value : N . container , writeOnce : true } ) ; this . setAttributeConfig ( "srcelement" , { value : N . srcelement , writeOnce : true } ) ; this . setAttributeConfig ( "menu" , { value : null , method : this . _setMenu , writeOnce : true } ) ; this . setAttributeConfig ( "lazyloadmenu" , { value : ( N . lazyloadmenu === false ? false : true ) , validator : I . isBoolean , writeOnce : true } ) ; this . setAttributeConfig ( "menuclassname" , { value : ( N . menuclassname || "yui-button-menu" ) , validator : I . isString , method : this . _setMenuClassName , writeOnce : true } ) ; this . setAttributeConfig ( "menuminscrollheight" , { value : ( N . menuminscrollheight || 90 ) , validator : I . isNumber } ) ; this . setAttributeConfig ( "menumaxheight" , { value : ( N . menumaxheight || 0 ) , validator : I . isNumber } ) ; this . setAttributeConfig ( "menualignment" , { value : ( N . menualignment || [ "tl" , "bl" ] ) , validator : I . isArray } ) ; this . setAttributeConfig ( "selectedMenuItem" , { value : null } ) ; this . setAttributeConfig ( "onclick" , { value : N . onclick , method : this . _setOnClick } ) ; this . setAttributeConfig ( "focusmenu" , { value : ( N . focusmenu === false ? false : true ) , validator : I . isBoolean } ) ; } , focus : function ( ) { if ( ! this . get ( "disabled" ) ) { this . _button . focus ( ) ; } } , blur : function ( ) { if ( ! this . get ( "disabled" ) ) { this . _button . blur ( ) ; } } , hasFocus : function ( ) { return ( C == this ) ; } , isActive : function ( ) { return this . hasClass ( this .
} else { X . get ( "element" ) . dispatchEvent ( W ) ; } } } } } } ; YAHOO . widget . Button . addHiddenFieldsToForm = function ( N ) { var S = G . getElementsByClassName ( YAHOO . widget . Button . prototype . CSS _CLASS _NAME , "*" , N ) , Q = S . length , R , O , P ; if ( Q > 0 ) { for ( P = 0 ; P < Q ; P ++ ) { O = S [ P ] . id ; if ( O ) { R = D [ O ] ; if ( R ) { R . createHiddenFields ( ) ; } } } } } ; YAHOO . widget . Button . getButton = function ( N ) { return D [ N ] ; } ; } ) ( ) ; ( function ( ) { var C = YAHOO . util . Dom , B = YAHOO . util . Event , D = YAHOO . lang , A = YAHOO . widget . Button , E = { } ; YAHOO . widget . ButtonGroup = function ( J , H ) { var I = YAHOO . widget . ButtonGroup . superclass . constructor , K , G , F ; if ( arguments . length == 1 && ! D . isString ( J ) && ! J . nodeName ) { if ( ! J . id ) { F = C . generateId ( ) ; J . id = F ; } I . call ( this , ( this . _createGroupElement ( ) ) , J ) ; } else { if ( D . isString ( J ) ) { G = C . get ( J ) ; if ( G ) { if ( G . nodeName . toUpperCase ( ) == this . NODE _NAME ) { I . call ( this , G , H ) ; } } } else { K = J . nodeName . toUpperCase ( ) ; if ( K && K == this . NODE _NAME ) { if ( ! J . id ) { J . id = C . generateId ( ) ; } I . call ( this , J , H ) ; } } } } ; YAHOO . extend ( YAHOO . widget . ButtonGroup , YAHOO . util . Element , { _buttons : null , NODE _NAME : "DIV" , CSS _CLASS _NAME : "yui-buttongroup" , _createGroupElement : function ( ) { var F = document . createElement ( this . NODE _NAME ) ; return F ; } , _setDisabled : function ( G ) { var H = this . getCount ( ) , F ; if ( H > 0 ) { F = H - 1 ; do { this . _buttons [ F ] . set ( "disabled" , G ) ; } while ( F -- ) ; } } , _onKeyDown : function ( K ) { var G = B . getTarget ( K ) , I = B . getCharCode ( K ) , H = G . parentNode . parentNode . id , J = E [ H ] , F = - 1 ; if ( I == 37 || I == 38 ) { F = ( J . index === 0 ) ? ( this . _buttons . length - 1 ) : ( J . index - 1 ) ; } else { if ( I == 39 || I == 40 ) { F = ( J . index === ( this . _buttons . length - 1 ) ) ? 0 : ( J . index + 1 ) ; } } if ( F > - 1 ) { this . check ( F ) ; this . getButton ( F ) . focus ( ) ; } } , _onAppendTo : function ( H ) { var I = this . _buttons , G = I . length , F ; for ( F = 0 ; F < G ; F ++ ) { I [ F ] . appendTo ( this . get ( "element" ) ) ; } } , _onButtonCheckedChange : function ( G , F ) { var I = G . newValue , H = this . get ( "checkedButton" ) ; if ( I && H != F ) { if ( H ) { H . set ( "checked" , false , true ) ; } this . set ( "checkedButton" , F ) ; this . set ( "value" , F . get ( "value" ) ) ; } else { if ( H && ! H . set ( "checked" ) ) { H . set ( "checked" , true , true ) ; } } } , init : function ( I , H ) { this . _buttons = [ ] ; YAHOO . widget . ButtonGroup . superclass . init . call ( this , I , H ) ; this . addClass ( this . CSS _CLASS _NAME ) ; var J = this . getElementsByClassName ( "yui-radio-button" ) ; if ( J . length > 0 ) { this . addButtons ( J ) ; } function F ( K ) { return ( K . type == "radio" ) ; } J = C . getElementsBy ( F , "input" , this . get ( "element" ) ) ; if ( J . length > 0 ) { this . addButtons ( J ) ; } this . on ( "keydown" , this . _onKeyDown ) ; this . on ( "appendTo" , this . _onAppendTo ) ; var G = this . get ( "container" ) ; if ( G ) { if ( D . isString ( G ) ) { B . onContentReady ( G , function ( ) { this . appendTo ( G ) ; } , null , this ) ; } else { this . appendTo ( G ) ; } } } , initAttributes : function ( G ) { var F = G || { } ; YAHOO . widget . ButtonGroup . superclass . initAttributes . call ( this , F ) ; this . setAttributeConfig ( "name" , { value : F . name , validator : D . isString } ) ; this . setAttributeConfig ( "disabled" , { value : ( F . disabled || false ) , validator : D . isBoolean , method : this . _setDisabled } ) ; this . setAttributeConfig ( "value" , { value : F . value } ) ; this . setAttributeConfig ( "container" , { value : F . container , writeOnce : true } ) ; this . setAttributeConfig ( "checkedButton" , { value : null } ) ; } , addButton : function ( J ) { var L , K , G , F , H , I ; if ( J instanceof A && J . get ( "type" ) == "radio" ) { L = J ; } else { if ( ! D . isString ( J ) && ! J . nodeName ) { J . type = "radio" ; L = new A ( J ) ; } else { L = new A ( J , { type : "radio" } ) ; } } if ( L ) { F = this . _buttons . length ; H = L . get ( "name" ) ; I = this . get ( "name" ) ; L . index = F ; this . _buttons [ F ] = L ; E [ L . get ( "id" ) ] = L ; if ( H != I ) { L . set ( "name" , I ) ; } if ( this . get ( "disabled" ) ) { L . set ( "disabled" , true ) ; } if ( L . get ( "checked" ) ) { this . set ( "checkedButton" , L ) ; } K = L . get ( "element" ) ; G = this . get ( "element" ) ; if ( K . parentNode != G ) { G . appendChild ( K ) ; } L . on ( "checkedChange" , this . _onButtonCheckedChange , L , this ) ; } return L ; } , addButtons : function ( G ) { var H , I , J , F ; if ( D . isArray ( G ) ) { H = G . length ; J = [ ] ; if ( H > 0 ) { for ( F = 0 ; F < H ; F ++ ) { I = this . addButton ( G [ F ] ) ; if ( I ) { J [ J . length ] = I ; } } } } return J ; } , removeButton : function ( H ) { var I = this . getButton ( H ) , G , F ; if ( I ) { this . _buttons . splice ( H , 1 ) ; delete E [ I . get ( "id" ) ] ; I . removeListener ( "checkedChange" , this . _onButtonCheckedChange ) ; I . destroy ( ) ; G = this . _buttons . length ; if ( G > 0 ) { F = this . _buttons . length - 1 ; do { this . _buttons [ F ] . index = F ; } while ( F -- ) ; } } } , getButton : function ( F ) { return this . _buttons [ F ] ; } , getButtons : function ( ) { return this . _buttons ; } , getCount : function ( ) { return this . _buttons . length ; } , focus : function ( H ) { var I , G , F ; if ( D . isNumber ( H ) ) { I = this . _buttons [ H ] ; if ( I