Corrected invisible whitespace on chromium-based browsers for line-breaks in long words.
This commit is contained in:
parent
2905fa21ac
commit
d7749d3f57
2 changed files with 6 additions and 6 deletions
|
|
@ -116,14 +116,14 @@ class commandPreprocessor{
|
|||
*/
|
||||
processEmotes(){
|
||||
//inject invisible whitespace in-between emotes to prevent from mushing links together
|
||||
this.message = this.message.replaceAll('][',']ㅤ[');
|
||||
this.message = this.message.replaceAll('][','][');
|
||||
|
||||
//For each list of emotes
|
||||
Object.keys(this.emotes).forEach((key) => {
|
||||
//For each emote in the current list
|
||||
this.emotes[key].forEach((emote) => {
|
||||
//Inject emote links into the message, pad with invisible whitespace to keep link from getting mushed
|
||||
this.message = this.message.replaceAll(`[${emote.name}]`, `ㅤ${emote.link}ㅤ`);
|
||||
this.message = this.message.replaceAll(`[${emote.name}]`, `${emote.link}`);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
@ -135,13 +135,13 @@ class commandPreprocessor{
|
|||
//Strip out file seperators in-case the user is being a smart-ass
|
||||
this.message = this.message.replaceAll('␜','');
|
||||
//Split message by links
|
||||
var splitMessage = this.message.split(/(https?:\/\/[^\sㅤ]+)/g);
|
||||
var splitMessage = this.message.split(/(https?:\/\/[^\s]+)/g);
|
||||
//Create an empty array to hold links
|
||||
this.links = [];
|
||||
|
||||
splitMessage.forEach((chunk, chunkIndex) => {
|
||||
//For each chunk that is a link
|
||||
if(chunk.match(/(https?:\/\/[^\sㅤ]+)/g)){
|
||||
if(chunk.match(/(https?:\/\/[^\s]+)/g)){
|
||||
//I looked online for obscure characters that no one would use to prevent people from chatting embed placeholders
|
||||
//Then I found this fucker, turns out it's literally made for the job lmao (even if it was originally intended for paper/magnetic tape)
|
||||
//Replace link with indexed placeholder
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue