minor improvements (scroll down on msg)
authorDylan Lloyd <dylan@dylansserver.com>
Thu, 29 Aug 2013 09:43:50 +0000 (09:43 +0000)
committerDylan Lloyd <dylan@dylansserver.com>
Thu, 29 Aug 2013 09:43:50 +0000 (09:43 +0000)
index.php
mud.js

index ce8a197..8e8360e 100644 (file)
--- a/index.php
+++ b/index.php
@@ -2,11 +2,9 @@
 <html>
   <head>
     <title>mud</title>
-    <link type='text/css' rel='stylesheet' href='style.css'>
-    <script type='text/javascript' src='jquery-core.js'></script>
-<!--
-    <script type='text/javascript' src='mud.js'></script>
--->
+    <link type='text/css' rel='stylesheet' href='/mud/style.css'>
+    <script type='text/javascript' src='/mud/jquery-core.js'></script>
+    <script type='text/javascript' src='/mud/mud.js'></script>
   </head>
   <body>
     <canvas width='450px' height='450px' id='universe'></canvas>
diff --git a/mud.js b/mud.js
index 45373cc..1fee512 100644 (file)
--- a/mud.js
+++ b/mud.js
@@ -155,7 +155,8 @@ $(document).ready(function(){
                     $('<span>').addClass(style).text(action),
                     $('<span>').addClass('msg').text(msg)
                 )
-            )
+            );
+            $("#log").animate({ scrollTop: $('#log')[0].scrollHeight}, 1000);
         }
         $('#submit').click(function() {
             var text = $('#chat').val();
@@ -214,6 +215,7 @@ $(document).ready(function(){
                     var msg = messages[i];
                     if (msg.id == self.player.id) continue;
                     writeToLog(msg.name + ':', msg.type, msg.message);
+                    $("#log").animate({ scrollTop: $('#log')[0].scrollHeight}, 1000);
                 }
             });
         }