Added Endpoints and AJAX Helper Functions for emote management, as well as imporvements to link embedding.
This commit is contained in:
parent
b9283607d6
commit
255e6e0d7f
7 changed files with 63 additions and 27 deletions
|
|
@ -54,10 +54,6 @@ class chatPostprocessor{
|
|||
this.bodyArray.forEach((wordObj) => {
|
||||
if(wordObj.type == 'word'){
|
||||
//Inject current wordObj string into the chat body
|
||||
//this doesnt work right with escaped strings atm
|
||||
//we should make an array that contains all the strings split by nodes
|
||||
//so text can be added in word chunks, allowing escaped strings and
|
||||
//node injections w/o adding them as html instead of an appended node
|
||||
injectString(wordObj.string);
|
||||
}else if(wordObj.type == 'link'){
|
||||
//Create a link node from our link
|
||||
|
|
@ -79,6 +75,16 @@ class chatPostprocessor{
|
|||
|
||||
//Append node to chatBody
|
||||
injectNode(wordObj, badLink);
|
||||
}else if(wordObj.type == 'malformedLink'){
|
||||
//Create a text span node from our link
|
||||
const malformedLink = document.createElement('span');
|
||||
malformedLink.classList.add('chat-malformed-link');
|
||||
//Use textContent to be safe since links can't be escaped (this is why we don't just add it using injectString)
|
||||
//arguably we could sanatize malformed links serverside since they're never actually used as links
|
||||
malformedLink.textContent = wordObj.link;
|
||||
|
||||
//Append node to chatBody
|
||||
injectNode(wordObj, malformedLink);
|
||||
}else if(wordObj.type == 'image'){
|
||||
//Create an img node from our link
|
||||
const img = document.createElement('img');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue