Skip to content

Commit

Permalink
fixed an issue where multiple foldout scripts on the same would break…
Browse files Browse the repository at this point in the history
… each other
  • Loading branch information
Bonemeijer committed Feb 15, 2019
1 parent ed9741c commit 4751578
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
//<![CDATA[
var nodeList = document.querySelectorAll('.aggregate-node .aggregate-node .aggregate-node-name');
for (var i = 0, length = nodeList.length; i < length; i++) {
nodeList[i].parentNode.classList.add('aggregate-node-foldout');
nodeList[i].addEventListener('click', function(){
if (typeof clickEventListener === 'undefined') {
var clickEventListener = function(){
var node = this;
var nextNode = node.nextSibling;

Expand All @@ -11,6 +9,13 @@ for (var i = 0, length = nodeList.length; i < length; i++) {
} else {
nextNode.classList.add('open');
}
});
};
}

var nodeList = document.querySelectorAll('.aggregate-node .aggregate-node .aggregate-node-name');
for (var i = 0, length = nodeList.length; i < length; i++) {
nodeList[i].parentNode.classList.add('aggregate-node-foldout');
nodeList[i].removeEventListener('click', clickEventListener, true);
nodeList[i].addEventListener('click', clickEventListener, true);
}
//]]>

0 comments on commit 4751578

Please sign in to comment.