Update ChatFilter.plugin.js

This commit is contained in:
Mirco Wittrien 2021-02-19 11:54:23 +01:00
parent dc000da297
commit 12728e67c7
1 changed files with 135 additions and 123 deletions

View File

@ -14,12 +14,18 @@ module.exports = (_ => {
"info": {
"name": "ChatFilter",
"author": "DevilBro",
"version": "3.5.0",
"version": "3.5.1",
"description": "Allows the user to censor Words or block complete Messages/Statuses"
},
"changeLog": {
"added": {
"Ignore own Messages/Status": "Added option to ignore your own Messages/Status"
},
"improved": {
"Zero Width Spaces": "Ignores any zero width space, since some ppl like to troll with it"
},
"fixed": {
"Settings Update": "Fixed issue where the settings panel wouldn't show new words without having to close it first"
}
}
};
@ -127,7 +133,11 @@ module.exports = (_ => {
}
getSettingsPanel (collapseStates = {}) {
let settingsPanel, settingsItems = [];
let settingsPanel;
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, {
collapseStates: collapseStates,
children: _ => {
let settingsItems = [];
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Settings",
@ -154,7 +164,7 @@ module.exports = (_ => {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Button",
label: "Pick a Word Value and Replacement Value:",
label: "Pick a Word Value and Replacement Value",
disabled: !Object.keys(values).every(valuename => values[valuename]),
children: BDFDB.LanguageUtils.LanguageStrings.ADD,
ref: instance => {if (instance) values.addButton = instance;},
@ -251,7 +261,9 @@ module.exports = (_ => {
}))
}));
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
return settingsItems;
}
});
}
onSettingsClosed () {
@ -497,7 +509,7 @@ module.exports = (_ => {
}
regTest (word, reg) {
let wordWithoutSpecial = word.replace(/[\?\¿\!\¡\.\"\*\-\_\~]/g, "");
let wordWithoutSpecial = word.replace(/[\?\¿\!\¡\.\"\*\-\_\~\u180E\u200B-\u200D\u2060\uFEFF]/g, "");
return word && reg.test(word) || wordWithoutSpecial && reg.test(wordWithoutSpecial);
}