Skip to content

Commit

Permalink
Merging changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas C. Zakas committed Nov 28, 2009
2 parents f40c554 + be6e685 commit 39a0952
Show file tree
Hide file tree
Showing 195 changed files with 59,907 additions and 157 deletions.
141 changes: 106 additions & 35 deletions build/gallery-accordion/gallery-accordion-debug.js
@@ -1,7 +1,7 @@
YUI.add('gallery-accordion', function(Y) {

/**
* Provides the Accordion class
* Provides Accordion widget
*
* @module gallery-accordion
*/
Expand Down Expand Up @@ -1712,7 +1712,7 @@ Y.Accordion = Accordion;
}());

/**
* Provides the Accordion class
* Provides AccordionItem class
*
* @module gallery-accordion
*/
Expand Down Expand Up @@ -1785,7 +1785,12 @@ var Lang = Y.Lang,
HREF = "href",
HREF_VALUE = "#",
YUICONFIG = "yuiConfig",
HEADER_CONTENT = "headerContent";
HEADER_CONTENT = "headerContent",

REGEX_TRUE = /^(?:true|yes|1)$/,
REGEX_AUTO = /^auto\s*/,
REGEX_STRETCH = /^stretch\s*/,
REGEX_FIXED = /^fixed-\d+/;

