User:DearlySkies/chat.js

//I'm being... bored to say the least. I'll save this for PeaBot // Swearing crap var SWEAR_LIST = [ "\\bfuck", "\\bmotherfuck", "\\bshit\\b", "\\bshitt", "\\bbitch", "\\bwhore\\b", "\\bgtfo\\b", "\\bstfu\\b", "\\bwtf\\b", "\\bidfk\\b", "\\bidfc\\b", "\\bidgaf\\b", "\\bidefk\\b", "\\bjfc\\b", "\\bomf", "\\bffs\\b", "\\bw t f", "\\bmilf\\b" ]; var SLUR_LIST = [ "\\bnigga\\b", "\\bnigger\\b", "\\niglet\\b", "\\bfag\\b", "\\bfagg", "\\bcunt\\b", "\\btranny\\b", "\\bdyke\\b" ]; var tempMessageValue = ''; var lmt = {}; // Function itself. $(function { if ( mw.config.get('wgCanonicalSpecialPageName') == 'Chat' ) {    console.log("Pingchecking activated!");    $('.Chat').on('DOMNodeInserted', function(e) { var msg = $.parseHTML(e.target.innerHTML)[7]; var nmg = msg.innerHTML; var mee = $(".User .username").html; var mid = e.target.id; var usr = e.target.getAttribute('data-user'); var usrSpam = usr + 'Spam'; if ( usr == mee ) return; if ( msg !== void 0 ) { if ( lmt[usrSpam] === undefined || isNaN(lmt[usr]) ) { lmt[usrSpam] = 1; } else if ( lmt[usrSpam] > 7 ) { tempMessageValue = $(".message textarea").val; $(".message textarea").val(usr + ', end this flooding. Your tears are enough.'); $('.message textarea').trigger(jQuery.Event('keypress', { which: 13 }));           $(".message textarea").val(tempMessageValue); $(".message textarea").focus; mainRoom.kick({               name: usr            }); } else if ( typeof lmt[usrSpam] === 'number' ) { lmt[usrSpam]++; }       setTimeout(function {          if ( lmt[usrSpam] > 0 ) {            lmt[usrSpam]--;          }        }, 7000); for ( var v = 0; v < SWEAR_LIST.length; v++ ) { if ( new RegExp(SWEAR_LIST[v], "mi").test(msg.innerHTML) === true ) { if ( lmt[usr] === undefined || isNaN(lmt[usr]) ) { lmt[usr] = 1; } else if ( lmt[usr] > 5 ) { tempMessageValue = $(".message textarea").val; $(".message textarea").val(usr + ', cease your cursing or I shall curse you to banishment.'); $('.message textarea').trigger(jQuery.Event('keypress', { which: 13 }));               $(".message textarea").val(tempMessageValue); $(".message textarea").focus; mainRoom.kick({                 name: usr                }); } else if ( typeof lmt[usr] === 'number' ) { lmt[usr]++; }           setTimeout(function {              if (lmt[usr] > 0) {                lmt[usr]--;              }            }, 600000); }       }        for ( var i = 0; i < SLUR_LIST.length; i++ ) { if ( new RegExp(SLUR_LIST[i], "mi").test(msg.innerHTML) === true ) { tempMessageValue = $(".message textarea").val; $(".message textarea").val(usr + ', are you being rude? That will be enough.'); $('.message textarea').trigger(jQuery.Event('keypress', { which: 13 }));           $(".message textarea").val(tempMessageValue); $(".message textarea").focus; mainRoom.kick({             name: usr            }); }       }      }    });  } }); logInterval = 600000; importScriptPage('User:Monchoman45/ChatHacks.js', 'c'); importScriptPage('User:Joeytje50/ChatLogger.js', 'runescape');