From 5dc140390551c133ac5525725a86854ca69679af Mon Sep 17 00:00:00 2001 From: Greg Burri Date: Mon, 16 Mar 2009 10:09:53 +0000 Subject: [PATCH] MOD french -> english (7) --- js/chat/commandes.js | 2 +- js/chat/conversation.js | 2 +- js/chat/conversations.js | 2 +- js/chat/message.js | 10 +++---- js/formater.js | 63 ++++++++++++++++++++++----------------- js/pageAdmin.js | 10 +++---- js/pageMinichat.js | 2 +- js/pageProfile.js | 2 +- js/util.js | 2 +- styles/1/pageMinichat.css | 4 +-- styles/2/pageMinichat.css | 4 +-- 11 files changed, 55 insertions(+), 48 deletions(-) diff --git a/js/chat/commandes.js b/js/chat/commandes.js index 5aec5d5..0c3d23b 100644 --- a/js/chat/commandes.js +++ b/js/chat/commandes.js @@ -40,7 +40,7 @@ euphorik.Commandes = function(client, pageMinichat, util, formater) { objectEach( euphorik.Commandes.liste, function(name, commande) { - thisCommandes.texteAide += "
  • " + thisCommandes.formater.traitementComplet(commande.usage) + " : " + thisCommandes.formater.traitementComplet(commande.description) + "
  • "; + thisCommandes.texteAide += "
  • " + thisCommandes.formater.completeProcessing(commande.usage) + " : " + thisCommandes.formater.completeProcessing(commande.description) + "
  • "; } ); this.texteAide += ""; diff --git a/js/chat/conversation.js b/js/chat/conversation.js index b3fb191..5321380 100644 --- a/js/chat/conversation.js +++ b/js/chat/conversation.js @@ -319,7 +319,7 @@ euphorik.Conversation.prototype.attacherEventsSurMessage = function(element) { } var thisConversation = this; - $(".lienConv", element).click( + $(".conversationLink", element).click( function(event) { // FIXME : ya pas mieux ? var racine = $(event.target).text(); diff --git a/js/chat/conversations.js b/js/chat/conversations.js index c7be4e0..3f9fe2d 100644 --- a/js/chat/conversations.js +++ b/js/chat/conversations.js @@ -380,7 +380,7 @@ euphorik.Conversations.prototype.rafraichirMessages = function(vider) { "new_troll" : function(data) { thisConversations.trollIdCourant = data.troll_id; - $("#trollCourant .troll").html(thisConversations.formater.traitementComplet(data.content)).unbind("click").click( + $("#trollCourant .troll").html(thisConversations.formater.completeProcessing(data.content)).unbind("click").click( function() { thisConversations.ouvrirConversation(data.message_id); } diff --git a/js/chat/message.js b/js/chat/message.js index 2586dbb..51d84b9 100644 --- a/js/chat/message.js +++ b/js/chat/message.js @@ -118,9 +118,9 @@ euphorik.Message.prototype.XHTML = function(messagePair, pre) { // construit l'identifiant de la personne var identifiant = - this.client.nickFormat === "nick" || this.login === "" ? this.formater.traitementComplet(this.nick) : - (this.client.nickFormat === "login" ? this.formater.traitementComplet(this.login) : - this.formater.traitementComplet(this.nick) + "(" + this.formater.traitementComplet(this.login) +")" ); + this.client.nickFormat === "nick" || this.login === "" ? this.formater.completeProcessing(this.nick) : + (this.client.nickFormat === "login" ? this.formater.completeProcessing(this.login) : + this.formater.completeProcessing(this.nick) + "(" + this.formater.completeProcessing(this.login) +")" ); var XHTMLrepondA = ""; var debut = true; @@ -128,7 +128,7 @@ euphorik.Message.prototype.XHTML = function(messagePair, pre) { if (!debut) { XHTMLrepondA += ", "; } - XHTMLrepondA += thisMessage.formater.traitementComplet(rep.nick); + XHTMLrepondA += thisMessage.formater.completeProcessing(rep.nick); debut = false; }); if (XHTMLrepondA) { @@ -148,6 +148,6 @@ euphorik.Message.prototype.XHTML = function(messagePair, pre) { "" + "" + XHTMLrepondA + - "" + this.formater.traitementComplet(this.contenu, this.nick) + "" + + "" + this.formater.completeProcessing(this.contenu, this.nick) + "" + ""; }; diff --git a/js/formater.js b/js/formater.js index 78e2407..a4fbc23 100644 --- a/js/formater.js +++ b/js/formater.js @@ -16,29 +16,30 @@ // You should have received a copy of the GNU General Public License // along with Euphorik. If not, see . +/*jslint laxbreak:true */ /** - * Objet permettant de formater du texte par exemple pour la substitution des liens dans les - * message par "[url]". - * TODO : améliorer l'efficacité des méthods notamment lié au smiles. + * An object for text formatting like Wiki syntax or smiles substitution. + * TODO : improve the performance of the smiles substitution */ euphorik.Formater = function() { this.smiles = euphorik.conf.smiles; - this.protocoles = "http|https|ed2k"; + this.protocols = "http|https|ed2k"; - this.regexUrl = new RegExp("(?:(?:" + this.protocoles + ")://|www\\.)[^ ]*", "gi"); + this.regexUrl = new RegExp("(?:(?:" + this.protocols + ")://|www\\.)[^ ]*", "gi"); this.regexImg = new RegExp("^.*?\\.(gif|jpg|png|jpeg|bmp|tiff)$", "i"); - this.regexDomaine = new RegExp("^(?:(?:" + this.protocoles + ")://)(.*?)(?:$|/).*$", "i"); - this.regexTestProtocoleExiste = new RegExp("^(?:" + this.protocoles + ")://.*$", "i"); + this.regexDomain = new RegExp("^(?:(?:" + this.protocols + ")://)(.*?)(?:$|/).*$", "i"); + this.regexTestIfProtocolExists = new RegExp("^(?:" + this.protocols + ")://.*$", "i"); this.regexProtocolName = new RegExp("^(.*?)://"); }; /** - * Formate un nick saise par l'utilisateur. - * @param nick le nick brut - * @return le nick filtré + * Formats a nick given by the user. + * Trim and remove "{..}". + * @param nick the given nick + * @return the cleaned nick */ -euphorik.Formater.prototype.filtrerInputPseudo = function(nick) { +euphorik.Formater.prototype.formatNick = function(nick) { return nick.replace(/\{|\}/g, "").trim(); }; @@ -51,34 +52,40 @@ euphorik.Formater.prototype.getSmilesHTML = function() { }; /** - * Formatage complet d'un texte. - * @m le message - * @nick facultatif, permet de contruire le label des images sous la forme : " : " + * Complete fomratting process applied to a text. + * - Remove HTML markups + * - Substitutes wiki syntax with HTML + * - Replaces URL with 'a' tag + * - Replaces smiles with HTML + * - Replaces the link to a conversation with HTML + * @m the raw message + * @nick optional, attaches the nick and the message to each images like " : " */ -euphorik.Formater.prototype.traitementComplet = function(m, nick) { - return this.traiterLiensConv(this.traiterSmiles(this.traiterURL(this.traiterWikiSyntaxe(this.remplacerBalisesHTML(m)), nick))); +euphorik.Formater.prototype.completeProcessing = function(m, nick) { + return this.processConversationLinks(this.processSmiles(this.traiterURL(this.traiterWikiSyntaxe(this.remplacerBalisesHTML(m)), nick))); }; /** - * Transforme les liens en entités clickables. - * Un lien vers une conversation permet d'ouvrire celle ci, elle se marque comme ceci dans un message : - * "{5F}" ou 5F est la racine de la conversation. - * Ce lien sera transformer en {5F} pouvant être clické pour créer la conv 5F. + * Processes all conversation links. + * The user can click on a conversation link to open it. + * A link is a number in between brackets like that : "{5F}" where '5F' is the id of the root message. + * This link will be turn in '{5F}' which can be clicked to open the '5F' conversation. */ -euphorik.Formater.prototype.traiterLiensConv = function(m) { +euphorik.Formater.prototype.processConversationLinks = function(m) { return m.replace( /\{\w+\}/g, function(lien) { - return "" + lien + ""; + return "" + lien + ""; } ); }; /** - * FIXME : Cette méthode est attrocement lourde ! A optimiser. - * moyenne sur échantillon : 234ms + * Substitute the smiles (':)', ':P', etc.) with HTML. + * FIXME : This function is very heavy, to optimize ! + * Average : 234ms */ -euphorik.Formater.prototype.traiterSmiles = function(m) { +euphorik.Formater.prototype.processSmiles = function(m) { objectEach(this.smiles, function(name, smiles) { for (var i = 0; i < smiles.length; i++) { m = m.replace(smiles[i], "\"""); @@ -95,7 +102,7 @@ euphorik.Formater.prototype.traiterURL = function(m, nick) { var thisFormater = this; var traitementUrl = function(url) { // si ya pas de protocole on rajoute "http://" - if (!thisFormater.regexTestProtocoleExiste.test(url)) { + if (!thisFormater.regexTestIfProtocolExists.test(url)) { url = "http://" + url; } var extension = thisFormater.getShort(url); @@ -138,7 +145,7 @@ euphorik.Formater.prototype.getShort = function(url) { } estUneImage = true; } else { - var rechercheDomaine = this.regexDomaine.exec(url); + var rechercheDomaine = this.regexDomain.exec(url); if (rechercheDomaine && rechercheDomaine.length >= 2) { versionShort = rechercheDomaine[1]; } else { @@ -163,7 +170,7 @@ euphorik.Formater.prototype.supprimerSmiles = function(m) { /** * Traite les nick et messages à être affiché dans le titre d'une image visualisé avec lightbox. - * Supprime les smiles pour pas qu'ils puissent être remplacés par la fonction 'traiterSmiles'. + * Supprime les smiles pour pas qu'ils puissent être remplacés par la fonction 'processSmiles'. * TODO : trouver un moyen pour que les smiles puissent être conservés */ euphorik.Formater.prototype.traiterPourFenetreLightBox = function(M, urlCourante) { diff --git a/js/pageAdmin.js b/js/pageAdmin.js index f94f9ab..608a7ec 100644 --- a/js/pageAdmin.js +++ b/js/pageAdmin.js @@ -134,8 +134,8 @@ euphorik.PageAdmin.prototype.majIPs = function() { '|'; ip.users.each(function(j, user) { XHTML += (j > 0 ? ", " : "") + - '' + thisPageAdmin.formater.traitementComplet(user.nick) + '' + - (user.login === "" ? "" : ''); + '' + thisPageAdmin.formater.completeProcessing(user.nick) + '' + + (user.login === "" ? "" : ''); }); XHTML += 'débannir'; }); @@ -234,8 +234,8 @@ euphorik.Trolls.prototype.ajouterTrollEvent = function(data) { XHTML += '
    ' + - '' + thisTrolls.formater.traitementComplet(troll.content, troll.author) + '' + - ' - ' + thisTrolls.formater.traitementComplet(troll.author) + '' + + '' + thisTrolls.formater.completeProcessing(troll.content, troll.author) + '' + + ' - ' + thisTrolls.formater.completeProcessing(troll.author) + '' + (trollData.author_id === thisTrolls.client.id ? 'éditerSupprimer' : '') + '
    '; }); @@ -305,7 +305,7 @@ euphorik.Trolls.prototype.ajouterTrollEvent = function(data) { euphorik.Trolls.prototype.modifierTrollEvent = function(data) { var thisTrolls = this; - $("#trolls #troll" + data.troll_id + " .content").html(thisTrolls.formater.traitementComplet(data.content, thisTrolls.trolls[data.troll_id].author)); + $("#trolls #troll" + data.troll_id + " .content").html(thisTrolls.formater.completeProcessing(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; }; diff --git a/js/pageMinichat.js b/js/pageMinichat.js index 0af78d0..abcb72b 100755 --- a/js/pageMinichat.js +++ b/js/pageMinichat.js @@ -229,7 +229,7 @@ euphorik.PageMinichat.prototype.envoyerMessage = function(message) { var nick = $("form#posterMessage input.nick").val(); // (un nick vide est autorisé) - nick = this.formater.filtrerInputPseudo(nick); + nick = this.formater.formatNick(nick); if (nick === euphorik.conf.defaultNick) { this.util.messageDialog("Le nick ne peut pas être " + euphorik.conf.defaultNick); diff --git a/js/pageProfile.js b/js/pageProfile.js index 99f2cfb..7bbe045 100755 --- a/js/pageProfile.js +++ b/js/pageProfile.js @@ -64,7 +64,7 @@ euphorik.PageProfile.prototype.chargerProfile = function() { $("form#profile button").click( function() { - thisPage.client.nick = thisPage.formate.filtrerInputPseudo($("form#profile input.nick").val()); + thisPage.client.nick = thisPage.formate.formatNick($("form#profile input.nick").val()); thisPage.client.email = $("form#profile input.email").val(); thisPage.client.chatOrder = $("form#profile select#chatOrder option:selected").attr("value"); thisPage.client.nickFormat = $("form#profile select#affichagePseudo option:selected").attr("value"); diff --git a/js/util.js b/js/util.js index 27fab59..7ca5760 100644 --- a/js/util.js +++ b/js/util.js @@ -59,7 +59,7 @@ euphorik.Util.prototype.messageDialog = function(message, type, buttons, format, var close = function() { $("#info").slideUp(100); }; close(); - $("#info .message").html(!thisUtil.formater || !format ? message : thisUtil.formater.traitementComplet(message)); + $("#info .message").html(!thisUtil.formater || !format ? message : thisUtil.formater.completeProcessing(message)); switch(type) { case euphorik.Util.messageType.informatif : $("#info #icone").attr("class", "information"); break; diff --git a/styles/1/pageMinichat.css b/styles/1/pageMinichat.css index 03c5ee0..863d385 100755 --- a/styles/1/pageMinichat.css +++ b/styles/1/pageMinichat.css @@ -285,12 +285,12 @@ #page.minichat div.message a { font-weight: bold; } -#page.minichat div.message .lienConv { +#page.minichat div.message .conversationLink { color: #c62929; font-weight: bold; cursor: pointer } -#page.minichat div.message .lienConv:hover { +#page.minichat div.message .conversationLink:hover { color: #e84747 } #page.minichat .entete { diff --git a/styles/2/pageMinichat.css b/styles/2/pageMinichat.css index 085568e..da30f73 100755 --- a/styles/2/pageMinichat.css +++ b/styles/2/pageMinichat.css @@ -253,12 +253,12 @@ #page.minichat div.message a { font-weight: bold; } -#page.minichat div.message .lienConv { +#page.minichat div.message .conversationLink { color: #db960f; font-weight: bold; cursor: pointer } -#page.minichat div.message .lienConv:hover { +#page.minichat div.message .conversationLink:hover { color: #f1c060 } #page.minichat .date { -- 2.43.0