Compare commits

...

2 Commits

Author SHA1 Message Date
84baaff88a message style refine 2023-04-04 00:59:42 +08:00
ce89247a9c message auto wrap 2023-04-04 00:38:02 +08:00

View File

@ -7,10 +7,11 @@
</ul> </ul>
</div> </div>
<div class="fixed-bottom form-inline"> <div class="fixed-bottom form-inline">
<textarea id="msgbox" class="form-control" style="min-width:80%"></textarea> <textarea id="msgbox" class="form-control" style="width:85%; float: left;"></textarea>
<button id="btn-send" <button id="btn-send"
class="btn btn-info" class="btn btn-info"
type="button" type="button"
style="width: 10%;"
onclick="send_message()" onclick="send_message()"
disabled> disabled>
<svg xmlns="http://www.w3.org/2000/svg" <svg xmlns="http://www.w3.org/2000/svg"
@ -50,18 +51,17 @@
var li = document.createElement('li'); var li = document.createElement('li');
var pre = document.createElement('pre'); var pre = document.createElement('pre');
li.appendChild(pre) li.appendChild(pre)
li.style.marginBottom = "20px" li.style.textAlign = "left"
li.style.padding = "10px"
li.style.clear = "both"
if (msg.response == "" && msg.request != "") { if (msg.response == "" && msg.request != "") {
li.style.textAlign = "right"
pre.innerText = msg.request pre.innerText = msg.request
pre.style.backgroundColor = "lightblue" pre.style = "background-color: lightblue; border-radius: 10px; padding: 5px; white-space: pre-wrap; word-wrap: break-word; float: right;"
} else if (msg.request != "") { } else if (msg.request != "") {
li.style.textAlign = "left" li.style.textAlign = "left"
pre.innerText = msg.response pre.innerText = msg.response
pre.style.backgroundColor = "lightgreen" pre.style = "background-color: lightgreen; border-radius: 10px; padding: 5px; white-space: pre-wrap; word-wrap: break-word;"
} }
pre.style.borderRadius = "10px"
pre.style.padding = "5px"
msg_list.appendChild(li) msg_list.appendChild(li)
}) })
window.scrollTo(0,document.documentElement.scrollHeight) window.scrollTo(0,document.documentElement.scrollHeight)
@ -82,12 +82,11 @@
var li = document.createElement('li'); var li = document.createElement('li');
var pre = document.createElement('pre'); var pre = document.createElement('pre');
li.appendChild(pre) li.appendChild(pre)
li.style.textAlign="right" li.style.textAlign = "left"
li.style.marginBottom="20px" li.style.padding = "10px"
pre.innerText=data.msg li.style.clear = "both"
pre.style.backgroundColor="lightblue" pre.innerText = data.msg
pre.style.borderRadius="10px" pre.style = "background-color: lightblue; border-radius: 10px; padding: 5px; white-space: pre-wrap; word-wrap: break-word; float: right;"
pre.style.padding="5px"
msg_list.appendChild(li) msg_list.appendChild(li)
} }
msgbox.value="" msgbox.value=""
@ -105,12 +104,11 @@
var li = document.createElement('li'); var li = document.createElement('li');
var pre = document.createElement('pre'); var pre = document.createElement('pre');
li.appendChild(pre) li.appendChild(pre)
pre.innerText=response.message pre.innerText = response.message
li.style.textAlign="left" li.style.textAlign = "left"
li.style.marginBottom="20px" li.style.padding = "10px"
pre.style.backgroundColor="lightgreen" li.style.clear = "both"
pre.style.borderRadius="10px" pre.style = "background-color: lightgreen; border-radius: 10px; padding: 5px; white-space: pre-wrap; word-wrap: break-word;"
pre.style.padding="5px"
msg_list.appendChild(li) msg_list.appendChild(li)
msg_list.appendChild(document.createElement('br')) msg_list.appendChild(document.createElement('br'))
} }