// ==UserScript==
// @match http://www.gamekult.com/*
// ==/UserScript==
/*
** GKExtended v2
** Pour les forums de Gamekult.com
** Par Fish_Guts
** Celui qui lit ceci est un idiot :)
**
*/

/*******************************************************/
/*				Variables - Constantes
/*******************************************************/

// Blacklistés.
// RESPECTER LES MAJUSCULES, SEPARER PAR DES VIRGULES
// EXEMPLES :
// EX1 : var string_bl = "Pseudo1,Pseudo2,Pseudo2";
// EX2 : var string_bl = "Pseudo1";
// EX3 : var string_bl = "";

var string_bl = "";


//Options activées ou non
// Pour ACTIVER mettre true
// Pour DESACTIVER mettre false


//Injecter les vidéos dailymotion
var addMotion = true;

//Injecter les vidéos Youtube
var addTube = true;

//Activer le blacklistage
var blOn = true;

//Activer les smileys dans les bunks
var smBunk = true;

//Activer les smileys dans l'historique
var smHistorique = true;

//Activer les urls cliquables dans les bunks
var uriBunk = true;

//Activer les urls cliquables dans l'historique
var uriHistorique = true;

//Activer les urls cliquables dans l'interface premium
var uriHistoriqueIM = true;

//Activer les smileys dans l'interface premium
var smHistoriqueIM = true;

//Activer les smileys dans les commentaires de blog
var smCommentairesBlog = true;

//Dupliquer la barre de bunks
var duplicateBunks = true;

//Remettre le light dans les forums normaux
var displayOldNav = true;

//Activer l'autocomplétion des smileys
var autoComplete = true;












//ne PAS éditer sous cette ligne
//ne PAS éditer sous cette ligne
//ne PAS éditer sous cette ligne
//ne PAS éditer sous cette ligne


body = document.body;
var style = document.createElement("link" ); 
with(style) { 
	type="text/css"; 
	rel="stylesheet"; 
	href="http://fiaxhs.com/gkfix.css"; 
}
document.getElementsByTagName("head")[0].appendChild(style);
var style2 = document.createElement("link" ); 
with(style2) { 
	type="text/css"; 
	rel="stylesheet"; 
	href="http://fiaxhs.com/gklist.css"; 
}
document.getElementsByTagName("head")[0].appendChild(style2);




var bl = string_bl.split(',');
var fastPost = false;
var fastEdit = false;
var pseudoUp = false;


var count_vid = 1;

//Tableau des smileys
var tab = Array();
tab[":note:"]	   = 1;
tab[":fleche:"]	   = 2;
tab[":lumiere:"]   = 3;
tab["/!\\"]		   = 4;
tab[":?:"]		   = 5;
tab[":oldcool:"]   = 6;
tab[":niais:"]	   = 7;
tab[":oldfou:"]	   = 8;
tab[":old:(:"]	   = 9;
tab["^^"]		   = 10;
tab[":old:o:"]	   = 11;
tab[":old;):"]	   = 12;
tab[":moins:"]	   = 13;
tab[":plus:"]	   = 14;
tab[":cool:"]	   = 21;
tab[":sarcastic:"] = 22;
tab[":fou:"]	   = 23;
tab[":ouch:"]	   = 24;
tab[":??:"]		   = 25;
tab[":lol:"]	   = 26;
tab[":gun:"]	   = 27;
tab[":wahoo:"]	   = 28;
tab[":crazy:"]	   = 29;
tab[":hello:"]	   = 30;
tab[":benetton:"]  = 31;
tab[":cry:"]	   = 32;
tab[":hap:"]	   = 33;
tab[":sol:"]	   = 34;
tab[":jap:"]	   = 35;
tab[":bounce:"]	   = 36;
tab[":hot:"]	   = 37;
tab[":spookie:"]   = 38;
tab[":eek:"]	   = 39;
tab[":love:"]	   = 40;
tab[":sleep:"]	   = 41;
tab[":sweat:"]	   = 42;
tab[":flag:"]	   = 43;
tab[":zippo:"]	   = 44;
tab[":pan:"]	   = 45;
tab[":instagib:"]  = 46;
tab[":love2:"]	   = 47;
tab[":ass:"]	   = 48;
tab[":napo:"]	   = 49;
tab[":grrr:"]	   = 50;
tab[":plasma:"]	   = 51;
tab[":roll:"]	   = 52;
tab[":saint:"]	   = 53;
tab[":roll2:"]	   = 54;
tab[":ange:"]	   = 55;
tab[":guil:"]	   = 56;
tab[":king:"]	   = 57;
tab[":frog:"]	   = 58;
tab[":dead:"]	   = 59;
tab[":clap:"]	   = 60;
tab[":homer:"]	   = 61;
tab[":|"]		   = 62;
tab[":fool:"]	   = 63;
tab[":youpi:"]	   = 64;
tab[":nerd:"]	   = 65;
tab[":book:"]	   = 67;
tab[":warning:"]   = 68;
tab[":cry2:"]	   = 69;
tab[":no:"]		   = 70;
tab[":!!!:"]	   = 71;
tab[":cool2:"]	   = 72;
tab[":rain:"]	   = 73;
tab[":DD:"]		   = 74;
tab[":lick:"]	   = 75;
tab[":dj:"]		   = 76;
tab[":!!:"]		   = 77;
tab[":yes:"]	   = 78;
tab[":puke:"]	   = 79;
tab[":cheer:"]	   = 80;
tab[":fuck:"]	   = 81;
tab[":/ "]		   = 82;
tab[":fuck2:"]	   = 83;
tab[":afro:"]	   = 84;
tab[":baby:"]	   = 85;
tab[":dance:"]	   = 86;
tab[":no2:"]	   = 87;
tab[":crash:"]	   = 88;
tab[":cry3:"]	   = 89;
tab[":nerd2:"]	   = 90;
tab[":dead2:"]	   = 91;
tab[":devil:"]	   = 92;
tab[":pray:"]	   = 93;
tab[":hug:"]	   = 94;
tab[":happy:"]	   = 95;
tab[":crazy2:"]	   = 96;
tab[":sayan:"]	   = 97;
tab[":no3:"]	   = 98;
tab[":ass2:"]	   = 99;
tab[":tap:"]	   = 100;
tab[":trout:"]	   = 101;
tab[":honte:"]	   = 102;
tab[":slap:"]	   = 103;
tab[":bang:"]	   = 104;
tab[":pray2:"]	   = 105;
tab[":banana:"]	   = 106;
tab[":clap2:"]	   = 108;
tab[":boulet:"]	   = 109;
tab[":x:"]		   = 111;
tab[":lol2:"]	   = 112;
tab[":malades:"]   = 113;
tab[":mdr:"]	   = 114;
tab[":merci:"]	   = 115;
tab[":off:"]	   = 116;
tab[":rhoo:"]	   = 117;
tab[":sors:"]	   = 118;
tab[":boxe:"]	   = 119;
tab[":yff:"]	   = 120;
tab[":humour:"]	   = 121;
tab[":)"]		   = 15;
tab[":("]		   = 16;
tab[":o"]		   = 17;
tab[":D"]		   = 18;
tab[";)"]		   = 19;
tab[":p"]		   = 20;


