X-Git-Url: http://git.euphorik.ch/?p=euphorik.git;a=blobdiff_plain;f=js%2FpageMinichat.js;fp=js%2FpageMinichat.js;h=2a0e81f3a4ee9d703604a574b7c3ea229c249f49;hp=e660b1aa9ea2545c6f07fcdefbee58f325d40ec4;hb=7426ce522bf526924be728aec492fb4ae3ccbfed;hpb=e594d42b773e51b4c6d05451be3ff67a09e632df diff --git a/js/pageMinichat.js b/js/pageMinichat.js index e660b1a..2a0e81f 100755 --- a/js/pageMinichat.js +++ b/js/pageMinichat.js @@ -1,19 +1,19 @@ -// coding: utf-8 -// Copyright 2008 Grégory Burri -// -// This file is part of Euphorik. -// -// Euphorik is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Euphorik is distributed in the hope that it will be useful, -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License +// coding: utf-8 +// Copyright 2008 Grégory Burri +// +// This file is part of Euphorik. +// +// Euphorik is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Euphorik is distributed in the hope that it will be useful, +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License // along with Euphorik. If not, see . function PageMinichat(client, formateur, util) @@ -58,7 +58,7 @@ PageMinichat.prototype.charger = function() this.messages = new Messages(this.client, this.formateur, this.util) this.messages.rafraichirMessages(true) - + this.util.setCaretToEnd($("form input.message")[0]) // les outils de bannissement (uniquement pour les ekMaster) @@ -179,7 +179,7 @@ PageMinichat.prototype.getJSONMessage = function(pseudo, message, repondA) PageMinichat.prototype.envoyerMessage = function(pseudo, message) { var thisPageMinichat = this - + // (un pseudo vide est autorisé) pseudo = this.formateur.filtrerInputPseudo(pseudo) @@ -191,23 +191,23 @@ PageMinichat.prototype.envoyerMessage = function(pseudo, message) for(var i = 0; i < tags.length; i++) repondA.push(parseInt(/\{(.*?)\}>/.exec(tags[i])[1], 36)) message = message.replace(this.regexMessageTagReplace, "") - } - - message = message.trim() - if (message == "") + } + + message = message.trim() + if (message == "") { - this.util.messageDialogue("Le message est vide") - return - } - - if (!this.client.authentifie()) - if (!this.client.enregistrement()) - { - this.util.messageDialogue("login impossible") - return + this.util.messageDialogue("Le message est vide") + return + } + + if (!this.client.authentifie()) + if (!this.client.enregistrement()) + { + this.util.messageDialogue("login impossible") + return } - this.client.pseudo = pseudo + this.client.pseudo = pseudo // évite le double post if (this.envoieMessageEnCours) @@ -217,24 +217,24 @@ PageMinichat.prototype.envoyerMessage = function(pseudo, message) } this.envoieMessageEnCours = true - ;; dumpObj(this.getJSONMessage(pseudo, message, repondA)) - jQuery.ajax( - { - url : "request", - type: "POST", - data : this.util.jsonVersAction(this.getJSONMessage(pseudo, message, repondA)), + ;; dumpObj(this.getJSONMessage(pseudo, message, repondA)) + jQuery.ajax( + { + url : "request", + type: "POST", + data : this.util.jsonVersAction(this.getJSONMessage(pseudo, message, repondA)), dataType : "json", beforeSend : function(xmlHttpRequest) { // TODO : ça marche ça ?? xmlHttpRequest.setRequestHeader("X-Requested-With", "") - }, - success : function(data, textStatus) + }, + success : function(data, textStatus) { ;; dumpObj(data) if(data["reply"] == "ok") - { + { $("form input.message").val("") // met à jour la classe des messages auquel repond celui ci (c'est un peu de la triche) TODO : ya mieux ? @@ -253,13 +253,13 @@ PageMinichat.prototype.envoyerMessage = function(pseudo, message) { thisPageMinichat.util.messageDialogue(data["error_message"]) } - thisPageMinichat.envoieMessageEnCours = false + thisPageMinichat.envoieMessageEnCours = false }, error : function() { thisPageMinichat.envoieMessageEnCours = false - } - } + } + } ) } @@ -843,7 +843,7 @@ Messages.prototype.ajouterMessage = function(element, numConversation) element["nick"], element["login"], element["content"] - ) + ) message.appartientAuClient = element["owner"] message.clientARepondu = element["answered"] @@ -930,10 +930,10 @@ Messages.prototype.supprimerConversation = function(num) * Ajuste la largeur des conversations en fonction de leur nombre. modifie l'attribut CSS 'width'. */ Messages.prototype.ajusterLargeurConversations = function() -{ - var largeurPourcent = (100 / this.conversations.length) - // le "- 0.01" evite que IE se chie dessus lamentablement et affiche les conversations les unes au dessus des autres - if($.browser["msie"]) +{ + var largeurPourcent = (100 / this.conversations.length) + // le "- 0.01" evite que IE se chie dessus lamentablement et affiche les conversations les unes au dessus des autres + if($.browser["msie"]) largeurPourcent -= 0.05 $("#conversations .conversation").css("width", largeurPourcent + "%") }