use pre instead of span
This commit is contained in:
parent
7f11e85034
commit
c0814c4b42
@ -48,20 +48,20 @@
|
|||||||
msgs.forEach(msg => {
|
msgs.forEach(msg => {
|
||||||
var msg_list = document.getElementById("msg-list")
|
var msg_list = document.getElementById("msg-list")
|
||||||
var li = document.createElement('li');
|
var li = document.createElement('li');
|
||||||
var span = document.createElement('span');
|
var pre = document.createElement('pre');
|
||||||
li.appendChild(span)
|
li.appendChild(pre)
|
||||||
li.style.marginBottom = "20px"
|
li.style.marginBottom = "20px"
|
||||||
if (msg.response == "" && msg.request != "") {
|
if (msg.response == "" && msg.request != "") {
|
||||||
li.style.textAlign = "right"
|
li.style.textAlign = "right"
|
||||||
span.innerHTML = msg.request
|
pre.innerHTML = msg.request
|
||||||
span.style.backgroundColor = "lightblue"
|
pre.style.backgroundColor = "lightblue"
|
||||||
} else if (msg.request != "") {
|
} else if (msg.request != "") {
|
||||||
li.style.textAlign = "left"
|
li.style.textAlign = "left"
|
||||||
span.innerHTML = msg.response
|
pre.innerHTML = msg.response
|
||||||
span.style.backgroundColor = "lightgreen"
|
pre.style.backgroundColor = "lightgreen"
|
||||||
}
|
}
|
||||||
span.style.borderRadius = "10px"
|
pre.style.borderRadius = "10px"
|
||||||
span.style.padding = "5px"
|
pre.style.padding = "5px"
|
||||||
msg_list.appendChild(li)
|
msg_list.appendChild(li)
|
||||||
})
|
})
|
||||||
window.scrollTo(0,document.documentElement.scrollHeight)
|
window.scrollTo(0,document.documentElement.scrollHeight)
|
||||||
@ -80,14 +80,14 @@
|
|||||||
if (data.msg) {
|
if (data.msg) {
|
||||||
var msg_list = document.getElementById("msg-list")
|
var msg_list = document.getElementById("msg-list")
|
||||||
var li = document.createElement('li');
|
var li = document.createElement('li');
|
||||||
var span = document.createElement('span');
|
var pre = document.createElement('pre');
|
||||||
li.appendChild(span)
|
li.appendChild(pre)
|
||||||
li.style.textAlign="right"
|
li.style.textAlign="right"
|
||||||
li.style.marginBottom="20px"
|
li.style.marginBottom="20px"
|
||||||
span.innerHTML=data.msg
|
pre.innerHTML=data.msg
|
||||||
span.style.backgroundColor="lightblue"
|
pre.style.backgroundColor="lightblue"
|
||||||
span.style.borderRadius="10px"
|
pre.style.borderRadius="10px"
|
||||||
span.style.padding="5px"
|
pre.style.padding="5px"
|
||||||
msg_list.appendChild(li)
|
msg_list.appendChild(li)
|
||||||
}
|
}
|
||||||
msgbox.value=""
|
msgbox.value=""
|
||||||
@ -103,14 +103,14 @@
|
|||||||
if (response?.status == "success") {
|
if (response?.status == "success") {
|
||||||
var msg_list = document.getElementById("msg-list")
|
var msg_list = document.getElementById("msg-list")
|
||||||
var li = document.createElement('li');
|
var li = document.createElement('li');
|
||||||
var span = document.createElement('span');
|
var pre = document.createElement('pre');
|
||||||
li.appendChild(span)
|
li.appendChild(pre)
|
||||||
span.innerText=response.message
|
pre.innerText=response.message
|
||||||
li.style.textAlign="left"
|
li.style.textAlign="left"
|
||||||
li.style.marginBottom="20px"
|
li.style.marginBottom="20px"
|
||||||
span.style.backgroundColor="lightgreen"
|
pre.style.backgroundColor="lightgreen"
|
||||||
span.style.borderRadius="10px"
|
pre.style.borderRadius="10px"
|
||||||
span.style.padding="5px"
|
pre.style.padding="5px"
|
||||||
msg_list.appendChild(li)
|
msg_list.appendChild(li)
|
||||||
msg_list.appendChild(document.createElement('br'))
|
msg_list.appendChild(document.createElement('br'))
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user