blob: a91d30e82622a07a06c1d555c632f1f30ce6806b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
window.addEvent('domready', function() {
$$('div.highlight').each(addExpander);
});
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){
span.set('html',html);
});
}
|