/* Affichage de l'aide */ function formAide (idName, affiche) { if (affiche == 1) { document.getElementById(idName).style.display = 'block'; } else { document.getElementById(idName).style.display = 'none'; } } /* Confirmation de suppression d'un élément */ function supprimer () { return confirm('Voulez-vous vraiment supprimer cet élément ?'); } /* Confirmation de suppression d'un élément */ function checkLinks() { if(!document.getElementsByTagName) { return; } var links = document.getElementsByTagName('A'); for(var i=links.length-1; i>=0; --i) { if(links[i].className.indexOf('doConfirm') != -1) { links[i].onclick = function (e) { return confirm("Voulez vous réellement effectuer cette action ?" ); } } } } window.onload = checkLinks; /* Envoi d'un emoticon à un formulaire */ function emoticon(text, idName) { var txtarea = document.getElementById(idName); text = ' ' + text + ' '; if (txtarea.createTextRange && txtarea.caretPos) { var caretPos = txtarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text; txtarea.focus(); } else { var txtareaValue = txtarea.value; var Deb = txtareaValue.substring( 0 , getSelectionStart(txtarea) ); var Fin = txtareaValue.substring( getSelectionEnd(txtarea) , txtarea.textLength ); txtarea.value = Deb + text + Fin; } } function getSelectionStart(txtarea) { if ( typeof txtarea.selectionStart != 'undefined' ) return txtarea.selectionStart; /* IE Support */ txtarea.focus(); var range = txtarea.createTextRange(); range.moveToBookmark(document.selection.createRange().getBookmark()); range.moveEnd('character', txtarea.value.length); return txtarea.value.length - range.text.length; } function getSelectionEnd(txtarea) { if ( typeof txtarea.selectionEnd != 'undefined' ) return txtarea.selectionEnd; /* IE Support */ txtarea.focus(); var range = txtarea.createTextRange(); range.moveToBookmark(document.selection.createRange().getBookmark());
range.moveStart('character', - txtarea.value.length); return range.text.length; } /* Prévisualisation */ function  previsualiser(texte) { var timer=0; var textVisu = document.getElementById(texte).value; textVisu = code_to_html(textVisu); if (document.getElementById) { document.getElementById('previsualiser_' + texte).innerHTML = textVisu; document.getElementById('previsualiser_' + texte).style.border = '1px dashed #34425F'; document.getElementById('previsualiser_' + texte).style.padding = '4px'; document.getElementById('previsualiser_' + texte).style.margin = '4px'; } timer=setTimeout('previsualiser("'+texte+'")',1000); } function code_to_html(t) { t=nl2khol(t); /* balise Gras */ t=deblaie(/(\[\/b\])/g,t); t=remplace_tag(/\[b\](.+)\[\/b\]/g,'<b>$1</b>',t); t=remblaie(t); /* balise Italique */ t=deblaie(/(\[\/i\])/g,t); t=remplace_tag(/\[i\](.+)\[\/i\]/g,'<i>$1</i>',t); t=remblaie(t); /* balise Underline */ t=deblaie(/(\[\/u\])/g,t); t=remplace_tag(/\[u\](.+)\[\/u\]/g,'<u>$1</u>',t); t=remblaie(t);
/* balise quote */ t=deblaie(/(\[\/quote\])/g,t); t=remplace_tag(/\[quote=([^\s<>]+)\](.+)\[\/quote\]/g,'<div class="quoteBloc"><strong>$1 a écrit</strong> :<br/><div class="quote">$2</div></div>',t); t=remblaie(t); /* balise quote */ t=deblaie(/(\[\/quote\])/g,t); t=remplace_tag(/\[quote\](.+)\[\/quote\]/g,'<div class="quoteBloc"><div class="quote">$1</div></div>',t); t=remblaie(t); /* balise code */ t=remplace_tag(/\[code\](.+)\[\/code\]/g,'<code>$1</code>',t); /* balise Img */ t=deblaie(/(\[\/img\])/g,t); t=remplace_tag(/\[img\](.+)\[\/img\]/g,'<img src="$1" alt="" />',t); t=remplace_tag(/\[img=(.+)\](.+)\[\/img\]/g,'<img src="$1" alt="$2"/>',t); t=remblaie(t); /* balise Smiley */ t = remplace_smiley(t); /* balise URL */ t=remplace_tag(/\[url=([^\s<>]+)\](.+)\[\/url\]/g,'<a href="$1" target="_blank">$2</a>',t); /* balise Color */ t=deblaie(/(\[\/color\])/g,t); t=remplace_tag(/\[color=(#[a-fA-F0-9]{6})\](.+)\[\/color\]/g,'<font color="$1">$2</font>',t); t=remblaie(t); /* balise size */
t=deblaie(/(\[\/size\])/g,t); t=remplace_tag(/\[size=([+-]?[0-9])\](.+)\[\/size\]/g,'<font size="$1">$2</font>',t); t=remblaie(t); t=unkhol(t); t=nl2br(t); return t; } function deblaie(reg,t) { texte=new String(t); return texte.replace(reg,'$1\n'); } function remblaie(t) { texte=new String(t); return texte.replace(/\n/g,''); } function remplace_tag(reg,rep,t) { texte=new String(t); return texte.replace(reg,rep); } function nl2br(t) { texte=new String(t); return texte.replace(/\n/g,'<br/>'); } function nl2khol(t) { var ptag=String.fromCharCode(5,6,7); texte=new String(t); return texte.replace(/\n/g,ptag); } function unkhol(t) { var ptag=String.fromCharCode(5,6,7); texte=new String(t); return texte.replace(new RegExp(ptag,'g'),'\n'); } /* Change l'opacité */ function setOpacity(variable,value) { variable.style.opacity = value/10; variable.style.filter = 'alpha(opacity=' + value*10 + ')'; } /*include('./scripts/js_smiley.php?js=1');*/ function p_d(p){for( i=0 ; i < p.length ; i++ ){
var p_d = document.getElementById('pu_d_' + p[i]).innerHTML; document.getElementById('pu_d_' + p[i]).innerHTML = ''; document.getElementById('pu_' + p[i]).innerHTML = p_d;}} /* en favoris */ function favoris() { if ( navigator.appName != 'Microsoft Internet Explorer' ) { window.sidebar.addPanel("EspaceKid","http://www.espacekid.com",""); } else { window.external.AddFavorite("http://www.espacekid.com","EspaceKid"); } }
