aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
Diffstat (limited to 'res')
-rw-r--r--res/client.js50
1 files changed, 41 insertions, 9 deletions
diff --git a/res/client.js b/res/client.js
index 80f7597..fc9bc48 100644
--- a/res/client.js
+++ b/res/client.js
@@ -1,4 +1,4 @@
-// Generated by Haxe 4.3.5
+// Generated by Haxe 4.3.6
(function ($hx_exports, $global) { "use strict";
$hx_exports["client"] = $hx_exports["client"] || {};
$hx_exports["client"]["JsApi"] = $hx_exports["client"]["JsApi"] || {};
@@ -1254,6 +1254,7 @@ var client_Main = function() {
this.matchSimpleDate = new EReg("^-?([0-9]+d)?([0-9]+h)?([0-9]+m)?([0-9]+s?)?$","");
this.mask = new EReg("\\${([0-9]+)-([0-9]+)}","g");
this.disabledReconnection = false;
+ this.gotInitialConnection = false;
this.isConnected = false;
this.personal = new Client("Unknown",0);
this.filters = [];
@@ -1355,19 +1356,34 @@ client_Main.prototype = {
this.ws = new WebSocket("" + protocol + "//" + this.host + colonPort + path);
this.ws.onmessage = $bind(this,this.onMessage);
this.ws.onopen = function() {
+ var tmp = _gthis.disconnectNotification;
+ if(tmp != null) {
+ tmp.stop();
+ }
+ _gthis.disconnectNotification = null;
_gthis.chatMessageConnected();
+ _gthis.gotInitialConnection = true;
return _gthis.isConnected = true;
};
this.ws.onclose = function() {
- if(_gthis.isConnected) {
- _gthis.chatMessageDisconnected();
- }
_gthis.isConnected = false;
- _gthis.player.pause();
+ var notificationDelay = _gthis.gotInitialConnection ? 5000 : 0;
+ if(_gthis.disabledReconnection) {
+ notificationDelay = 0;
+ }
+ if(_gthis.disconnectNotification == null) {
+ _gthis.disconnectNotification = haxe_Timer.delay(function() {
+ if(_gthis.isConnected) {
+ return;
+ }
+ _gthis.chatMessageDisconnected();
+ _gthis.player.pause();
+ },notificationDelay);
+ }
if(_gthis.disabledReconnection) {
return;
}
- haxe_Timer.delay($bind(_gthis,_gthis.openWebSocket),2000);
+ haxe_Timer.delay($bind(_gthis,_gthis.openWebSocket),_gthis.gotInitialConnection ? 1000 : 2000);
};
}
,initListeners: function() {
@@ -1593,7 +1609,7 @@ client_Main.prototype = {
var data = JSON.parse(e.data);
if(this.config != null && this.config.isVerbose) {
var t = data.type;
- haxe_Log.trace("Event: " + data.type,{ fileName : "src/client/Main.hx", lineNumber : 404, className : "client.Main", methodName : "onMessage", customParams : [Reflect.field(data,t.charAt(0).toLowerCase() + HxOverrides.substr(t,1,null))]});
+ haxe_Log.trace("Event: " + data.type,{ fileName : "src/client/Main.hx", lineNumber : 418, className : "client.Main", methodName : "onMessage", customParams : [Reflect.field(data,t.charAt(0).toLowerCase() + HxOverrides.substr(t,1,null))]});
}
client_JsApi.fireOnceEvent(data);
switch(data.type) {
@@ -2029,19 +2045,35 @@ client_Main.prototype = {
this.ws.send(JSON.stringify(data));
}
,chatMessageConnected: function() {
+ var msgBuf = window.document.querySelector("#messagebuffer");
+ if(this.isLastMessageConnectionStatus()) {
+ msgBuf.removeChild(msgBuf.lastChild);
+ }
var div = window.document.createElement("div");
div.className = "server-msg-reconnect";
div.textContent = Lang.get("msgConnected");
- window.document.querySelector("#messagebuffer").appendChild(div);
+ msgBuf.appendChild(div);
this.scrollChatToEnd();
}
,chatMessageDisconnected: function() {
+ var msgBuf = window.document.querySelector("#messagebuffer");
+ if(this.isLastMessageConnectionStatus()) {
+ msgBuf.removeChild(msgBuf.lastChild);
+ }
var div = window.document.createElement("div");
div.className = "server-msg-disconnect";
div.textContent = Lang.get("msgDisconnected");
- window.document.querySelector("#messagebuffer").appendChild(div);
+ msgBuf.appendChild(div);
this.scrollChatToEnd();
}
+ ,isLastMessageConnectionStatus: function() {
+ var tmp = window.document.querySelector("#messagebuffer").lastElementChild;
+ if(tmp != null) {
+ return StringTools.startsWith(tmp.className,"server-msg");
+ } else {
+ return null;
+ }
+ }
,updateUserList: function() {
window.document.querySelector("#usercount").textContent = this.clients.length + " " + Lang.get("online");
window.document.title = this.getPageTitle();
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage