1
0

2 Commity aca19a8ae7 ... a7799c6d25

Autor SHA1 Správa Dátum
  Alexander Vornam a7799c6d25 Initial Commit 3 rokov pred
  Alexander Vornam aca19a8ae7 Initial Commit 3 rokov pred
2 zmenil súbory, kde vykonal 10 pridanie a 9 odobranie
  1. 2 1
      index.js
  2. 8 8
      www/js/main.js

+ 2 - 1
index.js

@@ -29,7 +29,8 @@ fs.readFile("config/ban.json", "utf8", (err, data) => {
     }
 })
 
-app.use(express.static('www'));
+app.use(express.static(__dirname + '/www'));
+app.use('/node_modules', express.static(__dirname + '/node_modules'));
 
 io.on('connection', (socket) => {
     const ip = socket.handshake.address;

+ 8 - 8
www/js/main.js

@@ -135,6 +135,14 @@ function onServerLogin(user) {
         appendMessage(messageWrapper);
     });
 
+    socket.on('userJoined', (msg) => {
+        appendMessage($('<li class="systemMsg user joined">').text(msg + ' hat den Chat betreten.'));
+    });
+
+    socket.on('userLeft', (msg) => {
+        appendMessage($('<li class="systemMsg user left">').text(msg + ' hat den Chat verlassen.'));
+    });
+
     $('#chat-host .messageForm').submit((e) => {
         e.preventDefault();
         socket.emit('message', $('#chat-host .messageForm .messageField').val());
@@ -150,14 +158,6 @@ function onServerLogin(user) {
             return false;
         }
     });
-
-    socket.on('userJoined', (msg) => {
-        appendMessage($('<li class="systemMsg user joined">').text(msg + ' hat den Chat betreten.'));
-    });
-
-    socket.on('userLeft', (msg) => {
-        appendMessage($('<li class="systemMsg user left">').text(msg + ' hat den Chat verlassen.'));
-    });
 }
 
 function onServerKick() {