repo: janusweb action: commit revision: path_from: revision_from: bd24c41c764b91b77e0861eebbfddfc8b0f38bd9: path_to: revision_to:
commit bd24c41c764b91b77e0861eebbfddfc8b0f38bd9 Author: James BaicoianuDate: Fri Apr 15 01:09:14 2016 -0700 Fixed chat message format diff --git a/scripts/chat.js b/scripts/chat.js
--- a/scripts/chat.js
+++ b/scripts/chat.js
@@ -1,6 +1,6 @@
elation.requireCSS('janusweb.chat');
elation.require(['ui.window', 'ui.list', 'ui.input', 'elation.collection'], function() {
- elation.template.add('janusweb.chat.message', '[{userId}] {message.data}');
+ elation.template.add('janusweb.chat.message', '[{userId}] {message}');
elation.component.add('janusweb.chat', function() {
this.init = function() {
@@ -40,7 +40,7 @@ elation.require(['ui.window', 'ui.list', 'ui.input', 'elation.collection'], func
}
this.sendmessage = function() {
this.client.send({'method': 'chat', data: this.input.value});
- var msg = {userId: 'me', message: { data: this.input.value }, self: true};
+ var msg = {userId: 'me', message: this.input.value, self: true};
this.addmessage(msg);
elation.events.fire({element: this, type: 'janusweb_chat_send', data: msg});
this.input.value = '';
diff --git a/scripts/janusweb.js b/scripts/janusweb.js
--- a/scripts/janusweb.js
+++ b/scripts/janusweb.js
@@ -171,7 +171,7 @@ elation.require(['janusweb.config', 'engine.things.generic','engine.things.remot
if (!this.remotePlayers.hasOwnProperty(userId)) {
var remoteplayer = this.spawnRemotePlayer(msg.data.data);
elation.events.fire({element: this, type: 'janusweb_user_joined', data: remoteplayer});
- this.chat.addmessage({userId: ' ! ', message: { data: userId + ' entered room'} });
+ this.chat.addmessage({userId: ' ! ', message: userId + ' entered room' });
}
else {
this.moveRemotePlayer(msg.data.data);
@@ -181,7 +181,7 @@ elation.require(['janusweb.config', 'engine.things.generic','engine.things.remot
var remoteplayer = this.remotePlayers[msg.data.data.userId];
console.log("removing player", msg.data.data.userId, remoteplayer);
elation.events.fire({element: this, type: 'janusweb_user_left', data: remoteplayer});
- this.chat.addmessage({userId: ' ! ', message: { data: msg.data.data.userId + ' left room'} });
+ this.chat.addmessage({userId: ' ! ', message: msg.data.data.userId + ' left room' });
if (remoteplayer && remoteplayer.parent) {
remoteplayer.die();
}
-----END OF PAGE-----