X-Git-Url: http://git.euphorik.ch/?p=euphorik.git;a=blobdiff_plain;f=js%2FpageMinichat%2Fconversations.js;h=90e59434e7a11927d4e715dcf244e9d7ecf143cd;hp=0ad7878a2d991ca97907d6e2604a7ef8558d1d5f;hb=4aa85a2e80963b73773e748fd4402fab2ad852ce;hpb=2648c8ab1a531e660e18ac97d2efe08d4d63968d diff --git a/js/pageMinichat/conversations.js b/js/pageMinichat/conversations.js index 0ad7878..90e5943 100644 --- a/js/pageMinichat/conversations.js +++ b/js/pageMinichat/conversations.js @@ -99,7 +99,7 @@ euphorik.Conversations.prototype.enleverMessageRepond = function(mess) { * Définit un message comme y répondant. */ euphorik.Conversations.prototype.ajouterMessageRepond = function(mess) { - var thisMessages = this; + var thisConversations = this; // est-ce que le message fait partie de la même conversation que les autres messages ? // TODO : solution plus élégante pour prendre un mess parmis messagesRepond !? @@ -126,7 +126,7 @@ euphorik.Conversations.prototype.ajouterMessageRepond = function(mess) { $("#" + mess.getId(this.prefixIdMessage)).click( function() { $(this).fadeOut("normal", function() { - thisMessages.enleverMessageRepond(mess); + thisConversations.enleverMessageRepond(mess); $("form#posterMessage #repondA .messages").hide(); }); } @@ -246,9 +246,7 @@ euphorik.Conversations.prototype.ajouterMessages = function(elements, numConvers * @param numConversation le numéro de la conversation, 0 = principale * @return true si une nouvelle conversation a été créée sinon false */ -euphorik.Conversations.prototype.ajouterMessage = function(element, numConversation) { - var thisConversations = this; - +euphorik.Conversations.prototype.ajouterMessage = function(element, numConversation) { var message = new euphorik.Message( this.client, @@ -267,24 +265,23 @@ euphorik.Conversations.prototype.ajouterMessage = function(element, numConversat return nouvelleConversation; }; -euphorik.Conversations.prototype.nouvelleConversation = function(num) -{ - var thisMessages = this; +euphorik.Conversations.prototype.nouvelleConversation = function(num) { + var thisConversations = this; this.conversations[num] = new euphorik.Conversation(this, num); this.conversations[num].setFunPage( function(num) { // page suivante - thisMessages.client.pageSuivante(num - 1); - thisMessages.rafraichirMessages(true); + thisConversations.client.pageSuivante(num - 1); + thisConversations.rafraichirMessages(true); }, function(num) { // page précédente - thisMessages.client.pagePrecedente(num - 1); - thisMessages.rafraichirMessages(true); + thisConversations.client.pagePrecedente(num - 1); + thisConversations.rafraichirMessages(true); }, function(num) { // retour à la page une - if (thisMessages.client.goPremierePage(num - 1)) { - thisMessages.rafraichirMessages(true); + if (thisConversations.client.goPremierePage(num - 1)) { + thisConversations.rafraichirMessages(true); } } ); @@ -365,7 +362,7 @@ euphorik.Conversations.prototype.viderMessages = function() { * @param vider vide tous les messages avant d'afficher les nouveaux */ euphorik.Conversations.prototype.rafraichirMessages = function(vider) { - var thisMessages = this; + var thisConversations = this; vider = vider || false; @@ -376,14 +373,14 @@ euphorik.Conversations.prototype.rafraichirMessages = function(vider) { } this.comet.waitEvent( - function() { return thisMessages.getJSONrafraichirMessages(); }, + function() { return thisConversations.getJSONrafraichirMessages(); }, { "new_troll" : - function(data) { - thisMessages.trollIdCourant = data.troll_id; - $("#trollCourant .troll").html(thisMessages.formateur.traitementComplet(data.content)).unbind("click").click( + function(data) { + thisConversations.trollIdCourant = data.troll_id; + $("#trollCourant .troll").html(thisConversations.formateur.traitementComplet(data.content)).unbind("click").click( function() { - thisMessages.ouvrirConversation(data.message_id); + thisConversations.ouvrirConversation(data.message_id); } ); @@ -392,19 +389,19 @@ euphorik.Conversations.prototype.rafraichirMessages = function(vider) { "new_messages" : function(data) { if (vider) { - thisMessages.viderMessages(); + thisConversations.viderMessages(); } // ajoute les messages reçus à leur conversation respective data.conversations.each(function(numConv, conv) { - if (!thisMessages.ajouterMessages(conv, numConv)) { - thisMessages.util.messageDialogue("La conversation {" + thisMessages.client.conversations[numConv - 1].root.toString(36) + "} n'existe pas"); - thisMessages.client.supprimerConversation(numConv - 1); + if (!thisConversations.ajouterMessages(conv, numConv)) { + thisConversations.util.messageDialogue("La conversation {" + thisConversations.client.conversations[numConv - 1].root.toString(36) + "} n'existe pas"); + thisConversations.client.supprimerConversation(numConv - 1); } }); if (vider) { - thisMessages.afficherMessagesRepondConversations(); + thisConversations.afficherMessagesRepondConversations(); } vider = false;