add another escaping function for another characterset
This commit is contained in:
parent
0f49d4f023
commit
7e309850ef
@ -35,3 +35,11 @@ const unes = {
|
||||
const cape = m => unes[m];
|
||||
|
||||
const unescape = un => replace.call(un, es, cape);
|
||||
|
||||
function escape_special(str) {
|
||||
return str.replace("\\","\\\\").replace("`","\\`")
|
||||
}
|
||||
|
||||
function unescape_special(str) {
|
||||
return str.replace("\\\\","\\").replace("\\`","`")
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ async function createPost(username,text,time,specialtext,postid,isbot,reply_id)
|
||||
}
|
||||
newP.appendChild(spacerTextNode())
|
||||
// |\>.</|
|
||||
newP.innerHTML += `<button onclick="reply('${username}',${postid},\`${htmlesc(htmlesc(text)).replace("\\","\\\\").replace("`","\\`")}\`)">Reply to this Post</button>`
|
||||
newP.innerHTML += `<button onclick="reply('${username}',${postid},\`${htmlesc(htmlesc(escape_special(escape_special(text))))}\`)">Reply to this Post</button>`
|
||||
|
||||
if(reply_id != 0) {
|
||||
try {
|
||||
@ -182,7 +182,7 @@ async function main(){
|
||||
function reply(username,postid,posttext) {
|
||||
document.getElementById("reply").style = ""
|
||||
document.getElementById("reply_username").innerText = username
|
||||
document.getElementById("reply_text").innerHTML = filterPost(unescape(posttext.replace("\\\\","\\").replace("\\`","`")))
|
||||
document.getElementById("reply_text").innerHTML = filterPost(unescape(unescape_special(unescape_special(posttext))))
|
||||
reply_id = postid
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user