Taming.io Uncensor Chat

Uncensors selected words by the user.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Taming.io Uncensor Chat
// @namespace    http://tampermonkey.net/
// @version      0.9
// @description  Uncensors selected words by the user.
// @author       You
// @match        https://taming.io/
// @match        https://biologyclass.school/
// @match        https://trymath.org/
// @match        https://school-homework.com/
// @match        https://tamming.io/
// @match        https://mathcool.glitch.me/
// @match        https://sandtimer.net/
// @match        https://mynotetaking.com/
// @icon         https://taming.io/img/creature/boss-grim-reaper-scythe-skin1.png
// @grant        none
// ==/UserScript==

const selector = document.querySelector("input");
const character = "‎";
let censoredWords = [];
let text;

selector.addEventListener("input", () => {
    text = selector.value;
    if (text.includes("/wl") || text.includes("/bl")) return;
    censoredWords.forEach((word) => {
        const regex = new RegExp(word, 'gi');
        selector.value = selector.value.replace(regex, (match) => {
            return match[0] + character + match.substring(1);
        });
    });
});
selector.addEventListener("keyup", (event) => {
    if (event.key === "Enter") {
        let words = [];

        if (text != undefined) words = text.split(" ");

        let word;

        if (words.includes("/wl")) {
            word = words[words.indexOf("/wl") + 1];
        } else if (words.includes("/bl")) {
            word = words[words.indexOf("/bl") + 1]
        } else {
            return;
        }

        if (words.length > 1 && word != "") {
            if (text.includes("/wl") && !censoredWords.includes(word)) {
                censoredWords.push(word);
            } else if (text.includes("/bl")) {
                if (censoredWords.includes(word)) censoredWords.splice(censoredWords.indexOf(word), 1);
            }
        }
    }
});