Automatically injects a zero-width space into the Taming.io chat to uncensor selected censored words.
当前为
// ==UserScript==
// @name Taming.io ZWSP Injector 2.4
// @namespace http://tampermonkey.net/
// @version 0.4
// @description Automatically injects a zero-width space into the Taming.io chat to uncensor selected censored words.
// @author You
// @match https://taming.io/
// @icon https://taming.io/img/creature/boss-seahorse-head.png
// @grant none
// ==/UserScript==
let censoredWords = prompt("Bypass List: (separated by spaces)", "") || "".split(" ");
const selector = document.querySelector("input");
const resetKeybind = document.onkeydown = (evt) => {
evt = evt || window.event;
if (evt.keyCode == 27) {
censoredWords = prompt("Bypass List: (separated by spaces)", censoredWords.join(" ")).split(" ");
}
};
const indexes = (string, search) => {
return [...string.matchAll(new RegExp(search, "gi"))].map((a) => a.index);
};
const inject = (string, index) => {
index++;
return string.slice(0, index) + "" + string.slice(index);
}
const onInput = () => {
if (censoredWords[0] == "" && censoredWords.length == 1) return;
selector.value = selector.value.replace(/[\u200B-\u200D\uFEFF]/g, '');
censoredWords.forEach((i) => {
if (selector.value.toLowerCase().includes(i)) {
let indexList = indexes(selector.value, i);
let indexIncrement = 0;
indexList.forEach((j) => {
indexList[indexList.indexOf(j)] += indexIncrement;
indexIncrement += 2;
});
indexList.forEach((k) => {
selector.value = inject(selector.value, k);
selector.value = inject(selector.value, k + 2);
});
}
});
};
selector.oninput = onInput;