X-Git-Url: http://git.euphorik.ch/?p=euphorik.git;a=blobdiff_plain;f=js%2Fformater.js;h=78e240778a6b8bfa9cef54f12ef899a3000c651e;hp=eec87f8180014b8f5a10c7e85f9e87699502aac7;hb=24ed7a141aa345454300dd260bbabae3a9f92408;hpb=09608ab29e1c39ea51b51a5f8669dcde36efb306 diff --git a/js/formater.js b/js/formater.js index eec87f8..78e2407 100644 --- a/js/formater.js +++ b/js/formater.js @@ -30,22 +30,22 @@ euphorik.Formater = function() { 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.regexNomProtocole = new RegExp("^(.*?)://"); + this.regexProtocolName = new RegExp("^(.*?)://"); }; /** - * Formate un pseudo saise par l'utilisateur. - * @param pseudo le pseudo brut - * @return le pseudo filtré + * Formate un nick saise par l'utilisateur. + * @param nick le nick brut + * @return le nick filtré */ -euphorik.Formater.prototype.filtrerInputPseudo = function(pseudo) { - return pseudo.replace(/\{|\}/g, "").trim(); +euphorik.Formater.prototype.filtrerInputPseudo = function(nick) { + return nick.replace(/\{|\}/g, "").trim(); }; euphorik.Formater.prototype.getSmilesHTML = function() { var XHTML = ""; - objectEach(this.smiles, function(nom) { - XHTML += "\"""; + objectEach(this.smiles, function(name) { + XHTML += "\"""; }); return XHTML; }; @@ -53,10 +53,10 @@ euphorik.Formater.prototype.getSmilesHTML = function() { /** * Formatage complet d'un texte. * @m le message - * @pseudo facultatif, permet de contruire le label des images sous la forme : " : " + * @nick facultatif, permet de contruire le label des images sous la forme : " : " */ -euphorik.Formater.prototype.traitementComplet = function(m, pseudo) { - return this.traiterLiensConv(this.traiterSmiles(this.traiterURL(this.traiterWikiSyntaxe(this.remplacerBalisesHTML(m)), pseudo))); +euphorik.Formater.prototype.traitementComplet = function(m, nick) { + return this.traiterLiensConv(this.traiterSmiles(this.traiterURL(this.traiterWikiSyntaxe(this.remplacerBalisesHTML(m)), nick))); }; /** @@ -79,9 +79,9 @@ euphorik.Formater.prototype.traiterLiensConv = function(m) { * moyenne sur échantillon : 234ms */ euphorik.Formater.prototype.traiterSmiles = function(m) { - objectEach(this.smiles, function(nom, smiles) { + objectEach(this.smiles, function(name, smiles) { for (var i = 0; i < smiles.length; i++) { - m = m.replace(smiles[i], "\"""); + m = m.replace(smiles[i], "\"""); } }); return m; @@ -91,7 +91,7 @@ euphorik.Formater.prototype.remplacerBalisesHTML = function(m) { return m.replace(//g, ">").replace(/"/g, """); }; -euphorik.Formater.prototype.traiterURL = function(m, pseudo) { +euphorik.Formater.prototype.traiterURL = function(m, nick) { var thisFormater = this; var traitementUrl = function(url) { // si ya pas de protocole on rajoute "http://" @@ -99,7 +99,7 @@ euphorik.Formater.prototype.traiterURL = function(m, pseudo) { url = "http://" + url; } var extension = thisFormater.getShort(url); - return "[" + extension[0] + "]"; + return "[" + extension[0] + "]"; }; return m.replace(this.regexUrl, traitementUrl); }; @@ -111,13 +111,13 @@ euphorik.Formater.prototype.traiterURL = function(m, pseudo) { euphorik.Formater.prototype.traiterWikiSyntaxe = function(m) { return m.replace( /(?:^| )_(.*?)_(?:$| )/g, - function(texte, capture) { - return '' + capture + ''; + function(texte, c1, c2, c3) { + return '' + c1 + c2 + c3 + ''; } ).replace( /(?:^| )\*(.*?)\*(?:$| )/g, - function(texte, capture) { - return '' + capture + ''; + function(texte, c1, c2, c3) { + return '' + c1 + c2 + c3 + ''; } ); }; @@ -142,9 +142,9 @@ euphorik.Formater.prototype.getShort = function(url) { if (rechercheDomaine && rechercheDomaine.length >= 2) { versionShort = rechercheDomaine[1]; } else { - var nomProtocole = this.regexNomProtocole.exec(url); - if (nomProtocole && nomProtocole.length >= 2) { - versionShort = nomProtocole[1]; + var protocolName = this.regexProtocolName.exec(url); + if (protocolName && protocolName.length >= 2) { + versionShort = protocolName[1]; } } } @@ -153,7 +153,7 @@ euphorik.Formater.prototype.getShort = function(url) { }; euphorik.Formater.prototype.supprimerSmiles = function(m) { - objectEach(this.smiles, function(nom, smiles) { + objectEach(this.smiles, function(name, smiles) { for (var i = 0; i < smiles.length; i++) { m = m.replace(smiles[i], ""); } @@ -162,7 +162,7 @@ euphorik.Formater.prototype.supprimerSmiles = function(m) { }; /** - * Traite les pseudo et messages à être affiché dans le titre d'une image visualisé avec lightbox. + * 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'. * TODO : trouver un moyen pour que les smiles puissent être conservés */