/**
* Static property provides a string to identify the class.
Expand Down Expand Up @@ -1906,7 +1911,7 @@ AccordionItem.ATTRS = {
},

/**
* @description Get/Set the expanded status of the item
* @description Get/Set expanded status of the item
*
* @attribute expanded
* @default false
Expand Down Expand Up @@ -1952,7 +1957,7 @@ AccordionItem.ATTRS = {
},

/**
* @description Get/Set the expanded status of the item
* @description Get/Set always visible status of the item
*
* @attribute alwaysVisible
* @default false
Expand Down Expand Up @@ -2032,14 +2037,20 @@ AccordionItem.HTML_PARSER = {
},

label: function( contentBox ){
var node, labelSelector, yuiConfig;
var node, labelSelector, yuiConfig, label;

yuiConfig = this._getConfigDOMAttribute( contentBox );

if( yuiConfig && Lang.isValue( yuiConfig.label ) ){
return yuiConfig.label;
}

label = contentBox.getAttribute( "data-label" );

if( label ){
return label;
}

labelSelector = HEADER_SELECTOR_SUB + C_LABEL;
node = contentBox.query( labelSelector );

Expand Down Expand Up @@ -2092,86 +2103,119 @@ AccordionItem.HTML_PARSER = {
},

expanded: function( contentBox ){
var yuiConfig = this._getConfigDOMAttribute( contentBox );
var yuiConfig, expanded;

yuiConfig = this._getConfigDOMAttribute( contentBox );

if( yuiConfig && Lang.isValue( yuiConfig.expanded ) ){
if( yuiConfig && Lang.isBoolean( yuiConfig.expanded ) ){
return yuiConfig.expanded;
}

expanded = contentBox.getAttribute( "data-expanded" );

if( expanded ) {
return REGEX_TRUE.test( expanded );
}

return contentBox.hasClass( C_EXPANDED );
},

alwaysVisible: function( contentBox ){
var value, yuiConfig;
var yuiConfig, alwaysVisible;

yuiConfig = this._getConfigDOMAttribute( contentBox );

if( yuiConfig && Lang.isValue( yuiConfig.alwaysVisible ) ){
value = yuiConfig.alwaysVisible;
if( yuiConfig && Lang.isBoolean( yuiConfig.alwaysVisible ) ){
alwaysVisible = yuiConfig.alwaysVisible;
} else {
value = contentBox.hasClass( C_ALWAYSVISIBLE );
alwaysVisible = contentBox.getAttribute( "data-alwaysvisible" );

if( alwaysVisible ) {
alwaysVisible = REGEX_TRUE.test( alwaysVisible );
} else {
alwaysVisible = contentBox.hasClass( C_ALWAYSVISIBLE );
}
}

if( Lang.isBoolean(value) && value ){
if( alwaysVisible ){
this.set( "expanded", true, {
internalCall: true
} );
}

return value;
return alwaysVisible;
},

closable: function( contentBox ){
var yuiConfig = this._getConfigDOMAttribute( contentBox );
var yuiConfig, closable;

yuiConfig = this._getConfigDOMAttribute( contentBox );

if( yuiConfig && Lang.isValue( yuiConfig.closable ) ){
if( yuiConfig && Lang.isBoolean( yuiConfig.closable ) ){
return yuiConfig.closable;
}

closable = contentBox.getAttribute( "data-closable" );

if( closable ) {
return REGEX_TRUE.test( closable );
}

return contentBox.hasClass( C_CLOSABLE );
},

contentHeight: function( contentBox ){
var contentHeightClass, classValue, height = 0, i, length, index, chr, yuiConfig;
var contentHeightClass, classValue, height = 0, index, yuiConfig,
contentHeight;

yuiConfig = this._getConfigDOMAttribute( contentBox );

if( yuiConfig && yuiConfig.contentHeight ){
return yuiConfig.contentHeight;
}

contentHeight = contentBox.getAttribute( "data-contentheight" );

if( REGEX_AUTO.test( contentHeight ) ){
return {
method: AUTO
};
} else if( REGEX_STRETCH.test( contentHeight ) ){
return {
method: STRETCH
};
} else if( REGEX_FIXED.test( contentHeight ) ){
height = this._extractFixedMethodValue( contentHeight );

return {
method: FIXED,
height: height
};
}


classValue = contentBox.get( CLASS_NAME );

contentHeightClass = C_CONTENTHEIGHT + '-';

index = classValue.indexOf( contentHeightClass, 0);

if( index >= 0 ){
length = classValue.length;
index += contentHeightClass.length;

classValue = classValue.substring( index );

if( classValue.match( /^auto\s*/g ) ){
if( REGEX_AUTO.test( classValue ) ){
return {
method: AUTO
};
} else if( classValue.match( /^stretch\s*/g ) ){
} else if( REGEX_STRETCH.test( classValue ) ){
return {
method: STRETCH
};
} else if( classValue.match( /^fixed-\d+/g ) ){
for( i = 6, length = classValue.length; i < length; i++ ){ // 6 = "fixed-".length
chr = classValue.charAt(i);
chr = parseInt( chr, 10 );

if( Lang.isNumber( chr ) ){
height = (height * 10) + chr;
} else {
break;
}
}

} else if( REGEX_FIXED.test( classValue ) ){
height = this._extractFixedMethodValue( classValue );

return {
method: FIXED,
height: height
Expand Down Expand Up @@ -2363,7 +2407,7 @@ Y.extend( AccordionItem, Y.Widget, {

if( this.get( RENDERED ) ){
label = this.get( NODE_LABEL );
label.set( INNER_HTML, ["<a href='#'>", params.newVal, "</a>" ].join('') );
label.set( INNER_HTML, params.newVal );
}
},

Expand Down Expand Up @@ -2578,9 +2622,9 @@ Y.extend( AccordionItem, Y.Widget, {
* This function will be replaced with more clever solution when YUI 3.1 becomes available
*
* @method _getConfigDOMAttribute
* @private
* @param {Node} contentBox Widget's contentBox
* @return {Object} The parsed yuiConfig value
* @private
*/
_getConfigDOMAttribute: function( contentBox ) {
if( !this._parsedCfg ){
Expand All @@ -2592,6 +2636,33 @@ Y.extend( AccordionItem, Y.Widget, {
}

return this._parsedCfg;
},


/**
* Parses and returns the value of contentHeight property, if set method "fixed".
* The value must be in this format: fixed-X, where X is integer
*
* @method _extractFixedMethodValue
* @param {String} value The value to be parsed
* @return {Number} The parsed value or null
* @protected
*/
_extractFixedMethodValue: function( value ){
var i, length, chr, height = null;

for( i = 6, length = value.length; i < length; i++ ){ // 6 = "fixed-".length
chr = value.charAt(i);
chr = parseInt( chr, 10 );

if( Lang.isNumber( chr ) ){
height = (height * 10) + chr;
} else {
break;
}
}

return height;
}

});
Expand All @@ -2607,4 +2678,4 @@ Y.AccordionItem = AccordionItem;



}, 'gallery-2009.10.27' ,{requires:['event', 'anim-easing', 'dd-constrain', 'dd-proxy', 'dd-drop', 'widget', 'widget-stdmod', 'json-parse']});
}, 'gallery-2009.11.09-19' ,{requires:['event', 'anim-easing', 'dd-constrain', 'dd-proxy', 'dd-drop', 'widget', 'widget-stdmod', 'json-parse']});

0 comments on commit 39a0952

Please sign in to comment.