From ecd0a5c422114eb2d2482e471ff98890ac70da68 Mon Sep 17 00:00:00 2001 From: Silvio Date: Sat, 3 Oct 2009 19:08:10 -0300 Subject: Code cleanup and new function changelink() --- finder_menu.js | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/finder_menu.js b/finder_menu.js index 2aec3f7..17efa76 100644 --- a/finder_menu.js +++ b/finder_menu.js @@ -65,28 +65,18 @@ function ul2finder() { ref = uls[i].parentNode.getElementsByTagName('a')[0]; if (ref != this && !isparent(uls[i],parentUls[0])) { - window.finderOpened[ref.id] = false; - cssjs('add',uls[i],hideClass); + changelink('close', ref); cssjs('remove',uls[i],showClass); - cssjs('remove',ref,openClass); - cssjs('add',ref,parentClass); } } } + // open or close a given finder tab if (window.finderOpened[this.id] == false) { - window.finderOpened[this.id] = true; - // change the current link from parent to open - // and show the current nested list - cssjs('remove',this,parentClass); - cssjs('add',this,openClass); + changelink('open', this); cssjs('add',parentUls[0],showClass); } else { - window.finderOpened[this.id] = false; - // change the current link from open to parent - // and hide the current nested list - cssjs('add',this,parentClass); - cssjs('remove',this,openClass); + changelink('close', this); for(var u=0;u