changeset 2485:f059b572e612

Cleanup.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 14 Feb 2023 09:37:52 +0200
parents 5402702015cc
children 81a0f6e6256c
files www/search.js
diffstat 1 files changed, 18 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/www/search.js	Fri Feb 10 02:47:54 2023 +0200
+++ b/www/search.js	Tue Feb 14 09:37:52 2023 +0200
@@ -113,6 +113,7 @@
   }
 }
 
+
 function mapCapitalize(str)
 {
   return str.substr(0, 1).toUpperCase() + str.substr(1);
@@ -194,8 +195,8 @@
     {
       mapResult("<b>WebSocket error occured!</b>"+
       "<p>If this problem persists for more than few hours AND this search HAS worked for you before, "+
-      "AND you are NOT using a IPv6 connection, please send e-mail to ccr@tnsp.org and report the problem.</p>"+
-      "<p>Do note that IPv6 connections are not currently supported by the MapSearch WebSocket server and in such case this error is expected.</p>");
+      "you should check if your Internet provider and firewall allow connections to TCP port 444.</p>"
+      );
       console.error("WebSocket error occured: ", mev);
     };
 
@@ -231,14 +232,6 @@
   if (mlobj)
     mlobj.innerHTML = "Contacting server ...";
 
-  var mlhelp1 = document.getElementById("help1");
-  if (mlhelp1)
-    mlhelp1.style.display = "none";
-
-  var mlhelp2 = document.getElementById("help2");
-  if (mlhelp2)
-    mlhelp2.style.display = "none";
-
   dataWS.onopen = function()
   {
     if (mlobj)
@@ -590,7 +583,19 @@
   if (verr)
     verr.parentNode.removeChild(verr);
 
-  mapGetData();
+  var mlhelp1 = document.getElementById("help1");
+  if (mlhelp1)
+    mlhelp1.style.display = "none";
+
+  var mlhelp2 = document.getElementById("help2");
+  if (mlhelp2)
+    mlhelp2.style.display = "none";
+
+  if (!("WebSocket" in window))
+  {
+    mapResult("Your browser does not support WebSockets!");
+    return;
+  }
 
   fieldPattern = document.getElementById("mapPattern");
   btnMapSearch = document.getElementById("btnMapSearch");
@@ -618,6 +623,8 @@
     mapResult("Cleared search pattern and results.");
   });
 
+  mapGetData();
+
   // Reset or clear map list button
   mapAddEvent("btnMaps", "click",
   function ()