hide underaged users (chat avenue)

removes messages in chat-avenue.com's gay chat that are most likely coming from minors (and wierdos).

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         hide underaged users (chat avenue)
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  removes messages in chat-avenue.com's gay chat that are most likely coming from minors (and wierdos).
// @author       Dev'd
// @match        gaychat.chat-avenue.com/*
// @license      MIT
// @icon         https://www.google.com/s2/favicons?sz=64&domain=chat-avenue.com
// @grant        none
// ==/UserScript==

// large ty to https://github.com/KinkyDeveloper for ChatAf's code which helped me create this project

const filter = /[^0-9a-z]?1[^0-9a-z]?[0-7]|1[0-7]|i[^0-9a-z]?[0-7]|i[0-7]|\|[0-7]/gims

//var str = "ELLO IM LIKE | 3 PLS BAN ME" // testing regex
//console.log(filter.test(str)); // true

function handleChat() {
    var messages = document.getElementsByClassName('chat_message');

    message_loop:
    for (let message of messages) {
        if (message.getAttribute('handled')) {
            continue;
        }
        message.setAttribute('handled', true); //to stop unessesary checking
        var images = message.getElementsByClassName('chat_image');
        var message_box = message.parentElement.parentElement;
        var content = message.innerHTML.toLowerCase()

        if (images.length == 0){ //means not a image
            if (filter.test(content) == true) {
                message_box.remove()
                console.log("Blocked term found. Deleteing one message. \n" + content)
            }
        }
    }
}

setInterval(handleChat, 450);