FFL Chat Modifier

This userscript allows you to run the FFL LIVE chat within a tab in your browser and allows for some new BBCode!

Versión del día 24/09/2015. Echa un vistazo a la versión más reciente.

// ==UserScript==
// @name         FFL Chat Modifier
// @namespace    http://fusionfalllegacy.com/
// @version      1.0
// @description  This userscript allows you to run the FFL LIVE chat within a tab in your browser and allows for some new BBCode!
// @author       L0L_Limewire
// @match        http://interact.modulatornetwork.com/forums/chat/index.php
// @grant        none
// ==/UserScript==

// ADDED FEATURES LIST
// [textcolor=#COLOR IN HEX]message[/textcolor]
// [code]message[/code]
// [img]image url[/img]
// enabled opening the LIVE chat in a tab

// allow for tab chat to be open

window.name = 'ModNetFMHQliveMainWindow';
top = self;

// very hacky but it works

// now for the real features

sound = new Audio("http://s1.vocaroo.com/media/download_temp/Vocaroo_s1i83BLxw0A0.mp3"); // you're welcome Professor

NaughtyWords = [ // avert your eyes, children!
    'bastard',
    'basstard',
    'basterd',
    'bassterd',
    'bas tard',
    'bass tard',
    'bas terd',
    'bass terd',
    'asshole',
    'asshoie',
    'assho1e',
    'assho!e',
    'ass',
    'azzhole',
    'azzhoie',
    'azzho1e',
    'azzho!e',
    'beer',
    'boob',
    'badb',
    'bitch',
    'cunt',
    'dammit',
    'damm!t',
    'damm1t',
    'dammlt',
    'damn',
    'dick',
    'd!ck',
    'd1ck',
    'dlck',
    'fuc',
    'fuk',
    'fuck',
    'fux',
    'nipple',
    'nude',
    'nudity',
    'p!ss',
    'p1ss',
    'penis',
    'pen!s',
    'pen1s',
    'piss',
    'puss',
    'sex',
    'shit',
    'sh!t',
    'sh1t',
    'shlt',
    'tits',
    'vagisil',
    'vagina',
    'arse',
    'hel',
    'hell',
    'bullass',
    'fvck',
    'twat',
    'jerkwad',
    'jack coco',
    'jackazz',
    'jack azz',
    'porn',
    'customass',
    'sasser',
    'sasst',
    'helpuffs',
    'cock',
    'faggot',
    'fagot',
    'fagot',
    'fagot',
    'fag',
    'nigger',
    'n!gger',
    'panty',
    'porm',
    'pr0n',
    'anal',
    'ccoco',
    'semen',
    'whore',
    'biggot',
    'chink',
    'clit',
    'vag',
    'slut',
    'skank',
    'hooker',
    'prostitute',
    'nigga',
    'thot',
    'hentai'
];

ajaxChat.bbCodeTags = ['b','i','u','strike','quote','color','url','img','textcolor']; //add new bbcode and revive old bbcode
ajaxChat.settings.bbCodeImages = true; // enable images

ajaxChat.replaceBBCodeCallback = function(str, p1, p2, p3) { // replace functions to allow for new features
	// Only replace predefined BBCode tags:
	if(!ajaxChat.inArray(ajaxChat.bbCodeTags, p1)) {
		return str;
	}
	// Avoid invalid XHTML (unclosed tags):
	if(ajaxChat.containsUnclosedTags(p3)) {
		return str;
	}	
	switch(p1) {
		case 'color':
			return ajaxChat.replaceBBCodeColor(p3, p2);
        case 'textcolor': // [color] tag but allows for use within nested colors such as 
            return ajaxChat.replaceBBCodeColor(p3,p2);
		case 'url':
			return ajaxChat.replaceBBCodeUrl(p3, p2);
		case 'quote':
			return ajaxChat.replaceBBCodeQuote(p3, p2);
		case 'u':
			return ajaxChat.replaceBBCodeUnderline(p3);
		case 'strike':
			return ajaxChat.replaceBBCodeStrike(p3);
		case 'img': // [img] tag
			return ajaxChat.replaceBBCodeImage(p3);
		default:
			return ajaxChat.replaceCustomBBCode(p1, p2, p3);
	}
};

ajaxChat.replaceBBCodeImage = function(url) { // function enabled
	var regExpUrl;
	regExpUrl = new RegExp(this.regExpMediaUrl,'');
	if(!url || !url.match(regExpUrl))
		return url;
	url = url.replace(/\s/gm, this.encodeText(' '));
	return	'<a href="'+url+'" onclick="window.open(this.href); return false;">'+'<img class="bbCodeImage" style="max-width:250px;" src="'+url+'" alt="Click to view full-size image." onload="ajaxChat.updateChatlistView();"/></a>';
};

ajaxChat.replaceBBCodeColor = function(content, attribute) { // color limitations removed
    if(this.settings.bbCodeColors) {
		return 	'<span style="color:'+ attribute + ';">'+ this.replaceBBCode(content)+ '</span>';
	}
	return content;
};

ajaxChat.replaceCustomText = function(text){
    var doAlert,index;
    doAlert = false; // do sound upon naughty word
    for(index in NaughtyWords){
        naughty = NaughtyWords[index];
        if(text.search(new RegExp('\\b'+naughty+'\\b','gi'))!=-1){
            doAlert = true; // enable sound playback
        }
        text = text.replace(new RegExp('\\b'+naughty+'\\b','gi'), 'coco'); // and then censor the word
    }
    if(doAlert === true){
        sound.play();
    }
    return text;
};