1
0
mirror of synced 2024-12-15 07:36:03 +03:00
doctrine2/manual/new/scripts/tree.js
jepso b868b23d9e Documentation:
- modified javascript files to use mootools
- fixed a layout bug in table of contents when javascript is disabled
- added a smooth scrolling effect :)
2007-07-16 18:59:53 +00:00

34 lines
1.0 KiB
JavaScript

function initializeTrees(symbolClosed, symbolOpen)
{
$$('ul.tree li').each(function(listItem) {
var subTree = listItem.getChildren().filterByTag('ul')[0];
if (subTree) {
var expander = new Element('a', {
'class': 'expander',
'href': 'javascript:void(0);',
'events': {
'click': function() {
if (subTree.hasClass('closed')) {
subTree.removeClass('closed');
this.setHTML(symbolOpen);
} else {
subTree.addClass('closed');
this.setHTML(symbolClosed);
}
}
}
});
expander.setHTML(subTree.hasClass('closed') ? symbolClosed : symbolOpen);
expander.injectTop(listItem);
}
});
}
window.addEvent('domready', function() {
initializeTrees('+', '-');
});