Fixed Bug ChatFilter destroying format

This commit is contained in:
Mirco Wittrien 2018-10-23 10:49:24 +02:00
parent 61dd182614
commit f957a2217b
1 changed files with 5 additions and 4 deletions

View File

@ -9,7 +9,7 @@ class ChatFilter {
${BDFDB.dotCNS.messagegroup + BDFDB.dotCN.messagemarkup}.blocked:not(.revealed) { ${BDFDB.dotCNS.messagegroup + BDFDB.dotCN.messagemarkup}.blocked:not(.revealed) {
font-weight: bold; font-weight: bold;
font-style: italic; font-style: italic;
} }\n
${BDFDB.dotCNS.messagegroup + BDFDB.dotCN.messageaccessory}.censored:not(.revealed), ${BDFDB.dotCNS.messagegroup + BDFDB.dotCN.messageaccessory}.censored:not(.revealed),
${BDFDB.dotCNS.messagegroup + BDFDB.dotCN.messagemarkup}:not(.revealed) { ${BDFDB.dotCNS.messagegroup + BDFDB.dotCN.messagemarkup}:not(.revealed) {
@ -32,7 +32,7 @@ class ChatFilter {
getDescription () {return "Allows the user to censor words or block complete messages based on words in the chatwindow.";} getDescription () {return "Allows the user to censor words or block complete messages based on words in the chatwindow.";}
getVersion () {return "3.2.4";} getVersion () {return "3.2.5";}
getAuthor () {return "DevilBro";} getAuthor () {return "DevilBro";}
@ -330,7 +330,8 @@ class ChatFilter {
if (reg.test(url)) blocked = true; if (reg.test(url)) blocked = true;
} }
else if (string.indexOf("<") != 0) { else if (string.indexOf("<") != 0) {
string.split(/[\s\n\r]/).forEach((word) => { console.log(string.replace(/\n/g, "\s\n\s").split(" "))
string.replace(/\n/g, " \n ").split(" ").forEach((word) => {
if (word && reg.test(word)) blocked = true; if (word && reg.test(word)) blocked = true;
}); });
} }
@ -372,7 +373,7 @@ class ChatFilter {
} }
else if (string.indexOf("<") != 0) { else if (string.indexOf("<") != 0) {
var newstring = []; var newstring = [];
string.split(/[\s\n\r]/).forEach((word) => { string.replace(/\n/g, " \n ").split(" ").forEach((word) => {
newstring.push(word && reg.test(word) ? BDFDB.encodeToHTML(censoredReplace) : word); newstring.push(word && reg.test(word) ? BDFDB.encodeToHTML(censoredReplace) : word);
}); });
strings[i] = newstring.join(" "); strings[i] = newstring.join(" ");