From c6c2e967979e86690f37a83d30ba9bf9afe47a29 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Tue, 28 Jul 2020 18:22:26 +0200 Subject: webclient: Send replies --- webclient/client.html | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) (limited to 'webclient/client.html') diff --git a/webclient/client.html b/webclient/client.html index 512a2ed..f88ee07 100644 --- a/webclient/client.html +++ b/webclient/client.html @@ -12,6 +12,7 @@ var sock=null,negotiated_version=false,username=null; var messagecache=new Map(); // msgid => [user,message] var roomlist=[":console"]; var currentroom=":console"; +var currentreply=null; // [msgid, table row] or null var roomlogs=new Map([[":console",[]]]); // see drawRoomEntry for entry types var commandlist=[ @@ -102,6 +103,7 @@ function resetState() { username=null; messagecache.clear(); net_callbacks={}; + cancelReply(); } function reconnect(){ @@ -330,6 +332,11 @@ function drawRoomEntry(type,args){ td2.insertBefore(replyNode,node2); td2.insertBefore(document.createElement("br"),node2); } + + tr.addEventListener("click",function(){ + if(currentreply&¤treply[0]==args[2])cancelReply(); + else startReply(args[2],tr); + }); break; case "error": // [timestamp_ms, text] @@ -364,6 +371,21 @@ function addRoomEntry(roomid,type,args){ } } +function cancelReply(){ + if(!currentreply)return; + currentreply[1].classList.remove("replying"); + document.getElementById("roominput_td").classList.remove("replying"); + currentreply=null; +} + +function startReply(msgid,tr){ + cancelReply(); + currentreply=[msgid,tr]; + tr.classList.add("replying"); + document.getElementById("roominput_td").classList.add("replying"); + document.getElementById("roominput").focus(); +} + function showUsage(roomid,cmd){ for(var i=0;i tr.message{ color:inherit; + cursor:pointer; +} +#roomlog > tr.message:hover{ + background-color:#202030; +} +#roomlog > tr.replying{ + background-color:#090 !important; } #roomlog > tr.error{ color:#f44; @@ -627,6 +664,9 @@ table{ vertical-align:top; padding:0px 1px 0px 10px; } +#roominput_td.replying{ + background-color:#090; +} #roominput{ position:absolute; background-color:rgba(0,0,0,0); -- cgit v1.2.3-70-g09d2