]> git.mar77i.info Git - hublib/blobdiff - webroot/first/index.js
big cleanup and refactoring #1
[hublib] / webroot / first / index.js
index 8cae34e6e39a60df7b28a53fafb70fe958de9d5a..03b1f4990d8e5ebfeff5e696b42d5f7e094beafe 100644 (file)
@@ -3,7 +3,9 @@
     var input_div = null;
 
     function write(msg) {
-        common.write(input_div.previousSibling, msg);
+        common.write(
+            input_div === null ? document.body : input_div.previousSibling, msg
+        );
     }
 
     function change_name_button(hub) {
 
     function close() {
         write("connection lost");
-        input_div.remove();
+        if (input_div !== null) {
+            input_div.remove();
+            input_div = null;
+        }
     }
 
     function message(msg) {