// Pour annulation d'injection de news
var today = new Date()
var targetDate = new Date("02/27/2008") 
var timeAfterTarget = Math.floor(( today.getTime() - targetDate.getTime() ) / 86400000);




var codes = ':alex:,:badoum:,:bookfap:,:bookfapfou:,:bookfoubranle:,:booknerd:,:bougeourre:,:chucheum:,:corbo:,:delarue1:,:delarue2:,:delarue3:,:douvel:,:emo:,:fear:,:fouo:,:frodon:,:frodon2:,:gauche:,:hah1n1:,:hahalbanel:,:hahasith:,:haha_afro:,:haha_auto:,:haha_auto2:,:haha_belge:,:haha_cry:,:haha_dbz:,:haha_dead:,:haha_diamond:,:haha_fail:,:haha_fier:,:haha_france:,:haha_francais:,:haha_golden:,:haha_grillaid:,:haha_jap:,:haha_lovecraft:,:haha_non:,:haha_ol:,:haha_omg:,:haha_pasmafaute:,:haha_pedo:,:haha_reveil:,:haha_reverse:,:haha_skeleton:,:haha_sommeil:,:haha_tarte:,:haha_think:,:haha_want:,:haha_wink:,:james:,:kebab:,:laporte:,:marto:,:moundirpapa:,:napo1:,:napo2:,:napo3:,:nashman:,:nerdboulet:,:nerdviolon:,:ninjabranlette:,:nonofeuj:,:pedo:,:pika:,:rido:,:rs:,:rvd:,:schtroumph:,:ultra:,:weird:,:yuki:,:3:,:7:,:fp:,:hum:,:nerdenvers:,:nerdhein:,:niais:,:sweaf:,:wah:,:awesome:,:black:,:boum:,:chut:,:clapclap:,:clebs:,:cthulhu:,:cylon:,:cylonduck:,:emocut:,:fap:,:frogcool:,:frogsiren:,:monocle:,:ohdear:,:psyduck:,:sad:,:tente:,:wtc:,:foubatte:,:happyfou:,:helloinv:,:helloo:,:napofou:,:nerdlol:,:ptdrmdr:,:rocknroll:,:siffle:,:surfeuses:'.split(',');



var urls =  'http://www.fiaxhs.com/smilies/alex.gif,http://www.fiaxhs.com/smilies/badoum.gif,http://www.fiaxhs.com/smilies/bookfap.gif,http://www.fiaxhs.com/smilies/bookfapfou.gif,http://www.fiaxhs.com/smilies/bookfoubranle.gif,http://www.fiaxhs.com/smilies/booknerd.gif,http://www.fiaxhs.com/smilies/bougeourre.gif,http://www.fiaxhs.com/smilies/chucheum.gif,http://www.fiaxhs.com/smilies/corbo.gif,http://www.fiaxhs.com/smilies/delarue1.gif,http://www.fiaxhs.com/smilies/delarue2.gif,http://www.fiaxhs.com/smilies/delarue3.gif,http://www.fiaxhs.com/smilies/douvel.gif,http://www.fiaxhs.com/smilies/emo.gif,http://www.fiaxhs.com/smilies/fear.gif,http://www.fiaxhs.com/smilies/fouo.gif,http://www.fiaxhs.com/smilies/frodon.gif,http://www.fiaxhs.com/smilies/frodon2.gif,http://www.fiaxhs.com/smilies/gauche.gif,http://www.fiaxhs.com/smilies/hah1n1.gif,http://www.fiaxhs.com/smilies/hahalbanel.gif,http://www.fiaxhs.com/smilies/hahasith.gif,http://www.fiaxhs.com/smilies/haha_afro.gif,http://www.fiaxhs.com/smilies/haha_auto.gif,http://www.fiaxhs.com/smilies/haha_auto2.gif,http://www.fiaxhs.com/smilies/haha_belge.gif,http://www.fiaxhs.com/smilies/haha_cry.gif,http://www.fiaxhs.com/smilies/haha_dbz.gif,http://www.fiaxhs.com/smilies/haha_dead.gif,http://www.fiaxhs.com/smilies/haha_diamond.gif,http://www.fiaxhs.com/smilies/haha_fail.gif,http://www.fiaxhs.com/smilies/haha_fier.gif,http://www.fiaxhs.com/smilies/haha_france.gif,http://www.fiaxhs.com/smilies/haha_francais.gif,http://www.fiaxhs.com/smilies/haha_golden.gif,http://www.fiaxhs.com/smilies/haha_grillaid.gif,http://www.fiaxhs.com/smilies/haha_jap.gif,http://www.fiaxhs.com/smilies/haha_lovecraft.gif,http://www.fiaxhs.com/smilies/haha_non.gif,http://www.fiaxhs.com/smilies/haha_ol.gif,http://www.fiaxhs.com/smilies/haha_omg.gif,http://www.fiaxhs.com/smilies/haha_pasmafaute.gif,http://www.fiaxhs.com/smilies/haha_pedo.gif,http://www.fiaxhs.com/smilies/haha_reveil.gif,http://www.fiaxhs.com/smilies/haha_reverse.gif,http://www.fiaxhs.com/smilies/haha_skeleton.gif,http://www.fiaxhs.com/smilies/haha_sommeil.gif,http://www.fiaxhs.com/smilies/haha_tarte.gif,http://www.fiaxhs.com/smilies/haha_think.gif,http://www.fiaxhs.com/smilies/haha_want.gif,http://www.fiaxhs.com/smilies/haha_wink.gif,http://www.fiaxhs.com/smilies/james.gif,http://www.fiaxhs.com/smilies/kebab.gif,http://www.fiaxhs.com/smilies/laporte.gif,http://www.fiaxhs.com/smilies/marto.gif,http://www.fiaxhs.com/smilies/moundirpapa.gif,http://www.fiaxhs.com/smilies/napo1.gif,http://www.fiaxhs.com/smilies/napo2.gif,http://www.fiaxhs.com/smilies/napo3.gif,http://www.fiaxhs.com/smilies/nashman.gif,http://www.fiaxhs.com/smilies/nerdboulet.gif,http://www.fiaxhs.com/smilies/nerdviolon.gif,http://www.fiaxhs.com/smilies/ninjabranlette.gif,http://www.fiaxhs.com/smilies/nonofeuj.gif,http://www.fiaxhs.com/smilies/pedo.gif,http://www.fiaxhs.com/smilies/pika.gif,http://www.fiaxhs.com/smilies/rido.gif,http://www.fiaxhs.com/smilies/rs.gif,http://www.fiaxhs.com/smilies/rvd.gif,http://www.fiaxhs.com/smilies/schtroumph.gif,http://www.fiaxhs.com/smilies/ultra.gif,http://www.fiaxhs.com/smilies/weird.gif,http://www.fiaxhs.com/smilies/yuki.gif,http://www.fiaxhs.com/smilies/3.gif,http://www.fiaxhs.com/smilies/7.gif,http://www.fiaxhs.com/smilies/fp.gif,http://www.fiaxhs.com/smilies/hum.gif,http://www.fiaxhs.com/smilies/nerdenvers.gif,http://www.fiaxhs.com/smilies/nerdhein.gif,http://www.fiaxhs.com/smilies/niais.gif,http://www.fiaxhs.com/smilies/sweaf.gif,http://www.fiaxhs.com/smilies/wah.gif,http://www.fiaxhs.com/smilies/awesome.gif,http://www.fiaxhs.com/smilies/black.gif,http://www.fiaxhs.com/smilies/boum.gif,http://www.fiaxhs.com/smilies/chut.gif,http://www.fiaxhs.com/smilies/clapclap.gif,http://www.fiaxhs.com/smilies/clebs.gif,http://www.fiaxhs.com/smilies/cthulhu.gif,http://www.fiaxhs.com/smilies/cylon.gif,http://www.fiaxhs.com/smilies/cylonduck.gif,http://www.fiaxhs.com/smilies/emocut.gif,http://www.fiaxhs.com/smilies/fap.gif,http://www.fiaxhs.com/smilies/frogcool.gif,http://www.fiaxhs.com/smilies/frogsiren.gif,http://www.fiaxhs.com/smilies/monocle.gif,http://www.fiaxhs.com/smilies/ohdear.gif,http://www.fiaxhs.com/smilies/psyduck.gif,http://www.fiaxhs.com/smilies/sad.gif,http://www.fiaxhs.com/smilies/tente.gif,http://www.fiaxhs.com/smilies/wtc.gif,http://www.fiaxhs.com/smilies/foubatte.gif,http://www.fiaxhs.com/smilies/happyfou.gif,http://www.fiaxhs.com/smilies/helloinv.gif,http://www.fiaxhs.com/smilies/helloo.gif,http://www.fiaxhs.com/smilies/napofou.gif,http://www.fiaxhs.com/smilies/nerdlol.gif,http://www.fiaxhs.com/smilies/ptdrmdr.gif,http://www.fiaxhs.com/smilies/rocknroll.gif,http://www.fiaxhs.com/smilies/siffle.gif,http://www.fiaxhs.com/smilies/surfeuses.gif'.split(',');


