yui-core-js.mustache revision 7ce2b0acf92b6a5d4b8844372f1c19146d88c35b
ef421f66f47224a42073deaf087378c5d0c9952eEvan HuntYUI().use('node', function(Y) {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt var count = 6, // seconds for timer count down
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt changer = Y.one('.changer'), // just the node to change
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt counters = Y.all('.fruit .count'); // counter numbers on both fruits
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt var doChange = function(){
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt count -= 1; // decrement the seconds count
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt counters.setContent(count); // update the number of seconds by setting the contents of the node
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt // when it gets to 0 seconds, make changes to just the node with class "changer"
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt if(count < 1){
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt // set the "src" attribute of one image to an orange
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt Y.one('.changer img').setAttribute('src', '{{{componentAssets}}}/images/orange.png');
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt // change the contents of one speech bubble
Y.one('.changer .speech').setContent("No, I'm from <em>Florida!</em>");