+ );
+
+ if (data.trolls.length > 0) {
+ thisTrolls.dernierTroll = data.trolls[data.trolls.length - 1].troll_id;
+ }
+};
+
+euphorik.Trolls.prototype.modifierTrollEvent = function(data) {
+ var thisTrolls = this;
+ $("#trolls #troll" + data.troll_id + " .content").html(thisTrolls.formateur.traitementComplet(data.content, thisTrolls.trolls[data.troll_id].author));
+ $("#trolls #troll" + data.troll_id + " a[@rel*=lightbox]").lightBox();
+ thisTrolls.trolls[data.troll_id].content = data.content;
+};
+
+euphorik.Trolls.prototype.supprimerTrollEvent = function(data) {
+ $("#trolls #troll" + data.troll_id).remove();
+};
+
+euphorik.Trolls.prototype.modifier = function(id, content) {
+ var thisTrolls = this;
+
+ var dataToSend = {
+ "header" : { "action" : "mod_troll", "version" : euphorik.conf.versionProtocole },
+ "cookie" : this.client.cookie,
+ "troll_id" : id,
+ "content" : content
+ };
+
+ jQuery.ajax({
+ type: "POST",
+ url: "request",
+ dataType: "json",
+ data: this.util.jsonVersAction(dataToSend),
+ success:
+ function(data) {
+ if (data.reply === "error") {
+ thisTrolls.util.messageDialogue(data.error_message);
+ }
+ }
+ });
+};
+
+/**
+ * Supprime un troll en fonction de son id.
+ */
+euphorik.Trolls.prototype.supprimer = function(id) {
+ var thisTrolls = this;
+
+ var dataToSend = {
+ "header" : { "action" : "del_troll", "version" : euphorik.conf.versionProtocole },
+ "cookie" : this.client.cookie,
+ "troll_id" : id
+ };
+
+ jQuery.ajax({
+ type: "POST",
+ url: "request",
+ dataType: "json",
+ data: this.util.jsonVersAction(dataToSend),
+ success:
+ function(data) {
+ if (data.reply === "error") {
+ thisTrolls.util.messageDialogue(data.error_message);
+ }
+ }
+ });
+};