/*******************************************************/
/*				Fonctions "utilitaires"
/*******************************************************/

function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function deleterb(temp){
	temp=temp.replace(/\r/g, "");
	temp=temp.replace(/\n/g, "");
	return temp;
}

function nltobr(temp){
	temp=temp.replace(/\r/g, "<br>");
	temp=temp.replace(/\n/g, "");
	return temp;
}

function brtonl(temp){
	temp=temp.replace(/<br>/g, "\r");
	//temp=temp.replace(/\n/g, "<br>");
	return temp;
}

function inArray(string,array){
	var present = false;
	if(array.length > 0){
		for(num=0;num<array.length;num++){
			if(array[num] == string){
				present = true;
			}
		}
	} else { 
		present = false;
	}
	return present;
}

function getPseudo(){
	var expression = /Bonjour <a href="\/internaute\/([0-9]{1,9})\/"><b>(.{1,50})<\/b><\/a>/;
	expression.exec(document.getElementById('bunk').innerHTML);
	return RegExp.$2;
}

function insertAtCursor(myField, myValue, drop) {

  //IE support
  if (document.selection) {
    myField.focus();
    sel = document.selection.createRange();
    sel.text = myValue;
  }
  //MOZILLA/NETSCAPE support
  else if (myField.selectionStart || myField.selectionStart == '0') {
    var startPos = myField.selectionStart;
    var endPos = myField.selectionEnd;
    myField.value = myField.value.substring(0, startPos - drop)
                  + myValue
                  + myField.value.substring(endPos, myField.value.length);
  } else {
    myField.value += myValue;
  }
}


function isModo(){
	return /title="Modération"/.test(document.getElementById('bunk').innerHTML);
}


/*******************************************************/
/*				Partie "Blacklist"
/*******************************************************/



// Ajout du masquer / afficher temporaire
function injectLink(element){
	divlink = document.createElement("span");
	txt = document.createTextNode(" | ");
	divlink.appendChild(txt);
	a = document.createElement('a');
	
	a.href = "javascript:void(0);";
	a.innerHTML = "Afficher";
	a.addEventListener('click',function(){
									div = this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
									div.style.overflow='';
									div.style.height='';
									div.style.marginBottom=''
								},false);
	divlink.appendChild(a);
	txt = document.createTextNode(" - ");
	divlink.appendChild(txt);
	a2 = document.createElement('a');
	a2.href = "javascript:void(0);";
	a2.innerHTML+=("Masquer ");
	a2.addEventListener('click',function(){
									div = this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
									div.style.overflow='hidden';
									div.style.height='35px';
									div.style.marginBottom='5px';
								},false);
	divlink.appendChild(a2);
	element.insertBefore(divlink,element.childNodes[2]);

}

//Applique le style pour cacher les messages
function applyHideStyle(div){
	div.style.overflow='hidden';
	div.style.height='35px';
	div.style.marginBottom='5px';
}
/*******************************************************/
/*				Partie "TubeMotion"
/*******************************************************/



