DC - Chat

Personalisation du Chat. Adaptation du script de Gideon, ou d'Odul, je sais plus!

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name        	DC - Chat
// @namespace   	DreadCast
// @include     	http://www.dreadcast.net/Main
// @grant       	none
// @author 		Ianouf
// @date 		07/01/2013
// @version 		1.0
// @description 	Personalisation du Chat. Adaptation du script de Gideon, ou d'Odul, je sais plus!
// @compat 		Firefox, Chrome
// ==/UserScript==


$(document).ready(function() {

	//Couleurs dans le chat:
	var chatBox = $('#chatForm .text_chat').eq(0);
	chatBox.keypress(function(event) {
		 if ( event.which == 13 ) {
			var text = chatBox.val();
			text = text.replace(/\*R([^\*]+)\*R/gi, "[couleur=DF0101]$1[/couleur]");
			text = text.replace(/\*V([^\*]+)\*V/gi, "[couleur=298A08]$1[/couleur]");
			text = text.replace(/\*B([^\*]+)\*B/gi, "[couleur=0404B4]$1[/couleur]");
			text = text.replace(/\*J([^\*]+)\*J/gi, "[couleur=FFFF00]$1[/couleur]");
			if(text.substr(0,3) == '/me'){
				text = text.replace(/\*([^\*]+)\*/gi, "[couleur=FFFFFF]$1[/couleur]");
			}else{
				text = text.replace(/\*I([^\*]+)\*I/gi, "[i]$1[/i]");
				text = text.replace(/\*([^\*]+)\*/gi, "[couleur=7BEEFF][i]$1[/i][/couleur]");
			}
			chatBox.val(text);
		}
	});
});