From f957a2217b0b1127b8917d40b5dcdb55b2f2f6ed Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Tue, 23 Oct 2018 10:49:24 +0200 Subject: [PATCH] Fixed Bug ChatFilter destroying format --- Plugins/ChatFilter/ChatFilter.plugin.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Plugins/ChatFilter/ChatFilter.plugin.js b/Plugins/ChatFilter/ChatFilter.plugin.js index 86b137502d..23d327819b 100644 --- a/Plugins/ChatFilter/ChatFilter.plugin.js +++ b/Plugins/ChatFilter/ChatFilter.plugin.js @@ -9,7 +9,7 @@ class ChatFilter { ${BDFDB.dotCNS.messagegroup + BDFDB.dotCN.messagemarkup}.blocked:not(.revealed) { font-weight: bold; font-style: italic; - } + }\n ${BDFDB.dotCNS.messagegroup + BDFDB.dotCN.messageaccessory}.censored: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.";} - getVersion () {return "3.2.4";} + getVersion () {return "3.2.5";} getAuthor () {return "DevilBro";} @@ -330,7 +330,8 @@ class ChatFilter { if (reg.test(url)) blocked = true; } 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; }); } @@ -372,7 +373,7 @@ class ChatFilter { } else if (string.indexOf("<") != 0) { 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); }); strings[i] = newstring.join(" ");