/************************************** | ShoutBox : JavaScript +-------------------------------------- | version : 0.2 | auteur : Fantome ***************************************/ var stop = 0 /* 1=stop / 0=start */ var valid = false; var bis = false function testPost() { if(!document.REPLIER) { document.REPLIER_bis.name = 'REPLIER'; } else { bis = true; } } // Fonction de creation de l'objet 'AJAX' function getHTTPObject() { var xmlhttp = false; /* Compilation conditionnelle d'IE */ /*@cc_on @if (@_jscript_version >= 5) try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @else xmlhttp = false; @end @*/ /* on essaie de créer l'objet si ce n'est pas déjà fait */ if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp = false; } } return xmlhttp; } function affiche(lien) { /* Création de l'objet : */ var xmlhttp = getHTTPObject(); /* on définit ce qui doit se passer quand la page répondra */ xmlhttp.onreadystatechange=function (){ if (xmlhttp.readyState == 4 && xmlhttp.status == 200) /* 4 : état "complete" && 200 : code HTTP pour OK */ { document.getElementById('sb_txt').innerHTML=xmlhttp.responseText; /* Affichage de la reponse */ i=1; while(obj=document.getElementById('b_del'+i)) { obj.innerHTML=img_del; i++; } } } /* Préparation d'une requête asynchrone */ xmlhttp.open("GET", lien,true); /* Effectue la requête : */ xmlhttp.send(null); } function actuShout(force, page) { if(!page) page=1; if (stop==1 && page==1) stopStartActu(); else if(stop==0 && page>1) stopStartActu(); if (force==1) clearTimeout(timer); /* Mise a jours */ affiche(sb_base_url+'&type='+type+'&page='+page+'&sb_time='+sb_time+'&sb_color='+sb_color); /* Prepare l'initialistion */ if(page==1) timer=setTimeout("actuShout(0)",delay*1000); valid=false; } function postShout() { var obj = document.REPLIER; if(bis && !document.REPLIER_tmp) obj = document.REPLIER_bis; if(obj.Post.value.length<2) alert(lang_msg_msg); else { if(stop==0) clearTimeout(timer); /* Mise a jours */ if(filtre == '1') affiche(ipb_base_url+'act=module&module=shoutbox&cmd=post&Post='+obj.Post.value+'&type='+type); else affiche(sb_base_url+'msg='+obj.Post.value+'&type='+type+'&sb_time='+sb_time+'&sb_color='+sb_color); /* Effacement du message */ obj.Post.value = ''; /* Prepare l'initialistion */ if(stop==0) timer=setTimeout("actuShout(0)",delay*1000); } valid=false; if(bis && document.REPLIER_tmp) { obj.name = 'REPLIER_bis'; document.REPLIER_tmp.name = 'REPLIER'; document.REPLIER_tmp = false; } } function delete_shout(shid, page) { if(stop==0) clearTimeout(timer); /* Mise a jours */ affiche(sb_base_url+'&type='+type+'&cmd=del&shid='+shid+'&page='+page); /* Prepare l'initialistion */ if(stop==0) timer=setTimeout("actuShout(0)",delay*1000); } function efface_box() { if (confirm(lang_msg_vider)) { if(stop==0) clearTimeout(timer); /* Mise a jours */ affiche(sb_base_url+'&type='+type+'&cmd=vider'); /* Prepare l'initialistion */ if(stop==0) timer=setTimeout("actuShout(0)",delay*1000); } } function ban_mem() { var mem = document.getElementById('modo_ban_mem').value; var time = document.getElementById('modo_ban_time').value; if(mem) { /* Création de l'objet : */ var xmlhttp = getHTTPObject(); /* on définit ce qui doit se passer quand la page répondra */ xmlhttp.onreadystatechange=function (){ if (xmlhttp.readyState == 4 && xmlhttp.status == 200) /* 4 : état "complete" && 200 : code HTTP pour OK */ alert(xmlhttp.responseText); /* Affichage de la reponse */ } /* Préparation d'une requête asynchrone */ xmlhttp.open("GET", sb_base_url+'&cmd=ban&mid='+mem+'&time='+time,true); /* Effectue la requête : */ xmlhttp.send(null); } } function stopStartActu() { var obj = document.REPLIER; if(bis && !document.REPLIER_tmp) obj = document.REPLIER_bis; if(stop==0) { clearTimeout(timer); stop=1; obj.sb_stop.value=lang_sb_start; } else { stop=0; obj.sb_stop.value=lang_sb_stop; actuShout(0); } valid=false; if(bis && document.REPLIER_tmp) { obj.name = 'REPLIER_bis'; document.REPLIER_tmp.name = 'REPLIER'; document.REPLIER_tmp = false; } } function sb_voirProfile(mid, opener) { if(mid) { if(opener==0) { window.location = ipb_base_url+'showuser='+mid; } else { oponer.location = ipb_base_url+'showuser='+mid; } } } function emoticon(theSmilie) { document.REPLIER.Post.value += " " + theSmilie + " "; } function emo_fen() { if(bis) { document.REPLIER.name = 'REPLIER_tmp'; document.REPLIER_bis.name = 'REPLIER'; } window.open(ipb_base_url+'act=legends&CODE=emoticons','Legends','width=250,height=500,resizable=yes,scrollbars=yes'); }