// Generated by Haxe 4.0.5
(function ($global) { "use strict";
var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_;
function $extend(from, fields) {
var proto = Object.create(from);
for (var name in fields) proto[name] = fields[name];
if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString;
return proto;
}
var ClientGroup = $hxEnums["ClientGroup"] = { __ename__ : true, __constructs__ : ["User","Leader","Admin"]
,User: {_hx_index:0,__enum__:"ClientGroup",toString:$estr}
,Leader: {_hx_index:1,__enum__:"ClientGroup",toString:$estr}
,Admin: {_hx_index:2,__enum__:"ClientGroup",toString:$estr}
};
var Client = function(name,group) {
this.name = name;
var i = group;
if(group == null) {
i = 0;
}
this.group = i;
};
Client.__name__ = true;
Client.fromData = function(data) {
return new Client(data.name,data.group);
};
Client.prototype = {
setGroupFlag: function(type,flag) {
if(flag) {
this.group |= 1 << type._hx_index;
} else {
this.group &= -1 - (1 << type._hx_index);
}
return flag;
}
};
var ClientTools = function() { };
ClientTools.__name__ = true;
ClientTools.setLeader = function(clients,name) {
var _g = 0;
while(_g < clients.length) {
var client = clients[_g];
++_g;
if(client.name == name) {
client.setGroupFlag(ClientGroup.Leader,true);
} else if((client.group & 2) != 0) {
client.setGroupFlag(ClientGroup.Leader,false);
}
}
};
ClientTools.getByName = function(clients,name,def) {
var _g = 0;
while(_g < clients.length) {
var client = clients[_g];
++_g;
if(client.name == name) {
return client;
}
}
return def;
};
var EReg = function(r,opt) {
this.r = new RegExp(r,opt.split("u").join(""));
};
EReg.__name__ = true;
EReg.prototype = {
match: function(s) {
if(this.r.global) {
this.r.lastIndex = 0;
}
this.r.m = this.r.exec(s);
this.r.s = s;
return this.r.m != null;
}
,matched: function(n) {
if(this.r.m != null && n >= 0 && n < this.r.m.length) {
return this.r.m[n];
} else {
throw new js__$Boot_HaxeError("EReg::matched");
}
}
};
var HxOverrides = function() { };
HxOverrides.__name__ = true;
HxOverrides.substr = function(s,pos,len) {
if(len == null) {
len = s.length;
} else if(len < 0) {
if(pos == 0) {
len = s.length + len;
} else {
return "";
}
}
return s.substr(pos,len);
};
HxOverrides.remove = function(a,obj) {
var i = a.indexOf(obj);
if(i == -1) {
return false;
}
a.splice(i,1);
return true;
};
HxOverrides.iter = function(a) {
return { cur : 0, arr : a, hasNext : function() {
return this.cur < this.arr.length;
}, next : function() {
return this.arr[this.cur++];
}};
};
var Lambda = function() { };
Lambda.__name__ = true;
Lambda.exists = function(it,f) {
var x = $getIterator(it);
while(x.hasNext()) if(f(x.next())) {
return true;
}
return false;
};
Lambda.find = function(it,f) {
var v = $getIterator(it);
while(v.hasNext()) {
var v1 = v.next();
if(f(v1)) {
return v1;
}
}
return null;
};
var haxe_ds_StringMap = function() {
this.h = { };
};
haxe_ds_StringMap.__name__ = true;
haxe_ds_StringMap.prototype = {
setReserved: function(key,value) {
if(this.rh == null) {
this.rh = { };
}
this.rh["$" + key] = value;
}
,getReserved: function(key) {
if(this.rh == null) {
return null;
} else {
return this.rh["$" + key];
}
}
};
var Lang = function() { };
Lang.__name__ = true;
Lang.request = function(path,callback) {
var http = new haxe_http_HttpJs(path);
http.onData = callback;
http.request();
};
Lang.init = function(folderPath,callback) {
var _this = Lang.langs;
_this.h = { };
_this.rh = null;
var count = 0;
var _g = 0;
var _g1 = Lang.ids;
while(_g < _g1.length) {
var name = [_g1[_g]];
++_g;
Lang.request("" + folderPath + "/" + name[0] + ".json",(function(name1) {
return function(data) {
var data1 = JSON.parse(data);
var lang = new haxe_ds_StringMap();
var _g2 = 0;
var _g11 = Reflect.fields(data1);
while(_g2 < _g11.length) {
var key = _g11[_g2];
++_g2;
var v = Reflect.field(data1,key);
if(__map_reserved[key] != null) {
lang.setReserved(key,v);
} else {
lang.h[key] = v;
}
}
var id = haxe_io_Path.withoutExtension(name1[0]);
var _this1 = Lang.langs;
if(__map_reserved[id] != null) {
_this1.setReserved(id,lang);
} else {
_this1.h[id] = lang;
}
count += 1;
if(count == Lang.ids.length && callback != null) {
callback();
}
return;
};
})(name));
}
};
Lang.get = function(key) {
var key1 = Lang.lang;
var _this = Lang.langs;
if((__map_reserved[key1] != null ? _this.getReserved(key1) : _this.h[key1]) == null) {
Lang.lang = "en";
}
var key2 = Lang.lang;
var _this1 = Lang.langs;
var _this2 = __map_reserved[key2] != null ? _this1.getReserved(key2) : _this1.h[key2];
var text = __map_reserved[key] != null ? _this2.getReserved(key) : _this2.h[key];
if(text == null) {
return key;
} else {
return text;
}
};
Math.__name__ = true;
var Reflect = function() { };
Reflect.__name__ = true;
Reflect.field = function(o,field) {
try {
return o[field];
} catch( e ) {
return null;
}
};
Reflect.fields = function(o) {
var a = [];
if(o != null) {
var hasOwnProperty = Object.prototype.hasOwnProperty;
for( var f in o ) {
if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) {
a.push(f);
}
}
}
return a;
};
Reflect.isFunction = function(f) {
if(typeof(f) == "function") {
return !(f.__name__ || f.__ename__);
} else {
return false;
}
};
Reflect.compareMethods = function(f1,f2) {
if(f1 == f2) {
return true;
}
if(!Reflect.isFunction(f1) || !Reflect.isFunction(f2)) {
return false;
}
if(f1.scope == f2.scope && f1.method == f2.method) {
return f1.method != null;
} else {
return false;
}
};
var Std = function() { };
Std.__name__ = true;
Std.string = function(s) {
return js_Boot.__string_rec(s,"");
};
Std.parseInt = function(x) {
if(x != null) {
var _g = 0;
var _g1 = x.length;
while(_g < _g1) {
var i = _g++;
var c = x.charCodeAt(i);
if(c <= 8 || c >= 14 && c != 32 && c != 45) {
var v = parseInt(x, (x[(i + 1)]=="x" || x[(i + 1)]=="X") ? 16 : 10);
if(isNaN(v)) {
return null;
} else {
return v;
}
}
}
}
return null;
};
var StringTools = function() { };
StringTools.__name__ = true;
StringTools.startsWith = function(s,start) {
if(s.length >= start.length) {
return s.lastIndexOf(start,0) == 0;
} else {
return false;
}
};
StringTools.replace = function(s,sub,by) {
return s.split(sub).join(by);
};
var client_Buttons = function() { };
client_Buttons.__name__ = true;
client_Buttons.init = function(main) {
client_Buttons.initChatInput(main);
var smilesBtn = window.document.querySelector("#smilesbtn");
smilesBtn.onclick = function(e) {
smilesBtn.classList.toggle("active");
var smilesWrap = window.document.querySelector("#smileswrap");
if(smilesBtn.classList.contains("active")) {
return smilesWrap.style.display = "block";
} else {
return smilesWrap.style.display = "none";
}
};
window.document.querySelector("#clearchatbtn").style.display = "inline-block";
window.document.querySelector("#clearchatbtn").onclick = function(e1) {
if((main.personal.group & 4) != 0) {
main.send({ type : "ClearChat"});
}
return;
};
var userList = window.document.querySelector("#userlist");
userList.onclick = function(e2) {
if((main.personal.group & 4) == 0) {
return;
}
var el = e2.target;
if(userList == el) {
return;
}
if(!el.classList.contains("userlist_item")) {
el = el.parentElement;
}
var name = "";
if(el.children.length == 1) {
name = el.lastElementChild.innerText;
}
main.send({ type : "SetLeader", setLeader : { clientName : name}});
return;
};
client_Buttons.split = new Split(["#chatwrap","#videowrap"],{ sizes : [40,60], onDragEnd : function() {
return window.dispatchEvent(new Event("resize"));
}, minSize : 185, snapOffset : 0});
var userlistToggle = window.document.querySelector("#userlisttoggle");
userlistToggle.onclick = function(e3) {
var style = window.document.querySelector("#userlist").style;
if(style.display == "none") {
userlistToggle.classList.add("glyphicon-chevron-down");
userlistToggle.classList.remove("glyphicon-chevron-right");
return style.display = "block";
} else {
userlistToggle.classList.add("glyphicon-chevron-right");
userlistToggle.classList.remove("glyphicon-chevron-down");
return style.display = "none";
}
};
window.document.querySelector("#usercount").onclick = userlistToggle.onclick;
var extendPlayer = window.document.querySelector("#extendplayer");
extendPlayer.onclick = function(e4) {
if(extendPlayer.classList.contains("active")) {
client_Buttons.split.setSizes([40,60]);
window.document.querySelector("#userlist").style.width = "90px";
} else {
client_Buttons.split.setSizes([20,80]);
window.document.querySelector("#userlist").style.width = "80px";
}
extendPlayer.classList.toggle("active");
return window.dispatchEvent(new Event("resize"));
};
window.document.querySelector("#mediarefresh").onclick = function(e5) {
main.refreshPlayer();
return;
};
window.document.querySelector("#fullscreenbtn").onclick = function(e6) {
return client_Utils.toggleFullScreen(window.document.querySelector("#ytapiplayer"));
};
var getPlaylist = window.document.querySelector("#getplaylist");
getPlaylist.onclick = function(e7) {
client_Utils.copyToClipboard(main.getPlaylistLinks().join(","));
var icon = getPlaylist.firstElementChild;
icon.classList.remove("glyphicon-link");
icon.classList.add("glyphicon-ok");
return haxe_Timer.delay(function() {
icon.classList.add("glyphicon-link");
icon.classList.remove("glyphicon-ok");
return;
},2000);
};
window.document.querySelector("#clearplaylist").onclick = function(e8) {
if(!window.confirm(Lang.get("clearPlaylistConfirm"))) {
return;
}
main.send({ type : "ClearPlaylist"});
return;
};
window.document.querySelector("#shuffleplaylist").onclick = function(e9) {
if(!window.confirm(Lang.get("shufflePlaylistConfirm"))) {
return;
}
main.send({ type : "ShufflePlaylist"});
return;
};
window.document.querySelector("#showmediaurl").onclick = function(e10) {
window.document.querySelector("#showmediaurl").classList.toggle("collapsed");
window.document.querySelector("#showmediaurl").classList.toggle("active");
return window.document.querySelector("#addfromurl").classList.toggle("collapse");
};
window.onresize = client_Buttons.onVideoResize;
window.dispatchEvent(new Event("resize"));
};
client_Buttons.onVideoResize = function() {
var height = window.document.querySelector("#ytapiplayer").offsetHeight - window.document.querySelector("#chatline").offsetHeight;
window.document.querySelector("#messagebuffer").style.height = "" + height + "px";
window.document.querySelector("#userlist").style.height = "" + height + "px";
};
client_Buttons.initChatInput = function(main) {
var guestName = window.document.querySelector("#guestname");
guestName.onkeydown = function(e) {
if(guestName.value.length == 0) {
return;
}
if(e.keyCode == 13) {
main.send({ type : "Login", login : { clientName : guestName.value}});
}
return;
};
var chatLine = window.document.querySelector("#chatline");
chatLine.onkeydown = function(e1) {
switch(e1.keyCode) {
case 13:
if(chatLine.value.length == 0) {
return;
}
main.send({ type : "Message", message : { clientName : "", text : chatLine.value}});
client_Buttons.personalHistory.push(chatLine.value);
if(client_Buttons.personalHistory.length > 50) {
client_Buttons.personalHistory.shift();
}
client_Buttons.personalHistoryId = -1;
chatLine.value = "";
break;
case 38:
client_Buttons.personalHistoryId--;
if(client_Buttons.personalHistoryId == -2) {
client_Buttons.personalHistoryId = client_Buttons.personalHistory.length - 1;
if(client_Buttons.personalHistoryId == -1) {
return;
}
} else if(client_Buttons.personalHistoryId == -1) {
client_Buttons.personalHistoryId++;
}
chatLine.value = client_Buttons.personalHistory[client_Buttons.personalHistoryId];
break;
case 40:
if(client_Buttons.personalHistoryId == -1) {
return;
}
client_Buttons.personalHistoryId++;
if(client_Buttons.personalHistoryId > client_Buttons.personalHistory.length - 1) {
client_Buttons.personalHistoryId = -1;
chatLine.value = "";
return;
}
chatLine.value = client_Buttons.personalHistory[client_Buttons.personalHistoryId];
break;
}
};
};
var client_Main = function(host,port) {
this.matchNumbers = new EReg("^-?[0-9]+$","");
this.onTimeGet = new haxe_Timer(2000);
this.isConnected = false;
this.personal = new Client("Unknown",0);
this.filters = [];
this.globalIp = "";
this.pageTitle = window.document.title;
this.clients = [];
var _gthis = this;
this.player = new client_Player(this);
if(host == null) {
host = window.location.hostname;
}
if(host == "") {
host = "localhost";
}
this.host = host;
if(port == null) {
port = window.location.port;
}
if(port == "") {
port = "80";
}
this.initListeners();
this.onTimeGet.run = function() {
if(_gthis.player.isListEmpty()) {
return;
}
_gthis.send({ type : "GetTime"});
return;
};
window.document.onvisibilitychange = function() {
if(!window.document.hidden && _gthis.onBlinkTab != null) {
window.document.title = _gthis.getPageTitle();
_gthis.onBlinkTab.stop();
_gthis.onBlinkTab = null;
}
return;
};
Lang.init("langs",function() {
_gthis.openWebSocket(host,port);
return;
});
};
client_Main.__name__ = true;
client_Main.main = function() {
new client_Main();
};
client_Main.prototype = {
openWebSocket: function(host,port) {
var _gthis = this;
this.ws = new WebSocket("ws://" + host + ":" + port);
this.ws.onmessage = $bind(this,this.onMessage);
this.ws.onopen = function() {
_gthis.serverMessage(1);
return _gthis.isConnected = true;
};
this.ws.onclose = function() {
if(_gthis.isConnected) {
_gthis.serverMessage(2);
}
_gthis.isConnected = false;
_gthis.player.pause();
return haxe_Timer.delay(function() {
_gthis.openWebSocket(host,port);
return;
},2000);
};
}
,initListeners: function() {
var _gthis = this;
client_Buttons.init(this);
client_MobileView.init();
window.document.querySelector("#leader_btn").onclick = function(e) {
_gthis.setLeaderButton((_gthis.personal.group & 2) == 0);
_gthis.send({ type : "SetLeader", setLeader : { clientName : (_gthis.personal.group & 2) != 0 ? "" : _gthis.personal.name}});
return;
};
window.document.querySelector("#queue_next").onclick = function(e1) {
_gthis.addVideoUrl(false);
return;
};
window.document.querySelector("#queue_end").onclick = function(e2) {
_gthis.addVideoUrl(true);
return;
};
window.document.querySelector("#mediaurl").onkeydown = function(e3) {
if(e3.keyCode == 13) {
_gthis.addVideoUrl(true);
}
};
}
,addVideoUrl: function(atEnd) {
var _gthis = this;
var mediaUrl = window.document.querySelector("#mediaurl");
var url = mediaUrl.value;
if(url.length == 0) {
return;
}
mediaUrl.value = "";
var _this_r = new RegExp(",(https?)","g".split("u").join(""));
var links = url.replace(_this_r,"|$1").split("|");
this.addVideo(atEnd || this.player.isListEmpty() ? links.shift() : links.pop(),atEnd,function() {
_gthis.addVideoArray(links,atEnd);
return;
});
}
,addVideoArray: function(links,atEnd) {
var _gthis = this;
if(links.length == 0) {
return;
}
this.addVideo(atEnd ? links.shift() : links.pop(),atEnd,function() {
_gthis.addVideoArray(links,atEnd);
return;
});
}
,addVideo: function(url,atEnd,callback) {
var _gthis = this;
var protocol = window.location.protocol;
if(StringTools.startsWith(url,"/")) {
url = "" + protocol + "//" + window.location.hostname + ":" + window.location.port + url;
}
if(!StringTools.startsWith(url,"http")) {
url = "" + protocol + "//" + url;
}
var pos = url.lastIndexOf("/") + 1;
var name = HxOverrides.substr(url,pos,null);
var matchName = new EReg("^(.+)\\.","");
if(matchName.match(name)) {
name = matchName.matched(1);
} else {
name = Lang.get("rawVideo");
}
this.getRemoteVideoDuration(url,function(duration) {
if(duration == 0) {
var tmp = Lang.get("addVideoError");
_gthis.serverMessage(4,tmp);
return;
}
_gthis.send({ type : "AddVideo", addVideo : { item : { url : url, title : name, author : _gthis.personal.name, duration : duration}, atEnd : atEnd}});
callback();
return;
});
}
,refreshPlayer: function() {
this.player.refresh();
}
,getPlaylistLinks: function() {
var items = this.player.getItems();
var _g = [];
var _g1 = 0;
while(_g1 < items.length) _g.push(items[_g1++].url);
return _g;
}
,tryLocalIp: function(url) {
if(this.host == this.globalIp) {
return url;
}
return StringTools.replace(url,this.globalIp,this.host);
}
,getRemoteVideoDuration: function(src,callback) {
var player = window.document.querySelector("#ytapiplayer");
var video = window.document.createElement("video");
video.src = src;
video.onerror = function(e) {
if(player.contains(video)) {
player.removeChild(video);
}
callback(0);
return;
};
video.onloadedmetadata = function() {
if(player.contains(video)) {
player.removeChild(video);
}
callback(video.duration);
return;
};
client_Utils.prepend(player,video);
}
,onMessage: function(e) {
var data = JSON.parse(e.data);
var t = data.type;
var t1 = t.charAt(0).toLowerCase() + HxOverrides.substr(t,1,null);
haxe_Log.trace("Event: " + data.type,{ fileName : "src/client/Main.hx", lineNumber : 195, className : "client.Main", methodName : "onMessage", customParams : [data[t1]]});
switch(data.type) {
case "AddVideo":
if(this.player.isListEmpty()) {
this.player.setVideo(data.addVideo.item);
}
this.player.addVideoItem(data.addVideo.item,data.addVideo.atEnd);
break;
case "ClearChat":
window.document.querySelector("#messagebuffer").innerHTML = "";
break;
case "ClearPlaylist":
this.player.clearItems();
if(this.player.isListEmpty()) {
this.player.pause();
}
break;
case "Connected":
this.onConnected(data);
this.onTimeGet.run();
break;
case "GetTime":
var newTime = data.getTime.time;
var time = this.player.getTime();
if((this.personal.group & 1 << ClientGroup.Leader._hx_index) != 0) {
if(Math.abs(time - newTime) < 2) {
return;
}
this.player.setTime(time,false);
return;
}
if(!data.getTime.paused) {
this.player.play();
} else {
this.player.pause();
}
if(Math.abs(time - newTime) < 2) {
return;
}
this.player.setTime(newTime);
break;
case "Login":
this.onLogin(data.login.clients,data.login.clientName);
break;
case "LoginError":
var text = StringTools.replace(Lang.get("usernameError"),"$MAX","" + this.config.maxLoginLength);
this.serverMessage(4,text);
break;
case "Logout":
this.updateClients(data.logout.clients);
this.personal = new Client(data.logout.clientName,0);
this.showGuestLoginPanel();
break;
case "Message":
this.addMessage(data.message.clientName,data.message.text);
break;
case "Pause":
if((this.personal.group & 1 << ClientGroup.Leader._hx_index) != 0) {
return;
}
this.player.pause();
this.player.setTime(data.pause.time);
break;
case "Play":
if((this.personal.group & 1 << ClientGroup.Leader._hx_index) != 0) {
return;
}
this.player.setTime(data.play.time);
this.player.play();
break;
case "RemoveVideo":
this.player.removeItem(data.removeVideo.url);
if(this.player.isListEmpty()) {
this.player.pause();
}
break;
case "Rewind":
this.player.setTime(data.rewind.time);
break;
case "SetLeader":
ClientTools.setLeader(this.clients,data.setLeader.clientName);
this.updateUserList();
this.setLeaderButton((this.personal.group & 1 << ClientGroup.Leader._hx_index) != 0);
if((this.personal.group & 1 << ClientGroup.Leader._hx_index) != 0) {
this.player.setTime(this.player.getTime(),false);
}
break;
case "SetTime":
var newTime1 = data.setTime.time;
var time1 = this.player.getTime();
if(Math.abs(time1 - newTime1) < 2) {
return;
}
this.player.setTime(newTime1);
break;
case "ShufflePlaylist":
break;
case "UpdateClients":
this.updateClients(data.updateClients.clients);
this.personal = ClientTools.getByName(this.clients,this.personal.name,this.personal);
break;
case "UpdatePlaylist":
this.player.setItems(data.updatePlaylist.videoList);
break;
case "VideoLoaded":
this.player.setTime(0);
this.player.play();
break;
}
}
,onConnected: function(data) {
var connected = data.connected;
this.globalIp = connected.globalIp;
this.setConfig(connected.config);
if(connected.isUnknownClient) {
this.updateClients(connected.clients);
this.personal = ClientTools.getByName(this.clients,connected.clientName,this.personal);
this.showGuestLoginPanel();
} else {
this.onLogin(connected.clients,connected.clientName);
}
var guestName = window.document.querySelector("#guestname");
if(guestName.value.length > 0) {
this.send({ type : "Login", login : { clientName : guestName.value}});
}
window.document.querySelector("#messagebuffer").innerHTML = "";
this.serverMessage(1);
var _g = 0;
var _g1 = connected.history;
while(_g < _g1.length) {
var message = _g1[_g];
++_g;
this.addMessage(message.name,message.text,message.time);
}
this.player.setItems(connected.videoList);
}
,setConfig: function(config) {
this.config = config;
this.pageTitle = config.channelName;
window.document.querySelector("#guestname").maxLength = config.maxLoginLength;
window.document.querySelector("#chatline").maxLength = config.maxMessageLength;
this.filters.length = 0;
var _g = 0;
var _g1 = config.filters;
while(_g < _g1.length) {
var filter = _g1[_g];
++_g;
this.filters.push({ regex : new EReg(filter.regex,filter.flags), replace : filter.replace});
}
var _g2 = 0;
var _g3 = config.emotes;
while(_g2 < _g3.length) {
var emote = _g3[_g2];
++_g2;
this.filters.push({ regex : new EReg(this.escapeRegExp(emote.name),"g"), replace : ""});
}
var smilesWrap = window.document.querySelector("#smileswrap");
smilesWrap.onclick = function(e) {
var el = e.target;
var form = window.document.querySelector("#chatline");
form.value += " " + el.title;
form.focus();
return;
};
smilesWrap.innerHTML = "";
var _g4 = 0;
var _g5 = config.emotes;
while(_g4 < _g5.length) {
var emote1 = _g5[_g4];
++_g4;
var img = window.document.createElement("img");
img.className = "smile-preview";
img.src = emote1.image;
img.title = emote1.name;
smilesWrap.appendChild(img);
}
}
,onLogin: function(data,clientName) {
this.updateClients(data);
var newPersonal = ClientTools.getByName(this.clients,clientName);
if(newPersonal == null) {
return;
}
this.personal = newPersonal;
this.hideGuestLoginPanel();
}
,showGuestLoginPanel: function() {
window.document.querySelector("#guestlogin").style.display = "block";
window.document.querySelector("#chatline").style.display = "none";
}
,hideGuestLoginPanel: function() {
window.document.querySelector("#guestlogin").style.display = "none";
window.document.querySelector("#chatline").style.display = "block";
window.dispatchEvent(new Event("resize"));
}
,updateClients: function(newClients) {
this.clients.length = 0;
var _g = 0;
while(_g < newClients.length) this.clients.push(Client.fromData(newClients[_g++]));
this.updateUserList();
}
,send: function(data) {
if(!this.isConnected) {
return;
}
this.ws.send(JSON.stringify(data));
}
,serverMessage: function(type,text) {
var msgBuf = window.document.querySelector("#messagebuffer");
var div = window.document.createElement("div");
var time = "[" + new Date().toTimeString().split(" ")[0] + "] ";
switch(type) {
case 1:
div.className = "server-msg-reconnect";
div.innerHTML = Lang.get("msgConnected");
break;
case 2:
div.className = "server-msg-disconnect";
div.innerHTML = Lang.get("msgDisconnected");
break;
case 3:
div.className = "server-whisper";
div.innerHTML = time + text + " " + Lang.get("entered");
break;
case 4:
div.className = "server-whisper";
div.innerHTML = time + text;
break;
default:
}
msgBuf.appendChild(div);
msgBuf.scrollTop = msgBuf.scrollHeight;
}
,updateUserList: function() {
window.document.querySelector("#usercount").innerHTML = this.clients.length + " " + Lang.get("online");
window.document.title = this.getPageTitle();
var list_b = "";
var _g = 0;
var _g1 = this.clients;
while(_g < _g1.length) {
var client1 = _g1[_g];
++_g;
list_b += "