lib/jschat/http/public/javascripts/app/ui/commands.js in jschat-0.2.9 vs lib/jschat/http/public/javascripts/app/ui/commands.js in jschat-0.3.0
- old
+ new
@@ -12,10 +12,11 @@
help.push(['/join #room_name', 'Joins a room']);
help.push(['/part #room_name', 'Leaves a room. Leave room_name blank for the current room']);
help.push(['/lastlog', 'Shows recent activity']);
help.push(['/names', 'Refreshes the names list']);
help.push(['/name new_name', 'Changes your name']);
+ help.push(['/toggle images', 'Toggles showing of images and videos']);
help.push(['/quit', 'Quit']);
help.push(['/emotes', 'Shows available emotes']);
$A(help).each(function(options) {
var help_text = '<span class="command">#{command}</span><span class="command_help">#{text}</span>'.interpolate({ command: options[0], text: options[1]});
Display.add_message(help_text, 'help');
@@ -41,22 +42,25 @@
name = name[2];
new Ajax.Request('/change-name', {
method: 'post',
parameters: { name: name },
onSuccess: function(response) {
- this.displayMessages(response.responseText, function() {
- $('name').innerHTML = name;
- Cookie.create('jschat-name', name, 28, '/');
- });
+ this.displayMessages(response.responseText);
+ JsChat.user.setName(name);
}.bind(this),
onFailure: function() {
Display.add_message("Server error: couldn't access: #{url}".interpolate({ url: url }), 'server');
}
});
},
'/names': function() {
JsChat.Request.get('/names', function(t) { this.displayMessages(t.responseText); }.bind(this));
+ },
+
+ '/toggle images': function() {
+ JsChat.user.setHideImages(!JsChat.user.hideImages);
+ Display.add_message("Hide images set to #{hide}".interpolate({ hide: JsChat.user.hideImages }), 'server');
},
'/(join)\\s+(.*)': function() {
var room = arguments[0][2];
this.validateAndJoinRoom(room);