2 Commits aca19a8ae7 ... a7799c6d25

Author SHA1 Message Date
  Alexander Vornam a7799c6d25 Initial Commit 3 years ago
  Alexander Vornam aca19a8ae7 Initial Commit 3 years ago
2 changed files with 10 additions and 9 deletions
  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() {