aboutsummaryrefslogtreecommitdiffstats
path: root/src/client/Main.hx
diff options
context:
space:
mode:
authorRblSb <msrblsb@gmail.com>2020-02-24 15:07:37 +0300
committerRblSb <msrblsb@gmail.com>2020-02-24 15:07:37 +0300
commit2d2fe59eca303e2fe0ea36f831482bf10d8bb058 (patch)
tree9d11b7db916c9bf1aeef48b3fac0fec68f58acea /src/client/Main.hx
parent5ff624a196b3603983052b2139eefe788413e2f1 (diff)
Wow, same port for ws
Diffstat (limited to 'src/client/Main.hx')
-rw-r--r--src/client/Main.hx13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/client/Main.hx b/src/client/Main.hx
index aa0a648..a95a9a2 100644
--- a/src/client/Main.hx
+++ b/src/client/Main.hx
@@ -2,8 +2,8 @@ package client;
import haxe.Timer;
import js.html.MouseEvent;
-import js.html.ButtonElement;
import js.html.KeyboardEvent;
+import js.html.Event;
import js.html.Element;
import haxe.Json;
import js.html.InputElement;
@@ -33,11 +33,13 @@ class Main {
static function main():Void new Main();
- public function new(?host:String, port = 4201) {
+ public function new(?host:String, ?port:String) {
player = new Player(this);
if (host == null) host = Browser.location.hostname;
if (host == "") host = "localhost";
this.host = host;
+ if (port == null) port = Browser.location.port;
+ if (port == "") port = "80";
initListeners();
onTimeGet.run = () -> {
@@ -56,7 +58,7 @@ class Main {
});
}
- function openWebSocket(host:String, port:Int):Void {
+ function openWebSocket(host:String, port:String):Void {
ws = new WebSocket('ws://$host:$port');
ws.onmessage = onMessage;
ws.onopen = () -> {
@@ -89,8 +91,8 @@ class Main {
});
}
- ge("#queue_next").onclick = (e:MouseEvent) -> addVideoUrl(false);
- ge("#queue_end").onclick = (e:MouseEvent) -> addVideoUrl(true);
+ ge("#queue_next").onclick = e -> addVideoUrl(false);
+ ge("#queue_end").onclick = e -> addVideoUrl(true);
ge("#mediaurl").onkeydown = function(e:KeyboardEvent) {
if (e.keyCode == 13) addVideoUrl(true);
}
@@ -361,6 +363,7 @@ class Main {
function hideGuestLoginPanel():Void {
ge("#guestlogin").style.display = "none";
ge("#chatline").style.display = "block";
+ js.Browser.window.dispatchEvent(new Event("resize"));
}
function updateClients(newClients:Array<ClientData>):Void {
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage