From 107016b49c680e6bc4ff8ae9685f7c57e46cc450 Mon Sep 17 00:00:00 2001 From: Greg Burri Date: Thu, 17 Jul 2008 14:07:58 +0000 Subject: [PATCH] MOD minimodif --- js/euphorik.js | 47 +++++++++++++++++++++-------------------------- js/formateur.js | 12 ++++++------ 2 files changed, 27 insertions(+), 32 deletions(-) diff --git a/js/euphorik.js b/js/euphorik.js index b93498f..400f215 100755 --- a/js/euphorik.js +++ b/js/euphorik.js @@ -614,10 +614,10 @@ Client.prototype.kick = function(userId, raison) * { * "reply" : * } - * @page la page + * @page la page courante pour laquelle on écoute des événements + * @util le helper 'util' */ -function PageEvent(page, util) -{ +function PageEvent(page, util) { this.page = page this.util = util @@ -631,12 +631,10 @@ function PageEvent(page, util) /** * Arrête l'attente courante s'il y en a une. */ -PageEvent.prototype.stopAttenteCourante = function() -{ +PageEvent.prototype.stopAttenteCourante = function() { this.stop = true - if (this.attenteCourante != null) - { + if (this.attenteCourante != null) { this.attenteCourante.abort() } } @@ -648,8 +646,7 @@ PageEvent.prototype.stopAttenteCourante = function() * les fonctions acceptent un paramètre correspondant au données reçues. * exemple : {"new_message" : function(data){ ... }} */ -PageEvent.prototype.waitEvent = function(funSend, funsReceive) -{ +PageEvent.prototype.waitEvent = function(funSend, funsReceive) { this.stopAttenteCourante() this.stop = false @@ -658,14 +655,14 @@ PageEvent.prototype.waitEvent = function(funSend, funsReceive) // on doit conserver l'ordre des valeurs de l'objet JSON (le serveur les veut dans l'ordre définit dans le protocole) // TODO : ya pas mieux ? - var dataToSend = - { + var dataToSend = { "header" : { "action" : "wait_event", "version" : euphorik.conf.versionProtocole }, "page" : this.page } var poulpe = funSend() - for (var v in poulpe) - dataToSend[v] = poulpe[v] + for (var v in poulpe) { + dataToSend[v] = poulpe[v] + } this.attenteCourante = jQuery.ajax({ type: "POST", @@ -675,31 +672,29 @@ PageEvent.prototype.waitEvent = function(funSend, funsReceive) timeout: 180000, // timeout de 3min. Gros HACK pas beau. FIXME problème décrit ici : http://groups.google.com/group/jquery-en/browse_thread/thread/8724e64af3333a76 data: this.util.jsonVersAction(dataToSend), success: - function(data) - { + function(data) { funsReceive[data["reply"]](data) // rappel de la fonction dans 100 ms setTimeout(function(){ thisPageEvent.waitEvent2(funSend, funsReceive) }, 100) }, error: - function(XMLHttpRequest, textStatus, errorThrown) - { - ;; console.log("Connexion perdue dans waitEvent") + function(XMLHttpRequest, textStatus, errorThrown) { + ;; console.log("Connexion perdue dans PageEvent.prototype.waitEvent()") setTimeout(function(){ thisPageEvent.waitEvent2(funSend, funsReceive) }, 1000) } - }) -} + }); +}; /** * Si un stopAttenteCourante survient un peu n'importe quand il faut imédiatement arreter de boucler. */ -PageEvent.prototype.waitEvent2 = function(funSend, funsReceive) -{ - if (this.stop) - return - this.waitEvent(funSend, funsReceive) -} +PageEvent.prototype.waitEvent2 = function(funSend, funsReceive) { + if (this.stop) { + return; + } + this.waitEvent(funSend, funsReceive); +}; /////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/js/formateur.js b/js/formateur.js index 34b108b..23f2531 100644 --- a/js/formateur.js +++ b/js/formateur.js @@ -107,19 +107,19 @@ euphorik.Formateur.prototype.traiterURL = function(m, pseudo) { }; /** - * Formatage en utilisant un sous-ensemble des règles de mediwiki. - * par exemple ''italic'' devient italic + * Formatage en utilisant un sous-ensemble des règles de Textile : http://en.wikipedia.org/wiki/Textile_(markup_language). + * par exemple _italic_ devient italic. */ euphorik.Formateur.prototype.traiterWikiSyntaxe = function(m) { return m.replace( - /'''(.*?)'''/g, + /_(.*?)_/g, function(texte, capture) { - return "" + capture + ""; + return '' + capture + ''; } ).replace( - /''(.*?)''/g, + /\*(.*?)\*/g, function(texte, capture) { - return "" + capture + ""; + return '' + capture + ''; } ); }; -- 2.43.0