PageMinichat.prototype.contenu = function()
{
return '\
+<div id="trollCourant">Troll de la semaine : <span class="troll"></span></div>\
<form method="post" action="">\
<p>\
<input class="captcha" name="captcha" type="text" size="8" maxlength="8"></input>\
function(e)
{
var offset = $(e.target).offset()
+ alert($("$smiles").width())
$("#smiles").css("top", offset.top).css("left", offset.left).show()
},
function(e){}
$("form input.message").val()
)
- $("form input.message")[0].focus()
+ $("form input.message").focus()
}
$("form").keypress(
this.conversations = new Array() // les conversations, la première représente la conversation principale
this.nouvelleConversation(0)
+ this.trollIdCourant = 0
+
this.pageEvent = new PageEvent("chat", this.util)
}
var mess = {
"message_count" : conf.nbMessageAffiche,
"main_page" : this.client.pagePrincipale,
- "conversations" : this.getJSONConversations()
+ "conversations" : this.getJSONConversations(),
+ "troll_id" : this.trollIdCourant
}
- if (this.client.cookie != null) mess["cookie"] = this.client.cookie;
+ if (this.client.cookie != null) mess["cookie"] = this.client.cookie
mess["last_message_id"] = this.conversations[0].idDernierMessageAffiche
return mess
function() { return thisMessages.getJSONrafraichirMessages() },
function(data)
{
- if (vider)
- {
- thisMessages.viderMessages()
- vider = false
- }
-
- // ajoute les messages reçus à leur conversation respective
- for (var numConv = 0; numConv < data["conversations"].length; numConv++)
- {
- if (! thisMessages.ajouterMessages(data["conversations"][numConv], numConv))
+ if (vider)
+ {
+ thisMessages.viderMessages()
+ vider = false
+ }
+
+ // en fonction du message
+ switch(data["reply"])
+ {
+ case "new_troll" :
+ thisMessages.trollIdCourant = data["troll_id"]
+ $("#trollCourant .troll").html(thisMessages.formateur.traitementComplet(data["content"]))
+ $("#trollCourant .troll a[@rel*=lightbox]").lightBox()
+ break
+
+ case "new_messages" :
+ // ajoute les messages reçus à leur conversation respective
+ for (var numConv = 0; numConv < data["conversations"].length; numConv++)
{
- thisMessages.util.messageDialogue("La conversation {" + thisMessages.client.conversations[numConv -1].root.toString(36) + "} n'existe pas")
- thisMessages.client.supprimerConversation(numConv - 1)
+ if (! thisMessages.ajouterMessages(data["conversations"][numConv], numConv))
+ {
+ thisMessages.util.messageDialogue("La conversation {" + thisMessages.client.conversations[numConv -1].root.toString(36) + "} n'existe pas")
+ thisMessages.client.supprimerConversation(numConv - 1)
+ }
}
- }
+ break
+ }
}
)
}