changeset 1813:d7deea635463

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 30 Oct 2017 01:14:51 +0200
parents cfb623a04f77
children daf7dcc635d6
files www/search.html www/search.js
diffstat 2 files changed, 21 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/www/search.html	Mon Oct 30 00:07:14 2017 +0200
+++ b/www/search.html	Mon Oct 30 01:14:51 2017 +0200
@@ -13,6 +13,12 @@
       padding: 1em;
     }
 
+    #note {
+      color: red;
+      background: black;
+      padding: 0.5em;
+    }
+
     h1 {
       font-size: 1.3em;
       margin: 0.2em;
@@ -90,9 +96,10 @@
 <body onload="mapInitSearch()">
 
 <h1>Pupunen Map search (DEMO/ALPHA)</h1>
-<div>NOTICE: Testing only. Not on-line/available all the time.
+<div id="note">
+NOTICE: This is a TEMPORARY test page only. Not on-line/available all the time.
 The map pattern parser is not very tolerant currently, best is to have
-strictly "square" patterns.
+strictly "square" or one-line patterns.
 </div>
 <noscript>
   <div id="error">
@@ -102,8 +109,7 @@
 
 <div id="searchBox">
   <h2>Search pattern</h2>
-<textarea id="pattern" cols="30" rows="15">
-</textarea>
+  <textarea id="pattern" cols="30" rows="15"></textarea>
   <div id="controls">
     <div id="mapList">LOADING MAP LIST...</div>
     <button id="btnMaps" type="button">C^</button>
--- a/www/search.js	Mon Oct 30 00:07:14 2017 +0200
+++ b/www/search.js	Mon Oct 30 01:14:51 2017 +0200
@@ -18,7 +18,7 @@
     evobj.addEventListener(evtype, evcallback, false);
   else
   if (evobj.attachEvent)
-    evobj.attachEvent("on" + evtype, evcallback);
+    evobj.attachEvent("on"+evtype, evcallback);
   else
     evobj["on"+evtype] = evcallback;
 }
@@ -98,7 +98,6 @@
     return;
   }
 
-  mapLog("WebSocket connection to server established.");
   btnSearch.disabled = true;
 
   mapWS.onopen = function()
@@ -167,10 +166,14 @@
 
   mapWS.onclose = function()
   {
-    mapLog("WebSocket connection closed.");
     mapWS = null;
     btnSearch.disabled = false;
   };
+
+  mapWS.onerror = function()
+  {
+    mapLog("WebSocket error occured.");
+  };
 }
 
 
@@ -221,7 +224,6 @@
     else
     if (evt.data == "END")
     {
-      mapLog("Server ending communication.");
       tmpWS.close();
     }
     else
@@ -232,9 +234,13 @@
 
   tmpWS.onclose = function()
   {
-    mapLog("WebSocket connection closed.");
     tmpWS = null;
   };
+
+  tmpWS.onerror = function()
+  {
+    mapLog("WebSocket error occured.");
+  };
 }