Fresh(er) motd, cleanup

This commit is contained in:
Hexagon 2014-09-18 21:38:15 +02:00
parent 99ace561f6
commit ac8952abb9
3 changed files with 38 additions and 21 deletions

View File

@ -39,7 +39,7 @@ body, html {
/* Messages */ /* Messages */
#chat li { #chat li {
white-space: pre; white-space: pre;
padding: 2px 10px; padding: 2px 15px;
} }
/* Message types */ /* Message types */
@ -47,7 +47,8 @@ body, html {
#chat i { #chat i {
font-style: normal; font-style: normal;
} }
#chat i.info { color: #7777ff; } #chat i.motd { color: #99FF99; display:inline-block; line-height: 12px !important; }
#chat i.info { color: #999999; }
#chat i.server { color: #999999; } #chat i.server { color: #999999; }
#chat i.error { color: #ff7777; } #chat i.error { color: #ff7777; }
#chat i.message { color: #eeeeee; } #chat i.message { color: #eeeeee; }
@ -61,7 +62,7 @@ body, html {
left:0; left:0;
position: absolute; position: absolute;
height:40px; height:30px;
} }
#input { #input {
@ -75,6 +76,6 @@ body, html {
padding: 5px 5px 5px 15px; padding: 5px 5px 5px 15px;
color: #00dd00; color: #FFFFFF;
background-color:#141414; background-color:#141414;
} }

View File

@ -42,12 +42,11 @@ define('cryptalk', {
// Chat related commands // Chat related commands
commands = { commands = {
help: function () { help: function () {
post('info', templates.help); post('motd', templates.help);
}, },
clear: function () { clear: function () {
components.chat.html(''); components.chat.html('');
components.input[0].value = '';
}, },
leave: function () { leave: function () {
@ -133,6 +132,10 @@ define('cryptalk', {
// Execute command handler // Execute command handler
commands[command](payload); commands[command](payload);
// Clear input field
components.input[0].value = '';
} else /* Handle ordinary message */ { } else /* Handle ordinary message */ {
// Make sure that the users has joined a room // Make sure that the users has joined a room
if (!room) { if (!room) {
@ -200,7 +203,7 @@ define('cryptalk', {
}); });
// Post the help/welcome message // Post the help/welcome message
post('info', templates.help, true); post('motd', templates.motd, true);
// It's possible to provide room and key using the hashtag. // It's possible to provide room and key using the hashtag.
// The room and key is then seperated by semicolon (room:key). // The room and key is then seperated by semicolon (room:key).

View File

@ -1,32 +1,45 @@
// The templating function only supports variables. // The templating function only supports variables.
// Define a variable as so: {variable_name} // Define a variable as so: {variable_name}
define({ define({
motd: '\n\n' +
'▄████▄ ██▀███ ▓██ ██▓ ██▓███ ▄▄▄█████▓ ▄▄▄ ██▓ ██ ▄█▀ \n' +
'▒██▀ ▀█ ▓██ ▒ ██▒▒██ ██▒▓██░ ██▒▓ ██▒ ▓▒▒████▄ ▓██▒ ██▄█▒ \n'+
'▒▓█ ▄ ▓██ ░▄█ ▒ ▒██ ██░▓██░ ██▓▒▒ ▓██░ ▒░▒██ ▀█▄ ▒██░ ▓███▄░ \n'+
'▒▓▓▄ ▄██▒▒██▀▀█▄ ░ ▐██▓░▒██▄█▓▒ ▒░ ▓██▓ ░ ░██▄▄▄▄██ ▒██░ ▓██ █▄ \n'+
'▒ ▓███▀ ░░██▓ ▒██▒ ░ ██▒▓░▒██▒ ░ ░ ▒██▒ ░ ▓█ ▓██▒░██████▒▒██▒ █▄ \n'+
'░ ░▒ ▒ ░░ ▒▓ ░▒▓░ ██▒▒▒ ▒▓▒░ ░ ░ ▒ ░░ ▒▒ ▓▒█░░ ▒░▓ ░▒ ▒▒ ▓▒ \n'+
' ░ ▒ ░▒ ░ ▒░▓██ ░▒░ ░▒ ░ ░ ▒ ▒▒ ░░ ░ ▒ ░░ ░▒ ▒░ \n'+
'░ ░░ ░ ▒ ▒ ░░ ░░ ░ ░ ▒ ░ ░ ░ ░░ ░ \n'+
'░ ░ ░ ░ ░ ░ ░ ░ ░░ ░ \n'+
'░ ░ ░ \n'+
' https://github.com/hexagon/cryptalk \n'+
' \n'+
' Tip of the day: /help \n'+
' \n'+
'----------------------------------------------------------------------\n',
help: '' + help: '' +
'<li> \n' + '<li> \n' +
'Cryptalk, encrypted instant chat. \n' + 'Cryptalk, encrypted instant chat. \n' +
' \n' + ' \n' +
'---------------------------------------------------------------------------------- \n' + '---------------------------------------------------------------------- \n' +
' \n' + ' \n' +
'Available commands: \n' + 'Available commands: \n' +
' /generate Generate a random room id \n' + ' /generate Generate random room \n' +
' /join RoomId Joins a room \n' + ' /join RoomId Join a room \n' +
' /leave Leaves the current room \n' + ' /leave Leave the room \n' +
' /nick NickName Sets an optinal nickname \n' + ' /nick NickName Sets an optional nick \n' +
' /key OurStrongPassphrase Sets the password used for \n' + ' /key OurStrongPassphrase Sets encryption key \n' +
' encryption/decryption \n' + ' /clear Clear on-screen buffer \n' +
' /clear Clears on-screen buffer \n' +
' /help This \n' + ' /help This \n' +
' \n' + ' \n' +
' Besides that, it\'s just to talk! \n' + '---------------------------------------------------------------------- \n' +
' \n' +
'Code available for review at https://www.github.com/hexagon/cryptalk \n' +
' \n' +
'--------------------------------------------------------------------------------- \n' +
'</li> ', '</li> ',
default_nick: 'Anonymous', default_nick: 'Anonymous',
post: { post: {
motd: '<li><i class="motd">{text}</i></li>',
info: '<li>INF> <i class="info">{text}</i></li>', info: '<li>INF> <i class="info">{text}</i></li>',
server: '<li>SRV> <i class="server">{text}</i></li>', server: '<li>SRV> <i class="server">{text}</i></li>',
error: '<li>ERR> <i class="error">{text}</i></li>', error: '<li>ERR> <i class="error">{text}</i></li>',