ADD trolls, fin coté serveur et début coté client
[euphorik.git] / js / pageMinichat.js
index 6b7b340..80cd013 100755 (executable)
@@ -44,7 +44,12 @@ PageMinichat.prototype.charger = function()
    if (this.client.ekMaster)
    {    
       $("body").append(
-         "<div id=\"outilsBan\"><img id=\"ban\" alt=\"Ban de 3 jours\" src=\"img/ban.gif\" /><img id=\"kick\" alt=\"Ban de 15min\" src=\"img/kick.gif\" /><img id=\"slap\" alt=\"Avertissement\" src=\"img/slap.gif\" /></div>"
+         '<div id="outilsBan">' +
+         '<form><p><input id="raison" name="raison" type="text" size="10" maxlength="200"></input></p></form>' +
+         '<img id="ban" src="img/ban.gif" alt="Ban de 3 jours" />' +
+         '<img id="kick" src="img/kick.gif" alt="Ban de 15min" />' +
+         '<img id="slap" src="img/slap.gif" alt="Avertissement" />' +
+         '</div>'
       )
       $("#outilsBan").hover(
          function(){},
@@ -535,7 +540,7 @@ Conversation.prototype.flush = function(funClickOuvrirConv)
             }
          )
          
-         $("a[@rel*=lightbox]").lightBox()
+         $("a[@rel*=lightbox]", this).lightBox()
          
          // les outils de bannissement (uniquement pour les ekMaster)
          if (thisConversation.client.ekMaster)
@@ -546,24 +551,27 @@ Conversation.prototype.flush = function(funClickOuvrirConv)
                   var element = $(e.target)
                   var h = element.height()
                   var offset = element.offset()
-                  var outils = $("#outilsBan").css("top", offset.top - 2).css("left", offset.left - 2).height(h < 16 ? 16 : h).width(element.width() + 16 * 3 + 4).show()
+                  var outils = $("#outilsBan").css("top", offset.top - 2).css("left", offset.left - 2).height(h < 16 ? 16 : h).width(element.width() + 16 * 3 + 4 + 64).show()
                   $("img", outils).unbind()
                   $("#slap", outils).click(
                      function(e)
                      {
-                        thisConversation.client.slap(userId)
+                        thisConversation.client.slap(userId, $("#outilsBan input").val())
+                        $("#outilsBan input").val("")
                      }
                   )
                   $("#kick", outils).click(
                      function(e)
                      {
-                        thisConversation.client.kick(userId)
+                        thisConversation.client.kick(userId, $("#outilsBan input").val())
+                        $("#outilsBan input").val("")
                      }
                   )
                   $("#ban", outils).click(
                      function(e)
                      {
-                        thisConversation.client.ban(userId)
+                        thisConversation.client.ban(userId, $("#outilsBan input").val())
+                        $("#outilsBan input").val("")
                      }
                   )
                },
@@ -903,7 +911,7 @@ Messages.prototype.rafraichirMessages = function(vider)
       for (var i = 0; i < this.conversations.length; i++)
          this.conversations[i].idDernierMessageAffiche = 0\r
       
-   dumpObj(this.getJSONrafraichirMessages())
+   ;;; dumpObj(this.getJSONrafraichirMessages())
    this.attenteCourante = jQuery.ajax({
       type: "POST",
       url: "request",
@@ -920,9 +928,6 @@ Messages.prototype.rafraichirMessages = function(vider)
             // ajoute les messages reçus à leur conversation respective
             for (var numConv = 0; numConv < data["conversations"].length; numConv++)
             {
-               // ya pas de nouveaux message -> on passe à la prochaine conversation FIXME : marche pas
-               //if (data["conversations"][numConv]["messages"].length == 0) continue
-               
                if (! thisMessages.ajouterMessages(data["conversations"][numConv], numConv))
                {
                   thisMessages.util.messageDialogue("La conversation {" + thisMessages.client.conversations[numConv -1].root.toString(36) + "} n'existe pas")