var ghost = window.location.hostname+":2258";
var sendrefresh = true;
var showicon = true;
var portraiturl = "http://" + host + "/IceBeans/";
var usenickname = 0;
var listmode = 1;
function UserList() {
this.nSort = 0;
this.nSort0 = 0;
this.m_pUsers = new Array();
this.GetCount = function () { return this.m_pUsers.length; }
this.GetAdminCount = function () {
var num = 0;
for (var i = 0; i < this.GetCount(); i++) {
if (this.GetObject(i).usertype == "11") {
num++;
}
}
return num;
}
this.GetUserCount = function () {
return this.m_pUsers.length;// - this.GetAdminCount();
}
this.GetObject = function (n) { return this.m_pUsers[n]; }
this.GetID = function (strName) {
var obj;
for (var i = 0; i < this.GetCount(); i++) {
if (this.GetObject(i).name == strName) {
obj = this.GetObject(i);
return obj.id;
}
}
return 0;
}
this.Find = function (strName) {
for (var i = 0; i < this.GetCount(); i++)
if (this.GetObject(i).name == strName) return i;
return -1;
}
this.FindObject = function (strName) {
var i = this.Find(strName);
if (i != -1)
return this.GetObject(i);
return null;
}
this.FindbyID = function (ID) {
for (var i = 0; i < this.GetCount(); i++)
if (this.GetObject(i).id == ID) return i;
return -1;
}
this.FindObjectbyID = function (ID) {
var i = this.FindbyID(ID);
if (i != -1)
return this.GetObject(i);
return null;
}
this.Add = function (name, adminmode, usertype, extinfo, icon, id, sex, voice, video) {
var obj, n;
if ((n = this.Find(name)) != -1) obj = this.GetObject(n);
else obj = new UserObject();
obj.name = name;
obj.adminmode = adminmode;
obj.usertype = usertype;
obj.extinfo = extinfo;
obj.icon = icon;
obj.id = id;
obj.sex = sex;
obj.voice = voice;
obj.video = video;
obj.level = get_user_type(name);
if (n == -1) this.m_pUsers[this.GetCount()] = obj;
this.DoSort();
}
this.Del = function (strName) {
var n = this.Find(strName);
if (n != -1) {
delete this.m_pUsers[n];
this.m_pUsers.sort(this.SortOnNull);
this.m_pUsers.length--;
return true;
} return false;
}
this.RemoveAll = function () {
for (var i = 0; i < this.GetCount(); i++)
delete this.m_pUsers[i];
this.m_pUsers.length = 0;
}
this.SortOnXB = function (a, b) {
var n1 = a.sex;
var n2 = b.sex;
if (n1 == n2) return 0;
if (n1 > n2) return 1;
if (n1 < n2) return -1;
}
this.SortOnName = function (a, b) {
var n1 = a.name.length;
var n2 = b.name.length;
if (n1 == n2) return 0;
if (n1 > n2) return -1;
if (n1 < n2) return 1;
}
this.SortOnName1 = function (a, b) {
var a2 = new String(a.name);
var b2 = new String(b.name);
if (a.adminmode == 1 && b.adminmode != 1) {
t = -1;
} else if (a.adminmode != 1 && b.adminmode == 1) {
t = 1;
} else {
if (a2.substr(0, 1) == "*" && b2.substr(0, 1) != "*") {
t = -1;
} else if (a2.substr(0, 1) != "*" && b2.substr(0, 1) == "*") {
t = 1;
} else {
if (a2 == b2) {
t = 0;
}
if (a2 > b2) {
t = -1;
}
if (a2 < b2) {
t = 1;
}
}
}
return t;
}
this.SortOnName2 = function (a, b) {
if (a.adminmode == 1 && b.adminmode != 1) {
t = -1;
} else if (a.adminmode != 1 && b.adminmode == 1) {
t = 1;
} else {
t = 0;
}
return t;
}
this.SortOnUserType = function (a, b) {
if (a.adminmode == 1 && b.adminmode != 1) {
t = -1;
} else if (a.adminmode != 1 && b.adminmode == 1) {
t = 1;
} else {
if (a.usertype > b.usertype) {
t = 1;
} else if (a.usertype < b.usertype) {
t = -1;
} else {
if (a.name < b.name) {
t = 1;
} else if (a.name > b.name) {
t = -1;
} else {
t = 0;
}
}
}
return t;
}
this.SortOnNull = function (a, b) {
if (a == null || b == null) return -1;
return 0;
}
this.DoSort = function () {
return;
}
this.SortByLevel = function () {
this.m_pUsers.sort(function (a, b) { return a.level - b.level; });
}
}
var timerID = null, timerRunning = false;
function refreshstop() { if (timerRunning) clearTimeout(timerID); timerRunning = false; }
function refreshstart() { refreshstop(); writeuserlist(); }
function Users_Add(name, adminmode, usertype, extinfo, icon, id, sex, voice, video, exps, nickname) {
var isnewuser = (parent.Users.FindObject(name) == null);
try {
this.d.refreshsdx(name, id);
} catch (e) { }
if (limituserlist == 1) {
if ((voice == 0) && (video == 0)) {
newlogin(name, id, nickname);
}
if (usertype != "11") { //如果是管理員保證列出。可以在腳本中重定義本函數使得VIP用戶也可以保證列出
if (this.Users.GetCount() > limituserlistnum) {
return;
}
}
}
this.Users.Add(name, adminmode, usertype, extinfo, icon, id, sex, voice, video, exps, nickname);
if (this.Users.GetCount() < refreshatonce_threshold) {
refreshstart();
}
if (listmode == 1) {
if (list_parsed == 0) {
var tmp = name + "-'" + adminmode + "-'" + usertype + "-'" + extinfo + "-'" + icon + "-'" + id + "-'" + exps + "-'" + nickname + "'-" + sex + "'-" + voice + "'-" + video;
list.push(tmp);
list_length = list.length;
} else {
addusertolist(name, adminmode, usertype, extinfo, icon, id, sex, voice, video, exps, nickname);
}
}
if (isAutoWelcome && isnewuser) {
if (get_user_type(name) > 10) {
setTimeout('parent.d.send_msg_ex("' + name + '","[Advertising][username=' + parent.myinfo.USER + ']","",1,11,"",1)', 15000);
}
}
}
function Users_Add1(name, adminmode, usertype, extinfo, icon, id, sex, voice, video, exps, nickname) {
if (limituserlist == 1) {
if ((voice == 0) && (video == 0)) {
newlogin(name, id, nickname);
}
if (usertype != "11") { //如果是管理員保證列出。可以在腳本中重定義本函數使得VIP用戶也可以保證列出
if (this.Users.GetCount() > limituserlistnum) {
return;
}
}
}
this.Users.Add(name, adminmode, usertype, extinfo, icon, id, sex, voice, video, exps, nickname);
this.Users.SortByLevel();
if (this.Users.GetCount() < refreshatonce_threshold) {
//refreshstart();
}
/*增加到用戶列表*/
if (listmode == 1) {
addusertolist(name, adminmode, usertype, extinfo, icon, id, sex, voice, video, exps, nickname);
}
}
function newlogin(name, id, nickname) {
if (this.n == null) return;
if (this.n.document == null) return;
var objTable = this.n.document.getElementById('newuserlisttable');
var row = objTable.rows.length;
var i = 0;
for (i = 1; i < row; i++) {
if (objTable.rows[i].id == id) {
return;
}
}
if (objTable.rows.length >= 6) {
objTable.deleteRow(1);
}
var objRow = objTable.insertRow();
objRow.id = id;
var objCell = objRow.insertCell();
if (usenickname) {
objCell.innerHTML = "[" + nickname + "]";
} else {
objCell.innerHTML = "[" + name + "]";
}
}
function Users_Del(str) {
if (this.Users.Del(str))
if (this.Users.GetCount() < refreshatonce_threshold) {
refreshstart();
}
if (listmode == 1) {
deluserfromlist(str);
}
}
function Users_GetID(str) {
return this.Users.GetID(str);
}
var Users = new UserList();
function dodeluserfromlist(listtable, name) {
var i;
var rown = 0;
rown = listtable.rows.length;
for (i = 0; i < rown; i++) {
if (listtable.rows[i].id == name) {
listtable.deleteRow(i);
return 1;
break;
}
}
return 0;
}
function smdeluser(listtable,name)
{
var table = this.r.document.getElementById(""+listtable+"");
dodeluserfromlist(table, name);
this.r.document.getElementById("AdminCount").innerHTML = this.r.document.getElementById("AdminCount").innerHTML-1;
}
function checkvipuser(name) {
return "Z";
}
function getlist(type) {
if (type != "adm") return;
alist = new Array();
listtable = this.r.document.getElementById("listtable_" + type);
rown = listtable.rows.length;
for (i = 0; i < rown; i++) {
alist[alist.length] = listtable.rows[i].id;
}
}
function Swap(table, i, j) {
if (i < 0 || j > table.rows.length - 1) return;
if (i < j) {
table.moveRow(i, j);
table.moveRow(j - 1, i);
}
else {
table.moveRow(i, j);
table.moveRow(j + 1, i);
}
}
function addusertolist(name, adminmode, usertype, extinfo, icon, id, sex, voice, video, exps, nickname) {
if (this.r == null) return;
if (this.r.document == null) return;
if (list_parsed == 1) {
//this.r.document.getElementById("usercount").innerHTML = Users.GetCount();
this.r.document.getElementById("AdminCount").innerHTML = Users.GetAdminCount();
this.r.document.getElementById("UserCount").innerHTML = Users.GetUserCount();
}
if (ppmode == 1) { voice = 1; }
var i;
var listtable, listrow, listcell;
var rown = 0;
if (adminmode == 0) { //remove from listtable_adm
/*下管情況需刪除管理員裡相同名字*/
listtable = this.r.document.getElementById("listtable_adm");
dodeluserfromlist(listtable, name);
}
/*取相關列表表格*/
level = get_user_type(name);
portrait = "";
//icon = "";
displayname = new String(name);
if (extinfo != 0) t = extinfo;
else t = "";
var infolist = new Array("");
if (typeof (t) != "undefined" && t != "" && displayname.substr(0, 1) == "*") {
infolist = t.split(":");
if (!infolist[0]) { infolist[0] = "" };
if (!infolist[1]) { infolist[1] = "" };
if (!infolist[2]) { infolist[2] = "" };
portrait = infolist[0];
//icon = infolist[1];
}
userinfo0 = getptid(name, portrait, adminmode)
userinfo = userinfo0.split("\t");
styletext = ""
title = "";
adminmode_ret = adminmode;
if (userinfo.length >= 1) {
ptid = userinfo[0];
if (userinfo.length >= 2) {
styletext = userinfo[1];
if (userinfo.length >= 3) {
title = userinfo[2];
if (userinfo.length >= 4) {
adminmode_ret = userinfo[3];
}
}
}
} else {
ptid = userinfo0;
}
if (usertype == "11") {
listtable = this.r.document.getElementById("listtable_sm");
} else if (level > 0 ) {
listtable = this.r.document.getElementById("listtable_vip");
} else if (name.charAt(0) == '*' ) {
listtable = this.r.document.getElementById("listtable_reg");
} else {
listtable = this.r.document.getElementById("listtable_other");
}
rown = listtable.rows.length;
listrow = null;
/*按級別和昵稱字符排序*/
for (i = 0; i < rown; i++) {
cmpname = listtable.rows[i].id;
cmplevel = listtable.rows[i].level;
cmpstr = cmplevel + cmpname;
if (cmpstr == level + name) {
listrow = listtable.rows[i];
}
}
// var p_length = listtable.rows.length;
// for (var i = 0; i <= p_length - 2; i++) {
// for (var j = p_length - 1; j >= 1; j--) {
// if (listtable.rows[j].level < listtable.rows[j - 1].level) {
// Swap(listtable, j, j - 1);
// }
// }
// }
if (listrow == null) {
/*沒有此名的*/
/*上管情況下需從其他列表表格中刪除同名者,*/
if (adminmode > 0) {
var listtable1;
listtable1 = this.r.document.getElementById("listtable_vip");
if (dodeluserfromlist(listtable1, name) == 0) {
listtable1 = this.r.document.getElementById("listtable_reg");
if (dodeluserfromlist(listtable1, name) == 0) {
listtable1 = this.r.document.getElementById("listtable_other");
dodeluserfromlist(listtable1, name);
}
}
}
/*增加進相關列表表格*/
listrow = listtable.insertRow(i);
listrow.id = name;
listrow.level = level;
} else {
/*有此名的,先刪除該行第一列(聲頻視頻狀態可能變化,需要重寫)*/
listrow.deleteCell(0);
}
/*重寫該行第一列*/
listcell = listrow.insertCell(0);
var cellcontent = "";
if (showicon == true) {
//portrait = "<image src=" + ptid + ".gif border=0 align=absmiddle>";
var s = sex == 0 ? "0" : "1";
s = "1";
var imgurl = myvip.GetImgUrl(name, s);
portrait = "<image src='" + imgurl + "' border='0' align='absmiddle'>";
//portrait += "<img src='" + "http://m.ABC.COM/xq/" + icon + "_x.gif" + "' border='0' align='absmiddle'>";
} else {
portrait = "";
}
if (voice == 1) {
voicenote = "<font face=\"Webdings\" color=000000>¯</font>";
nametitle = name + " 開麥";
} else if (voice == 2) {
voicenote = "<font face=\"Wingdings\" color=black>(</font>";
nametitle = name + " 雙工";
} else {
voicenote = "";
nametitle = name + " 關麥";
}
if (adminmode_ret == 1) {
nametitle += " 在線管理員";
}
if (title != "") {
nametitle += " " + title;
}
if (nametitle != "") nametitle = " title=\"" + nametitle + "\"";
if (adminmode_ret == 1) {
if (styletext == "") {
styletext = "color:red;";
displayname += "<font color=red></font>";
} else {
displayname += "*";
}
}
if (styletext == "0") styletext = "";
var ucolor = usercolor.FindObject(name);
var xc = is_uservip(name);
if (xc != null) {
var v = xc.split(",");
//displayname += "<img src=http://www.ABC.COM/user/xc2/" + v[5] + " border=0 hspace=1 vspace=1 align='absmiddle' /> ";
//displayname = "<a target=d href=\"javascript:parent.cs('" + name + "')\"title=\"" + v[6] + "\">";
if (v[0] == '1') {
displayname = "<img src=http://www.ABC.COM/user/xc1/" + v[1] + " border=0><font style=\"filter: glow(color=#9933FF,strength=4); Height:8pt; color:#FFFFFF; padding:1px;cursor:hand\">" + v[7] + "</font>"
} else {
displayname = "<font style=\"filter: glow(color=#" + v[2] + ",strength=4); Height:8pt; color:#" + v[3] + "; padding:1px;cursor:hand\">" + v[4] + "</font><font style=\"filter: glow(color=#9933FF,strength=4); Height:8pt; color:#FFFFFF; padding:1px;cursor:hand\">" + v[7] + "</font>";
}
} else if (ucolor != null) {
if (styletext) {
displayname = "<span style='filter: glow(color=" + ucolor.outcolor + ",strength=4); PADDING-BOTTOM: 1px; padding-left: 1px; padding-right: 1px; height: 8pt; color: red; cursor: hand; padding-top: 1px;'>" + displayname + "</span>";
}
else {
displayname = "<span style='filter: glow(color=" + ucolor.outcolor + ",strength=4); PADDING-BOTTOM: 1px; padding-left: 1px; padding-right: 1px; height: 8pt; color: " + ucolor.incolor + "; cursor: hand; padding-top: 1px;'>" + displayname + "</span>";
}
} else if (styletext) {
displayname = "<span style='" + styletext + "'>" + displayname + "</span>";
}
cellcontent += portrait + " <a class='name' target=d href=\"javascript:parent.cs('" + name + "')\" " + nametitle + ">" + displayname + "</a>";
cellcontent += voicenote;
if (video == 1) {
cellcontent += "";
}
var twgif="";
if ((level >= 13 && level <= 15) && video == 1) {
cellcontent += "";
cellcontent += "";
twgif = "";
}
listcell.innerHTML = "<span class='ydt'></span>" + twgif + cellcontent;
}
function deluserfromlist(name) {
if (this.r == null) return;
if (this.r.document == null) return;
if (list_parsed == 1) {
//this.r.document.getElementById("usercount").innerHTML = Users.GetCount();
this.r.document.getElementById("AdminCount").innerHTML = Users.GetAdminCount();
this.r.document.getElementById("UserCount").innerHTML = Users.GetUserCount();
}
var listtable;
listtable = this.r.document.getElementById("listtable_adm");
if (dodeluserfromlist(listtable, name) > 0) return;
listtable = this.r.document.getElementById("listtable_vip");
if (dodeluserfromlist(listtable, name) > 0) return;
listtable = this.r.document.getElementById("listtable_reg");
if (dodeluserfromlist(listtable, name) > 0) return;
listtable = this.r.document.getElementById("listtable_other");
if (dodeluserfromlist(listtable, name) > 0) return;
return;
}
function removealluserfromlist() {
if (this.r == null) return;
if (this.r.document == null) return;
if (list_parsed == 1) {
//this.r.document.getElementById("usercount").innerHTML = Users.GetCount();
this.r.document.getElementById("AdminCount").innerHTML = Users.GetAdminCount();
this.r.document.getElementById("UserCount").innerHTML = Users.GetUserCount();
}
var i;
var listtable;
var rown = 0;
listtable = this.r.document.getElementById("listtable_adm");
rown = listtable.rows.length;
for (i = rown - 1; i >= 0; i--) {
listtable.deleteRow(i);
}
listtable = this.r.document.getElementById("listtable_vip");
rown = listtable.rows.length;
for (i = rown - 1; i >= 0; i--) {
listtable.deleteRow(i);
}
listtable = this.r.document.getElementById("listtable_reg");
rown = listtable.rows.length;
for (i = rown - 1; i >= 0; i--) {
listtable.deleteRow(i);
}
listtable = this.r.document.getElementById("listtable_other");
rown = listtable.rows.length;
for (i = rown - 1; i >= 0; i--) {
listtable.deleteRow(i);
}
}
/* 由setInterval循環調用本函數初始用戶數組list(按先後順序)賦值至Users,利用list_parsing標識避免沖突 */
function dolistparse() {
if (list_parsing) {
return;
}
list_parsing = 1;
list_i++;
var i = list_i;
if (i < list_length) {
if (list[i] != null) {
sublists = list[i].split("'-");
if (sublists.length == 4) {
if (!sublists[1]) sublists[1] = '';
if (!sublists[2]) sublists[2] = '';
if (!sublists[3]) sublists[3] = '';
sex = sublists[1];
voice = sublists[2];
if (ppmode == 1) { voice = 1; }
video = sublists[3];
} else {
if (!sublists[1]) sublists[1] = '';
if (!sublists[2]) sublists[2] = '';
voice = sublists[1];
if (ppmode == 1) { voice = 1; }
video = sublists[2];
sex = 0;
}
lists = sublists[0].split("-'");
if (!lists[1]) lists[1] = '';
if (!lists[2]) lists[2] = '';
if (!lists[3]) lists[3] = '';
if (!lists[4]) lists[4] = '';
if (!lists[5]) lists[5] = '';
if (!lists[6]) lists[6] = '0';
if (!lists[7]) lists[7] = '';
name = lists[0];
adminmode = lists[1];
usertype = lists[2];
extinfo = lists[3];
icon = lists[4];
id = lists[5];
exps = lists[6];
nickname = lists[7];
Users_Add1(name, adminmode, usertype, extinfo, icon, id, sex, voice, video, exps, nickname);
}
} else {
clearInterval(list_timer);
list_parsed = 1;
//this.r.document.getElementById("usercount").innerHTML = Users.GetCount();
this.r.document.getElementById("AdminCount").innerHTML = Users.GetAdminCount();
this.r.document.getElementById("UserCount").innerHTML = Users.GetUserCount();
}
list_parsing = 0;
}
function RefreshUsers() {
if (listmode == 1) {
list_parsed = 0;
list_i = 0;
list_length = 0;
list_parsing = 0;
list_length = list.length;
Users.RemoveAll();
removealluserfromlist();
list_timer = setInterval("dolistparse()", 1);
if ((this.r != null) && (this.r.document != null)) {
//this.r.document.getElementById("usercount").innerHTML = this.usercount;
this.r.document.getElementById("AdminCount").innerHTML = Users.GetAdminCount();
this.r.document.getElementById("UserCount").innerHTML = Users.GetUserCount();
}
return;
}
Users.RemoveAll();
for (var i = 1; i < list.length; i++)
if (list[i] != null) {
sublists = list[i].split("'-");
if (sublists.length == 4) {
if (!sublists[1]) sublists[1] = '';
if (!sublists[2]) sublists[2] = '';
if (!sublists[3]) sublists[3] = '';
sex = sublists[1];
voice = sublists[2];
video = sublists[3];
} else {
if (!sublists[1]) sublists[1] = '';
if (!sublists[2]) sublists[2] = '';
voice = sublists[1];
video = sublists[2];
sex = 0;
}
lists = sublists[0].split("-'");
if (!lists[1]) lists[1] = '';
if (!lists[2]) lists[2] = '';
if (!lists[3]) lists[3] = '';
if (!lists[4]) lists[4] = '';
if (!lists[5]) lists[5] = '';
name = lists[0];
adminmode = lists[1];
usertype = lists[2];
extinfo = lists[3];
icon = lists[4];
id = lists[5];
Users_Add(name, adminmode, usertype, extinfo, icon, id, sex, voice, video);
}
refreshclick = true;
writeuserlist();
}
function writerframe() {
if (listmode == 0) {
return;
}
if (this.r == null) return;
if (this.r.document == null) return;
this.r.document.open();
this.r.document.writeln("
你這個代碼是在js文件裡面還是script標簽裡面的?如果script標簽裡面你下面這句要對script結束標簽轉義下,要不會導致代碼截斷而出錯
this.r.document.writeln(" </script>");
==>
this.r.document.writeln(" <\/script>");