From 65d8a1c1225a489435156ea2ce74d2c90f25a85f Mon Sep 17 00:00:00 2001 From: unkelpehr Date: Sat, 27 Sep 2014 14:22:57 +0200 Subject: [PATCH] Lintin' lintin' lintin' --- public/js/cryptalk_modules/cryptalk.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/public/js/cryptalk_modules/cryptalk.js b/public/js/cryptalk_modules/cryptalk.js index e918ae3..fc37749 100644 --- a/public/js/cryptalk_modules/cryptalk.js +++ b/public/js/cryptalk_modules/cryptalk.js @@ -26,9 +26,11 @@ define({ mediator.emit('console:param',{ room: room}); mediator.emit('host:param',{ room: room}); }); + mediator.on('nick:changed', function(nick) { mediator.emit('console:param',{ nick: nick}); }); + mediator.on('key:changed', function(key) { mediator.emit('console:param',{ key: key}); mediator.emit('host:param',{ key: key}); @@ -38,12 +40,16 @@ define({ // Connect to the default host mediator.emit('command:connect', undefined, function() { // Join room and set key if a hash in the format #Room:Key has been provided - if (hash = window.location.hash) { + if ((hash = window.location.hash)) { parts = hash.slice(1).split(':'); - parts[0] && mediator.emit('command:join',parts[0]); - parts[1] && mediator.emit('command:key',parts[1]); + if (parts[0]) { + mediator.emit('command:join', parts[0]); + } + + if (parts[1]) { + mediator.emit('command:key', parts[1]); + } } }); - }); \ No newline at end of file