function addVideos(divUbb){
	links = divUbb.getElementsByTagName("a");//Tous les liens du message
	for(a=0;a<links.length;a++){
		if(addTube){
			/***** Youtube *****/
			var regTube = new RegExp("http%3A%2F%2F(www%2E|fr%2E|)youtube%2Ecom%2Fwatch%3Fv%3D([^&]*)","g");//Lien youtube ?(merci GK pour ta Rd..)
			matchTube = links[a].href.match(regTube);
			
			//Si c'est un lien youtube
			if(matchTube != null){
				var numVideo = RegExp.$2;
				//Le lien en question
				var link = links[a]; 
				//On lui colle un id, pour le manipuler par la suite
				link.id = 'link_youtube_'+count_vid; 
				// Le message contenant le lien
				var message = link.parentNode; 
				
				//Lien pour masquer-afficher le div contenant la vidéo
				var toggleLink = document.createElement('a');
				with(toggleLink){
					id = 'tube_'+count_vid;;
				};
				
				var imgPlay = document.createElement('img');
				imgPlay.src = 'http://gklist.fiaxhs.com/files/play.png';
				with(imgPlay){
					src = 'http://gklist.fiaxhs.com/files/play.png';
					align = 'top';
				}
				toggleLink.appendChild(imgPlay);
				toggleLink.style.cursor = 'pointer';
				
				toggleLink.addEventListener('click',function(event){
														var id = this.id;
														var div = document.getElementById('div_'+id);
														if(div.style.display == 'none'){
															div.style.display = 'block';
														} else {
															div.style.display = 'none';
														}
													},false);
				
			
				//Div contenant le flash, caché à la base.
				var div = document.createElement('div');
				with(div.style){
					display = 'none';
				}
				div.id = 'div_tube_'+count_vid;
				
				//Objet contenant video + parametres
				var obj = document.createElement('object');
				with(obj) {
					width = '425px';
					height = '355px';
				};
				var param1 = document.createElement('param');
				with(param1){
					name = 'movie';
					value = 'http://www.youtube.com/v/'+numVideo;
				};
				var param2 = document.createElement('param');
				with(param2){
					name = 'wmode';
					value = 'transparent';
				};
				
				var emb = document.createElement('embed');
				with(emb){
					src = 'http://www.youtube.com/v/'+numVideo;
					type = 'application/x-shockwave-flash';
					wmode = 'transparent';
					width = '425px';
					height = '355px';
					
				};
				obj.appendChild(param1);
				obj.appendChild(param2);
				obj.appendChild(emb);
				div.appendChild(obj);
				message.insertBefore(toggleLink,document.getElementById('link_youtube_'+count_vid));
				message.insertBefore(div,document.getElementById('link_youtube_'+count_vid));
				
				//Vu qu'on a rajouté un lien, on passe au lien encore après :baby:
				a++;
				count_vid++;	
			}
		}
		if(addMotion){
			/***** DailyMotion *****/
			var regMotion = new RegExp("http%3A%2F%2F(www%2E|)dailymotion%2Ecom(.)*%2Fvideo%2F([^%&_]*)","g");//Lien dailymotion ?(merci GK pour ta Rd..)
			matchMotion = links[a].href.match(regMotion);
			//Si c'est un lien dailymotion
			if(matchMotion != null){
				var numVideo = RegExp.$3;
				//Le lien en question
				var link = links[a]; 
				//On lui colle un id, pour le manipuler par la suite
				link.id = 'link_motion_'+count_vid; 
				// Le message contenant le lien
				var message = link.parentNode; 
				
				//Lien pour masquer-afficher le div contenant la vidéo
				var toggleLink = document.createElement('a');
				with(toggleLink){
					id = 'motion_'+count_vid;;
				};
				
				var imgPlay = document.createElement('img');
				imgPlay.src = 'http://gklist.fiaxhs.com/files/play.png';
				with(imgPlay){
					src = 'http://gklist.fiaxhs.com/files/play.png';
					align = 'top';
				}
				toggleLink.appendChild(imgPlay);
				toggleLink.style.cursor = 'pointer';
				
				toggleLink.addEventListener('click',function(event){
														var id = this.id;
														var div = document.getElementById('div_'+id);
														if(div.style.display == 'none'){
															div.style.display = 'block';	
														} else {
															div.style.display = 'none';
														}
													},false);
				
			
				//Div contenant le flash, caché à la base.
				var div = document.createElement('div');
				with(div.style){
					display = 'none';
				}
				div.id = 'div_motion_'+count_vid;
				
				//Objet contenant video + parametres
				var obj = document.createElement('object');
				with(obj) {
					width = '420px';
					height = '336px';
				};
				var param1 = document.createElement('param');
				with(param1){
					name = 'movie';
					value = 'http://www.dailymotion.com/swf/'+numVideo+'&v3=1&related=1';
				};
				var param2 = document.createElement('param');
				with(param2){
					name = 'allowFullScreen';
					value = 'true';
				};
				var param3 = document.createElement('param');
				with(param3){
					name = 'allowScriptAccess';
					value = 'always';
				};
				var emb = document.createElement('embed');
				with(emb){
					src = 'http://www.dailymotion.com/swf/'+numVideo+'&v3=1&related=1';
					type = 'application/x-shockwave-flash';
					wmode = 'transparent';
					width = '420px';
					height = '336px';
					allowFullScreen = 'true';
					allowScriptAccess = 'always';
					
				};
				obj.appendChild(param1);
				obj.appendChild(param2);
				obj.appendChild(param3);
				obj.appendChild(emb);
				div.appendChild(obj);
				message.insertBefore(toggleLink,document.getElementById('link_motion_'+count_vid));
				message.insertBefore(div,document.getElementById('link_motion_'+count_vid));
				
				//Vu qu'on a rajouté un lien, on passe au lien encore après :baby:
				a++;
				count_vid++;	
			}
		}
	}
}


/*******************************************************/
/*			   Smileys dans bunks / blogs
/*******************************************************/

/* RegExp de remplacement */
var replaceSmileys = function ( s )
 {
    var reg = new RegExp("(:[^: ]+:|;\\)|:[^:/ ]{1})","g");
    s = s.replace
    (
        reg,
        function ( chaine, capture )
        {
            return typeof (tab[capture]) == 'undefined'
                ?  capture 
                : '<img border="0" src="http://media.cnetnetworks.fr/gamekult-com/images/images/forum/icones/icon' + tab[capture] + '.gif" alt="' + capture + '" />'
        }
    );
    var reg2 = new RegExp(" :\/","g");
    return s.replace(reg2,' <img src="http://media.cnetnetworks.fr/gamekult-com/images/images/forum/icones/icon82.gif" alt="damn" />');
};


// Mets les smileys dans les bunks 
function smileysBunk(){
	try{
		div = document.getElementById("bunk");
		div.innerHTML = replaceSmileys(div.innerHTML);

	 }
	catch(e){
		//alert(e);
	}
	
}
function smileysBlog(){
	try{
		div = document.getElementById("blogcommentaire");
		div.innerHTML = replaceSmileys(div.innerHTML);

	 }
	catch(e){
		//alert(e);
	}
}

