Dreadcast Chat Enhancer

Améliore le chat de Dreadcast.

当前为 2019-12-05 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Dreadcast Chat Enhancer
  3. // @namespace https://greasyfork.org/scripts/21359-dreadcast-chat-enhancer/
  4. // @version 2.3
  5. // @description Améliore le chat de Dreadcast.
  6. // @author MockingJay, Odul, Ladoria, Isilin
  7. // @match https://www.dreadcast.eu/Main
  8. // @match https://www.dreadcast.net/Main
  9. // @grant GM_setValue
  10. // @grant GM_getValue
  11. // @grant GM_deleteValue
  12. // @grant GM_listValues
  13. // @license http://creativecommons.org/licenses/by-nc-nd/4.0/
  14. // ==/UserScript==
  15.  
  16. //Lit les variables dans GM à la demande. A utiliser pour chaque déclaration de variable qui est copiée en mémoire.
  17. //initValue: Valeur par défaut de la variable, qu'on lui donne à la déclaration et qu'elle garde si pas d'équivalent en mémoire. localVarName: Valeur GM locale.
  18. function initLocalMemory(defaultValue, localVarName) {
  19. if (GM_getValue(localVarName) === undefined) {
  20. GM_setValue(localVarName, defaultValue);
  21. return defaultValue;
  22. } else {
  23. return GM_getValue(localVarName);
  24. }
  25. }
  26.  
  27. function rgb2hex(orig){
  28. var rgb = orig.replace(/\s/g,'').match(/^rgba?\((\d+),(\d+),(\d+)/i);
  29. return (rgb && rgb.length === 4) ? "#" +
  30. ("0" + parseInt(rgb[1],10).toString(16)).slice(-2) +
  31. ("0" + parseInt(rgb[2],10).toString(16)).slice(-2) +
  32. ("0" + parseInt(rgb[3],10).toString(16)).slice(-2) : orig;
  33. }
  34.  
  35. $(document).ready(function() {
  36.  
  37. //**********************************************
  38. // DECLARATION DES VARIABLES
  39. //**********************************************
  40.  
  41. //CONSTANTES
  42. const W_ZONE_CHAT = 317; //Largeur de base des différents éléments du chat.
  43. const W_MSG = 290;
  44. const W_CHATCONTENT = 308; //Valeur pas d'origine, mais nécessaire pour le script.
  45. const W_CHAT = 328;
  46. const W_ONGLETS_CHAT = 254;
  47. const W_CHATFORM = 288;
  48.  
  49. const DEFAULT_CHAT_COLOR = rgb2hex($("#zone_chat .zone_infos").css("color"));
  50. $('<div class="couleur5" style="display:none;"></div>').appendTo("body");
  51. const DEFAULT_CHAT_COLOR5 = ($(".couleur5").css("color") !== undefined) ? rgb2hex($(".couleur5").css("color")) : "#999";
  52. $('<div class="couleur_rouge" style="display:none;"></div>').appendTo("body");
  53. const DEFAULT_CHAT_COLOR_RED = ($(".couleur_rouge").css("color") !== undefined) ? rgb2hex($(".couleur_rouge").css("color")) : "#D32929";
  54.  
  55. const DEFAULT_ZONE_DROITE_BG = $("#zone_droite").css("background"); //Permet de restituer le fond d'origine (ou de skin) de la zone droite lorsque le chat est à sa largeur initiale.
  56. const DEFAULT_SCRIPT_ZONE_DROITE_BG = 'http://i.imgur.com/kPzRqS2.png';
  57. const DEFAULT_SCRIPT_ZONE_CHAT_BG = 'http://i.imgur.com/0J3wOK0.png';
  58.  
  59. const DEFAULT_ALERT_CHAT_AUDIO_URL = 'http://s1download-universal-soundbank.com/mp3/sounds/2041.mp3';
  60.  
  61. //Initialisation variables de préférences
  62. var autoScroll = initLocalMemory(false, "DCCE_autoScroll");
  63. var scrollBar = initLocalMemory(true, "DCCE_scrollBar");
  64. var typePredict = initLocalMemory(true, "DCCE_typePredict");
  65. var alertVolume = initLocalMemory(1, "DCCE_alertVolume");
  66. var chatExtend = initLocalMemory(0, "DCCE_chatExtend");
  67.  
  68. const mrpDefaultCommands = [
  69. { alias:"env", name:"Environment", color:"#00FF00", bold:false, rp:true },
  70. { alias:"sis", name:"Ta soeur", color:"#00FFFF", bold:true, rp:false },
  71. { alias:"creepy", name:"Le Monstre", color:"#FF6464", bold:false, rp:true }
  72. ];
  73. var mrpCommandsString = initLocalMemory(JSON.stringify(mrpDefaultCommands), "DCCE_MRP");
  74. var mrpCommands = JSON.parse(mrpCommandsString);
  75.  
  76. var scriptZoneDroiteBG = initLocalMemory(DEFAULT_SCRIPT_ZONE_DROITE_BG, "DCCE_scriptZoneDroiteBG");
  77. var scriptZoneChatBG = initLocalMemory(DEFAULT_SCRIPT_ZONE_CHAT_BG, "DCCE_scriptZoneChatBG");
  78.  
  79. var alertChatAudioURL = initLocalMemory(DEFAULT_ALERT_CHAT_AUDIO_URL, "DCCE_alertChatAudioURL");
  80. var activateAlertChat = initLocalMemory(false, "DCCE_activateAlertChat");
  81.  
  82. var chatWidthStyle = $('<style id="chatWidthStyle">').appendTo("head"); //Utilisation d'une règle CSS car objets créés dynamiquement.
  83.  
  84. var chatEmoteStyle = $('<style id="chatEmoteStyle">span[style*="color:#58DCF9;"] em{color: ' + DEFAULT_CHAT_COLOR + ';}</style>').appendTo("head"); //Règle CSS pour appliquer la couleur du skin aux emotes. Visible uniquement côté client.
  85. var chatEmoteStyleWe = $('<style id="chatEmoteStyleWe">.msg.couleur5 span[style*="color:#58DCF9;"] em{color: ' + DEFAULT_CHAT_COLOR5 + ';}</style>').appendTo("head");
  86. var chatEmoteStyleYe = $('<style id="chatEmoteStyleYe">.msg.couleur_rouge span[style*="color:#58DCF9;"] em{color: ' + DEFAULT_CHAT_COLOR_RED + ';}</style>').appendTo("head");
  87. var chatEmoteStyleSpeech = $('<style id="chatEmoteStyleSpeech">.msg em span[style*="color:#FFFFFF;"]{font-style: normal;}</style>').appendTo("head"); //Redresse les paroles dans des emotes
  88. //Un non-utilisateur du script aura la couleur de base bleu clair.
  89.  
  90. //**********************************************
  91. // DECLARATION DES FONCTIONS, MISE EN PLACE DU CSS
  92. //**********************************************
  93.  
  94. $("#chatContent").css({
  95. "overflow-x": 'hidden',
  96. "overflow-y": 'scroll',
  97. height: '313px', //width traitée dans setChatCSS
  98. });
  99.  
  100. //Applique la barre de défilement en fonction des préférences, et règle la largeur des lignes dans le chat.
  101. function setChatContentScroll() {
  102. if(scrollBar) {
  103. $("#chatContent").css({"padding-right": '0px'});
  104. chatWidthStyle.text('#zone_chat .zone_infos .msg{width:' + (W_MSG + chatExtend) + 'px}');
  105. $("#zone_chat").css({width: (W_ZONE_CHAT + 5 + chatExtend) + 'px'}); //Assure d'avoir le fond derrière la scrollbar lorsque le chat est étendu.
  106. }
  107. else {
  108. $("#chatContent").css({"padding-right": '15px'});
  109. chatWidthStyle.text('#zone_chat .zone_infos .msg{width:' + (W_MSG + 7 + chatExtend) + 'px}');
  110. $("#zone_chat").css({width: (W_ZONE_CHAT + chatExtend) + 'px'});
  111. }
  112. }
  113.  
  114.  
  115. var $dcce_background = $('<div id="dcce_background"></div>').prependTo($("#zone_page")).css({left: '907px', top: '142px', height: '461px'});
  116.  
  117. function setZoneChatBackground() {
  118. if(chatExtend > 0) {
  119. $dcce_background.css({background: 'url("' + scriptZoneChatBG + '")',
  120. "background-size": '100% 100%',
  121. width: (W_ZONE_CHAT + 13 + chatExtend) + 'px'});
  122. $("#zone_droite").css({background: 'url("' + scriptZoneDroiteBG + '")'});
  123. } else {
  124. $dcce_background.css({
  125. background: 'none',
  126. width: '0px'
  127. });
  128. $("#zone_droite").css({background: DEFAULT_ZONE_DROITE_BG});
  129. }
  130. }
  131.  
  132. function setChatCSS() {
  133. setChatContentScroll(); //Comprend déjà #ZONE_CHAT et .MSG
  134. setZoneChatBackground();
  135. //Fixer les largeurs restantes
  136. $("#chatContent").width(W_CHATCONTENT + chatExtend);
  137. $("#zone_chat .zone_infos .chat").width(W_CHAT + chatExtend);
  138. $("#zone_chat #onglets_chat").width(W_ONGLETS_CHAT + chatExtend);
  139. $("#chatForm").width(W_CHATFORM + chatExtend);
  140. }
  141.  
  142. setChatCSS(); //Appliquer à l'initialisation.
  143.  
  144. //Initialisation du bouton d'alerte, utilisé quand l'autoScroll est désactivé.
  145. var $newMessageAlert = $('<div />').appendTo($('#zone_chat'));
  146. $newMessageAlert.text("⚠ Nouveau message! ⚠");
  147. $newMessageAlert.css({
  148. display: 'none',
  149. top: '45px',
  150. "text-align": 'center',
  151. cursor: 'pointer',
  152. background: '#fff',
  153. border: '1px solid #fff',
  154. color: '#0296bb',
  155. "margin-top": '2px',
  156. "-webkit-box-shadow": '0 0 4px 2px #329bc2',
  157. });
  158. $newMessageAlert.attr('onmouseover', 'this.style.backgroundColor=\"#0b9bcb\";this.style.color=\"#FFFFFF\";');
  159. $newMessageAlert.attr('onmouseout', 'this.style.backgroundColor=\"#FFFFFF\";this.style.color=\"#0296bb\";');
  160.  
  161. //Initialisation bandeau latéral
  162. var $toggleAutoScroll = $('<li id="toggleAutoScroll" class="couleur5" ></li>'+'<li class="separator"></li>').prependTo($('#bandeau ul.menus'));
  163. if(autoScroll) {
  164. $("#toggleAutoScroll").text("AS on");
  165. } else {
  166. $("#toggleAutoScroll").text("AS off");
  167. }
  168. $("#toggleAutoScroll").css({
  169. cursor: 'pointer',
  170. });
  171. //$("#toggleAutoScroll").attr('onmouseover', 'this.style.color=\"#0073d5\";');
  172. //$("#toggleAutoScroll").attr('onmouseout', 'this.style.color=\"#999\";');
  173. $("#toggleAutoScroll").hover(
  174. function(){
  175. $(this).css("color", "#0073d5");
  176. },
  177. function(){
  178. var colorAS = autoScroll ? "#999" : "#D00000";
  179. $(this).css("color", colorAS);
  180. }
  181. );
  182. //Changer l'autoscroll au clic sur le bandeau latéral.
  183. $("#toggleAutoScroll").click(function(){
  184. if(autoScroll) {
  185. autoScroll = false;
  186. $("#toggleAutoScroll").text("AS off");
  187. } else {
  188. autoScroll = true;
  189. $("#toggleAutoScroll").text("AS on");
  190. }
  191. GM_setValue("DCCE_autoScroll", autoScroll);
  192. });
  193.  
  194. //Fait défiler le chat jusqu'en bas.
  195. function scrollChat(){
  196. $('#chatContent').stop().animate({
  197. scrollTop: $('#chatContent')[0].scrollHeight
  198. }, 800);
  199. $newMessageAlert.stop().fadeOut(500);
  200. }
  201.  
  202. var colorTagStyle = $('<style id="colorTagStyle">').appendTo("head"); //Utilisation d'une règle CSS car objets créés dynamiquement.
  203.  
  204. function chatChangeColor(id) {
  205. var persoName = GM_getValue("dcce_name_" + id);
  206. var colorRule = GM_getValue("dcce_ctb_" + id);
  207. if (colorRule === undefined) colorRule = DEFAULT_CHAT_COLOR;
  208.  
  209. var newRule = '.c' + persoName + '{color: '+ colorRule +';}\n';
  210. colorTagStyle.text(colorTagStyle.text() + newRule);
  211.  
  212. }
  213.  
  214. function initChatColor() {
  215. var localValues = GM_listValues();
  216. for(var i = 0; i < localValues.length; i++) {
  217. if(localValues[i].includes("dcce_ctb_")) {
  218. chatChangeColor(localValues[i].slice(9));
  219. }
  220. }
  221. }
  222. initChatColor();
  223.  
  224. var chatCouleur5Important = $('<style id="chatCouleur5Important">.couleur5 span.link.linkable{color: #999 !important;}</style>').appendTo("head"); //Forcer la couleur grise sur les messages chuchotés.
  225.  
  226. //**********************************************
  227. //INTERFACE DE CONFIGURATION UTILISATEUR
  228. //**********************************************
  229. var $databox = $('#zone_dataBox');
  230. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  231. //Constructeur de fenêtre de configuration
  232. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  233. var DCCE_ConfigurationWindow = function () {
  234. var window_width = '560px';
  235. var window_height = '450px';
  236. var $config_window = $('<div id="dcce_configwindow" onclick="engine.switchDataBox(this)"/>');
  237. $config_window.draggable();
  238. $config_window.addClass('dataBox focused ui-draggable');
  239. $config_window.css({
  240. width: window_width,
  241. "margin-left": '-185px',
  242. display: 'block',
  243. position: 'absolute',
  244. "z-index": '2',
  245. });
  246. for (var i = 1; i <= 8; i++) {
  247. $('<div class="dbfond' + i + '" />').appendTo($config_window);
  248. }
  249. var $config_head = $('<div class="head ui-draggable-handle" ondblclick="$(\'#dcce_configwindow\').toggleClass(\'reduced\');" />').appendTo($config_window);
  250. $('<div title="Fermer la fenêtre (Q)" class="info1 link close" onclick="engine.closeDataBox($(this).parent().parent().attr(\'id\'));" />').appendTo($config_head);
  251. $('<div title="Reduire/Agrandir la fenêtre" class="info1 link reduce" onclick="$(\'#dcce_configwindow\').toggleClass(\'reduced\');" />').appendTo($config_head);
  252. $('<div class="title">Configuration DC Enhanced Chat</div>').appendTo($config_head);
  253. $('<div class="dbloader" />').appendTo($config_window);
  254. var $config_content = $('<div class="content" style="height:' + window_height + '; overflow: auto"/>').appendTo($config_window);
  255. //----------------------------------------
  256. //Widgets internes
  257. //----------------------------------------
  258. var $config_interface = $('<div />').appendTo($config_content);
  259. $config_interface.css({
  260. "margin-left": '3px',
  261. "font-variant": 'small-caps',
  262. color: '#fff',
  263. height: '100%',
  264. width: '98%',
  265. });
  266. //----------------------------------------
  267. //Configuration du défilement, auto-scroll
  268. //----------------------------------------
  269. var $autoconfig = $('<div />').appendTo($config_interface);
  270. var $autoconfig_title = $('<h2 class="couleur4 configTitre" />').appendTo($autoconfig);
  271. $autoconfig_title.text('Options de défilement du texte');
  272. $autoconfig_title.css({
  273. "margin-bottom": '5px',
  274. "border-bottom": '1px solid',
  275. display: 'block',
  276. "font-size": '17px',
  277. "-webkit-margin-before": '0.83em',
  278. "-webkit-margin-after": '0.83em',
  279. "-webkit-margin-start": '0px',
  280. "-webkit-margin-end": '0px',
  281. "font-weight": 'bold',
  282. position: 'relative',
  283. });
  284. var $autoconfig_container = $('<div class="ligne"/>').appendTo($config_interface);
  285. $autoconfig_container.text('Défilement automatique : ');
  286. $autoconfig_container.css({
  287. display: 'inline-block',
  288. "margin-bottom": '15px',
  289. "margin-left": '5px'
  290. });
  291. var $autoconfig_radio_activate = $('<input type="radio" name="typeAutoRadio" value="false">Activer</input>').appendTo($autoconfig_container);
  292. $autoconfig_radio_activate.css({
  293. margin: '0 5px',
  294. });
  295. $autoconfig_radio_activate.attr('checked', autoScroll);
  296. $autoconfig_radio_activate.change(function(){
  297. autoScroll = true;
  298. GM_setValue("DCCE_autoScroll", autoScroll);
  299. $("#toggleAutoScroll").text("AS on");
  300. });
  301. var $autoconfig_radio_deactivate = $('<input type="radio" name="typeAutoRadio" value="true">Désactiver</input>').appendTo($autoconfig_container);
  302. $autoconfig_radio_deactivate.css({
  303. margin: '0px 5px 0 25px',
  304. "padding-left": '20px',
  305. });
  306. $autoconfig_radio_deactivate.attr('checked', !autoScroll);
  307. $autoconfig_radio_deactivate.change(function(){
  308. autoScroll = false;
  309. GM_setValue("DCCE_autoScroll", autoScroll);
  310. $("#toggleAutoScroll").text("AS off");
  311. });
  312. //----------------------------------------
  313. //Configuration de l'affichage de la barre de défilement
  314. //----------------------------------------
  315. var $scrconfig_container = $('<div class="ligne"/>').appendTo($config_interface);
  316. $scrconfig_container.text('Barre de défilement : ');
  317. $scrconfig_container.css({
  318. display: 'inline-block',
  319. "margin-bottom": '15px',
  320. "margin-left": '5px'
  321. });
  322. var $scrconfig_radio_activate = $('<input type="radio" name="typeScrRadio" value="false">Afficher</input>').appendTo($scrconfig_container);
  323. $scrconfig_radio_activate.css({
  324. margin: '0 5px',
  325. });
  326. $scrconfig_radio_activate.attr('checked', scrollBar);
  327. $scrconfig_radio_activate.change(function(){
  328. scrollBar = true;
  329. GM_setValue("DCCE_scrollBar", scrollBar);
  330. setChatContentScroll();
  331. });
  332. var $scrconfig_radio_deactivate = $('<input type="radio" name="typeScrRadio" value="true">Masquer</input>').appendTo($scrconfig_container);
  333. $scrconfig_radio_deactivate.css({
  334. margin: '0px 5px 0 25px',
  335. "padding-left": '20px',
  336. });
  337. $scrconfig_radio_deactivate.attr('checked', !scrollBar);
  338. $scrconfig_radio_deactivate.change(function(){
  339. scrollBar = false;
  340. GM_setValue("DCCE_scrollBar", scrollBar);
  341. setChatContentScroll();
  342. });
  343. //----------------------------------------
  344. //Configuration de l'affichage de la barre de défilement
  345. //----------------------------------------
  346. var $predconfig_container = $('<div class="ligne"/>').appendTo($config_interface);
  347. $predconfig_container.text('Défiler le chat à l\'écriture : ');
  348. $predconfig_container.css({
  349. display: 'inline-block',
  350. "margin-bottom": '15px',
  351. "margin-left": '5px'
  352. });
  353. var $predconfig_radio_activate = $('<input type="radio" name="typePredRadio" value="false">Oui</input>').appendTo($predconfig_container);
  354. $predconfig_radio_activate.css({
  355. margin: '0 5px',
  356. });
  357. $predconfig_radio_activate.attr('checked', typePredict);
  358. $predconfig_radio_activate.change(function(){
  359. typePredict = true;
  360. GM_setValue("DCCE_typePredict", typePredict);
  361. });
  362. var $predconfig_radio_deactivate = $('<input type="radio" name="typePredRadio" value="true">Non</input>').appendTo($predconfig_container);
  363. $predconfig_radio_deactivate.css({
  364. margin: '0px 5px 0 25px',
  365. "padding-left": '20px',
  366. });
  367. $predconfig_radio_deactivate.attr('checked', !typePredict);
  368. $predconfig_radio_deactivate.change(function(){
  369. typePredict = false;
  370. GM_setValue("DCCE_typePredict", typePredict);
  371. });
  372.  
  373. //----------------------------------------
  374. //Configuration de l'audio joué avec AlertChat
  375. //----------------------------------------
  376. var $audioconfig_container = $('<div class="ligne"/>').appendTo($config_interface);
  377. $audioconfig_container.text('');
  378. $audioconfig_container.css({
  379. display: 'inline-block',
  380. "margin-bottom": '15px',
  381. });
  382. var $audioconfig_pzonechat = $('<div> </div><div>Audio joué à la réception d\'un message (indiquer URL de l\'audio) : </div>').appendTo($audioconfig_container);
  383. $audioconfig_pzonechat.css({
  384. margin: '0 5px',
  385. width: '500px'
  386. });
  387. var $audioconfig_zonechat = $('<input type="url" name="typealertchat" value="' + alertChatAudioURL + '" style="background-color: antiquewhite;"></input>').appendTo($audioconfig_container);
  388. $audioconfig_zonechat.css({
  389. margin: '0 5px',
  390. width: '500px'
  391. });
  392. $audioconfig_zonechat.keyup(function(){
  393. alertChatAudioURL = $(this).val();
  394. GM_setValue("DCCE_alertChatAudioURL", alertChatAudioURL);
  395. $('#checkchat').attr('src', alertChatAudioURL);
  396. });
  397. var $audioconfig_vol = $('<input type="range" name="typealertvolume" value="' + alertVolume + '" min="0" max="1" step="0.01"></input>').appendTo($audioconfig_container);
  398. $audioconfig_vol.css({
  399. margin: '0 5px',
  400. width: '500px'
  401. });
  402. $audioconfig_vol.change(function(){
  403. alertVolume = Number($audioconfig_vol.val());
  404. GM_setValue("DCCE_alertVolume", alertVolume);
  405. document.getElementById('checkchat').volume = (activateAlertChat) ? alertVolume : 0;
  406. });
  407.  
  408.  
  409. this.$window = $config_window;
  410.  
  411. //----------------------------------------
  412. //Configuration de la largeur du chat
  413. //----------------------------------------
  414. var $xtdconfig = $('<div />').appendTo($config_interface);
  415. var $xtdconfig_title = $('<h2 class="couleur4 configTitre" />').appendTo($xtdconfig);
  416. $xtdconfig_title.text('Largeur du chat');
  417. $xtdconfig_title.css({
  418. "margin-bottom": '5px',
  419. "border-bottom": '1px solid',
  420. display: 'block',
  421. "font-size": '17px',
  422. "-webkit-margin-before": '0.83em',
  423. "-webkit-margin-after": '0.83em',
  424. "-webkit-margin-start": '0px',
  425. "-webkit-margin-end": '0px',
  426. "font-weight": 'bold',
  427. position: 'relative',
  428. });
  429. var $xtdconfig_container = $('<div class="ligne"/>').appendTo($config_interface);
  430. //$xtdconfig_container.text('Défilement automatique : ');
  431. $xtdconfig_container.css({
  432. display: 'inline-block',
  433. "margin-bottom": '15px',
  434. });
  435. var $xtdconfig_range = $('<input type="range" name="typeXtdRange" value="' + chatExtend + '" min="0" max="300" step="1"></input>').appendTo($xtdconfig_container);
  436. $xtdconfig_range.css({
  437. margin: '0 5px',
  438. width: '500px'
  439. });
  440. $xtdconfig_range.change(function(){
  441. chatExtend = Number($xtdconfig_range.val());
  442. GM_setValue("DCCE_chatExtend", chatExtend);
  443. setChatCSS();
  444. });
  445.  
  446. //----------------------------------------
  447. //Configuration des fonds de zone droite/chat customs
  448. //----------------------------------------
  449. var $bgconfig = $('<div />').appendTo($config_interface);
  450. var $bgconfig_title = $('<h2 class="couleur4 configTitre" />').appendTo($bgconfig);
  451. $bgconfig_title.text('Fonds de zone customisés (pour réinitialiser, effacer la ligne)');
  452. $bgconfig_title.css({
  453. "margin-bottom": '5px',
  454. "border-bottom": '1px solid',
  455. display: 'block',
  456. "font-size": '17px',
  457. "-webkit-margin-before": '0.83em',
  458. "-webkit-margin-after": '0.83em',
  459. "-webkit-margin-start": '0px',
  460. "-webkit-margin-end": '0px',
  461. "font-weight": 'bold',
  462. position: 'relative',
  463. });
  464. var $bgconfig_container = $('<div class="ligne"/>').appendTo($config_interface);
  465. $bgconfig_container.css({
  466. display: 'inline-block',
  467. "margin-bottom": '15px',
  468. });
  469. var $bgconfig_pzonedroite = $('<div>Fond messagerie (indiquer URL de l\'image) :</div>').appendTo($bgconfig_container);
  470. $bgconfig_pzonedroite.css({
  471. margin: '0 5px',
  472. width: '500px'
  473. });
  474. var $bgconfig_zonedroite = $('<input type="url" name="typeBGzonedroite" value="' + scriptZoneDroiteBG + '" style="background-color: antiquewhite;"></input>').appendTo($bgconfig_container);
  475. $bgconfig_zonedroite.css({
  476. margin: '0 5px',
  477. width: '500px'
  478. });
  479. $bgconfig_zonedroite.keyup(function(){
  480. if($(this).val() === DEFAULT_SCRIPT_ZONE_DROITE_BG || $(this).val() === "") {
  481. GM_deleteValue("DCCE_scriptZoneDroiteBG");
  482. scriptZoneDroiteBG = DEFAULT_SCRIPT_ZONE_DROITE_BG;
  483. } else {
  484. scriptZoneDroiteBG = $(this).val();
  485. GM_setValue("DCCE_scriptZoneDroiteBG", scriptZoneDroiteBG);
  486. }
  487. setZoneChatBackground();
  488. });
  489. var $bgconfig_pzonechat = $('<div> </div><div>Fond chat (indiquer URL de l\'image) :</div>').appendTo($bgconfig_container);
  490. $bgconfig_pzonechat.css({
  491. margin: '0 5px',
  492. width: '500px'
  493. });
  494. var $bgconfig_zonechat = $('<input type="url" name="typeBGzonechat" value="' + scriptZoneChatBG + '" style="background-color: antiquewhite;"></input>').appendTo($bgconfig_container);
  495. $bgconfig_zonechat.css({
  496. margin: '0 5px',
  497. width: '500px'
  498. });
  499. $bgconfig_zonechat.keyup(function(){
  500. if($(this).val() === DEFAULT_SCRIPT_ZONE_CHAT_BG || $(this).val() === "") {
  501. GM_deleteValue("DCCE_scriptZoneChatBG");
  502. scriptZoneChatBG = DEFAULT_SCRIPT_ZONE_CHAT_BG;
  503. } else {
  504. scriptZoneChatBG = $(this).val();
  505. GM_setValue("DCCE_scriptZoneChatBG", scriptZoneChatBG);
  506. }
  507. setZoneChatBackground();
  508. });
  509.  
  510. //----------------------------------------
  511. //Configuration des couleurs de pseudos dans le chat
  512. //----------------------------------------
  513. var $clrconfig = $('<div />').appendTo($config_interface);
  514. var $clrconfig_title = $('<h2 class="couleur4 configTitre" />').appendTo($clrconfig);
  515. $clrconfig_title.text('Gestion des couleurs de pseudos');
  516. $clrconfig_title.css({
  517. "margin-bottom": '5px',
  518. "border-bottom": '1px solid',
  519. display: 'block',
  520. "font-size": '17px',
  521. "-webkit-margin-before": '0.83em',
  522. "-webkit-margin-after": '0.83em',
  523. "-webkit-margin-start": '0px',
  524. "-webkit-margin-end": '0px',
  525. "font-weight": 'bold',
  526. position: 'relative',
  527. });
  528. var $useritems_table = $('<table id="dcce_colorItems_config"/>').appendTo($clrconfig);
  529. $useritems_table.css({
  530. width: '100%',
  531. border: 'solid 1px white',
  532. margin: '5px 0',
  533. "font-size": '15px',
  534. });
  535. //Ligne d'en-têtes
  536. $useritems_table.append($('<thead><tr><th>Personnage</th><th>Couleur</th><th></th></tr></thead>'));
  537. var $useritems_tbody = $('<tbody />').appendTo($useritems_table);
  538. var localValues = GM_listValues();
  539. for (let j = 0; j < localValues.length; j++) {
  540. if(localValues[j].includes("dcce_ctb_")) {
  541. var type_id = localValues[j];
  542. var $row = $('<tr />').appendTo($useritems_tbody);
  543. $row.addClass("loaded_item");
  544. $row.attr('id', type_id);
  545. var item_perso = GM_getValue("dcce_name_" + localValues[j].slice(9));
  546. var $perso_td = $('<td class="perso_td" style="text-align:left;width:60%;font-size: 20px;padding-left: 5px;">' + item_perso + '</td>').appendTo($row);
  547. var item_couleur = '<input class="dcce_colortagbox" type="color" id="' + localValues[j] + '" value="' + GM_getValue(localValues[j]) + '"/>';
  548. var $couleur_td = $('<td class="couleur_td" style="/*padding-left:10px;*/width:20%;text-align:center">' + item_couleur + '</td>').appendTo($row);
  549. $couleur_td.data('type_ID', type_id);
  550. //Ajout d'un bouton pour la suppression
  551. var $last_td = $('<td style="width:20%"/>').appendTo($row);
  552. var $itemdel_btn = $('<div class="btnTxt" />').appendTo($last_td);
  553. $itemdel_btn.data('type_ID', type_id);
  554. $itemdel_btn.text('Reset');
  555. $itemdel_btn.css({
  556. height: '15px',
  557. margin: '5px 15px',
  558. });
  559. //Handler clic sur le bouton "Supprimer" d'une ligne du tableau
  560. $itemdel_btn.click(function () {
  561. if ($(this).data('confirmed')) {
  562. //Suppression des valeurs de la ligne
  563. var type_id = $(this).data('type_ID');
  564. GM_deleteValue("dcce_ctb_" + type_id.slice(9));
  565. chatChangeColor(type_id);
  566. $(this).parent().parent().children().children("input").val(DEFAULT_CHAT_COLOR); //Reset du color picker
  567. //Remise à zéro du bouton
  568. $(this).text('Reset');
  569. $(this).data('confirmed', false);
  570. } else {
  571. //Besoin d'un second clic, pour confirmation
  572. $(this).text('Confirmer');
  573. $(this).data('confirmed', true);
  574. }
  575. });
  576. $itemdel_btn.mouseleave(function () {
  577. //Annulation de la confirmation de suppression
  578. $(this).text('Reset');
  579. $(this).data('confirmed', false);
  580. });
  581. $couleur_td.children("input").change(function() {
  582. GM_setValue($couleur_td.data('type_ID'), $(this).val());
  583. chatChangeColor($couleur_td.data('type_ID').slice(9));
  584. });
  585. }
  586. }
  587.  
  588. //Css des éléments du tableau
  589. $useritems_table.find('td').css({
  590. border: '1px solid white',
  591. height: '15px'
  592. });
  593.  
  594.  
  595. //----------------------------------------
  596. //Configuration de MatriceRP
  597. //----------------------------------------
  598. var $mrpconfig = $('<div />').appendTo($config_interface);
  599. var $mrpconfig_title = $('<h2 class="couleur4 configTitre" />').appendTo($clrconfig);
  600. $mrpconfig_title.text('Gestion des commandes');
  601. $mrpconfig_title.css({
  602. "margin-bottom": '5px',
  603. "border-bottom": '1px solid',
  604. display: 'block',
  605. "font-size": '17px',
  606. "-webkit-margin-before": '0.83em',
  607. "-webkit-margin-after": '0.83em',
  608. "-webkit-margin-start": '0px',
  609. "-webkit-margin-end": '0px',
  610. "font-weight": 'bold',
  611. position: 'relative',
  612. });
  613. var $commands_table = $('<table id="dcce_commands_config"/>').appendTo($clrconfig);
  614. $commands_table.css({
  615. width: '100%',
  616. border: 'solid 1px white',
  617. margin: '5px 0',
  618. "font-size": '15px',
  619. });
  620.  
  621.  
  622.  
  623. //Ligne d'en-têtes
  624. $commands_table.append($('<thead><tr><th>Alias</th><th>Nom</th><th>Couleur</th><th>Gras</th><th>Action</th></tr></thead>'));
  625. var $commands_tbody = $('<tbody />').appendTo($commands_table);
  626. var cmdTotal = 0;
  627.  
  628. function updateCommand(id) {
  629. //console.log("Update on line: " + id);
  630. mrpCommands[id].alias = $("#mrp_alias_input_" + id).val();
  631. mrpCommands[id].name = $("#mrp_name_input_" + id).val();
  632. mrpCommands[id].color = $("#mrp_color_input_" + id).val();
  633. mrpCommands[id].bold = $("#mrp_bold_input_" + id).attr("checked") == "checked" ? true : false;
  634. mrpCommands[id].rp = $("#mrp_rp_input_" + id).attr("checked") == "checked" ? true : false;
  635. //console.log(mrpCommands[id]);
  636. GM_setValue("DCCE_MRP", JSON.stringify(mrpCommands));
  637. }
  638.  
  639. //Fonction pour générer une ligne au tableau
  640. //cmd {alias:"str", name:"str", color:"#008000", bold:false, rp:true}
  641. function drawCommand(cmd, id) {
  642. let $row = $('<tr id="cmd_row_' + id + '"/>').appendTo($commands_tbody);
  643. $row.addClass("loaded_item");
  644.  
  645. let $alias_td = $('<td class="alias_td" style="text-align:left;font-size: 20px;padding-left: 5px;"><input style="background-color: antiquewhite" type="text" id="mrp_alias_input_' + id + '" value="' + cmd.alias + '"/></td>').appendTo($row);
  646. let $name_td = $('<td class="name_td" style="text-align:left;font-size: 20px;padding-left: 5px;"><input style="background-color: antiquewhite" type="text" id="mrp_name_input_' + id + '" value="' + cmd.name + '"/></td>').appendTo($row);
  647. let $color_td = $('<td class="color_td" style="text-align:center;font-size: 20px;"><input type="color" id="mrp_color_input_' + id + '" value="' + cmd.color + '"/></td>').appendTo($row);
  648. let $bold_td = $('<td class="bold_td" style="text-align:center;font-size: 20px;"><input type="checkbox" id="mrp_bold_input_' + id + '"' + (cmd.bold ? ' checked' : '') + '/></td>').appendTo($row);
  649. let $rp_td = $('<td class="rp_td" style="text-align:center;font-size: 20px;"><input type="checkbox" id="mrp_rp_input_' + id + '"' + (cmd.rp ? ' checked' : '') + '/></td>').appendTo($row);
  650.  
  651. $alias_td.children("input").keyup(function(){updateCommand(id)});
  652. $name_td.children("input").keyup(function(){updateCommand(id)});
  653. $color_td.children("input").change(function(){updateCommand(id)});
  654. $bold_td.children("input").change(function(){updateCommand(id)});
  655. $rp_td.children("input").change(function(){updateCommand(id)});
  656. }
  657.  
  658. for (let j = 0; j < mrpCommands.length; j++) {
  659. $commands_tbody.append(drawCommand(mrpCommands[j], j));
  660. }
  661.  
  662. var $mrp_container = $('<div style="text-align: center"></div>').appendTo($clrconfig);
  663. var $mrp_remove = $('<input style="color: red; background-color: antiquewhite; width: 45%; margin: 5px" type="button" id="mrp_remove" value="Supprimer une ligne" />').click(function(){
  664. if (mrpCommands.length > 3) {
  665. mrpCommands.pop();
  666. GM_setValue("DCCE_MRP", JSON.stringify(mrpCommands));
  667. $("#cmd_row_" + mrpCommands.length).remove();
  668. }
  669. }).appendTo($mrp_container);
  670.  
  671. var $mrp_add = $('<input style="color: green; background-color: antiquewhite; width: 45%; margin: 5px" type="button" id="mrp_add" value="Ajouter une ligne" />').click(function(){
  672. drawCommand({alias:"", name:"", color:"#FFFFFF", bold:false, rp:false}, mrpCommands.length);
  673. stylizeTableCells();
  674. mrpCommands.push({alias:"", name:"", color:"#FFFFFF", bold:false, rp:false});
  675. GM_setValue("DCCE_MRP", JSON.stringify(mrpCommands));
  676. }).appendTo($mrp_container);
  677.  
  678. /*$("#mrp_add").click(function(){
  679. console.log("Adding new command line");
  680. drawCommand({alias:"", name:"", color:"#FFFFFF", bold:false, rp:false}, mrpCommands.length);
  681. mrpCommands.push({alias:"", name:"", color:"#FFFFFF", bold:false, rp:false});
  682. GM_setValue("DCCE_MRP", JSON.stringify(mrpCommands));
  683. });*/
  684.  
  685. //Css des éléments du tableau
  686. function stylizeTableCells() {
  687. $commands_table.find('td').css({
  688. border: '1px solid white',
  689. height: '15px'
  690. });
  691. }
  692. stylizeTableCells();
  693. }
  694. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  695. //FIN Constructeur de fenêtre de configuration
  696. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  697.  
  698.  
  699. //---------------------------------------------------
  700. //Ajout d'un item au menu bandeau "Paramètres" de DC
  701. //---------------------------------------------------
  702. var $params_menu = $('.menus > .parametres > ul');
  703. var $dcce_config = $('<li />').appendTo($params_menu);
  704. $dcce_config.text("Configuration du Chat");
  705. $dcce_config.addClass('link couleur2 separator');
  706.  
  707. $dcce_config.click(function () {
  708. //Fermeture des autres instances de paramétrage ouvertes
  709. engine.closeDataBox('dcce_configwindow');
  710. var $config_window = new DCCE_ConfigurationWindow();
  711. $databox.append($config_window.$window);
  712. });
  713.  
  714. //**********************************************
  715. // FIN INTERFACE DE CONFIGURATION UTILISATEUR
  716. //**********************************************
  717.  
  718. //**********************************************
  719. // DEBUT MAIN
  720. //**********************************************
  721.  
  722. //ALERTCHAT, Script d'Odul
  723. (function() {
  724. var imgUnmute = 'url(http://i.imgur.com/uvIB44X.png)';
  725. var imgMute = 'url(http://i.imgur.com/8oV9IrJ.png)';
  726.  
  727. var audio = document.createElement('audio');
  728. audio.id='checkchat';
  729. document.body.appendChild(audio);
  730. $('#checkchat').attr('src', alertChatAudioURL);
  731. $("#checkchat").css("display","none");
  732.  
  733. $('<li class="separator"></li>').prependTo($('#bandeau ul.menus'));
  734. var End = $('<li>').prependTo($('#bandeau ul.menus'));
  735. End.attr("id", 'endAudiocheckchat');
  736. End.css({
  737. left: '5px',
  738. height: '30px',
  739. "z-index": '999999',
  740. "background-size": '29px 15px',
  741. "background-repeat": 'no-repeat',
  742. "background-position-y": '6px',
  743. color: '#999'
  744. });
  745. End.text("AC").addClass('link');
  746. End.hover(
  747. function(){
  748. $(this).css("color", "#0073d5");
  749. },
  750. function(){
  751. var colorAC = (activateAlertChat) ? "#999" : "#D00000";
  752. $(this).css("color", colorAC);
  753. }
  754. );
  755. End.click(function() {
  756. activateAlertChat = (activateAlertChat) ? false : true;
  757. GM_setValue("DCCE_activateAlertChat", activateAlertChat);
  758. document.getElementById('endAudiocheckchat').style.backgroundImage = (activateAlertChat) ? imgUnmute : imgMute;
  759. //document.getElementById('checkchat').volume = (activateAlertChat) ? 1 : 0;
  760. document.getElementById('checkchat').volume = (activateAlertChat) ? alertVolume : 0;
  761. var colorAC = (activateAlertChat) ? "#999" : "#D00000";
  762. End.css("color", colorAC);
  763. });
  764.  
  765. //Initialisation depuis le stockage local
  766. document.getElementById('endAudiocheckchat').style.backgroundImage = (activateAlertChat) ? imgUnmute : imgMute;
  767. //document.getElementById('checkchat').volume = (activateAlertChat) ? 1 : 0;
  768. document.getElementById('checkchat').volume = (activateAlertChat) ? alertVolume : 0;
  769. var colorAC = (activateAlertChat) ? "#999" : "#D00000";
  770. End.css("color", colorAC);
  771. })();
  772.  
  773.  
  774.  
  775. //MatriceRP
  776. //Par Isilin
  777.  
  778. const FORBIDDEN_ALIASES = ["me", "y", "yme", "w", "wme", "roll", ""];
  779.  
  780. /*var commands = [
  781. { alias:"env", name:"Environment", color:"008000", bold:false, rp:true },
  782. { alias:"sis", name:"Ta soeur", color:"00FFFF", bold:false, rp:false },
  783. { alias:"creapy", name:"Le Monstre", color:"FF00FF", bold:false, rp:true }
  784. ];*/
  785.  
  786. function tagMessage(inputStr) {
  787.  
  788. let message = inputStr;
  789.  
  790. let aliasUsed = inputStr.split(" ")[0].substr(1);
  791.  
  792. if (FORBIDDEN_ALIASES.indexOf(aliasUsed) > -1) return message; //On ne modifie pas le message si l'alias utilisé est une commande du jeu ou un alias invalide
  793.  
  794. let command = mrpCommands.find(cmd => cmd.alias.toLowerCase() === aliasUsed.toLowerCase()); //On récupère les paramètres de la commande à partir de son alias (vérification non sensible à la casse)
  795.  
  796. if (command === undefined) return message; //On ne modifie pas le message si l'alias utilisé n'est pas défini
  797.  
  798. message = (command.rp ? "/me " : "")
  799. + "[b][c=" + command.color.substr(1) + "]{" + command.name + "}[/c][/b]"
  800. + (command.bold ? "[b]" : "")
  801. + "[c=" + command.color.substr(1) + "]" + message.substr(command.alias.length + 1) + "[/c]"
  802. + (command.bold ? "[/b]" : "");
  803.  
  804. return message;
  805. }
  806.  
  807.  
  808.  
  809. //AmeliorationTchat2.0
  810. //Par Odul
  811. var $chatInput = $("#chatForm .text_chat");
  812.  
  813. function beautifyMessage(inputStr) {
  814.  
  815. let message = inputStr;
  816.  
  817. if (/^\/me/i.test(message)) {
  818.  
  819. message = "/me" + message.substr(3); //Transforme /Me en /me pour que la casse soit respectée et que le chat ressorte bien une emote.
  820.  
  821. var quoteMatches = message.match(/\"/gi) || []; //Pré-calcul de la place que prendront les balises. Balisage que si ne dépasse pas 200 caractères, balises comprises.
  822.  
  823. if (message.length + (Math.floor(quoteMatches.length/2) * 14)) {
  824. message = message.replace(/"([^\"]+)"/gi, "[c=FFFFFF]$1[/c]");
  825. }
  826. } else {
  827. var starMatches = message.match(/\*/gi) || [];
  828.  
  829. if (message.length + (Math.floor(starMatches.length/2) * 21)) {
  830. message = message.replace(/\*([^\*]+)\*/gi, "[c=58DCF9][i]$1[/i][/c]");
  831. }
  832. }
  833. return message;
  834. }
  835.  
  836.  
  837. //Applique les scripts AmeliorationTchat2.0 et MatriceRP au moment de poster le message
  838. var ameliorInput = function(e) {
  839. if (e.keyCode==13) {
  840. $chatInput.val(tagMessage(beautifyMessage($chatInput.val())));
  841. }
  842. };
  843.  
  844. $("#chatForm .text_chat").on('keypress', ameliorInput);
  845.  
  846.  
  847. //HIGHLIGHT CHAT LIMIT
  848. //Code de Ladoria, modifications de débugging et implémentation au script.
  849. function HighlightChatLimit() {
  850.  
  851. var limitColor = 'red', //Couleurs pour chaque pallier de longueur
  852. alertColor = 'orange',
  853. warningColor = 'yellow',
  854. limitLength = 200, //Palliers de longueur
  855. alertLength = 170,
  856. warningLength = 135;
  857.  
  858. var c1 = $("#chatForm").css('border-color'); //CSS original de la box
  859. var c2 = $("#chatForm .text_mode").css('border-color');
  860. var c3 = $("#chatForm .text_valider").css('background-color');
  861. var c4 = $("#chatForm").css('box-shadow');
  862.  
  863. var animateChatInput = function(e) {
  864. var processedInput = tagMessage(beautifyMessage($("#chatForm .text_chat").val()));
  865. if (processedInput.length > limitLength)
  866. highlight(limitColor); // limit reached
  867. else if (processedInput.length >= alertLength)
  868. highlight(alertColor); // approach limit
  869. else if (processedInput.length >= warningLength)
  870. highlight(warningColor); // first warning
  871. else
  872. originalHighlight(c1, c2, c3, c4); // far away from limit
  873. };
  874.  
  875. function originalHighlight(formBorderColor, modeBorderColor, bgColor, bsSettings) {
  876. $("#chatForm").css('border-color', formBorderColor);
  877. $("#chatForm .text_mode").css('border-color', modeBorderColor);
  878. $("#chatForm .text_valider").css('background-color', bgColor);
  879.  
  880. $("#chatForm").css('box-shadow', bsSettings);
  881. }
  882.  
  883. function highlight(color) {
  884. originalHighlight(color, color, color, '0px 0px 3px 2px ' + color);
  885. }
  886.  
  887. $("#chatForm .text_chat").attr("maxlength", "200");
  888. $("#chatForm .text_chat").on('keyup', animateChatInput);
  889.  
  890. }
  891. HighlightChatLimit(); //Exécution du script de limite de chat.
  892.  
  893.  
  894. //SCROLLING
  895. scrollChat(); //Place le chat au chargement du jeu.
  896. $newMessageAlert.click(scrollChat); //Scroll au clic du bouton d'alerte de nouveau message.
  897. $(".text_chat").keydown(function(key){ //Si en préférence, scroller le chat automatiquement quand on commence à écrire.
  898. if(typePredict && key != 13) scrollChat(); //Ne pas le faire avec la touche entrée car déjà fait quand la ligne apparaît dans le chat.
  899. });
  900. var lastChat = $('#chatContent').text(); //Sert à comparer pour voir si le chat a changé.
  901. setInterval(function(){ //Scrolle ou alerte à la réception d'un message.
  902. if(lastChat != $('#chatContent').text()) {
  903. lastChat = $('#chatContent').text(); //Actualiser la copie local du chat.
  904.  
  905. var audio = document.getElementById('checkchat');
  906. audio.load();
  907. audio.play();
  908.  
  909. if(autoScroll) {
  910. scrollChat();
  911. }
  912. else if($("#chatContent .link.linkable:last").text() !== $("#txt_pseudo").text()) {
  913. $newMessageAlert.stop().fadeIn(500); //Afficher uniquement le bouton si l'utilisateur ne vient pas de poster.
  914. }
  915. }
  916. }, 1000);
  917.  
  918. //COLOR TAG
  919. $(document).on("click", "span.perso.link", function(){
  920. var idPerso = $(this).attr('id').slice(9);
  921. $(document).one("ajaxSuccess", {idPerso: idPerso}, function(e){ //Permet d'attendre le chargement de la fenêtre, one() pour éviter un duplicata.
  922. var idctb = '#colorTagBox_' + e.data.idPerso;
  923. var colorTagBox = $('<div style="margin-top: 15px; text-align: center;">' + 'Couleur chat: ' +
  924. '<input type="color" id="' + idctb.slice(1) + '" value="' + DEFAULT_CHAT_COLOR + '"/>' +
  925. '<input type="button" id="' + idctb.slice(1) + '_reset" value="Reset" style="background-color: buttonface; margin-left: 5px; height: 16px; font-size: 12px;"/>' +
  926. '</div>').appendTo($("#ib_persoBox_" + e.data.idPerso + " .fakeToolTip"));
  927.  
  928. GM_setValue("dcce_name_" + e.data.idPerso, $("#ib_persoBox_" + e.data.idPerso + " .titreinfo").contents().filter(function(){
  929. return this.nodeType == 3;
  930. })[0].nodeValue); //Récupère le nom du personnage, utilisé dans le nommage de la classe du pseudo.
  931.  
  932. if(GM_getValue("dcce_ctb_" + e.data.idPerso) !== undefined) { //Récupère et applique au bouton couleur la couleur enregistrée
  933. $(idctb).val((GM_getValue("dcce_ctb_" + e.data.idPerso)));
  934. }
  935. $(idctb).on("change", {idPerso: e.data.idPerso}, function(e) { //Enregistre en mémoire la nouvelle couleur
  936. GM_setValue("dcce_ctb_" + e.data.idPerso, $(this).val());
  937. chatChangeColor(e.data.idPerso);
  938. });
  939. $(idctb + "_reset").on("click", {idPerso: e.data.idPerso}, function(e) { //Reset de la couleur
  940. GM_deleteValue("dcce_ctb_" + e.data.idPerso);
  941. $(idctb).val(DEFAULT_CHAT_COLOR);
  942. chatChangeColor(e.data.idPerso);
  943. });
  944. });
  945.  
  946. });
  947. });