X-Git-Url: http://git.euphorik.ch/?p=euphorik.git;a=blobdiff_plain;f=js%2FpageMinichat.js;h=86c059e4486f441a05d96b7645ec929bc10fdc4d;hp=0b9c5b362ee2b83a41dd0230db2408e89b819f6f;hb=828daf607fdce322ea17c1786dff84f712aa1632;hpb=e49a1c483f1751f129c0766d1061b3da44b60581 diff --git a/js/pageMinichat.js b/js/pageMinichat.js index 0b9c5b3..86c059e 100755 --- a/js/pageMinichat.js +++ b/js/pageMinichat.js @@ -19,7 +19,7 @@ /*jslint laxbreak:true */ euphorik.PageMinichat = function(client, formater, util, communication) { - this.nom = "minichat"; + this.name = "minichat"; this.client = client; this.formater = formater; @@ -38,7 +38,7 @@ euphorik.PageMinichat.prototype.contenu = function() { '
' + '

' + ' ' + - ' ' + + ' ' + ' 0' + ' ' + ' ' + @@ -63,7 +63,7 @@ euphorik.PageMinichat.prototype.classes = function() { euphorik.PageMinichat.prototype.charger = function() { thisPage = this; - $("#posterMessage input.pseudo").val(this.client.pseudo); + $("#posterMessage input.nick").val(this.client.nick); // cet appel ne doit pas être fait avant l'appel à 'charger' this.conversations = new euphorik.Conversations(this.client, this.formater, this.util, this.communication, this.fragment); @@ -186,10 +186,10 @@ euphorik.PageMinichat.prototype.charger = function() { // interdiction de submiter le formulaire $("form#posterMessage").submit(function(){ return false; }); - $("input.pseudo").click( + $("input.nick").click( function() { - var input = $("input.pseudo")[0]; - if (input.value === euphorik.conf.pseudoDefaut) { + var input = $("input.nick")[0]; + if (input.value === euphorik.conf.defaultNick) { input.value = ""; } } @@ -221,18 +221,18 @@ euphorik.PageMinichat.prototype.decharger = function() { }; /** - * Envoie un nouve message donné, le pseudo utilisé est celui se trouvant - * dans la zone de saisie (form#posterMessage input.pseudo). + * Envoie un nouve message donné, le nick utilisé est celui se trouvant + * dans la zone de saisie (form#posterMessage input.nick). */ euphorik.PageMinichat.prototype.envoyerMessage = function(message) { var thisPageMinichat = this; - var pseudo = $("form#posterMessage input.pseudo").val(); + var nick = $("form#posterMessage input.nick").val(); - // (un pseudo vide est autorisé) - pseudo = this.formater.filtrerInputPseudo(pseudo); + // (un nick vide est autorisé) + nick = this.formater.formatNick(nick); - if (pseudo === euphorik.conf.pseudoDefaut) { - this.util.messageDialog("Le pseudo ne peut pas être " + euphorik.conf.pseudoDefaut); + if (nick === euphorik.conf.defaultNick) { + this.util.messageDialog("Le nick ne peut pas être " + euphorik.conf.defaultNick); return; } @@ -242,8 +242,6 @@ euphorik.PageMinichat.prototype.envoyerMessage = function(message) { return; } - this.client.pseudo = pseudo; - if (!this.client.authentifie()) { if (!this.client.enregistrement()) { this.util.messageDialog("login impossible"); @@ -258,9 +256,11 @@ euphorik.PageMinichat.prototype.envoyerMessage = function(message) { } this.envoieMessageEnCours = true; + this.client.nick = nick; + this.communication.requete( "put_message", - this.getJSONMessage(pseudo, message), + this.getJSONMessage(this.client.nick, message), function() { $("form#posterMessage input.message").val(""); thisPageMinichat.conversations.enleverMessagesRepond(); @@ -279,7 +279,7 @@ euphorik.PageMinichat.prototype.envoyerMessage = function(message) { ); }; -euphorik.PageMinichat.prototype.getJSONMessage = function(pseudo, message) { +euphorik.PageMinichat.prototype.getJSONMessage = function(nick, message) { var repondA = []; objectEach(this.conversations.messagesRepond, function(id) { repondA.push(parseInt(id, 10)); @@ -287,7 +287,7 @@ euphorik.PageMinichat.prototype.getJSONMessage = function(pseudo, message) { return { "cookie" : this.client.cookie, - "nick" : pseudo, + "nick" : nick, "content" : message, "answer_to" : repondA };