From 0780befdaa8903ec01114e0627dca3ebe4fce2c7 Mon Sep 17 00:00:00 2001
From: Fil <fil@rezo.net>
Date: Sat, 29 Nov 2003 14:06:30 +0000
Subject: [PATCH] =?UTF-8?q?javascript=20un=20peu=20moins=20d=C3=A9lirant?=
 =?UTF-8?q?=20(et=20un=20peu=20plus=20rapide)=20pour=20"tout=20d=C3=A9plie?=
 =?UTF-8?q?r"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ecrire/articles_tous.php3 | 12 ++++++------
 ecrire/layer.js           | 12 +++++++++++-
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/ecrire/articles_tous.php3 b/ecrire/articles_tous.php3
index 9233164365..512c116ad7 100644
--- a/ecrire/articles_tous.php3
+++ b/ecrire/articles_tous.php3
@@ -140,12 +140,11 @@ function afficher_rubriques_filles($id_parent) {
 		if (!$numero_block["$nom_block"] > 0){
 			$compteur_block++;
 			$numero_block["$nom_block"] = $compteur_block;
-		}
 
+			if (!$first_couche) $first_couche = $compteur_block;
+			$last_couche = $compteur_block;
+		}
 
-		$javasc_ouvrir .= "ouvrir_couche('$compteur_block', '$spip_lang_rtl');";
-		$javasc_fermer .= "fermer_couche('$compteur_block', '$spip_lang_rtl');";
-		
 		if ($id_parent == '0') 	{
 			$rubrique[$id_rubrique] = "$titre";
 		}
@@ -185,9 +184,10 @@ function afficher_rubriques_filles($id_parent) {
 		
 		$article[$id_rubrique][] = "<div class='puce-article' style='background: url(img_pack/$puce) $spip_lang_left center no-repeat;'><div><a href='articles.php3?id_article=$id_article' class='verdana1'>$titre</a></div></div>";
 	}
-
-
 	
+	$javasc_ouvrir="manipuler_couches('ouvrir','$spip_lang_rtl',$first_couche,$last_couche)";
+	$javasc_fermer="manipuler_couches('fermer','$spip_lang_rtl',$first_couche,$last_couche)";
+
 	// Demarrer l'affichage
 	if ($les_rubriques AND test_layer()) {
 		$les_rubriques = join($les_rubriques,",");
diff --git a/ecrire/layer.js b/ecrire/layer.js
index c47010fce5..d7cbcbaac7 100644
--- a/ecrire/layer.js
+++ b/ecrire/layer.js
@@ -35,4 +35,14 @@ function fermer_couche(couche, rtl) {
 	layer.style.display = 'none';
 	vis[couche] = 'hide';
 }
-
+function manipuler_couches(action,rtl,first,last) {
+	if (action=='ouvrir') {
+		for (j=first; j<=last; j+=1) {
+			ouvrir_couche(j,rtl);
+		}
+	} else {
+		for (j=first; j<=last; j+=1) {
+			fermer_couche(j,rtl);
+		}
+	}
+}
-- 
GitLab