Fixed issue with ChatFilter not ignoring ?!. etc.

This commit is contained in:
Mirco Wittrien 2018-11-23 16:03:05 +01:00
parent a14d786145
commit e9fb756adf
1 changed files with 4 additions and 4 deletions

View File

@ -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.8";} getVersion () {return "3.2.9";}
getAuthor () {return "DevilBro";} getAuthor () {return "DevilBro";}
@ -334,7 +334,7 @@ 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.replace(/\n/g, " \n ").split(" ").forEach((word) => { string.replace(/([\?\¿\!\¡\.\"\n])/g, " $1 ").split(" ").forEach((word) => {
if (word && reg.test(word)) blocked = true; if (word && reg.test(word)) blocked = true;
}); });
} }
@ -378,7 +378,7 @@ class ChatFilter {
} }
else if (string.indexOf("<") != 0) { else if (string.indexOf("<") != 0) {
var newstring = []; var newstring = [];
string.replace(/\n/g, " \n ").split(" ").forEach((word) => { string.replace(/([\?\¿\!\¡\.\"\n])/g, " $1 ").split(" ").forEach((word) => {
if (word && reg.test(word)) { if (word && reg.test(word)) {
censored = true; censored = true;
newstring.push(BDFDB.encodeToHTML(censoredReplace)); newstring.push(BDFDB.encodeToHTML(censoredReplace));
@ -393,7 +393,7 @@ class ChatFilter {
} }
if (censored) { if (censored) {
newhtml = strings.join("").replace(/\s\n\s/g, "\n"); newhtml = strings.join("").replace(/ ([\?\¿\!\¡\.\"\n]) /g, "$1");
$(message) $(message)
.html(newhtml) .html(newhtml)
.addClass("censored") .addClass("censored")