X-Git-Url: http://git.euphorik.ch/?p=euphorik.git;a=blobdiff_plain;f=js%2FpageMinichat%2FpageMinichat.js;h=792f64a7b85b7a1182c6afbea61704dfa5c782fa;hp=2283acbf20d56910fd39401545ec0f922d735b59;hb=217c4d7a0d5f9fee3a8ef0a05ab8506c7f39d5e5;hpb=ed281cb4331777625994d23a6e424fb7c5b5d2c9 diff --git a/js/pageMinichat/pageMinichat.js b/js/pageMinichat/pageMinichat.js index 2283acb..792f64a 100755 --- a/js/pageMinichat/pageMinichat.js +++ b/js/pageMinichat/pageMinichat.js @@ -68,9 +68,11 @@ euphorik.PageMinichat.prototype.charger = function() { $("#posterMessage input.pseudo").val(this.client.pseudo); // cet appel ne doit pas être fait avant l'appel à 'charger' - this.conversations = new euphorik.Conversations(this.client, this.formateur, this.util); + this.conversations = new euphorik.Conversations(this.client, this.formateur, this.util, this.fragment); - this.conversations.rafraichirMessages(true); + this.chargerConversationsFragment(); + + this.conversations.rafraichirMessages(true); this.util.setCaretToEnd($("form#posterMessage input.message")[0]); @@ -96,7 +98,14 @@ euphorik.PageMinichat.prototype.charger = function() { this.util.infoBulle("Cliquer sur les messages pour les enlevers de la liste", $("form#posterMessage #repondA").hover( - function() { thisPage.util.afficherBoite($(".messages", this), $(this), euphorik.Util.positionTypeX.centre, euphorik.Util.positionTypeY.bas); }, + function() { + thisPage.util.afficherBoite( + $(".messages", this), + $(this), + euphorik.Util.positionTypeX.centre, + thisPage.client.chatOrder === "reverse" ? euphorik.Util.positionTypeY.bas : euphorik.Util.positionTypeY.haut + ); + }, function() { $(".messages", this).hide(); } ).click( function(e) { @@ -187,12 +196,31 @@ euphorik.PageMinichat.prototype.charger = function() { ); }; +euphorik.PageMinichat.prototype.chargerConversationsFragment = function() { + var thisPageMinichat = this; + + // attention : "conv" doit être un tableau d'entier + try { + var conv = this.fragment.getVal("conv"); + if (conv) { + conv.each(function(i, racine) { + thisPageMinichat.client.ajouterConversation(racine) + }); + } + } catch(e) { + ;; console.log(e) + } +} + euphorik.PageMinichat.prototype.decharger = function() { this.conversations.comet.stopAttenteCourante(); $("body #smiles").remove(); + + this.fragment.delVal("conv") }; + euphorik.PageMinichat.prototype.getJSONMessage = function(pseudo, message) { var repondA = []; objectEach(this.conversations.messagesRepond, function(id) { @@ -259,10 +287,9 @@ euphorik.PageMinichat.prototype.envoyerMessage = function(pseudo, message) { var mess = conv.messagesParId[messId]; if (mess) { mess.clientARepondu = true; + $("#conversations #" + mess.getId(conv.getId())).addClass("repondu") } }); - // TODO : ca sert à qque chose ? - //$("#conversations div#" + thisPageMinichat.conversations.messagesRepond[messId].getId()).addClass("repondu") }); $("form#posterMessage input.message").val("");