View difference between Paste ID: eg6n1ESn and uQUwEKPi
SHOW: | | - or go back to the newest paste.
1
importScript('User:Joeytje50/chatmsg.js')
2
3
$('body').append('<span id="pingsound" style="display:none;"></span>');
4-
var badwords = 'cunt|cock|fuck|dick|bitch|r.{0,2}tard'; //add more pipe <|> seperated words to this list to expand.
4+
var badwords = 'cunt|cock|fuck|dick|bitch|r.{0,2}tard|badword'; //add more pipe <|> seperated words to this list to expand.
5
 
6
/* Run this when getting a new message */
7
 
8
onchatmessage = function(text, rawtext) {
9
	setTimeout(function() {
10
		/* Bad words beep */
11
		if ($('.Chat ul li:last-child:not(.you):not(.inline-alert) .message .badword').length && $('.Chat ul li:last-child .message').html().match(new RegExp(badwords, 'i'))) {
12
			$('#pingsound').html('<audio src="http://images.wikia.com/joeytje50/images/7/76/Censor_beep.ogg" autoplay="autoplay"></audio>');
13
		}
14
 	}, 20)
15
 
16
	/* Mark bad words */
17
	text = text.replace((new RegExp('((^|>|('+badwords+'))[^<]+?)('+badwords+')','ig')), '$1<span class="badword">$4</span>');
18
 
19
	return text; //DO NOT EDIT THIS LINE
20
}