commit 0e7e582f36e13846f3eb3aed350c91da458655d2
parent fd9b11b1e6dbaf2cfc06af1eca68e2e816e3611b
Author: Georges Dupéron <jahvascriptmaniac+github@free.fr>
Date: Mon, 23 May 2011 20:25:02 +0200
Correction d'un bug : lorsque le jeu recevait deux fois l'évènement "enter", un nouveau mot du nuage était affiché, mais le pointeur vers l'ancien (à animer ou supprimer) était écrasé avant que l'ancien ne soit effacé.
Diffstat:
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/code/serveur/php/ressources/pticlic.js b/code/serveur/php/ressources/pticlic.js
@@ -286,12 +286,14 @@ init(function() {
var isForward = (state.answers.length - oldstate.answers.length) >= 0;
var rb = runstate.relationBox[(isForward ? state : oldstate).answers[(isForward ? state : oldstate).answers.length - 1]];
-
- if (!runstate.currentMNCaption || oldstate.screen != 'game')
- runstate.currentMNCaption = $('<span class="mn-caption"/>');
+
+ if (runstate.currentMNCaption && oldstate.screen != 'game')
+ runstate.currentMNCaption.remove();
+ if (!runstate.currentMNCaption)
+ runstate.currentMNCaption = $('<span class="mn-caption"/>').attr('id', Math.random());
var tmp = runstate.game.cloud[oldstate.answers.length];
var a = runstate.currentMNCaption.text(tmp ? tmp.name : '…');
- var b = $('<span class="mn-caption"/>').text(runstate.game.cloud[state.answers.length].name);
+ var b = $('<span class="mn-caption"/>').attr('id', Math.random()).text(runstate.game.cloud[state.answers.length].name);
if (!rb || (isForward && (oldstate.screen != 'game' || state.answers.length == oldstate.answers.length))) {
isForward = true;
a.remove();