Fresh(er) motd, cleanup
This commit is contained in:
		
							parent
							
								
									99ace561f6
								
							
						
					
					
						commit
						ac8952abb9
					
				
					 3 changed files with 38 additions and 21 deletions
				
			
		| 
						 | 
				
			
			@ -39,7 +39,7 @@ body, html {
 | 
			
		|||
/* Messages */
 | 
			
		||||
#chat li {
 | 
			
		||||
	white-space: pre;
 | 
			
		||||
	padding: 2px 10px;
 | 
			
		||||
	padding: 2px 15px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Message types */
 | 
			
		||||
| 
						 | 
				
			
			@ -47,7 +47,8 @@ body, html {
 | 
			
		|||
#chat i {
 | 
			
		||||
	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.error	{ color: #ff7777; }
 | 
			
		||||
#chat i.message	{ color: #eeeeee; }
 | 
			
		||||
| 
						 | 
				
			
			@ -61,7 +62,7 @@ body, html {
 | 
			
		|||
	left:0;
 | 
			
		||||
	position: absolute;
 | 
			
		||||
 | 
			
		||||
	height:40px;
 | 
			
		||||
	height:30px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#input {
 | 
			
		||||
| 
						 | 
				
			
			@ -75,6 +76,6 @@ body, html {
 | 
			
		|||
 | 
			
		||||
	padding: 5px 5px 5px 15px;
 | 
			
		||||
 | 
			
		||||
	color: #00dd00;
 | 
			
		||||
	color: #FFFFFF;
 | 
			
		||||
	background-color:#141414;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -42,12 +42,11 @@ define('cryptalk', {
 | 
			
		|||
		// Chat related commands
 | 
			
		||||
		commands = {
 | 
			
		||||
			help: function () {
 | 
			
		||||
				post('info', templates.help);
 | 
			
		||||
				post('motd', templates.help);
 | 
			
		||||
			},
 | 
			
		||||
 | 
			
		||||
			clear: function () {
 | 
			
		||||
				components.chat.html('');
 | 
			
		||||
				components.input[0].value = '';
 | 
			
		||||
			},
 | 
			
		||||
 | 
			
		||||
			leave: function () {
 | 
			
		||||
| 
						 | 
				
			
			@ -133,6 +132,10 @@ define('cryptalk', {
 | 
			
		|||
 | 
			
		||||
				// Execute command handler
 | 
			
		||||
				commands[command](payload);
 | 
			
		||||
 | 
			
		||||
				// Clear input field
 | 
			
		||||
				components.input[0].value = '';
 | 
			
		||||
 | 
			
		||||
			} else /* Handle ordinary message */ {
 | 
			
		||||
				// Make sure that the users has joined a room
 | 
			
		||||
				if (!room) {
 | 
			
		||||
| 
						 | 
				
			
			@ -200,7 +203,7 @@ define('cryptalk', {
 | 
			
		|||
		});
 | 
			
		||||
 | 
			
		||||
	// 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.
 | 
			
		||||
	// The room and key is then seperated by semicolon (room:key).
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,32 +1,45 @@
 | 
			
		|||
// The templating function only supports variables.
 | 
			
		||||
// Define a variable as so: {variable_name}
 | 
			
		||||
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: '' +
 | 
			
		||||
		'<li>																				\n' +
 | 
			
		||||
		'Cryptalk, encrypted instant chat.													\n' +
 | 
			
		||||
		' 																					\n' +
 | 
			
		||||
		'----------------------------------------------------------------------------------	\n' +
 | 
			
		||||
		'----------------------------------------------------------------------	\n' +
 | 
			
		||||
		' 																					\n' +
 | 
			
		||||
		'Available commands: 																\n' +
 | 
			
		||||
		' 	/generate 					Generate a random room id					\n' +
 | 
			
		||||
		'	/join		RoomId				Joins a room									\n' +
 | 
			
		||||
		'	/leave						Leaves the current room									\n' +
 | 
			
		||||
		'	/nick		NickName			Sets an optinal nickname							\n' +
 | 
			
		||||
		'	/key		OurStrongPassphrase		Sets the password used for 					\n' +
 | 
			
		||||
		'	 						encryption/decryption 									\n' +
 | 
			
		||||
		'	/clear						Clears on-screen buffer 							\n' +
 | 
			
		||||
		'	/help						This 												\n' +
 | 
			
		||||
		'	 																				\n' +
 | 
			
		||||
		'	Besides that, it\'s just to talk! 												\n' +
 | 
			
		||||
		'	 																				\n' +
 | 
			
		||||
		'Code available for review at https://www.github.com/hexagon/cryptalk 				\n' +
 | 
			
		||||
		' 	/generate 				Generate random room					\n' +
 | 
			
		||||
		'	/join		RoomId			Join a room									\n' +
 | 
			
		||||
		'	/leave					Leave the room									\n' +
 | 
			
		||||
		'	/nick		NickName		Sets an optional nick							\n' +
 | 
			
		||||
		'	/key		OurStrongPassphrase	Sets encryption key 					\n' +
 | 
			
		||||
		'	/clear					Clear on-screen buffer 							\n' +
 | 
			
		||||
		'	/help					This 												\n' +
 | 
			
		||||
		'																					\n' +
 | 
			
		||||
		'---------------------------------------------------------------------------------	\n' +
 | 
			
		||||
		'----------------------------------------------------------------------	\n' +
 | 
			
		||||
		'</li>																				',
 | 
			
		||||
 | 
			
		||||
	default_nick: 'Anonymous',
 | 
			
		||||
 | 
			
		||||
	post: {
 | 
			
		||||
		motd: 		'<li><i class="motd">{text}</i></li>',
 | 
			
		||||
		info: 		'<li>INF> <i class="info">{text}</i></li>',
 | 
			
		||||
		server: 	'<li>SRV> <i class="server">{text}</i></li>',
 | 
			
		||||
		error: 		'<li>ERR> <i class="error">{text}</i></li>',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue