X-Git-Url: http://git.euphorik.ch/index.cgi?a=blobdiff_plain;f=js%2Fchat%2Fcommandes.js;h=cbf522dfa81f86aaf15e1ca5feea30cbccf7b752;hb=4a6c575807a90370c0069b688026b10102e1ce10;hp=dbcc76ab9dbee327949558f6a99fdfa2f07c86a1;hpb=e49a1c483f1751f129c0766d1061b3da44b60581;p=euphorik.git
diff --git a/js/chat/commandes.js b/js/chat/commandes.js
index dbcc76a..cbf522d 100644
--- a/js/chat/commandes.js
+++ b/js/chat/commandes.js
@@ -15,32 +15,32 @@
//
// You should have received a copy of the GNU General Public License
// along with Euphorik. If not, see .
-
+
/*jslint laxbreak:true */
/**
* Permet d'executer des commandes tapées par l'utilisateur.
* les commandes sont entrées directement dans la ligne de saisie du message sous la forme :
* /
- *
+ *
* Voici les commandes supportées :
* /nick
- * Modifie le pseudo courant
+ * Modifie le nick courant
*/
-euphorik.Commandes = function(client, pageMinichat, util, formater) {
+euphorik.Commandes = function(client, pageMinichat, util, formatter) {
var thisCommandes = this;
this.client = client;
this.pageMinichat = pageMinichat;
this.util = util;
- this.formater = formater;
-
+ this.formatter = formatter;
+
// construction du texte d'aide (liste des commandes) de manière statique
this.texteAide = "Commandes
";
objectEach(
euphorik.Commandes.liste,
- function(nom, commande) {
- thisCommandes.texteAide += "- " + thisCommandes.formater.traitementComplet(commande.usage) + " : " + thisCommandes.formater.traitementComplet(commande.description) + "
";
+ function(name, commande) {
+ thisCommandes.texteAide += "- " + thisCommandes.formatter.completeProcessing(commande.usage) + " : " + thisCommandes.formatter.completeProcessing(commande.description) + "
";
}
);
this.texteAide += "
";
@@ -50,17 +50,17 @@ euphorik.Commandes.statut = {ok : 0, pas_une_commande : 1, erreur_commande : 2};
euphorik.Commandes.liste = {
"nick" : {
- description : "Change le pseudo courant",
- usage : "/nick ",
+ description : "Change le nick courant",
+ usage : "/nick ",
exec : function(args, client) {
-
+
if (args.length === 0) {
return [euphorik.Commandes.statut.erreur_commande, 'Utilisation de la commande : ' + this.usage];
}
-
- client.pseudo = args[0];
- $("form#posterMessage input.pseudo").val(client.pseudo);
-
+
+ client.nick = args[0];
+ $("form#posterMessage input.nick").val(client.nick);
+
return [euphorik.Commandes.statut.ok, ''];
}
},
@@ -88,33 +88,33 @@ euphorik.Commandes.liste = {
*/
euphorik.Commandes.prototype.exec = function(chaine) {
chaine = chaine.trim();
-
+
var fragments = chaine.split(/\s+/);
if (fragments.length === 0 || fragments[0].charAt(0) != '/') {
return [euphorik.Commandes.statut.pas_une_commande, ''];
}
-
- var nomCommande = fragments[0].slice(1);
+
+ var commandName = fragments[0].slice(1);
var args = fragments.slice(1);
-
- if (nomCommande === "") {
+
+ if (commandName === "") {
return [euphorik.Commandes.statut.erreur_commande, 'La commande est vide'];
}
// commandes spéciales pour afficher l'aide : "?", "h", "help", "aide"
- if (nomCommande === "?" || nomCommande === "h" || nomCommande === "help" || nomCommande === "aide") {
+ if (commandName === "?" || commandName === "h" || commandName === "help" || commandName === "aide") {
this.util.messageDialog(
this.texteAide,
euphorik.Util.messageType.informatif,
- {"fermer" : function(){}},
+ {"close" : function(){}},
false,
-1
);
return [euphorik.Commandes.statut.ok, ''];
}
-
- if (euphorik.Commandes.liste.hasOwnProperty(nomCommande)) {
- return euphorik.Commandes.liste[nomCommande].exec(args, this.client, this.pageMinichat);
+
+ if (euphorik.Commandes.liste.hasOwnProperty(commandName)) {
+ return euphorik.Commandes.liste[commandName].exec(args, this.client, this.pageMinichat);
}
-
- return [euphorik.Commandes.statut.erreur_commande, 'La commande /' + nomCommande + ' est inconnue'];
+
+ return [euphorik.Commandes.statut.erreur_commande, 'La commande /' + commandName + ' est inconnue'];
};