// Smileys dans l'historique 
function smileysHistorique(){

	div = document.getElementById("bunkHistorique");
	div.innerHTML = replaceSmileys(div.innerHTML);

	
}


/*******************************************************/
/*					URL dans bunks
/*******************************************************/


//Fonction de remplacement d'url
function replaceUrl(txt){
	var regUrl = new RegExp('( http:\/\/[^ "<]*)',"g");
	return txt.replace(regUrl,' <a href="$1">$1</a>');
}


// Mets les urls dans les bunks 
function urlBunk(){
	try{
		div = document.getElementById("bunk");
		div.innerHTML = replaceUrl(div.innerHTML);

	 }
	catch(e){
		//alert(e);
	}
	
}
// URL dans l'historique 
function urlHistorique(){

	div = document.getElementById("bunkHistorique");
	div.innerHTML = replaceUrl(div.innerHTML);

	
}


/*******************************************************/
/*					Améliorations générales
/*******************************************************/


// ajout du "moteur de recherche" dans les pages GK 
function addResearch(){
	
	try{
		var form = document.getElementById('qf');
	} catch(e){}
	if(form != null){
		var btn = document.createElement('input');
		with(btn) {
			type = 'button';
			value = ' + ';
		};
		
		btn.style.backgroundImage = "url(http://media.cnetnetworks.fr/gamekult-com/images/images/interface/submit.gif)";
		btn.style.backgroundPosition = "center";
		btn.style.backgroundRepeat = "repeat";
		btn.style.marginLeft = "30px"
		btn.style.fontFamily = "Verdana,Geneva,Arial,Helvetica,sans-serif";
		btn.style.fontSize = "11px";
		btn.style.height = "23px";		
		
		btn.addEventListener('click',function(event){
														motclef = document.getElementsByName("motcle");
														val = motclef[0].value;
														window.open("http://gklist.fiaxhs.com/search.php?q=1&search="+val);
													},false);
		element = form.childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0];
		try{//Ajout pour premium dabord :napo: 
			element.childNodes[0].childNodes[0].childNodes[1].appendChild(btn);
			btn.style.verticalAlign = "middle";
		} catch(e){
			try{
				//pour les "pauvres"
				element2 = element.childNodes[0].childNodes[0].childNodes[0].childNodes[0];
				element2.insertBefore(btn,element2.childNodes[9]);
			} catch(e){
				try{
					element2 = element.childNodes[1].childNodes[0].childNodes[0].childNodes[0].childNodes[0];
					element2.insertBefore(btn,element2.childNodes[9]);			
				}
				catch(e){
					//on est pas sur une page avec le formulaire de recherche
				}
			}
		}
	}
}

/*******************************************************/
/*					Fast Post
/*******************************************************/
//Ajout d'un formulaire de post rapide
function addFastPost(){
	//Le formulaire
	var form = document.createElement('form');
	form.method = 'POST';
	form.action = 'http://www.gamekult.com/communaute/forum/poster.html';
	form.name = 'saisie';
	form.id = 'GKExtentedFastPost';
	
	//Variables cachées : icone, edit, memo, noFil	
	var icone = document.createElement('input');
	icone.type = 'hidden';
	icone.value = '1';
	icone.name = 'icone';
		
	var memo = document.createElement('input');
	memo.type = 'hidden';
	memo.value = '1';
	memo.name = 'memo';
	
	var edit = document.createElement('input');
	edit.type = 'hidden';
	edit.value = '0';
	edit.name = 'edit';
	
	var noFil = document.createElement('input');
	noFil.type = 'hidden';
	noFil.value = getCurrentNoFil();
	noFil.name = 'noFil';

	//La textarea
	var message = document.createElement('textarea');
	message.value = '';
	message.name = 'message';
	message.cols = 80;
	message.rows = 6;
		
	//Le signature oui-non
	var signature = document.createElement('input');
	signature.type = 'checkbox';
	signature.checked = true;
	signature.name = 'signature';
	signature.value = '1';

	var textSignature = document.createTextNode('Insérer sa signature');
	var br = document.createElement('br');
	//Le sumbit
	var fastSubmit = document.createElement('input');
	fastSubmit.type = 'submit';
	fastSubmit.value = 'Poster ce message';


	//Son p
	var p = document.createElement('p');
	p.align = 'center';
	
	//La partie graphique, le conteneur du form, etc.	
	//Le td du bouton
	var tdBtn = document.createElement('td');
	tdBtn.className = 'type1';
	tdBtn.style.borderLeft = '1px solid black';
	tdBtn.style.cursor = 'pointer';
	tdBtn.addEventListener('click',function(){document.getElementById('divFastPost').style.display = 'block';},false);
	
	//Div pour le formulaire
	var divForm = document.createElement('div');
	divForm.id = 'divFastPost';
	divForm.style.display = 'none';
	divForm.style.margin = '5px';
	divForm.style.textAlign = 'center';
	fastSubmit.addEventListener('click',function(){this.disabled = 'true'},false);

	//Ajout des inputs dans le form.
	divForm.appendChild(form);
	form.appendChild(message);
	form.appendChild(br);
	form.appendChild(signature);
	form.appendChild(textSignature);
	form.appendChild(p);
	p.appendChild(fastSubmit);
	form.appendChild(icone);
	form.appendChild(memo);
	form.appendChild(edit);
	form.appendChild(noFil);
	
	//On récup la cellule avec 'Ajouter nouveau message'
	postTd = grabPostTd();
	//La ligne de cette cellule
	postTr = postTd.parentNode;
	//La table de cette cellule
	postTable = postTr.parentNode;
	//Le div contenant la table
	if(isModo()){//Si modo, faut placer le formulaire sous "Effacer les messages cochés"
		//création d'un nouveau div, qui contiendra notre fast post
		var divFastPostModo = document.createElement('div');
		var hold = document.getElementById('footer').previousSibling.previousSibling.childNodes[0].childNodes[0].childNodes[0];
		if(hold.childNodes.length == 5){
			hold.insertBefore(divFastPostModo,hold.childNodes[4]);
		} else {
			hold.insertBefore(divFastPostModo,hold.childNodes[3]);
		}
		
		postDiv = divFastPostModo;	
	
	} else {
		postDiv = postTable.parentNode.parentNode;
	}
	

	//On ajoute le div du formulaire
	postDiv.appendChild(divForm);
	//On ajoute une cellule à la ligne de 'Ajouter nouveau message', qui contiendra un 'Réponse rapide'
	postTr.appendChild(tdBtn);
	tdBtn.innerHTML = 'Réponse rapide';
	
	
}



