bluesplit / no spam ut

// ==UserScript==
// @name no spam ut
// @namespace no_spam_ut
// @include http://x9.f1.com.tw/VA/index.phtml
// @updateURL https://openuserjs.org/meta/bluesplit/no_spam_ut.meta.js
// @downloadURL https://openuserjs.org/src/scripts/bluesplit/no_spam_ut.user.js
// @run-at document-end
// @connect localhost
// @require http://code.jquery.com/jquery-2.1.4.min.js
// @grant none
// @copyright 2017, bluesplit
// @run-at document-end
// @version 1.0.2
// @author bluesplit
// @description no.spam.ut is JavaScript plugin for your browser to remove spam users in ut chatroom
// ==/UserScript==

(function() {
    'use strict';
    addcss();
    checkname[checkno++]='匿名檢.驗 ';
    checkname[checkno++]='台北→壞男在西門紅樓 ';
    checkname[checkno++]='台北→紓壓工作室(28) ';
    checkname[checkno++]='豆豆先生 ';
    checkname[checkno++]='可愛白淨舒+壓 ';
    checkname[checkno++]='.徵行政現賺千8兼可 ';

    var currentName = null;
    var currentLine = "";
    var skipflag = false;
    
    w_m = function (data){
        if (data.indexOf("<br>")>=0 || data.indexOf("</td></tr></table>")>=0){
            if (!skipflag) {
                parent.m.document.write(currentLine + data);
                console.log("write" + currentLine+ data);
            }else
                console.log("skip" + currentLine+ data);
            currentName = null;
            currentLine = "";
            skipflag = false;
        }else if (!skipflag && !filterMsg(data)){
            currentLine += data;
        }else{
            skipflag = true;
            currentLine += data;
        }
    };
    function filterMsg(str) {
        var re = new RegExp("\\.selectwho\\('(.+ )'\\)");
        var m = re.exec(str);
        if (m === null) {
            //find no name
            //return false;
        } else {
            currentName=m[1];
        }
        return filterRegExp(str, currentName);
    }

    function filterRegExp(str, name){
        var msgFilters = ["外出按摩", "紓壓","現貨","熱賣","現賺","缺錢","貨到付款","K-RUSH","購物送","壞男情趣","高雄店","全館","加送"];
        var nameFilters = ["^[\u4e00-\u9fa5]{2}.1 ","工作室","特價","^[\u4e00-\u9fa5]{2}.2 ","^[\u4e00-\u9fa5]{2}.3 ","匿.*",".*rush.* "];
        for(var i in msgFilters){
            var re = new RegExp(msgFilters[i]);
            var m = re.exec(str);
            if (m === null) {
                //alert("No match");
            } else {
                checkname[checkno++]=name;
                console.log("match:" +msgFilters[i]);
                return true;
            }
        }

        if (name === null )
            return false;

        for(var j in nameFilters){
            var ren = new RegExp(nameFilters[j]);
            var mn = ren.exec(name);
            if (mn === null) {
                //alert("No match");
            } else {
                checkname[checkno++]=name;
                console.log("match:" +nameFilters[j]);
                return true;
            }
        }
        return false;
    }
})();