Mostly done!
This commit is contained in:
parent
4f4f7c4325
commit
1ad2108e71
|
@ -5,6 +5,7 @@
|
|||
mediator.on('command:nick', ...);
|
||||
mediator.on('command:key', ...);
|
||||
mediator.on('command:clear', ...);
|
||||
mediator.on('command:title', ...);
|
||||
|
||||
Emits:
|
||||
mediator.emit('nick:changed',...);
|
||||
|
@ -53,7 +54,7 @@ define(
|
|||
return mediator.emit('console:info', templates.messages.key_ok );
|
||||
},
|
||||
|
||||
help = function (payload, done) { mediator.emit('console:motd', templates.help); },
|
||||
help = function () { mediator.emit('console:motd', templates.help); },
|
||||
|
||||
clear = function () { mediator.emit('console:clear'); },
|
||||
|
||||
|
@ -75,11 +76,17 @@ define(
|
|||
// Inform that the nick has been set
|
||||
mediator.emit('console:info', $.template(templates.messages.nick_set, { nick: $.escapeHtml(nick)}));
|
||||
|
||||
},
|
||||
|
||||
title = function(payload) {
|
||||
mediator.emit('window:title',payload);
|
||||
mediator.emit('console:info', $.template(templates.messages.title_set, { title: $.escapeHtml(payload)}));
|
||||
};
|
||||
|
||||
mediator.on('command:help', help);
|
||||
mediator.on('command:clear', clear);
|
||||
mediator.on('command:nick', nick);
|
||||
mediator.on('command:key', setKey);
|
||||
mediator.on('command:title', title);
|
||||
|
||||
});
|
|
@ -89,12 +89,18 @@ define(
|
|||
message = function (payload, done) { post('message', payload.message , payload.nick ); },
|
||||
server = function (payload, done) { post('server', payload); },
|
||||
|
||||
clear = function () {
|
||||
clearInput = function () {
|
||||
fandango.subordinate(function () {
|
||||
components.input[0].value = '';
|
||||
});
|
||||
},
|
||||
|
||||
clear = function () {
|
||||
fandango.subordinate(function () {
|
||||
components.chat[0].innerHTML=''
|
||||
});
|
||||
},
|
||||
|
||||
lockInput = function () {
|
||||
components.input[0].setAttribute('disabled', 'disabled');
|
||||
components.inputWrapper[0].className = 'loading';
|
||||
|
@ -140,7 +146,7 @@ define(
|
|||
if(recipients == 0) {
|
||||
return post('error', $.template(templates.messages.unrecognized_command, { commandName: command }));
|
||||
} else {
|
||||
clear();
|
||||
clearInput();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -151,8 +157,6 @@ define(
|
|||
// Make sure that the user has joined a room and the key is set
|
||||
return (!parameters.room) ? post('error', templates.messages.msg_no_room) : post('error', templates.messages.msg_no_key);
|
||||
}
|
||||
|
||||
console.log(parameters.room);
|
||||
|
||||
// Before sending the message.
|
||||
// Encrypt message using room UUID as salt and key as pepper.
|
||||
|
@ -169,7 +173,7 @@ define(
|
|||
);
|
||||
|
||||
// And clear the the buffer
|
||||
clear();
|
||||
clearInput();
|
||||
|
||||
}
|
||||
};
|
||||
|
|
|
@ -34,7 +34,6 @@ define(
|
|||
|
||||
emit = function(payload) {
|
||||
// Route message from mediator to socket
|
||||
console.log('EMIT:',payload.data,payload.payload);
|
||||
if(socket) socket.emit(payload.data,payload.payload);
|
||||
},
|
||||
|
||||
|
@ -252,8 +251,6 @@ define(
|
|||
|
||||
param = function (p) {
|
||||
parameters = fandango.merge({}, parameters, p );
|
||||
console.log(p);
|
||||
console.log(parameters);
|
||||
};
|
||||
|
||||
mediator.on('command:host', host);
|
||||
|
|
|
@ -31,6 +31,10 @@ define(
|
|||
join = function(payload) {
|
||||
if (room !== false) {
|
||||
mediator.emit('console:error',$.template(templates.messages.already_in_room, { room: room }));
|
||||
} else if (payload.length >= settings.room.maxLen) {
|
||||
mediator.emit('console:error',$.template(templates.messages.room_name_too_long));
|
||||
} else if (payload.length < settings.room.minLen) {
|
||||
mediator.emit('console:error',$.template(templates.messages.room_name_too_short));
|
||||
} else {
|
||||
room = payload;
|
||||
mediator.emit('room:changed', room );
|
||||
|
|
|
@ -29,6 +29,11 @@ define({
|
|||
minLen: 8,
|
||||
},
|
||||
|
||||
room: {
|
||||
minLen: 1,
|
||||
maxLen: 64
|
||||
},
|
||||
|
||||
notifications: {
|
||||
maxOnePerMs: 3000
|
||||
},
|
||||
|
|
|
@ -75,6 +75,9 @@ define({
|
|||
|
||||
unrecognized_command: 'Unrecognized command: "{commandName}"',
|
||||
|
||||
room_name_too_long: 'Isn\'t that a bit long?',
|
||||
room_name_too_short: 'Nah, too short.',
|
||||
|
||||
joined_room: 'Joined room {roomName}.',
|
||||
left_room: 'Left room {roomName}.',
|
||||
already_in_room: 'You are already in a room ({room}), stoopid.',
|
||||
|
|
Loading…
Reference in New Issue