Added underscores and dashes to usernames

This commit is contained in:
rainbow napkin 2025-05-02 03:47:46 -04:00
parent 23ceb74883
commit d3aa4b8274
3 changed files with 17 additions and 5 deletions

View file

@ -165,6 +165,7 @@ p.panel-head-element{
.chat-entry-username{
margin: auto 0.2em auto 0;
text-wrap: nowrap;
}
.chat-entry-body{
@ -203,6 +204,7 @@ span.user-entry{
font-size: 1em;
width: fit-content;
user-select: none;
text-wrap: nowrap;
}
.whisper{

View file

@ -73,11 +73,11 @@ class chatPostprocessor{
//Create an empty array to hold the body
this.messageArray = [];
//Escape any sanatized char codes as we use .textContent for double-safety, and to prevent splitting of char codes
//Split string by word-boundries on words and non-word boundries around whitespace, with negative lookaheads to exclude file seperators so we don't split link placeholders
//Unescape any sanatized char codes as we use .textContent for double-safety, and to prevent splitting of char codes
//Split string by word-boundries on words and non-word boundries around whitespace, with negative lookaheads to exclude file seperators so we don't split link placeholders, and dashes so we dont split usernames and other things
//Also split by any invisble whitespace as a crutch to handle mushed links/emotes
//If we can one day figure out how to split non-repeating special chars instead of special chars with whitespace, that would be perf, unfortunately my brain hasn't rotted enough to understand regex like that just yet.
const splitString = utils.unescapeEntities(this.rawData.msg).split(/(?<!␜)(?=\w)\b|(?<=\w)\b|(?=\s)\B|(?<=\s)\B|/g);
const splitString = utils.unescapeEntities(this.rawData.msg).split(/(?<!-)(?<!␜)(?=\w)\b|(?!-)(?<=\w)\b|(?=\s)\B|(?<=\s)\B|/g);
//for each word in the splitstring
splitString.forEach((string) => {