From 68e44def31b370099b95f24a7652b142bd6724fb Mon Sep 17 00:00:00 2001
From: Fil <fil@rezo.net>
Date: Thu, 2 Nov 2006 17:20:12 +0000
Subject: [PATCH] remettre l'antifocus sur les mots apres un tour d'ajax (#630)

---
 ecrire/inc/editer_mot.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ecrire/inc/editer_mot.php b/ecrire/inc/editer_mot.php
index 1548ee6e2d..a58730874a 100644
--- a/ecrire/inc/editer_mot.php
+++ b/ecrire/inc/editer_mot.php
@@ -343,6 +343,8 @@ function formulaire_mots_cles($id_groupes_vus, $id_objet, $les_mots, $table, $ta
 // http://doc.spip.org/@menu_mots
 function menu_mots($row, $id_groupes_vus, $les_mots)
 {
+	$rand = rand(0,10000); # pour antifocus & ajax
+
 	$id_groupe = $row['id_groupe'];
 
 	$result = spip_query("SELECT id_mot, type, titre FROM spip_mots WHERE id_groupe =$id_groupe " . ($les_mots ? "AND id_mot NOT IN ($les_mots) " : '') .  "ORDER BY type, titre");
@@ -360,7 +362,7 @@ function menu_mots($row, $id_groupes_vus, $les_mots)
 
 	// forcer le recalcul du noeud car on est en Ajax
 	$jscript1 = "findObj_forcer('$ancre').style.visibility='visible';";
-	$jscript2 = "if(!antifocus_mots[$id_groupe]){this.value='';antifocus_mots[$id_groupe]=true;}";
+	$jscript2 = "if(!antifocus_mots['$rand-$id_groupe']){this.value='';antifocus_mots['$rand-$id_groupe']=true;}";
 
 	if ($n > 50) {
 		$jscript = "onfocus=\"$jscript1 $jscript2\"";
-- 
GitLab