aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--finder_menu.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/finder_menu.js b/finder_menu.js
index d7a36a4..ded419b 100644
--- a/finder_menu.js
+++ b/finder_menu.js
@@ -29,19 +29,20 @@ function ul2finder()
}
// loop through all links of inside finder
+ window.finderOpened = [];
lis=document.getElementById('finder').getElementsByTagName('li');
for(i=0;i<lis.length;i++)
{
// if the li containing the link has no nested list, skip this one
if(!lis[i].getElementsByTagName('ul')[0])
{
-
continue;
}
var newa=document.createElement('a');
newa.href='#';
newa.appendChild(document.createTextNode(lis[i].firstChild.nodeValue));
lis[i].replaceChild(newa,lis[i].firstChild);
+ window.finderOpened[i] = false;
// otherwise apply the parent class
cssjs('add',newa,parentClass);
@@ -62,13 +63,20 @@ function ul2finder()
break;
}
}
+
// and hide all others
if(!found)
{
- cssjs('add',uls[i],hideClass)
+ cssjs('add',uls[i],hideClass)
cssjs('remove',uls[i],showClass)
cssjs('remove',uls[i].parentNode.getElementsByTagName('a')[0],openClass)
- cssjs('add',uls[i].parentNode.getElementsByTagName('a')[0],parentClass)
+ if (window.finderOpened[i] == false) {
+ window.finderOpened[i] = true;
+ cssjs('add',uls[i].parentNode.getElementsByTagName('a')[0],parentClass)
+ } else {
+ window.finderOpened[i] = false;
+ cssjs('remove',uls[i].parentNode.getElementsByTagName('a')[0],parentClass)
+ }
}
}
// change the current link from parent to open