aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <s1lv10@uol.com.br>2009-10-01 11:34:43 -0300
committerSilvio <s1lv10@uol.com.br>2009-10-01 11:34:43 -0300
commitfa86602b433abf5d692e42c3b4b8f527ea3233a7 (patch)
tree492645e404d4a7401ef735f0b3d222817247871e
parentb74b6cdfa6427fb011349f271a6f862f385778ef (diff)
downloadfinder_menu-fa86602b433abf5d692e42c3b4b8f527ea3233a7.tar.gz
finder_menu-fa86602b433abf5d692e42c3b4b8f527ea3233a7.tar.bz2
Initial code to hide the menu
-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