1
0
mirror of synced 2024-12-13 14:56:01 +03:00
doctrine2/manual/scripts/tree.js

34 lines
1.0 KiB
JavaScript
Raw Normal View History

function initializeTrees(symbolClosed, symbolOpen)
2007-06-13 02:18:21 +04:00
{
$$('ul.tree li').each(function(listItem) {
2007-06-13 02:18:21 +04:00
var subTree = listItem.getChildren().filterByTag('ul')[0];
2007-06-13 02:18:21 +04:00
if (subTree) {
2007-06-13 02:18:21 +04:00
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);
}
}
2007-06-13 02:18:21 +04:00
}
});
expander.setHTML(subTree.hasClass('closed') ? symbolClosed : symbolOpen);
expander.injectTop(listItem);
2007-06-13 02:18:21 +04:00
}
});
2007-06-13 02:18:21 +04:00
}
window.addEvent('domready', function() {
initializeTrees('+', '-');
});