1/* 2Copyright (c) 2010, Yahoo! Inc. All rights reserved. 3Code licensed under the BSD License: 4http://developer.yahoo.com/yui/license.html 5version: 3.4.0 6build: nightly 7*/ 8YUI.add("base-build",function(f){var c=f.Base,a=f.Lang,b="initializer",d="destructor",e;c._build=function(B,p,z,s,t,o){var u=c._build,x=u._ctor(p,o),q=u._cfg(p,o),h=u._mixCust,m=q.aggregates,g=q.custom,k=x._yuibuild.dynamic,w,v,A,j,n,y,r;if(k&&m){for(w=0,v=m.length;w<v;++w){A=m[w];if(p.hasOwnProperty(A)){x[A]=a.isArray(p[A])?[]:{};}}}for(w=0,v=z.length;w<v;w++){j=z[w];n=j.prototype;y=n[b];r=n[d];delete n[b];delete n[d];f.mix(x,j,true,null,1);h(x,j,m,g);if(y){n[b]=y;}if(r){n[d]=r;}x._yuibuild.exts.push(j);}if(s){f.mix(x.prototype,s,true);}if(t){f.mix(x,u._clean(t,m,g),true);h(x,t,m,g);}x.prototype.hasImpl=u._impl;if(k){x.NAME=B;x.prototype.constructor=x;}return x;};e=c._build;f.mix(e,{_mixCust:function(i,h,l,k){if(l){f.aggregate(i,h,true,l);}if(k){for(var g in k){if(k.hasOwnProperty(g)){k[g](g,i,h);}}}},_tmpl:function(g){function h(){h.superclass.constructor.apply(this,arguments);}f.extend(h,g);return h;},_impl:function(m){var p=this._getClasses(),o,h,g,n,q,k;for(o=0,h=p.length;o<h;o++){g=p[o];if(g._yuibuild){n=g._yuibuild.exts;q=n.length;for(k=0;k<q;k++){if(n[k]===m){return true;}}}}return false;},_ctor:function(g,h){var j=(h&&false===h.dynamic)?false:true,k=(j)?e._tmpl(g):g,i=k._yuibuild;if(!i){i=k._yuibuild={};}i.id=i.id||null;i.exts=i.exts||[];i.dynamic=j;return k;},_cfg:function(g,h){var i=[],l={},k,j=(h&&h.aggregates),n=(h&&h.custom),m=g;while(m&&m.prototype){k=m._buildCfg;if(k){if(k.aggregates){i=i.concat(k.aggregates);}if(k.custom){f.mix(l,k.custom,true);}}m=m.superclass?m.superclass.constructor:null;}if(j){i=i.concat(j);}if(n){f.mix(l,h.cfgBuild,true);}return{aggregates:i,custom:l};},_clean:function(o,n,j){var m,h,g,k=f.merge(o);for(m in j){if(k.hasOwnProperty(m)){delete k[m];}}for(h=0,g=n.length;h<g;h++){m=n[h];if(k.hasOwnProperty(m)){delete k[m];}}return k;}});c.build=function(i,g,j,h){return e(i,g,j,null,null,h);};c.create=function(g,j,i,h,k){return e(g,j,i,h,k);};c.mix=function(g,h){return e(null,g,h,null,null,{dynamic:false});};c._buildCfg={custom:{ATTRS:function(l,j,h){j.ATTRS=j.ATTRS||{};if(h.ATTRS){var i=h.ATTRS,k=j.ATTRS,g;for(g in i){if(i.hasOwnProperty(g)){k[g]=k[g]||{};f.mix(k[g],i[g],true);}}}}},aggregates:["_PLUG","_UNPLUG"]};},"3.4.0",{requires:["base-base"]});AUI.add("aui-template",function(A){var Lang=A.Lang,UA=A.UA,LString=Lang.String,isArray=Lang.isArray,isDate=Lang.isDate,isString=Lang.isString,isObject=Lang.isObject,isValue=Lang.isValue,isUndefined=Lang.isUndefined,REGEX_TPL=/<tpl\b[^>]*?((for|if|exec)="([^"]+)")*?>((?:(?=([^<]+))\5|<(?!tpl\b[^>]*>))*?)<\/tpl>/,REGEX_NEWLINE=/\r\n|\n/g,REGEX_QUOTE=/'/g,REGEX_QUOTE_ESCAPED=/\\'/g,REGEX_PREFIX_GLOBAL_REPLACE=/^(?!\$)/,REGEX_TPL_VAR=/\{([\w-.#$]+)(?:\:([\w.]*)(?:\((.*?)?\))?)?(\s?[+\-*\/]\s?[\d.+\-*\/()]+)?\}/g,REGEX_TPL_SCRIPTLET=/\{\[((?:\\\]|.|\n)*?)\]\}/g,STR_BLANK="",STR_COLON=":",STR_COMMA=",",STR_DOT=".",STR_FOR="for",STR_EXEC="exec",STR_IF="if",STR_QUOTE="'",STR_BRACE_OPEN="{",STR_BRACE_CLOSE="}",STR_PAREN_OPEN="(",STR_PAREN_CLOSE=")",STR_GLOBAL_SYMBOL="$",STR_JOIN_OPEN=STR_QUOTE+STR_COMMA,STR_JOIN_CLOSE=STR_COMMA+STR_QUOTE,STR_JOIN_GROUP_OPEN=STR_JOIN_OPEN+STR_PAREN_OPEN,STR_JOIN_GROUP_CLOSE=STR_PAREN_CLOSE+STR_JOIN_CLOSE,STR_COMPILE_TPL_ARGS="values, parent, $index, $i, $count, $last, $ns, $ans, $yns",BUFFER_HTML=["<tpl>",null,"</tpl>"],BUFFER_STR_COMPILE_SUB_TPL=[STR_JOIN_OPEN+"this._compileSubTpl(",null,STR_COMMA+STR_COMPILE_TPL_ARGS+STR_PAREN_CLOSE+STR_JOIN_CLOSE],BUFFER_COMPILED_TPL_FN=["compiledTplFn = function("+STR_COMPILE_TPL_ARGS+") { return ["+STR_QUOTE,null,STR_QUOTE+'].join("");};'],BUFFER_GLOBAL_PROP=['MAP_GLOBALS["',null,'"]'],BUFFER_VALUES_LOOKUP=['values["',null,'"]'],STR_INVOKE_METHOD_NAME_OPEN='this._invokeMethod("',STR_INVOKE_METHOD_NAME_CLOSE='"'+STR_COMMA,STR_UNDEFINED_OUT=' === undefined ? "" : ',STR_REPLACE_NEWLINE="\\n",STR_REPLACE_QUOTE="\\'",STR_VALUES="values",STR_PARENT="parent",STR_SPECIAL_I="$i",STR_SPECIAL_INDEX="$index",STR_SPECIAL_COUNT="$count",STR_SPECIAL_LAST="$last",STR_SPECIAL_ANS="$ans",STR_SPECIAL_NS="$ns",STR_SPECIAL_YNS="$yns",STR_RETURN="return ",STR_WITHVALUES="with(values){ ",STR_WITHCLOSE="; }",STR_LANGSTRING_VAR="LString.",TOKEN_TPL="AUITPL",TOKEN_TPL_LENGTH=TOKEN_TPL.length,TOKEN_PARENT_PROP=STR_PARENT+STR_DOT,TOKEN_THIS_PROP="this.",TOKEN_THIS_PROP_LENGTH=TOKEN_THIS_PROP.length,TOKEN_VALUES_PROP=STR_VALUES+STR_DOT,MAP_TPL_FN={".":new Function(STR_VALUES,STR_PARENT,STR_WITHVALUES+STR_RETURN+STR_VALUES+STR_WITHCLOSE),"..":new Function(STR_VALUES,STR_PARENT,STR_WITHVALUES+STR_RETURN+STR_PARENT+STR_WITHCLOSE)},MAP_TPL_FILTERED_TYPES={"boolean":true,"number":true,"string":true},MAP_TPL_VALUES={".":"this._getValidValues(values)","#":STR_SPECIAL_INDEX,"$index":STR_SPECIAL_INDEX,"$i":STR_SPECIAL_I,"$count":STR_SPECIAL_COUNT,"$last":STR_SPECIAL_LAST,"$ans":STR_SPECIAL_ANS,"$ns":STR_SPECIAL_NS,"$yns":STR_SPECIAL_YNS},MAP_GLOBALS={},SRC_CREATE={},AUI_NS=A.getClassName(STR_BLANK),YUI_NS=A.ClassNameManager.getClassName(STR_BLANK),_INSTANCES={};var Template=function(html,src){var instance=this;var tpl;var fromStaticCall=(src===SRC_CREATE);if(fromStaticCall||A.instanceOf(instance,Template)){if(!fromStaticCall){html=instance._parseArgs(arguments);}tpl=instance._parse(html);}else{html=Template.prototype._parseArgs(arguments);tpl=new Template(html,SRC_CREATE);}return tpl;};Template.prototype={html:function(tpl){var instance=this;var retVal=instance;if(isValue(tpl)){instance._parse(instance._parseArgs(arguments));}else{retVal=instance._html;}return retVal;},parse:function(values){var instance=this;return instance._parentTpl.compiled.call(instance,values,{},1,1,1);},render:function(values,node){var instance=this;var rendered=A.Node.create(instance.parse(values));node=node&&A.one(node);if(node){node.setContent(rendered);}return rendered;},_compile:function(tpl){var instance=this;var compiledTplFn;var fnBody=tpl.tplBody;fnBody=fnBody.replace(REGEX_NEWLINE,STR_REPLACE_NEWLINE);fnBody=fnBody.replace(REGEX_QUOTE,STR_REPLACE_QUOTE);fnBody=fnBody.replace(REGEX_TPL_VAR,instance._compileTpl);fnBody=fnBody.replace(REGEX_TPL_SCRIPTLET,instance._compileCode);BUFFER_COMPILED_TPL_FN[1]=fnBody;var body=BUFFER_COMPILED_TPL_FN.join(STR_BLANK);var $yns=instance.$yns;var $ans=instance.$ans;var $ns=instance.$ns;eval(body);tpl.compiled=function(values,parent,$index,$i,$count,$last){var buffer=[];var subTpl=STR_BLANK;var testFn=tpl.testFn;if(!testFn||testFn.call(instance,values,parent,$index,$i,$count,$last,$ns,$ans,$yns)){var subValues=values;var tplFn=tpl.tplFn;if(tplFn){subValues=tplFn.call(instance,values,parent);parent=values;}if(tplFn&&isArray(subValues)){var length=subValues.length;var execFn=tpl.execFn;for(var i=0;i<length;i++){var index=i+1;var last=(index==length);var subValue=subValues[i];buffer[buffer.length]=compiledTplFn.call(instance,subValue,parent,index,i,length,last,$ns,$ans,$yns);if(execFn){execFn.call(instance,subValues[i]);}}subTpl=buffer.join(STR_BLANK);}else{subTpl=compiledTplFn.call(instance,subValues,parent,$index,$i,$count,$last,$ns,$ans,$yns);}}return subTpl;};return instance;},_compileCode:function(match,code){return STR_JOIN_GROUP_OPEN+code.replace(REGEX_QUOTE_ESCAPED,STR_QUOTE)+STR_JOIN_GROUP_CLOSE;},_compileSubTpl:function(id,values,parent,$index,$i,$count,$last,$ns,$ans,$yns){var instance=this;var length;var tpl=instance.tpls[id];return tpl.compiled.call(instance,values,parent,$index,$i,$count,$last,$ns,$ans,$yns);},_compileTpl:function(match,name,methodName,args,math,offset,str){var compiled;if(name.indexOf(TOKEN_TPL)===0){BUFFER_STR_COMPILE_SUB_TPL[1]=name.substr(TOKEN_TPL_LENGTH);compiled=BUFFER_STR_COMPILE_SUB_TPL.join(STR_BLANK);}else{var value=MAP_TPL_VALUES[name];if(!value){if(name.indexOf(TOKEN_PARENT_PROP)===0){value=name;}else{if(name.indexOf(STR_DOT)>-1){value=TOKEN_VALUES_PROP+name;}else{if(name.indexOf(STR_GLOBAL_SYMBOL)===0&&(name in MAP_GLOBALS)){BUFFER_GLOBAL_PROP[1]=name;
8value=BUFFER_GLOBAL_PROP.join(STR_BLANK);}else{BUFFER_VALUES_LOOKUP[1]=name;value=BUFFER_VALUES_LOOKUP.join(STR_BLANK);}}}}if(math){value=STR_PAREN_OPEN+value+math+STR_PAREN_CLOSE;}if(methodName){args=args?STR_COMMA+args:STR_BLANK;if(methodName.indexOf(TOKEN_THIS_PROP)!==0){methodName=STR_LANGSTRING_VAR+methodName+STR_PAREN_OPEN;}else{methodName=STR_INVOKE_METHOD_NAME_OPEN+methodName.substr(TOKEN_THIS_PROP_LENGTH)+STR_INVOKE_METHOD_NAME_CLOSE; 9args=STR_COMMA+STR_VALUES;}}else{args=STR_BLANK;methodName=STR_PAREN_OPEN+value+STR_UNDEFINED_OUT;}compiled=STR_JOIN_OPEN+methodName+value+args+STR_JOIN_GROUP_CLOSE;}return compiled;},_getValidValues:function(values){var instance=this;var val=STR_BLANK;if(MAP_TPL_FILTERED_TYPES[typeof values]||isDate(values)){val=values;}return val;},_invokeMethod:function(methodName,value,allValues){var instance=this;return instance[methodName](value,allValues);},_parse:function(html){var instance=this;instance._html=html;var match;var id=0;var tpls=[];BUFFER_HTML[1]=html;html=BUFFER_HTML.join(STR_BLANK);while(match=html.match(REGEX_TPL)){var testFn=null;var execFn=null;var tplFn=null;var expression=match[2];var expressionValue=match[3];if(expressionValue){if(expression==STR_FOR){tplFn=MAP_TPL_FN[expressionValue]||new Function(STR_VALUES,STR_PARENT,STR_WITHVALUES+STR_RETURN+expressionValue+STR_WITHCLOSE);}else{expressionValue=LString.unescapeEntities(expressionValue);if(expression==STR_IF){testFn=new Function(STR_VALUES,STR_PARENT,STR_SPECIAL_INDEX,STR_SPECIAL_I,STR_SPECIAL_COUNT,STR_SPECIAL_LAST,STR_SPECIAL_NS,STR_SPECIAL_ANS,STR_SPECIAL_YNS,STR_WITHVALUES+STR_RETURN+expressionValue+STR_WITHCLOSE);}else{if(expression==STR_EXEC){execFn=new Function(STR_VALUES,STR_PARENT,STR_SPECIAL_INDEX,STR_SPECIAL_I,STR_SPECIAL_COUNT,STR_SPECIAL_LAST,STR_SPECIAL_NS,STR_SPECIAL_ANS,STR_SPECIAL_YNS,STR_WITHVALUES+expressionValue+STR_WITHCLOSE);}}}}var tplBody=match[4]||STR_BLANK;html=html.replace(match[0],STR_BRACE_OPEN+TOKEN_TPL+id+STR_BRACE_CLOSE);id=tpls.push({execFn:execFn,id:id,testFn:testFn,tplBody:tplBody,tplFn:tplFn});}var lastIndex=id-1;while(id--){instance._compile(tpls[id]);}instance._parentTpl=tpls[lastIndex];instance.tpls=tpls;return instance;},_parseArgs:function(args){var instance=this;var config;var tpl=args[0];if(isArray(tpl)){if(isObject(tpl[tpl.length-1])){config=tpl.pop();}else{if(isObject(args[1])){config=args[1];}}tpl=tpl.join(STR_BLANK);}else{if(args.length>1){var buffer=[];args=A.Array(args,0,true);var length=args.length;var item;var lastItem=args[length-1];if(isObject(lastItem)){config=args.pop();}for(var i=0;i<length;i++){item=args[i];buffer.push(item);}tpl=buffer.join(STR_BLANK);}}if(config){A.mix(instance,config,true);}return tpl;},$ans:AUI_NS,$yns:YUI_NS};var TEMPLATE_PROTO=Template.prototype;TEMPLATE_PROTO.$ns=AUI_NS;var globalVar=function(key,value){var retVal=null;if(isUndefined(value)&&key){retVal=MAP_GLOBALS[key];}else{if(key){key=String(key).replace(REGEX_PREFIX_GLOBAL_REPLACE,STR_GLOBAL_SYMBOL);if(value!==null){MAP_GLOBALS[key]=value;retVal=value;}else{delete MAP_GLOBALS[key];}}}return retVal;};Template.globalVar=TEMPLATE_PROTO.globalVar=globalVar;Template._GLOBALS=MAP_GLOBALS;var NODE_PROTO=A.Node.prototype;NODE_PROTO.toTPL=function(){return Template.from(this);};NODE_PROTO.renderTPL=function(tpl,data){var instance=this;if(isString(tpl)||isArray(tpl)){tpl=new Template(tpl);}if(tpl&&data){tpl.render(instance,data);}return instance;};A.NodeList.importMethod(NODE_PROTO,["renderTPL"]);A.mix(Template,{from:function(node){node=A.one(node);var content=STR_BLANK;if(node){node=node.getDOM();var nodeName=String(node&&node.nodeName).toLowerCase();if(nodeName!="script"){content=node.value||node.innerHTML;}else{content=node.text||node.textContent||node.innerHTML;}}return new Template(content);},get:function(key){var template=_INSTANCES[key];if(template&&!A.instanceOf(template,Template)){template=new Template(template);_INSTANCES[key]=template;}return template;},parse:function(key,data){var template=Template.get(key);return template&&template.parse(data);},register:function(key,value){var instance=this;var tpl=value;if(!(key in _INSTANCES)&&(Lang.isArray(value)||A.instanceOf(value,Template))){_INSTANCES[key]=value;}return value;},render:function(key,data,node){var template=Template.get(key);return template&&template.render(data,node);},_INSTANCES:_INSTANCES});A.Template=Template;},"1.5.0",{requires:["aui-base"],skinnable:false});AUI.add('aui-carousel', function(A) { 10var Lang = A.Lang, 11 12 STR_BLANK = ' ', 13 14 CAROUSEL = 'carousel', 15 16 getCN = A.getClassName, 17 18 CSS_ITEM = getCN(CAROUSEL, 'item'), 19 CSS_ITEM_ACTIVE = getCN(CAROUSEL, 'item', 'active'), 20 CSS_ITEM_TRANSITION = getCN(CAROUSEL, 'item', 'transition'), 21 CSS_MENU_ACTIVE = getCN(CAROUSEL, 'menu', 'active'), 22 CSS_MENU_INDEX = getCN(CAROUSEL, 'menu', 'index'), 23 CSS_MENU_ITEM = getCN(CAROUSEL, 'menu', 'item'), 24 CSS_MENU_NEXT = getCN(CAROUSEL, 'menu', 'next'), 25 CSS_MENU_PLAY = getCN(CAROUSEL, 'menu', 'play'), 26 CSS_MENU_PAUSE = getCN(CAROUSEL, 'menu', 'pause'), 27 CSS_MENU_PREV = getCN(CAROUSEL, 'menu', 'prev'), 28 CSS_MENU_ITEM_DEFAULT = [CSS_MENU_ITEM, CSS_MENU_INDEX].join(STR_BLANK), 29 CSS_MENU_ITEM_ACTIVE = [CSS_MENU_ITEM, CSS_MENU_INDEX, CSS_MENU_ACTIVE].join(STR_BLANK), 30 31 DOT = '.', 32 33 SELECTOR_MENU_INDEX = DOT + CSS_MENU_INDEX, 34 SELECTOR_MENU_NEXT = DOT + CSS_MENU_NEXT, 35 SELECTOR_MENU_PAUSE = DOT + CSS_MENU_PAUSE, 36 SELECTOR_MENU_PLAY = DOT + CSS_MENU_PLAY, 37 SELECTOR_MENU_PLAY_OR_PAUSE = [SELECTOR_MENU_PLAY, SELECTOR_MENU_PAUSE].join(), 38 SELECTOR_MENU_PREV = DOT + CSS_MENU_PREV,
39 40 TPL_MENU = new A.Template( 41 '<menu>', 42 '<li><a class="', CSS_MENU_ITEM, ' ', CSS_MENU_PLAY, '"></a></li>', 43 '<li><a class="', CSS_MENU_ITEM, ' ', CSS_MENU_PREV, '"></a></li>', 44 '<tpl for="items">', 45 '<li><a class="', CSS_MENU_ITEM, ' {[ $i == parent.activeIndex ? "', CSS_MENU_ITEM_ACTIVE, '" : "', CSS_MENU_ITEM_DEFAULT,'" ]}">{$index}</a></li>', 46 '</tpl>', 47 '<li><a class="', CSS_MENU_ITEM, ' ', CSS_MENU_NEXT, '"></a></li>', 48 '</menu>' 49 ), 50 51 UI_SRC = A.Widget.UI_SRC, 52 53 MAP_EVENT_INFO = { 54 src: UI_SRC 55 }; 56 57var Carousel = A.Component.create( 58 { 59 NAME: CAROUSEL, 60 61 ATTRS: { 62 activeIndex: { 63 value: 0, 64 setter: '_setActiveIndex' 65 }, 66 animationTime: { 67 value: 0.5 68 }, 69 intervalTime: { 70 value: 0.75 71 }, 72 itemSelector: { 73 value: '>*' 74 }, 75 nodeMenu: { 76 value: null, 77 setter: '_setNodeMenu' 78 }, 79 nodeMenuItemSelector: { 80 value: DOT + CSS_MENU_ITEM 81 }, 82 playing: { 83 value: true 84 }, 85 contentBox: { 86 value: '#carousel-MAIN_CAROUSEL #carousel-MAIN_CAROUSEL' 87 } 88 }, 89 90 prototype: { 91 animation: null, 92 nodeSelection: null, 93 nodeMenu: null, 94 95 initializer: function() { 96 var instance = this; 97 98 instance.animation = new A.Anim( 99 { 100 duration: instance.get('animationTime'), 101 to: { 102 opacity: 1 103 } 104 } 105 ); 106 }, 107 108 renderUI: function() { 109 var instance = this; 110 111 instance._updateNodeSelection(); 112 instance.nodeMenu = instance.get('nodeMenu'); 113 114 instance._updateMenuNodes(); 115 }, 116 117 bindUI: function() { 118 var instance = this; 119 120 instance.after( 121 { 122 activeIndexChange: instance._afterActiveIndexChange, 123 animationTimeChange: instance._afterAnimationTimeChange, 124 itemSelectorChange: instance._afterItemSelectorChange, 125 intervalTimeChange: instance._afterIntervalTimeChange, 126 nodeMenuItemSelector: instance._afterNodeMenuItemSelectorChange, 127 playingChange: instance._afterPlayingChange 128 } 129 ); 130 131 instance._bindMenu(); 132 133 if (instance.get('playing') === true) { 134 instance._afterPlayingChange( 135 { 136 prevVal: false, 137 newVal: true 138 } 139 ); 140 } 141 }, 142 143 syncUI: function() { 144 var instance = this; 145 146 instance._uiSetActiveIndex(instance.get('activeIndex')); 147 }, 148 149 item: function(val) { 150 var instance = this; 151 152 instance.set('activeIndex', val); 153 }, 154 155 next: function() { 156 var instance = this; 157 158 instance._updateIndexNext(); 159 }, 160 161 pause: function() { 162 var instance = this; 163 164 instance.set('playing', false); 165 }, 166 167 play: function() { 168 var instance = this; 169 170 instance.set('playing', true); 171 }, 172 173 prev: function() { 174 var instance = this; 175 176 instance._updateIndexPrev(); 177 }, 178 179 _afterActiveIndexChange: function(event) { 180 var instance = this; 181 182 instance._uiSetActiveIndex( 183 event.newVal, 184 { 185 prevVal: event.prevVal, 186 animate: instance.get('playing'), 187 src: event.src 188 } 189 ); 190 }, 191 192 _afterAnimationTimeChange: function(event) { 193 var instance = this; 194 195 instance.animation.set('duration', event.newVal); 196 }, 197 198 _afterItemSelectorChange: function(event) { 199 var instance = this; 200 201 instance._updateNodeSelection(); 202 }, 203 204 _afterNodeMenuItemSelectorChange: function(event) { 205 var instance = this; 206 207 instance.nodeMenuItemSelector = event.newVal; 208 209 instance._updateMenuNodes(); 210 }, 211 212 _afterIntervalTimeChange: function(event) { 213 var instance = this; 214 215 instance._clearIntervalRotationTask(); 216 instance._createIntervalRotationTask(); 217 }, 218 219 _afterPlayingChange: function(event) { 220 var instance = this; 221 222 var menuPlayItem = instance.nodeMenu.one(SELECTOR_MENU_PLAY_OR_PAUSE); 223 var playing = event.newVal; 224 225 var fromClass = CSS_MENU_PAUSE; 226 var toClass = CSS_MENU_PLAY; 227 228 var rotationTaskMethod = '_clearIntervalRotationTask'; 229 230 if (playing) { 231 fromClass = CSS_MENU_PLAY; 232 toClass = CSS_MENU_PAUSE; 233 234 rotationTaskMethod = '_createIntervalRotationTask'; 235 } 236 237 instance[rotationTaskMethod](); 238 239 if (menuPlayItem) { 240 menuPlayItem.replaceClass(fromClass, toClass); 241 } 242 }, 243 244 _bindMenu: function() { 245 var instance = this; 246 247 var menu = instance.nodeMenu; 248 249 var nodeMenuItemSelector = instance.get('nodeMenuItemSelector'); 250 251 menu.delegate('click', instance._onClickDelegate, nodeMenuItemSelector, instance); 252 253 instance.nodeMenuItemSelector = nodeMenuItemSelector; 254 }, 255 256 _clearIntervalRotationTask: function() { 257 var instance = this; 258 259 clearInterval(instance._intervalRotationTask); 260 }, 261 262 _createIndexRandom: function() { 263 var instance = this; 264 265 return Math.ceil(Math.random() * instance.nodeSelection.size()) - 1; 266 }, 267 268 _createIntervalRotationTask: function() { 269 var instance = this; 270 271 instance._clearIntervalRotationTask(); 272 273 instance._intervalRotationTask = setInterval( 274 function() { 275 instance._updateIndexNext( 276 { 277 animate: true 278 } 279 ); 280 }, 281 instance.get('intervalTime') * 1000 282 ); 283 }, 284 285 _onAnimationEnd: function(event, newImage, oldImage, newMenuItem, oldMenuItem) { 286 var instance = this; 287 288 if (oldImage) { 289 oldImage.removeClass(CSS_ITEM_TRANSITION); 290 } 291 292 newImage.setStyle('opacity', '1'); 293 }, 294 295 _onAnimationStart: function(event, newImage, oldImage, newMenuItem, oldMenuItem) { 296 var instance = this; 297 298 newImage.addClass(CSS_ITEM_ACTIVE); 299 300 if (newMenuItem) { 301 newMenuItem.addClass(CSS_MENU_ACTIVE); 302 } 303 304 if (oldImage) { 305 oldImage.replaceClass(CSS_ITEM_ACTIVE, CSS_ITEM_TRANSITION); 306 } 307 308 if (oldMenuItem) { 309 oldMenuItem.removeClass(CSS_MENU_ACTIVE); 310 } 311 }, 312 313 _onClickDelegate: function(event) { 314 var instance = this; 315 316 event.preventDefault(); 317 318 var currentTarget = event.currentTarget; 319 320 var handler; 321 322 if (currentTarget.hasClass(CSS_MENU_INDEX)) { 323 handler = instance._onMenuItemClick; 324 } 325 else if (currentTarget.hasClass(CSS_MENU_PREV)) { 326 handler = instance._updateIndexPrev; 327 } 328 else if (currentTarget.hasClass(CSS_MENU_NEXT)) { 329 handler = instance._updateIndexNext; 330 } 331 else if (currentTarget.test(SELECTOR_MENU_PLAY_OR_PAUSE)) { 332 handler = instance._onMenuPlayClick; 333 } 334 335 if (handler) { 336 handler.apply(instance, arguments); 337 } 338 }, 339 340 _onMenuItemClick: function(event) { 341 var instance = this; 342 343 event.preventDefault(); 344 345 var newIndex = instance.menuNodes.indexOf(event.currentTarget); 346 347 instance.set('activeIndex', newIndex, MAP_EVENT_INFO); 348 }, 349 350 _onMenuPlayClick: function(event) { 351 var instance = this; 352 353 this.set('playing', !this.get('playing')); 354 }, 355 356 _renderMenu: function() { 357 var instance = this; 358 359 var menu = TPL_MENU.render( 360 { 361 items: instance.nodeSelection.getDOM(), 362 activeIndex: instance.get('activeIndex') 363 } 364 ); 365 366 instance.get('contentBox').appendChild(menu); 367 368 return menu; 369 }, 370 371 _setActiveIndex: function(val) { 372 var instance = this; 373 374 if (val == 'rand') { 375 val = instance._createIndexRandom(); 376 } 377 else { 378 val = Math.max(Math.min(val, instance.nodeSelection.size()), -1); 379 } 380 381 return val; 382 }, 383 384 _setNodeMenu: function(val) { 385 var instance = this; 386 387 return A.one(val) || instance._renderMenu(); 388 }, 389 390 _uiSetActiveIndex: function(newVal, objOptions) { 391 var instance = this; 392 393 var oldImage = null; 394 var oldMenuItem = null; 395 var onStart = null; 396 var onEnd = null; 397 398 var newImage = instance.nodeSelection.item(newVal); 399
400 var menuNodes = instance.menuNodes; 401 402 var newMenuItem = menuNodes.item(newVal); 403 404 instance.animation.set('node', newImage); 405 406 if (objOptions && !Lang.isUndefined(objOptions.prevVal)) { 407 var prevVal = objOptions.prevVal; 408 409 newImage.setStyle('opacity', '0'); 410 411 oldMenuItem = menuNodes.item(prevVal); 412 oldImage = instance.nodeSelection.item(prevVal); 413 414 oldImage.replaceClass(CSS_ITEM_ACTIVE, CSS_ITEM_TRANSITION); 415 416 instance.animation.stop(); 417 } 418 else { 419 newImage.addClass(CSS_ITEM_ACTIVE); 420 421 newImage.setStyle('opacity', '1'); 422 } 423 424 onStart = instance.animation.on( 425 'start', 426 function(event) { 427 instance._onAnimationStart(event, newImage, oldImage, newMenuItem, oldMenuItem); 428 429 onStart.detach(); 430 } 431 ); 432 433 onEnd = instance.animation.on( 434 'end', 435 function(event) { 436 instance._onAnimationEnd(event, newImage, oldImage, newMenuItem, oldMenuItem); 437 438 onEnd.detach(); 439 } 440 ); 441 442 if (objOptions) { 443 if (objOptions.animate) { 444 instance.animation.run(); 445 } 446 else { 447 instance.animation.fire('start'); 448 instance.animation.fire('end'); 449 } 450 451 if (objOptions.src == UI_SRC && objOptions.animate) { 452 instance._createIntervalRotationTask(); 453 } 454 } 455 }, 456 457 _updateIndexNext: function(options) { 458 var instance = this; 459 460 var currentIndex = instance.get('activeIndex'); 461 var nodeSelectionSize = instance.nodeSelection.size(); 462 463 var newIndex = currentIndex + 1; 464 465 if (newIndex > (nodeSelectionSize - 1)) { 466 newIndex = 0; 467 } 468 469 if (options) { 470 options.src = UI_SRC; 471 } 472 473 instance.set('activeIndex', newIndex, options); 474 }, 475 476 _updateIndexPrev: function(options) { 477 var instance = this; 478 479 var currentIndex = instance.get('activeIndex'); 480 481 var newIndex = currentIndex - 1; 482 483 if (newIndex < 0) { 484 newIndex = instance.nodeSelection.size() - 1; 485 } 486 487 if (options) { 488 options.src = UI_SRC; 489 } 490 491 instance.set('activeIndex', newIndex, options); 492 }, 493 494 _updateMenuNodes: function() { 495 var instance = this; 496 497 instance.menuNodes = instance.nodeMenu.all(SELECTOR_MENU_INDEX); 498 }, 499 500 _updateNodeSelection: function() { 501 var instance = this; 502 503 var itemSelector = instance.get('itemSelector'); 504 505 var nodeSelection = null; 506 if((new String(instance.get('contentBox'))).indexOf('carousel-MAIN_CAROUSEL') < 0) { 507 nodeSelection = A.one('#carousel-MAIN_CAROUSEL').all(itemSelector).slice(2,6); 508 509 } else { 510 nodeSelection = instance.get('contentBox').all(itemSelector); 511 } 512 513 514 nodeSelection.addClass(CSS_ITEM); 515 516 instance.nodeSelection = nodeSelection; 517 }, 518 519 _intervalRotationTask: null 520 } 521 } 522); 523 524A.Carousel = Carousel; 525 526}, '1.5.0' ,{skinnable:true, requires:['aui-base','aui-template','anim']}); 527/* 528Copyright (c) 2010, Yahoo! Inc. All rights reserved. 529Code licensed under the BSD License: 530http://developer.yahoo.com/yui/license.html 531version: 3.4.0 532build: nightly 533*/ 534YUI.add("anim-xy",function(b){var a=Number;b.Anim.behaviors.xy={set:function(f,d,i,h,c,g,e){f._node.setXY([e(c,a(i[0]),a(h[0])-a(i[0]),g),e(c,a(i[1]),a(h[1])-a(i[1]),g)]);},get:function(c){return c._node.getXY();}};},"3.4.0",{requires:["anim-base","node-screen"]});/* 535Copyright (c) 2010, Yahoo! Inc. All rights reserved. 536Code licensed under the BSD License: 537http://developer.yahoo.com/yui/license.html 538version: 3.4.0 539build: nightly 540*/ 541YUI.add("anim-scroll",function(b){var a=Number;b.Anim.behaviors.scroll={set:function(f,g,i,j,k,e,h){var d=f._node,c=([h(k,a(i[0]),a(j[0])-a(i[0]),e),h(k,a(i[1]),a(j[1])-a(i[1]),e)]);if(c[0]){d.set("scrollLeft",c[0]);}if(c[1]){d.set("scrollTop",c[1]);}},get:function(d){var c=d._node;return[c.get("scrollLeft"),c.get("scrollTop")];}};},"3.4.0",{requires:["anim-base"]});/* 542Copyright (c) 2010, Yahoo! Inc. All rights reserved. 543Code licensed under the BSD License: 544http://developer.yahoo.com/yui/license.html 545version: 3.4.0 546build: nightly 547*/ 548YUI.add("anim-node-plugin",function(b){var a=function(c){c=(c)?b.merge(c):{};c.node=c.host;a.superclass.constructor.apply(this,arguments);};a.NAME="nodefx";a.NS="fx";b.extend(a,b.Anim);b.namespace("Plugin");b.Plugin.NodeFX=a;},"3.4.0",{requires:["node-pluginhost","anim-base"]});/* 549Copyright (c) 2010, Yahoo! Inc. All rights reserved. 550Code licensed under the BSD License:
551http://developer.yahoo.com/yui/license.html 552version: 3.4.0 553build: nightly 554*/ 555YUI.add("anim-easing",function(b){var a={easeNone:function(f,e,h,g){return h*f/g+e;},easeIn:function(f,e,h,g){return h*(f/=g)*f+e;},easeOut:function(f,e,h,g){return -h*(f/=g)*(f-2)+e;},easeBoth:function(f,e,h,g){if((f/=g/2)<1){return h/2*f*f+e;}return -h/2*((--f)*(f-2)-1)+e;},easeInStrong:function(f,e,h,g){return h*(f/=g)*f*f*f+e;},easeOutStrong:function(f,e,h,g){return -h*((f=f/g-1)*f*f*f-1)+e;},easeBothStrong:function(f,e,h,g){if((f/=g/2)<1){return h/2*f*f*f*f+e;}return -h/2*((f-=2)*f*f*f-2)+e;},elasticIn:function(g,e,k,j,f,i){var h;if(g===0){return e;}if((g/=j)===1){return e+k;}if(!i){i=j*0.3;}if(!f||f<Math.abs(k)){f=k;h=i/4;}else{h=i/(2*Math.PI)*Math.asin(k/f);}return -(f*Math.pow(2,10*(g-=1))*Math.sin((g*j-h)*(2*Math.PI)/i))+e;},elasticOut:function(g,e,k,j,f,i){var h;if(g===0){return e;}if((g/=j)===1){return e+k;}if(!i){i=j*0.3;}if(!f||f<Math.abs(k)){f=k;h=i/4;}else{h=i/(2*Math.PI)*Math.asin(k/f);}return f*Math.pow(2,-10*g)*Math.sin((g*j-h)*(2*Math.PI)/i)+k+e;},elasticBoth:function(g,e,k,j,f,i){var h;if(g===0){return e;}if((g/=j/2)===2){return e+k;}if(!i){i=j*(0.3*1.5);}if(!f||f<Math.abs(k)){f=k;h=i/4;}else{h=i/(2*Math.PI)*Math.asin(k/f);}if(g<1){return -0.5*(f*Math.pow(2,10*(g-=1))*Math.sin((g*j-h)*(2*Math.PI)/i))+e;}return f*Math.pow(2,-10*(g-=1))*Math.sin((g*j-h)*(2*Math.PI)/i)*0.5+k+e;},backIn:function(f,e,i,h,g){if(g===undefined){g=1.70158;}if(f===h){f-=0.001;}return i*(f/=h)*f*((g+1)*f-g)+e;},backOut:function(f,e,i,h,g){if(typeof g==="undefined"){g=1.70158;}return i*((f=f/h-1)*f*((g+1)*f+g)+1)+e;},backBoth:function(f,e,i,h,g){if(typeof g==="undefined"){g=1.70158;}if((f/=h/2)<1){return i/2*(f*f*(((g*=(1.525))+1)*f-g))+e;}return i/2*((f-=2)*f*(((g*=(1.525))+1)*f+g)+2)+e;},bounceIn:function(f,e,h,g){return h-b.Easing.bounceOut(g-f,0,h,g)+e;},bounceOut:function(f,e,h,g){if((f/=g)<(1/2.75)){return h*(7.5625*f*f)+e;}else{if(f<(2/2.75)){return h*(7.5625*(f-=(1.5/2.75))*f+0.75)+e;}else{if(f<(2.5/2.75)){return h*(7.5625*(f-=(2.25/2.75))*f+0.9375)+e;}}}return h*(7.5625*(f-=(2.625/2.75))*f+0.984375)+e;},bounceBoth:function(f,e,h,g){if(f<g/2){return b.Easing.bounceIn(f*2,0,h,g)*0.5+e;}return b.Easing.bounceOut(f*2-g,0,h,g)*0.5+h*0.5+e;}};b.Easing=a;},"3.4.0",{requires:["anim-base"]});/* 556Copyright (c) 2010, Yahoo! Inc. All rights reserved. 557Code licensed under the BSD License: 558http://developer.yahoo.com/yui/license.html 559version: 3.4.0 560build: nightly 561*/ 562YUI.add("anim-curve",function(a){a.Anim.behaviors.curve={set:function(f,c,i,h,b,g,e){i=i.slice.call(i);h=h.slice.call(h);var d=e(b,0,100,g)/100;h.unshift(i);f._node.setXY(a.Anim.getBezier(h,d));},get:function(c,b){return c._node.getXY();}};a.Anim.getBezier=function(f,e){var g=f.length;var d=[];for(var c=0;c<g;++c){d[c]=[f[c][0],f[c][1]];}for(var b=1;b<g;++b){for(c=0;c<g-b;++c){d[c][0]=(1-e)*d[c][0]+e*d[parseInt(c+1,10)][0];d[c][1]=(1-e)*d[c][1]+e*d[parseInt(c+1,10)][1];}}return[d[0][0],d[0][1]];};},"3.4.0",{requires:["anim-xy"]});/* 563Copyright (c) 2010, Yahoo! Inc. All rights reserved. 564Code licensed under the BSD License: 565http://developer.yahoo.com/yui/license.html 566version: 3.4.0 567build: nightly 568*/ 569YUI.add("anim-color",function(b){var a=Number;b.Anim.behaviors.color={set:function(f,d,i,h,c,g,e){i=b.Color.re_RGB.exec(b.Color.toRGB(i));h=b.Color.re_RGB.exec(b.Color.toRGB(h));if(!i||i.length<3||!h||h.length<3){b.error("invalid from or to passed to color behavior");}f._node.setStyle(d,"rgb("+[Math.floor(e(c,a(i[1]),a(h[1])-a(i[1]),g)),Math.floor(e(c,a(i[2]),a(h[2])-a(i[2]),g)),Math.floor(e(c,a(i[3]),a(h[3])-a(i[3]),g))].join(", ")+")");},get:function(d,c){var e=d._node.getComputedStyle(c);e=(e==="transparent")?"rgb(255, 255, 255)":e;return e;}};b.each(["backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"],function(c,d){b.Anim.behaviors[c]=b.Anim.behaviors.color;});},"3.4.0",{requires:["anim-base"]});/* 570Copyright (c) 2010, Yahoo! Inc. All rights reserved. 571Code licensed under the BSD License: 572http://developer.yahoo.com/yui/license.html 573version: 3.4.0 574build: nightly 575*/ 576YUI.add("anim-base",function(b){var c="running",n="startTime",l="elapsedTime",j="start",i="tween",m="end",d="node",k="paused",o="reverse",h="iterationCount",a=Number;var f={},e;b.Anim=function(){b.Anim.superclass.constructor.apply(this,arguments);b.Anim._instances[b.stamp(this)]=this;};b.Anim.NAME="anim";b.Anim._instances={};b.Anim.RE_DEFAULT_UNIT=/^width|height|top|right|bottom|left|margin.*|padding.*|border.*$/i;b.Anim.DEFAULT_UNIT="px";b.Anim.DEFAULT_EASING=function(q,p,s,r){return s*q/r+p;};b.Anim._intervalTime=20;b.Anim.behaviors={left:{get:function(q,p){return q._getOffset(p);}}};b.Anim.behaviors.top=b.Anim.behaviors.left;b.Anim.DEFAULT_SETTER=function(s,t,v,w,y,r,u,x){var q=s._node,p=u(y,a(v),a(w)-a(v),r);if(t in q._node.style||t in b.DOM.CUSTOM_STYLES){x=x||"";q.setStyle(t,p+x);}else{if(q._node.attributes[t]){q.setAttribute(t,p);}else{q.set(t,p);}}};b.Anim.DEFAULT_GETTER=function(r,p){var q=r._node,s="";if(p in q._node.style||p in b.DOM.CUSTOM_STYLES){s=q.getComputedStyle(p);}else{if(q._node.attributes[p]){s=q.getAttribute(p);}else{s=q.get(p);}}return s;};b.Anim.ATTRS={node:{setter:function(p){if(p){if(typeof p=="string"||p.nodeType){p=b.one(p);}}this._node=p;if(!p){}return p;}},duration:{value:1},easing:{value:b.Anim.DEFAULT_EASING,setter:function(p){if(typeof p==="string"&&b.Easing){return b.Easing[p];}}
576},from:{},to:{},startTime:{value:0,readOnly:true},elapsedTime:{value:0,readOnly:true},running:{getter:function(){return !!f[b.stamp(this)];},value:false,readOnly:true},iterations:{value:1},iterationCount:{value:0,readOnly:true},direction:{value:"normal"},paused:{readOnly:true,value:false},reverse:{value:false}};b.Anim.run=function(){var q=b.Anim._instances;for(var p in q){if(q[p].run){q[p].run();}}};b.Anim.pause=function(){for(var p in f){if(f[p].pause){f[p].pause();}}b.Anim._stopTimer();};b.Anim.stop=function(){for(var p in f){if(f[p].stop){f[p].stop();}}b.Anim._stopTimer();};b.Anim._startTimer=function(){if(!e){e=setInterval(b.Anim._runFrame,b.Anim._intervalTime);}};b.Anim._stopTimer=function(){clearInterval(e);e=0;};b.Anim._runFrame=function(){var p=true;for(var q in f){if(f[q]._runFrame){p=false;f[q]._runFrame();}}if(p){b.Anim._stopTimer();}};b.Anim.RE_UNITS=/^(-?\d*\.?\d*){1}(em|ex|px|in|cm|mm|pt|pc|%)*$/;var g={run:function(){if(this.get(k)){this._resume();}else{if(!this.get(c)){this._start();}}return this;},pause:function(){if(this.get(c)){this._pause();}return this;},stop:function(p){if(this.get(c)||this.get(k)){this._end(p);}return this;},_added:false,_start:function(){this._set(n,new Date()-this.get(l));this._actualFrames=0;if(!this.get(k)){this._initAnimAttr();}f[b.stamp(this)]=this;b.Anim._startTimer();this.fire(j);},_pause:function(){this._set(n,null);this._set(k,true);delete f[b.stamp(this)];this.fire("pause");},_resume:function(){this._set(k,false);f[b.stamp(this)]=this;this._set(n,new Date()-this.get(l));b.Anim._startTimer();this.fire("resume");},_end:function(p){var q=this.get("duration")*1000;if(p){this._runAttrs(q,q,this.get(o));}this._set(n,null);this._set(l,0);this._set(k,false);delete f[b.stamp(this)];this.fire(m,{elapsed:this.get(l)});},_runFrame:function(){var u=this._runtimeAttr.duration,r=new Date()-this.get(n),q=this.get(o),p=(r>=u),s,v;this._runAttrs(r,u,q);this._actualFrames+=1;this._set(l,r);this.fire(i);if(p){this._lastFrame();}},_runAttrs:function(A,z,w){var x=this._runtimeAttr,r=b.Anim.behaviors,y=x.easing,p=z,u=false,q,s,v;if(A>=z){u=true;}if(w){A=z-A;p=0;}for(v in x){if(x[v].to){q=x[v];s=(v in r&&"set" in r[v])?r[v].set:b.Anim.DEFAULT_SETTER;if(!u){s(this,v,q.from,q.to,A,z,y,q.unit);}else{s(this,v,q.from,q.to,p,z,y,q.unit);}}}},_lastFrame:function(){var p=this.get("iterations"),q=this.get(h);q+=1;if(p==="infinite"||q<p){if(this.get("direction")==="alternate"){this.set(o,!this.get(o));}this.fire("iteration");}else{q=0;this._end();}this._set(n,new Date());this._set(h,q);},_initAnimAttr:function(){var w=this.get("from")||{},v=this.get("to")||{},p={duration:this.get("duration")*1000,easing:this.get("easing")},r=b.Anim.behaviors,u=this.get(d),t,s,q;b.each(v,function(A,y){if(typeof A==="function"){A=A.call(this,u);}s=w[y];if(s===undefined){s=(y in r&&"get" in r[y])?r[y].get(this,y):b.Anim.DEFAULT_GETTER(this,y);}else{if(typeof s==="function"){s=s.call(this,u);}}var x=b.Anim.RE_UNITS.exec(s);var z=b.Anim.RE_UNITS.exec(A);s=x?x[1]:s;q=z?z[1]:A;t=z?z[2]:x?x[2]:"";if(!t&&b.Anim.RE_DEFAULT_UNIT.test(y)){t=b.Anim.DEFAULT_UNIT;}if(!s||!q){b.error('invalid "from" or "to" for "'+y+'"',"Anim");return;}p[y]={from:s,to:q,unit:t};},this);this._runtimeAttr=p;},_getOffset:function(q){var s=this._node,t=s.getComputedStyle(q),r=(q==="left")?"getX":"getY",u=(q==="left")?"setX":"setY";if(t==="auto"){var p=s.getStyle("position");if(p==="absolute"||p==="fixed"){t=s[r]();s[u](t);}else{t=0;}}return t;},destructor:function(){delete b.Anim._instances[b.stamp(this)];}};b.extend(b.Anim,b.Base,g);},"3.4.0",{requires:["base-base","node-style"]});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.