//Récupère la cellule contenant le lien 'Poster un nouveau message
function grabPostTd(){
	//Juste au dessus du footer, il existe une table...
	var table = document.getElementById('footer').previousSibling.previousSibling;
	// Et dans cette table, très loin, il existe une cellule, contenant ce qui nous intéresse :nerd:
 	try{
 		var postTd = table.childNodes[0].childNodes[0].childNodes[0].childNodes[2].childNodes[0].childNodes[0].childNodes[0].childNodes[1].childNodes[0].childNodes[0].childNodes[0].childNodes[0];
 	} catch(e){
 		var postTd = table.childNodes[0].childNodes[0].childNodes[0].childNodes[1].childNodes[0].childNodes[0].childNodes[0].childNodes[1].childNodes[0].childNodes[0].childNodes[0].childNodes[0];
 	}
 	return postTd;
}


//Récup le noFil en cours
function getCurrentNoFil(){
	var regNoFil = new RegExp('lire_n([0-9]*)|noFil=([0-9]*)',"g");
	regNoFil.exec(window.location);
	if(RegExp.$1 == ''){
		return RegExp.$2;
	} else {
		return RegExp.$1;
	}
}


/*******************************************************/
/*					Fast Post
/*******************************************************/

/*
function addFastEdit(btn,divUbb){
	var trEdit = btn.parentNode.parentNode;
	var tdFastEdit = document.createElement('td');
	tdFastEdit.className = 'type2';
	tdFastEdit.style.borderLeft = '1px solid white';
	tdFastEdit.style.cursor = 'pointer';
	
	trEdit.appendChild(tdFastEdit);
	var a = document.createElement('a');
	a.innerHTML = 'Edition rapide';
	a.className = 'type2';
	a.addEventListener('click',function(){
		GM_xmlhttpRequest({
			method: 'GET',
			overrideMimeType: "text/html; charset=ISO-8859-1",
			url: btn.href,
			onload: function(responseDetails) {
				var txt = responseDetails.responseText;
				txt = nltobr(txt);
				//Récup du txt
				var regTextArea = new RegExp('<textarea([^>]*)>(.*)</textarea>',"g");
				regTextArea.exec(txt);
				var txtToEdit = RegExp.$2;
				//Récup du noFil
				var regNoFil = new RegExp('<input type="hidden" name="noFil" value="([0-9]*)"',"g");
				regNoFil.exec(txt);
				var txtNoFil = RegExp.$1;
				//alert(noFil);
				//Récup du ref
				var regRef = new RegExp('<input type="hidden" name="ref" value="([0-9]*)"',"g");
				regRef.exec(txt);
				var txtRef = RegExp.$1;
				//Récup de l'icone
				var regIcone = new RegExp('<input type="radio" name="icone" value="([0-9]*)"  checked >',"g");
				regIcone.exec(txt);
				var txtIcone = RegExp.$1;				
				//Récup du titre
				var regTitre = new RegExp('name="titre" value="([^"]*)"',"g");
				regTitre.exec(txt);
				var textTitre = RegExp.$1;
		
			
				var form = document.createElement('form');
				with(form){
					method = 'POST';
					action = 'http://www.gamekult.com/communaute/forum/poster.html';
					name = 'saisie';
					id = 'GKExtentedFastEdit';
				};
				
				var txtAr = document.createElement('textarea');
				with(txtAr){
					cols = '80';
					rows = '12';
					name = 'message';
				};
				
				var memo = document.createElement('input');
				with(memo){
					type = 'hidden';
					value = '1';
					name = 'memo';
				};
				if(textTitre.length > 1){
					var titre = document.createElement('input');
					with(titre){
						type = 'hidden';
						value = textTitre;
						name = 'titre';
					};
				}
				var icone = document.createElement('input');
				with(icone){
					type = 'hidden';
					value = txtIcone;
					name = 'icone';
				};
				var edit = document.createElement('input');
				with(edit){
					type = 'hidden';
					value = '1';
					name = 'edit';
				};
				var noFil = document.createElement('input');
				with(noFil){
					type = 'hidden';
					value = txtNoFil;
					name = 'noFil';
				};
				var ref = document.createElement('input');
				with(ref){
					type = 'hidden';
					value = txtRef;
					name = 'ref';
				};
				var fastSubmit = document.createElement('input');
				with(fastSubmit){
					type = 'submit';
					value = 'Poster ce message';
				};
				divUbb.innerHTML = '';
				divUbb.appendChild(form);
				form.appendChild(txtAr);
				if(textTitre.length > 1){
					form.appendChild(titre);
				}
				form.appendChild(memo);
				form.appendChild(icone);
				form.appendChild(edit);
				form.appendChild(noFil);
				form.appendChild(ref);
				form.appendChild(document.createElement('br'));
				form.appendChild(fastSubmit);
				txtAr.value = brtonl(txtToEdit);
				//<input class="" type="hidden" value="13837007" name="ref"/>
				//<input class="" type="hidden" value="378601" name="noFil"/>
				
			}
		});
	},false);
	tdFastEdit.appendChild(a);
		
}
*/


function oldNav(where){
	if(where == ''){
		var listUp = document.getElementById('navigationHorizontale').parentNode.parentNode.parentNode.parentNode.nextSibling.nextSibling;
	} else {
		var listUp = document.getElementById('navigationHorizontale').parentNode.parentNode.parentNode.parentNode.nextSibling.nextSibling;
	}
	if(where == ''){
		var listDown = document.getElementById('footer').previousSibling.previousSibling;
	} else {
		var listDown = document.getElementById('forumListeTopic').nextSibling.nextSibling;
	}
	var regLightForEver = /<a href="\/forum\/forum_FO00012\/">([^\|]*)<\/a> \| /;
	var forumAV = /(<a href="\/forum\/forum_FO00007\/">)/;
	regLightForEver.exec(listUp.innerHTML);
	var lightDisplay = RegExp.$1;
	listUp.innerHTML = listUp.innerHTML.replace(regLightForEver,'');
	listUp.innerHTML = listUp.innerHTML.replace(forumAV,'<a href="/forum/forum_FO00012/">'+lightDisplay+'</a> | <a href="/forum/forum_FO00007/">');
	listDown.innerHTML = listDown.innerHTML.replace(regLightForEver,'');
	listDown.innerHTML = listDown.innerHTML.replace(forumAV,'<a href="/forum/forum_FO00012/">'+lightDisplay+'</a> | <a href="/forum/forum_FO00007/">');
}

