2009-11-12 11:19:36 -05:00
|
|
|
window.addEvent('domready', function() {
|
2009-11-12 11:28:30 -05:00
|
|
|
$$('div.highlight').each(addExpander);
|
2009-11-12 11:19:36 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
function addExpander(div){
|
|
|
|
new Element('span',{
|
|
|
|
html: 'expand »',
|
|
|
|
'class': 'pre_expander',
|
|
|
|
'styles': {
|
|
|
|
'display': 'block'
|
|
|
|
},
|
|
|
|
'events': {
|
|
|
|
'click': function(){
|
|
|
|
toggleExpander();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).inject(div, 'top');
|
|
|
|
}
|
|
|
|
function toggleExpander(){
|
|
|
|
var html = '';
|
|
|
|
if($('main').toggleClass('expanded').hasClass('expanded')){
|
|
|
|
html = '« contract';
|
|
|
|
} else {
|
|
|
|
html = 'expand »';
|
|
|
|
}
|
|
|
|
$$('div.highlight span.pre_expander').each(function(span){
|
2009-11-12 11:28:30 -05:00
|
|
|
span.set('html',html);
|
2009-11-12 11:19:36 -05:00
|
|
|
});
|
|
|
|
}
|