diff --git a/webapp.html b/webapp.html index 2f7dd9a..1cd6a3c 100644 --- a/webapp.html +++ b/webapp.html @@ -105,7 +105,7 @@ text-shadow: 1px 1px orange;
- +
@@ -124,7 +124,14 @@ text-shadow: 1px 1px orange; document.getElementById( 'send' ).onclick = function() { var outStr = localStorage.getItem( 'outbox' ) || ''; - outStr += new Date().getTime() + ' ' + document.getElementById('name').value + '///' + document.getElementById('message').value + '\n'; + if (document.getElementById('name').value == ""){ + var namm= "anonymous"; + } + else{ + var namm= document.getElementById('name').value; + } + + outStr += new Date().getTime() + ' ' + namm + '///' + document.getElementById('message').value + '\n'; localStorage.setItem( 'outbox', outStr ); updateOutboxView(); checkOutbox(); @@ -228,7 +235,7 @@ function updateInboxView() { if ( localStorage.key(i).length === 0 || element === 'outbox' ) { continue; } - localStorageArray[i] = { time:localStorage.key(i), content:elesplit[0] }; + localStorageArray[i] = { time:localStorage.key(i), user:elesplit[0], message:elesplit[1] }; } } orderStorage = localStorageArray.sort(function(a,b) { return b.time - a.time } ); @@ -241,8 +248,7 @@ function updateInboxView() { var date = new Date(parseInt(orderStorage[i].time)); // date.setHours(date.getHours() + 2); var datereadable = date.getDate()+"/"+date.getMonth()+"/"+date.getFullYear()+" "+date.getHours()+":"+date.getMinutes(); - element=orderStorage[i].content.split('///'); - contentString += '
  • ' + datereadable + ' ' + ' '+ element[0] +'
    '+ element[1]+'
  • '; + contentString += '
  • ' + datereadable + ' ' + ' '+ orderStorage[i].user +'
    '+orderStorage[i].message+'
  • '; } document.getElementById( 'inbox' ).innerHTML = contentString; }