/*******************************************************/
/*					Liste smiley persos.
/*******************************************************/
var capturing = false;
function AutoSuggest(elem, suggestions, urls) {

	//The 'me' variable allow you to access the AutoSuggest object
	//from the elem's event handlers defined below.
	var me = this;

	//A reference to the element we're binding the list to.
	this.elem = elem;

	this.suggestions = suggestions;
	this.urls = urls;

	//Arrow to store a subset of eligible suggestions that match the user's input
	this.eligible = new Array();
	this.eligibleUrls = new Array();

	//The text input by the user.
	this.inputText = '';

	//A pointer to the index of the highlighted eligible item. -1 means nothing highlighted.
	this.highlighted = -1;

	//A div to use to create the dropdown.
	this.div = document.getElementById("suggestDiv"); 
	//this.div = document.getElementById("navigationHorizontale");
	
	//A boolean, true if we're capturing what user is typing
	this.capture = false;
	
	//Integer, saves the caret pos (avoid moving caret where using key up & keydown)
	this.caretPos = 0;

	//Do you want to remember what keycode means what? Me neither.
	var TAB = 9;
	var ESC = 27;
	var KEYUP = 38;
	var KEYDN = 40;
	var PTS = 191;
	var SPACE = 32;
	var ENTER = 13;
	

	//The browsers' own autocomplete feature can be problematic, since it will 
	//be making suggestions from the users' past input.
	//Setting this attribute should turn it off.
	elem.setAttribute("autocomplete","off");

	//We need to be able to reference the elem by id. If it doesn't have an id, set one.
	if(!elem.id) {
		var id = "autosuggest" + idCounter;
		idCounter++;

		elem.id = id;
	}


	/********************************************************
	onkeydown event handler for the input elem.
	Tab key = use the highlighted suggestion, if there is one.
	Esc key = get rid of the autosuggest dropdown
	Up/down arrows = Move the highlight up and down in the suggestions.
	********************************************************/
	document.getElementById('message').onkeypress =  function (e) { 
		return (e.keyCode != 13 || capturing == false); 
		
	};
	
	
	elem.addEventListener('keypress',function(ev) {
		var key = me.getKeyCode(ev);
		switch(key) {
			case ENTER:
			case TAB:
				me.useSuggestion();
				return false;
			break;	
		}
	}, false);
	
	elem.addEventListener('keydown',function(ev) {
		var key = me.getKeyCode(ev);

		switch(key) {
			case ESC:
				me.hideDiv();
			break;
			
			case SPACE:
				me.resetCapture();
			break;
			
			case KEYUP:
				if (me.highlighted > 0){
					me.highlighted--;
				}
				me.changeHighlight(key);
			break;

			case KEYDN:
			if (me.highlighted < (me.eligible.length - 1)) {
				me.highlighted++;
			}
			me.changeHighlight(key);
			break;
		}
	},false);

	//onkeyup handler for the elem 
	elem.addEventListener('keyup',function(ev)  {
		var key = me.getKeyCode(ev);
		switch(key){
			case SPACE:
				me.resetCapture();
			break;
			//The control keys were already handled by onkeydown, so do nothing.
			case TAB:
			case ESC:
				me.resetCapture();
				break;
			case KEYUP:
			case KEYDN:
				//On doit remettre le curseur à sa place :x:
				if(me.capture){
					this.selectionStart = me.caretPos;
					this.selectionEnd = me.caretPos;
				}
				break;				
			default:
				var lastTyped = me.getLastTypedChar();
				if(lastTyped == ":"){
					me.capture = true;
					capturing = true;
				} else {
					if (me.capture){
						me.caretPos = this.selectionStart;
						//unsafeWindow.console.log(this.value.substring(this.value.lastIndexOf(":"),this.selectionStart));
						me.inputText = this.value.substring(this.value.lastIndexOf(":"),this.selectionStart);
						me.getEligible();
						me.createDiv();
						me.positionDiv();
						me.showDiv();
					} else {
						me.hideDiv();
					}
				}
				break;
		}
	},false);
	
	this.resetCapture = function(){
		this.capture = false;
		this.inputText = '';
		me.hideDiv();
		capturing = false;
	}

	// Insert the highlighted suggestion into the input box, and  remove the suggestion dropdown.
	this.useSuggestion = function() {
		if (this.highlighted > -1) {
			insertAtCursor(this.elem, '[img]'+this.eligibleUrls[this.highlighted]+'[/img]', this.inputText.length);
			//this.elem.value = this.eligible[this.highlighted];
			this.hideDiv();
			//It's impossible to cancel the Tab key's default behavior. 
			//So this undoes it by moving the focus back to our field right after
			//the event completes.
			setTimeout("document.getElementById('" + this.elem.id + "').focus()",0);
		}
		this.resetCapture();
	};

	//Display the dropdown. Pretty straightforward.
	this.showDiv = function() {
		this.div.style.display = 'block';
	};

	//Hide the dropdown and clear any highlight.
	this.hideDiv = function() {
		this.div.style.display = 'none';
		this.highlighted = -1;
	};

	//Modify the HTML in the dropdown to move the highlight.
	this.changeHighlight = function() {
		var lis = this.div.getElementsByTagName('LI');
		for (i in lis) {
			var li = lis[i];
			if (this.highlighted == i) {
				li.className = "selected";
			}
			else {
				li.className = "";
			}
		}
	};

	//Position the dropdown div below the input text field.
	this.positionDiv = function() {
		var el = this.elem;
		var x = el.offsetWidth;
		var y = 0;
		//Walk up the DOM and add up all of the offset positions.
		while (el.offsetParent && el.tagName.toUpperCase() != 'BODY') {
			x += el.offsetLeft;
			y += el.offsetTop;
			el = el.offsetParent;
		}
		x += el.offsetLeft;
		y += el.offsetTop;
		this.div.style.left = x + 'px';
		this.div.style.top = y + 'px';
	};
	
	//Get lastTypedChar
	this.getLastTypedChar = function(){
		//unsafeWindow.console.log(me.elem.value.substring(me.elem.selectionStart-1,me.elem.selectionStart));
		return me.elem.value.substring(me.elem.selectionStart-1,me.elem.selectionStart);
	};


	//Build the HTML for the dropdown div
	this.createDiv = function() {
		var ul = document.createElement('ul');
		//Create an array of LI's for the words.
		for (i in this.eligible) {
			var word = this.eligible[i];
			var li = document.createElement('li');
			var a = document.createElement('a');
			a.href="javascript:false";
			a.innerHTML = word;
			li.appendChild(a);
			if (me.highlighted == i) {
				li.className = "selected";
			}
			ul.appendChild(li);
		}
	
		this.div.replaceChild(ul,this.div.childNodes[0]);
	

		//mouseover handler for the dropdown ul move the highlighted suggestion with the mouse
		ul.addEventListener('mouseover',function(ev) {
			//Walk up from target until you find the LI.
			var target = me.getEventSource(ev);
			while (target.parentNode && target.tagName.toUpperCase() != 'LI') {
				target = target.parentNode;
			}
		
			var lis = me.div.getElementsByTagName('LI');
			
	
			for (i in lis) {
				var li = lis[i];
				if(li == target) {
					me.highlighted = i;
					break;
				}
			}
			me.changeHighlight();
		},false);
		
		//click handler for the dropdown ul insert the clicked suggestion into the input
		ul.addEventListener('click',function(ev) {
			me.useSuggestion();
			me.hideDiv();
			me.cancelEvent(ev);
			return false;
		},false);
	
		this.div.className="suggestion_list";
		this.div.style.position = 'absolute';
	};


	this.getEligible = function() {
		this.eligible = new Array();
		this.eligibleUrls = new Array();
		for (i in this.suggestions)  {
			var suggestion = this.suggestions[i];
			
			if(suggestion.toLowerCase().indexOf(this.inputText.toLowerCase()) == "0") {
				this.eligible[this.eligible.length]= '<img border="0" align="absmiddle" src="'+urls[i]+'"> '+suggestion;
				this.eligibleUrls[this.eligibleUrls.length]= urls[i];
			}
		}
	};

	this.getKeyCode = function(ev) {
			return ev.keyCode;
	};

	this.getEventSource = function(ev) {
			return ev.target;
	};

	this.cancelEvent = function(ev){
			ev.preventDefault();
			ev.stopPropagation();
	}
}


