/******************************************************** * * * Copyright ZIOMM 2006 - all rights reserved * * * * ----------------------------------------------------- * * * * Le code ci-dessous est la propiété d'Akeroz SARL * * détenteur de la marque ZIOMM. Vous ne pouvez copier * * ou modifier ce code sans l'autorisation d'AKEROZ. * * Toutes tentatives fera l'objet de poursuites. * * * * ----------------------------------------------------- * * * * All source code is property of Akeroz SARL owner * * of ZIOMM Trademark. You can't copy of modify sources * * without autorisation from AKEROZ. AKeroz will make * * pursuit to anyone who no respect this user licence. * * * ********************************************************/ var xmlURL = '/medias/xml/flux.php?op=ts-stats&addr=93.184.36.154&port=9008&tcpport=51234' ; var tsURL = 'teamspeak://93.184.36.154:9008/?' ; var isPrivate = false; var isAsking = 0; function refreshInfos( XMLresponse ) { var docTS = document.getElementById( 'ts-stats' ); deleteContent( docTS ); deleteContent( docTS ); deleteContent( docTS ); var name = getFirstNodeValue( XMLresponse, 'name' ); var welcome = getFirstNodeValue( XMLresponse, 'welcome' ); var type = getFirstNodeValue( XMLresponse, 'type' ); var pass = getFirstNodeValue( XMLresponse, 'password' ); var img = document.createElement("img"); if( pass == 'true' ) { isPrivate = true ; img.setAttribute( "src", "/medias/images/teamspeak/prive.gif" ); img.setAttribute( "alt", "Serveur privé" ); }else{ isPrivate = false ; img.setAttribute( "src", "/medias/images/teamspeak/public.gif" ); img.setAttribute( "alt", "Serveur public" ); } img.setAttribute( "border", "0" ); var serv = document.createElement("p"); serv.setAttribute( "id", "serverAddr" ); serv.appendChild( img ); serv.appendChild( document.createTextNode( name ) ); var brA = document.createElement( "br" ); var promo = document.createElement( "a" ); promo.setAttribute( "href", "http://www.ziomm.es/index.php?op=teamspeak-3&from=ts-who" ); promo.setAttribute( "target", "_blank" ); promo.setAttribute( "class", "lienPromo" ); //var promot1 = document.createTextNode( ""); var promot2 = document.createTextNode( "OpenBeta TEAMSPEAK 3: en ZIOMM.es el 19/12"); var promob = document.createElement( "font" ); promob.appendChild( promot2 ); //promo.appendChild( promot1 ); promo.appendChild( promob ); var i = document.createElement("i"); i.appendChild( document.createTextNode( '(' + type + ' mode)' ) ); serv.appendChild( i ); serv.appendChild( brA ); //serv.appendChild( promo ); var welc = document.createElement("span"); welc.appendChild( document.createTextNode( welcome ) ); serv.appendChild( welc ); docTS.appendChild( serv ); var sub = XMLresponse.getElementsByTagName('channels')[0]; if( sub.hasChildNodes ) { for( var i = 0 ; i < sub.childNodes.length ; i++ ) { var current = sub.childNodes[i] ; if( current.hasChildNodes ) { addChannel( docTS, current ); } } } /* Copyright */ var cop = document.createElement("b"); var acop = document.createElement("a"); acop.setAttribute( "href", "http://www.ziomm.es" ); acop.setAttribute( "target", "_blank" ); acop.appendChild( document.createTextNode( 'Ziomm.es' ) ); cop.appendChild( document.createTextNode( 'Copyright' ) ); cop.appendChild( acop ); cop.appendChild( document.createTextNode( '2003/2010 - all right reserved' ) ); docTS.appendChild( cop ); } function deleteContent( XMLNode ) { if( XMLNode.hasChildNodes ) { for( var i = 0 ; i < XMLNode.childNodes.length ; i++ ) { var current = XMLNode.childNodes[i] ; deleteContent( current ); XMLNode.removeChild( current ); } } } function addChannel( parent, XMLNode ) { try { var childs = XMLNode.getElementsByTagName('name'); } catch( Exception ) { return ; } var cname = getFirstNodeValue( XMLNode, 'name' ); var ctopic = getFirstNodeValue( XMLNode, 'topic' ); var cflags = getFirstNodeValue( XMLNode, 'flags' ); var cpass = getFirstNodeValue( XMLNode, 'password' ); var chan = document.createElement("div"); chan.setAttribute( "class", "channel" ); var aname = document.createElement("a"); aname.setAttribute( "class", "channel" ); if( isPrivate ){ aname.setAttribute( "href", "javascript:joinPrivateServer( '" + cname + "' ); " ); }else{ if( cpass == 'true' ){ aname.setAttribute( "href", "javascript:joinPrivateChannel( '" + cname + "' ); " ); }else{ aname.setAttribute( "href", "javascript:joinChannel( '" + cname + "' ); " ); } } aname.setAttribute( "title", ctopic + ' => Click to join channel' ); aname.appendChild( document.createTextNode( firstLetterUpper( cname ) ) ); var flags = document.createElement("span"); flags.setAttribute( "class", "cflags" ); flags.appendChild( document.createTextNode( '(' + cflags + ')' ) ); aname.appendChild( flags ); chan.appendChild( aname ); var sub = XMLNode.getElementsByTagName('sub-channels')[0]; if( sub != null ) { if( sub.hasChildNodes ) { for( var i = 0 ; i < sub.childNodes.length ; i++ ) { var current = sub.childNodes[i] ; if( current.hasChildNodes ) { addChannel( chan, current ); } } XMLNode.removeChild( sub ); } } var sup = XMLNode.getElementsByTagName('players')[0]; if( sup != null ) { /*var splay = document.createElement("div"); splay.setAttribute( "class", "players" );*/ if( sup.hasChildNodes ) { for( var i = 0 ; i < sup.childNodes.length ; i++ ) { var current = sup.childNodes[i] ; if( current.hasChildNodes ) { addPlayer( chan, current ); } } } /*chan.appendChild( splay );*/ } if( cname != null ) { parent.appendChild( chan ); } } function addPlayer( parent, XMLNode ) { try { var childs = XMLNode.getElementsByTagName('name'); } catch( Exception ) { return ; } var pname = getFirstNodeValue( XMLNode, 'name' ); var pflags = getFirstNodeValue( XMLNode, 'flags' ); var play = document.createElement("div"); play.setAttribute( "class", "player" ); play.appendChild( document.createTextNode( firstLetterUpper( pname ) ) ); var flags = document.createElement("span"); flags.setAttribute( "class", "pflags" ); flags.appendChild( document.createTextNode( '(' + pflags + ')' ) ); play.appendChild( flags ); parent.appendChild( play ); } function updateTS() { if( isAsking == 1 ) return; isAsking = 1; var requette = createRequest(); requette.open( "GET", xmlURL, true ); requette.onreadystatechange = function() { if( requette.readyState == 4 ) { var response = requette.responseXML; refreshInfos( response ); isAsking = 0; window.setTimeout('updateTS()', 20000); } }; requette.send( null ); } function firstLetterUpper( strchan ) { var fletter = strchan.substr( 0, 1 ).toUpperCase(); var others = strchan.substr( 1 ); return fletter + others ; } function hideLogin() { var login = document.getElementById( 'ts-login' ); login.style.display = 'none'; } function goTeamSpeak() { var channel = document.logints.channel.value ; var login = document.logints.name.value ; var passwd = document.logints.pass.value ; var need = document.logints.needPass.value ; var url = tsURL + 'channel=' + channel + '?nickname=' + login ; if( need == 1 ) { url += '?channelpassword=' + passwd ; } if( need == 2 ) { url += '?password=' + passwd ; } var layer = document.getElementById( 'ts-login' ); layer.style.display = 'none'; document.location.href = url ; } function joinChannel( name ) { var login = document.getElementById( 'ts-login' ); login.style.display = 'block'; document.logints.channel.value = name; document.logints.needPass.value = 0; hideTR( 'Pass' ); } function joinPrivateChannel( name ) { var login = document.getElementById( 'ts-login' ); var type = document.getElementById( 'type' ); document.logints.channel.value = name; document.logints.pass.value = ''; document.logints.needPass.value = 1; login.style.display = 'block'; updateChildText( type, 'du channel' ); showTR( 'Pass' ); } function joinPrivateServer( name ) { var login = document.getElementById( 'ts-login' ); var type = document.getElementById( 'type' ); document.logints.channel.value = name; document.logints.pass.value = ''; document.logints.needPass.value = 2; login.style.display = 'block'; updateChildText( type, 'du serveur' ); showTR( 'Pass' ); }