From 6926aecb1cdd777ef8c52f63291341a540670a2c Mon Sep 17 00:00:00 2001 From: Ummon Date: Sat, 13 Apr 2019 20:00:45 +0200 Subject: [PATCH] 'formater' -> 'formatter' --- js/{formater.js => formatter.js} | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) rename js/{formater.js => formatter.js} (86%) diff --git a/js/formater.js b/js/formatter.js similarity index 86% rename from js/formater.js rename to js/formatter.js index a4fbc23..8c3bf05 100644 --- a/js/formater.js +++ b/js/formatter.js @@ -22,7 +22,7 @@ * An object for text formatting like Wiki syntax or smiles substitution. * TODO : improve the performance of the smiles substitution */ -euphorik.Formater = function() { +euphorik.Formatter = function() { this.smiles = euphorik.conf.smiles; this.protocols = "http|https|ed2k"; @@ -39,11 +39,11 @@ euphorik.Formater = function() { * @param nick the given nick * @return the cleaned nick */ -euphorik.Formater.prototype.formatNick = function(nick) { +euphorik.Formatter.prototype.formatNick = function(nick) { return nick.replace(/\{|\}/g, "").trim(); }; -euphorik.Formater.prototype.getSmilesHTML = function() { +euphorik.Formatter.prototype.getSmilesHTML = function() { var XHTML = ""; objectEach(this.smiles, function(name) { XHTML += "\"""; @@ -61,7 +61,7 @@ euphorik.Formater.prototype.getSmilesHTML = function() { * @m the raw message * @nick optional, attaches the nick and the message to each images like " : " */ -euphorik.Formater.prototype.completeProcessing = function(m, nick) { +euphorik.Formatter.prototype.completeProcessing = function(m, nick) { return this.processConversationLinks(this.processSmiles(this.traiterURL(this.traiterWikiSyntaxe(this.remplacerBalisesHTML(m)), nick))); }; @@ -71,7 +71,7 @@ euphorik.Formater.prototype.completeProcessing = function(m, nick) { * 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.processConversationLinks = function(m) { +euphorik.Formatter.prototype.processConversationLinks = function(m) { return m.replace( /\{\w+\}/g, function(lien) { @@ -85,7 +85,7 @@ euphorik.Formater.prototype.processConversationLinks = function(m) { * FIXME : This function is very heavy, to optimize ! * Average : 234ms */ -euphorik.Formater.prototype.processSmiles = function(m) { +euphorik.Formatter.prototype.processSmiles = function(m) { objectEach(this.smiles, function(name, smiles) { for (var i = 0; i < smiles.length; i++) { m = m.replace(smiles[i], "\"""); @@ -94,11 +94,11 @@ euphorik.Formater.prototype.processSmiles = function(m) { return m; }; -euphorik.Formater.prototype.remplacerBalisesHTML = function(m) { +euphorik.Formatter.prototype.remplacerBalisesHTML = function(m) { return m.replace(//g, ">").replace(/"/g, """); }; -euphorik.Formater.prototype.traiterURL = function(m, nick) { +euphorik.Formatter.prototype.traiterURL = function(m, nick) { var thisFormater = this; var traitementUrl = function(url) { // si ya pas de protocole on rajoute "http://" @@ -115,7 +115,7 @@ euphorik.Formater.prototype.traiterURL = function(m, nick) { * 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.Formater.prototype.traiterWikiSyntaxe = function(m) { +euphorik.Formatter.prototype.traiterWikiSyntaxe = function(m) { return m.replace( /(?:^| )_(.*?)_(?:$| )/g, function(texte, c1, c2, c3) { @@ -133,7 +133,7 @@ euphorik.Formater.prototype.traiterWikiSyntaxe = function(m) { * Renvoie une version courte de l'url. * par exemple : http://en.wikipedia.org/wiki/Yakov_Smirnoff devient en.wikipedia.org */ -euphorik.Formater.prototype.getShort = function(url) { +euphorik.Formatter.prototype.getShort = function(url) { var estUneImage = false; var versionShort = null; var rechercheImg = this.regexImg.exec(url); @@ -159,7 +159,7 @@ euphorik.Formater.prototype.getShort = function(url) { return [versionShort ? versionShort : "url", estUneImage]; }; -euphorik.Formater.prototype.supprimerSmiles = function(m) { +euphorik.Formatter.prototype.supprimerSmiles = function(m) { objectEach(this.smiles, function(name, smiles) { for (var i = 0; i < smiles.length; i++) { m = m.replace(smiles[i], ""); @@ -173,7 +173,7 @@ euphorik.Formater.prototype.supprimerSmiles = function(m) { * 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) { +euphorik.Formatter.prototype.traiterPourFenetreLightBox = function(M, urlCourante) { var thisFormater = this; var traitementUrl = function(url) { return "[" + thisFormater.getShort(url)[0] + (urlCourante === url ? "*" : "") + "]"; -- 2.43.0