FIX #75 : problème de ban d'ip
[euphorik.git] / js / pageAdmin.js
index 04b642c..fc1d51a 100644 (file)
@@ -17,9 +17,9 @@
 // along with Euphorik.  If not, see <http://www.gnu.org/licenses/>.
 // 
 // La page d'administation, ne peut être accédée que par les ekMaster (admins)
-\r
-/*jslint laxbreak:true */\r
-\r
+
+/*jslint laxbreak:true */
+
 
 euphorik.PageAdmin = function(client, formateur, util) {
    this.nom = "admin";
@@ -84,7 +84,7 @@ euphorik.PageAdmin.prototype.decharger = function() {
    
    // supprime le rafraichissement période des ips
    if (this.timeoutIDmajIPs) {
-      clearTimeout(this.timeoutIDmajIPs);\r
+      clearTimeout(this.timeoutIDmajIPs);
    }
 };
 
@@ -129,7 +129,7 @@ euphorik.PageAdmin.prototype.posterTroll = function() {
   */
 euphorik.PageAdmin.prototype.majIPs = function() {
    if (this.timeoutIDmajIPs) {
-      clearTimeout(this.timeoutIDmajIPs);\r
+      clearTimeout(this.timeoutIDmajIPs);
    }
 
    var thisPageAdmin = this;
@@ -147,13 +147,13 @@ euphorik.PageAdmin.prototype.majIPs = function() {
       success:
          function(data) {               
             if (data.reply === "list_banned_ips") {
-               var XHTML = "";\r
-               data.list.each(function(ip) {
+               var XHTML = "";
+               data.list.each(function(i, ip) {
                   XHTML += '<div class="ban"><span class="ip">' + ip.ip + '</span>|' +
                      '<span class="temps">' +
                      ip.remaining_time +
-                     '</span>|';\r
-                  ip.users.each(function(user) {
+                     '</span>|';
+                  ip.users.each(function(j, user) {
                      XHTML += (j > 0 ? ", " : "") +
                         '<span class="pseudo">' + thisPageAdmin.formateur.traitementComplet(user.nick) + '</span>' +
                         (user.login === "" ? "" : '<span class="login">(' + thisPageAdmin.formateur.traitementComplet(user.login) + ')</span>');
@@ -162,7 +162,7 @@ euphorik.PageAdmin.prototype.majIPs = function() {
                });
                
                if (data.list.length === 0) {
-                  XHTML += '<p>Aucune IP bannie</p>';\r
+                  XHTML += '<p>Aucune IP bannie</p>';
                }
                   
                $("#ips").html(XHTML);
@@ -212,7 +212,7 @@ euphorik.PageAdmin.prototype.deban = function(ip) {
       success:
          function(data){
             if(data.reply === "error") {
-               thisPageAdmin.util.messageDialogue(data.error_message);\r
+               thisPageAdmin.util.messageDialogue(data.error_message);
             }
          }
    });
@@ -263,12 +263,12 @@ euphorik.Trolls = function(client, util, formateur) {
 euphorik.Trolls.prototype.ajouterTrollEvent = function(data) {
    var thisTrolls = this;
 
-   var XHTML = "";\r
-   data.trolls.each(function(trollData) {
+   var XHTML = "";
+   data.trolls.each(function(i, trollData) {
       var troll = new euphorik.Troll(trollData.content, trollData.author);
       var trollId = trollData.troll_id;
       thisTrolls.trolls[trollId] = troll;
-   
+      
       XHTML +=
          '<div id="troll' + trollId + '" class="troll">' +
          '<span class="content">' + thisTrolls.formateur.traitementComplet(troll.content, troll.author) + '</span>' +
@@ -287,10 +287,10 @@ euphorik.Trolls.prototype.ajouterTrollEvent = function(data) {
          $(this).keypress(
             function(e) {
                if (e.which === 13) { // return
-                  $(".modifier", this).click();\r
+                  $(".modifier", this).click();
                }
             }
-         );\r
+         );
          
          $(".delTroll", this).click(
             function() {
@@ -305,12 +305,12 @@ euphorik.Trolls.prototype.ajouterTrollEvent = function(data) {
                   }
                );
             }
-         );\r
+         );
          
          $(".editTroll", this).click(
             function() {
                $("span", troll).css("display", "none");
-               $(troll).append(\r
+               $(troll).append(
                   '<form><p><input class="content" type="text" size="50" maxlength="500" value="' +
                   thisTrolls.trolls[id].content +
                   '"></input><span class="modifier">modifier</span><span class="annuler">annuler</span></p></form>'
@@ -336,7 +336,7 @@ euphorik.Trolls.prototype.ajouterTrollEvent = function(data) {
    );
    
    if (data.trolls.length > 0) {
-      thisTrolls.dernierTroll = data.trolls[data.trolls.length - 1].troll_id;\r
+      thisTrolls.dernierTroll = data.trolls[data.trolls.length - 1].troll_id;
    }
 };
 
@@ -347,11 +347,11 @@ euphorik.Trolls.prototype.modifierTrollEvent = function(data) {
    thisTrolls.trolls[data.troll_id].content = data.content;
 };
 
-Trolls.prototype.supprimerTrollEvent = function(data) {
+euphorik.Trolls.prototype.supprimerTrollEvent = function(data) {
    $("#trolls #troll" + data.troll_id).remove();
 };
 
-Trolls.prototype.modifier = function(id, content) {
+euphorik.Trolls.prototype.modifier = function(id, content) {
    var thisTrolls = this;
    
    var dataToSend = {