Client/JavaScript/game.js
// prints the messages in the history div
prints the messages in the history div
prints the messages in the history div
function printToHistory() {
	for(var j=0; j<messages.length; j++) {
		var mesaj; 
		var date = new Date(messages[j].date);
		if(messages[j].sender === game.you) {
			var message='['+date.getHours()+':'+date.getMinutes()+'] '+ messages[j].message;
			mesaj = $("<div class='ownMessage'>").text(message);
		}
		else {
			var message='['+date.getHours()+':'+date.getMinutes()+'] '+game.players[messages[j].sender].username+': '+ messages[j].message;
			mesaj = $("<div class='message'>").text(message);
		}
		$("div#chat div#history").append(mesaj);
	}
	if(historyShown) {
		document.getElementById("history").lastChild.scrollIntoView(false);
	}
	messages=[];	
}
function printToHistory ( ) { for ( var j = 0 ; j < messages . length ; j ++ ) { var mesaj ; var date = new Date ( messages [ j ] . date ) ; if ( messages [ j ] . sender === game . you ) { var message = '[' + date . getHours ( ) + ':' + date . getMinutes ( ) + '] ' + messages [ j ] . message ; mesaj = $ ( "<div class='ownMessage'>" ) . text ( message ) ; } else { var message = '[' + date . getHours ( ) + ':' + date . getMinutes ( ) + '] ' + game . players [ messages [ j ] . sender ] . username + ': ' + messages [ j ] . message ; mesaj = $ ( "<div class='message'>" ) . text ( message ) ; } $ ( "div#chat div#history" ) . append ( mesaj ) ; } if ( historyShown ) { document . getElementById ( "history" ) . lastChild . scrollIntoView ( false ) ; } messages = [ ] ; }
prints the messages in the history div
prints the messages in the history div
// romanian for message -> ran out of ideas for names 