<script type="text/javascript">
//<![CDATA[
var online = [];
function QQPanel(id, data){
if((this.id = this.get(id)) == null)return false;
this.url = 'http://webpresence.qq.com/getonline?Type=1&';
this.header = document.getElementsByTagName('head');
this.items = this.id.childNodes;
this.lens = this.items.length;
this.index = 0;
this.data = data;
this.start();
}
QQPanel.prototype = {
get: function(id){return document.getElementById(id);},
start: function(){
if(this.index >= this.lens)return this.running=false;
this.running = true;
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = this.url + this.data[this.index] +':&'+(+new Date());
this.header[0].appendChild(script);
script.onload = script.onreadystatechange = (function(script){
var _this = this;
return (function(){
if(script.readyState){
if(script.readyState.match(/loaded|complete/i)){
_this.show(script)
_this = script = null;
}
}else{
_this.show()
_this = script = null;
}
});
}).call(this, script);
},
show: function(s){
this.items[this.index].className = '';
this.items[this.index].title = '我不在线,有事请留言.';
if(online[0] == 1){
this.items[this.index].className = 'online';
this.items[this.index].title = '我在线,有事您招呼.';
}
this.items[this.index].firstChild.href = 'tencent://message/?uin='+this.data[this.index++]+'&Site=小秦制作&Menu=yes';
this.start();
},
reload: function(){
if(this.running)return false;
this.index = 0;
this.start();
}
}
var QQOnline = new QQPanel('QQPanel', [48080163, 276891949, 14944941, 1007051105]);
setInterval(function(){//每隔10秒检测一次在线状态
QQOnline.reload();
}, 10000);
//]]>
</script>