From 7d0009d83c9b5c747d4adb535817924762429f30 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 26 Sep 2018 15:26:06 +0200 Subject: Make it work, including Web interface --- shardweb/assets/js/app.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'shardweb/assets') 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 = '' + name + ': ' + payload.message; // set li contents + li.innerHTML = '' + name + ' ' + payload.pk16 + ': ' + 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. -- cgit v1.2.3