ADD nouveau style (pas fini)
[euphorik.git] / js / pageMinichat.js
index 0ba6dc6..42314d1 100755 (executable)
@@ -497,7 +497,7 @@ Conversation.prototype.flush = function(funClickOuvrirConv)
       
    // construction de l'XHTML des messages
    var XHTML = ""
-   for (var i = this.messages.length - 1; i >= 0; i--)
+   for (var i = 0; i < this.messages.length; i++)
       if (this.messages[i].id > this.idDernierMessageAffiche)
       {      
          var message = this.messages[i]
@@ -531,16 +531,17 @@ Conversation.prototype.flush = function(funClickOuvrirConv)
          messagePair = !messagePair
       }
       
-   $("#conversations #" + this.getId()).prepend(XHTML)
-   
    // enlève les messages exedentaires
    var nbMessagesAffiche = $("#conversations #" + this.getId() + " .message").size()
    
    if (nbMessagesAffiche > this.nbMessageMax)
       $("#conversations #" + this.getId() + " .message").slice(this.nbMessageMax, nbMessagesAffiche).empty()
-
-   // ajoute les événements liés à chaque nouveau message
-   $("#conversations #" + this.getId() + " .message").filter(function(){ return parseInt($(this).attr("id").substr(4), 36) > thisConversation.idDernierMessageAffiche }).each(
+   
+   
+   //.filter(function(){ return parseInt($(this).attr("id").substr(4), 36) > thisConversation.idDernierMessageAffiche })
+   
+   var DOM = $(XHTML)
+   DOM.each(
       function()
       {
          $(".lienConv", this).click(
@@ -628,6 +629,7 @@ Conversation.prototype.flush = function(funClickOuvrirConv)
          )
       }
    )
+   DOM.prependTo("#conversations #" + this.getId())
    
    if (this.messages.length > 0)
       this.idDernierMessageAffiche = this.messages[this.messages.length-1].id