1
0
mirror of synced 2024-12-15 23:56:02 +03:00
doctrine2/website/web/js/manual_tree.js

34 lines
1.0 KiB
JavaScript
Raw Normal View History

2007-09-01 03:41:48 +04:00
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('+', '-');
});