Taming.io Uncensor Chat

Uncensors selected words by the user.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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);
            }
        }
    }
});