diff options
author | Alex Auvolat <alex@adnab.me> | 2018-09-26 15:26:06 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2018-09-26 15:26:06 +0200 |
commit | 7d0009d83c9b5c747d4adb535817924762429f30 (patch) | |
tree | 59b368cf189fc10976337e8caf4e6b623d69a04b /shardweb/assets/js/app.js | |
parent | f16973d3a492ae6d4890c40d77b0a93d3293bf3a (diff) | |
download | shard-7d0009d83c9b5c747d4adb535817924762429f30.tar.gz shard-7d0009d83c9b5c747d4adb535817924762429f30.zip |
Make it work, including Web interface
Diffstat (limited to 'shardweb/assets/js/app.js')
-rw-r--r-- | shardweb/assets/js/app.js | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/shardweb/assets/js/app.js b/shardweb/assets/js/app.js index 59a0acd..c98ec1b 100644 --- a/shardweb/assets/js/app.js +++ b/shardweb/assets/js/app.js @@ -28,7 +28,7 @@ if (room_name != undefined) channel.on('shout', function (payload) { // listen to the 'shout' event var li = document.createElement("li"); // creaet new list item DOM element var name = payload.name || 'guest'; // get name from payload or set default - li.innerHTML = '<b>' + name + '</b>: ' + payload.message; // set li contents + li.innerHTML = '<b>' + name + '</b> <small>' + payload.pk16 + '</small>: ' + payload.message; // set li contents console.log(ul.scrollTop + ' ' + ul.scrollHeight + ' ' + ul.clientHeight); var must_scroll = (ul.scrollTop >= ul.scrollHeight - ul.clientHeight - 10); @@ -49,7 +49,6 @@ if (room_name != undefined) msg.addEventListener('keypress', function (event) { if (event.keyCode == 13 && msg.value.length > 0) { // don't sent empty msg. channel.push('shout', { // send the message to the server on "shout" channel - name: name.value, // get value of "name" of person sending the message message: msg.value // get message text (value) from msg input field. }); msg.value = ''; // reset the message input field for next message. |