further enhance reply filtering
This commit is contained in:
parent
3377f45140
commit
084992bb18
@ -32,6 +32,11 @@ function filterReplies(text) {
|
|||||||
return text.replace(textregex,`<span><a href="/users/$1" class="reply" style="color: pink;">$1</a></span> `)
|
return text.replace(textregex,`<span><a href="/users/$1" class="reply" style="color: pink;">$1</a></span> `)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* filter out html, as well as render some markdown into html
|
||||||
|
* @param {string} text text to filter/format
|
||||||
|
* @return {string} html that represents the filtered text
|
||||||
|
*/
|
||||||
function filterPost(text) {
|
function filterPost(text) {
|
||||||
text = htmlesc(text)
|
text = htmlesc(text)
|
||||||
text = newlineify(text)
|
text = newlineify(text)
|
||||||
@ -44,3 +49,19 @@ function filterPost(text) {
|
|||||||
|
|
||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* filter out html, as well as render some markdown into html, but without mentions
|
||||||
|
* @param {string} text text to filter/format
|
||||||
|
* @return {string} html that represents the filtered text
|
||||||
|
*/
|
||||||
|
function filterReply(text) {
|
||||||
|
text = htmlesc(text)
|
||||||
|
text = newlineify(text)
|
||||||
|
text = urlify(text)
|
||||||
|
text = crossout(text)
|
||||||
|
text = boldify(text)
|
||||||
|
text = italicify(text)
|
||||||
|
|
||||||
|
return text
|
||||||
|
}
|
||||||
|
@ -130,7 +130,7 @@ async function createPost(username,text,time,specialtext,postid,isbot,reply_id)
|
|||||||
replyA.appendChild(replyAvatar)
|
replyA.appendChild(replyAvatar)
|
||||||
replyA.appendChild(reply_username_text)
|
replyA.appendChild(reply_username_text)
|
||||||
replyA.appendChild(spacerTextNode())
|
replyA.appendChild(spacerTextNode())
|
||||||
replyA.innerHTML += filterPost(reply_text.replace("\n"," ").substring(0,20))
|
replyA.innerHTML += filterReply(reply_text.replace("\n"," ").substring(0,20))
|
||||||
replyA.appendChild(replyBr)
|
replyA.appendChild(replyBr)
|
||||||
|
|
||||||
replyA.classList.add("no-link-style")
|
replyA.classList.add("no-link-style")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user