function addAutocomplete(){
	//GM_addStyle(" .suggestion_list { background: white; border: 1px solid; padding: 4px; } .suggestion_list ul { padding: 0; margin: 0; list-style-type: none; } .suggestion_list a { text-decoration: none; color: navy; } .suggestion_list .selected { background: navy; color: white; } .suggestion_list .selected a { color: white; } #autosuggest { display: none; } ");
	var suggestDiv = document.createElement('div');
	var innerSuggestDiv = document.createElement('div');
	suggestDiv.id = "suggestDiv";
	document.body.appendChild(suggestDiv);
	suggestDiv.appendChild(innerSuggestDiv);
	if(document.getElementById('message')){
		AutoSuggest(document.getElementById('message'),codes,urls);
	}
}





/*******************************************************/
/*					Main script
/*******************************************************/
try{
	//Si dans une page d'un topic
	if (/http:\/\/www\.gamekult\.com\/(communaute|forum|communaute\/forum)\/lire/.test(document.location)){
		
		if(displayOldNav){
			oldNav('');
		}
		//Tableau contenant les posts
		var posts = getElementsByClass('global',document,'table');
		//Parcours des post 
		if(posts.length > 0){
			for(count=0;count<posts.length;count++){
				//unsafeWindow.console.log('Deb '+count);
				//La table du post
				var post = posts[count];
				//Le div (juste pour appliquer le style caché)
				var divPost = post.parentNode;
				//La case à gauche du message, avec pseudo, avatar etc
				var nobr = post.childNodes[0].childNodes[0].childNodes[0].childNodes[0];
				//Le pseudo du post
				try{
					var pseudo = nobr.childNodes[2].childNodes[0].innerHTML;
					//Dans le post, le premier encadré (soit les infos, posté le etc, soit le "Votre pseudo apparait dans ce message"
					var tdInfoPost = post.childNodes[0].childNodes[0].childNodes[1].childNodes[0].childNodes[0].childNodes[0].childNodes[0];
					//Le div contenant message + signature
					var ubbPosts = post.childNodes[0].childNodes[0].childNodes[1].getElementsByTagName('div');
					var ubbPost = ubbPosts[0];
					
					//Le message "d'édition"
					try{
						var editBtn = ubbPost.nextSibling.nextSibling.nextSibling.childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0];
					} catch(e){
						var editBtn = ubbPost.nextSibling.nextSibling.childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0];
					}
					
					
					//Blacklist
					if(blOn){
						if(inArray(pseudo,bl)){
							applyHideStyle(divPost);
							injectLink(tdInfoPost);
						} 
					}
					
					//Ajout de vidéos
					if(addTube || addMotion){
						addVideos(ubbPost);
					}
					/*
					//Edit rapide
					if(pseudo == pseudoUp && fastEdit){
						addFastEdit(editBtn,ubbPost);
					}
					*/
				} catch(e){ //Publicité
					//noop
				}
				//unsafeWindow.console.log('Fin '+count);
			}
		}
		//Ajout du fastPost
		if(fastPost){
			addFastPost();
		}
	}
	//En train d'écrire/editer
	if (/http:\/\/www\.gamekult\.com\/(communaute|forum|communaute\/forum)\/ecrire/.test(document.location)){
		if(displayOldNav){
			oldNav('');
		}
	}
	//Si on est dans la liste des topics, on parse
	if (/http:\/\/www\.gamekult\.com\/forum\/forum_/.test(document.location)){
		if(displayOldNav){
			oldNav('liste');
		}
	}
	//Partout, ajout des smileys et url dans les bunks + recherche
	if (/http:\/\/www\.gamekult\.com/.test(document.location)){
		if(autoComplete){
			addAutocomplete();
		}
		if(smBunk){
			smileysBunk();
		}
		if(uriBunk){
			urlBunk();
		}
		
		var pseudoActuel = getPseudo();
		if(duplicateBunks){
			var barreBunks = document.getElementById('bunk').parentNode.parentNode.parentNode.parentNode.cloneNode(true);
			barreBunks.style.position = 'fixed';
			barreBunks.style.bottom = '0px';
			barreBunks.style.borderTop = '1px solid black';
			document.body.appendChild(barreBunks);
		}
	}
	// Si on est dans l'historique
	if( /gamekult\.com\/(forum|communaute)\/bunk\/historique.html/.test(document.location)){ 
		if(smHistorique){
			smileysHistorique();
		}
		if(uriHistorique){
			urlHistorique();
		}
	}
	if( /gamekult\.com\/(forum|communaute)\/im\/im_dialogue_iframe.html/.test(document.location)){ 
		if(smHistoriqueIM){
			smileysHistorique();
		}
		if(uriHistoriqueIM){
			urlHistorique();
		}
	}
	if( /gamekult\.com\/blog/.test(document.location)){ 
		if(smCommentairesBlog){
			smileysBlog();
		}
	}
} catch(e){
	//alert(e);
}
//alert('plop');