changeset 1937:f0311e3a9b44

Add button for showing a random example search pattern.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 13 Nov 2017 05:37:16 +0200
parents fe32111858f6
children ab7fd6ed8587
files www/search.js
diffstat 1 files changed, 48 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/www/search.js	Mon Nov 13 05:36:44 2017 +0200
+++ b/www/search.js	Mon Nov 13 05:37:16 2017 +0200
@@ -8,6 +8,47 @@
 var fieldPattern, fieldRes;
 var msgLog, mapWS, tmpWS, locWS, mapList = [];
 
+var mapExamples =
+[
+"^^HHHHHHHH+HHHHHH^^^H\n"
+,
+"~~~~~~~~~~~~hh^hhhhh\n"+
+"~~~~~~~~~~~~~hhh~~~~\n"+
+"~~~~~~~~~~~~~h~~~~~~\n"+
+"~~~~~~~~~~~~~~~~~~~~\n"+
+"~~~~~~~~~~~~~~~~~~~~\n"+
+"~~h~~~~~~~~~~~~~~~~~\n"+
+"~h^^f~~~~*~~~~~~~~~~\n"+
+"~~h^fff~~~~~~~~~~~~~\n"+
+"~~~ff^f~~~~~~~~~~~~~\n"+
+"~~~~fff~~~~~~h~~~~~~\n"+
+"~~~~~~~~~~~h~h~~~~~~\n"+
+"~~~~~~~~~~h^^^hh~~~~\n"+
+"~~~~~~~~~~h^^^^^hh~~\n"
+,
+
+" lljjjjjjjjhhhhjjjjjjjjjjj \n"+
+" llljjjjjjjjhhhhjjjjjjjjjj \n"+
+" lllljjjjjjjhhhhjjjjjjjjjj \n"+
+" jjllljjjjjjjjhhhhjjjjjjjj \n"+
+"jjjllllljjjjj*jjjhjjjjjjjjj\n"+
+" jllllllljjjjjjjjjjjjjjjjj \n"+
+" jlllllllljjjjjjjjjjjjjjjj \n"+
+" jlllllllljjjjjjjjjjjjjjjj \n"+
+" jjlljllllljjjjjjjjjjjjjjj \n"
+,
+"             S             \n"+
+"        SSSSSSSSSS~        \n"+
+"       SSSSSSSSSSS~~       \n"+
+"     SSSSsyssSSSSSSS~~     \n"+
+"    SSSSsyyssssSSSSS~~~    \n"+
+"   SSSSssssysssSSSSS~~~~   \n"+
+"   SSSSysshsyyssSSSS~~~~   \n"+
+"  SSSSSysyhhssssSSSSS~~~~  \n"+
+" SSSSSSysshhsssssSSSSS~~~~ \n"
+];
+
+
 
 function mapAddEventOb(obname, evobj, evtype, evcallback)
 {
@@ -360,6 +401,13 @@
   fieldRes = document.getElementById("results");
   btnMapSearch = document.getElementById("btnMapSearch");
 
+  mapAddEvent("btnExample", "click",
+  function ()
+  {
+    mapResult("Random example search pattern selected. Try clicking 'Search' now.");
+    fieldPattern.value = mapExamples[Math.floor(Math.random() * mapExamples.length)];
+  });
+
   // Map search button
   mapAddEventOb("btnMapSearch", btnMapSearch, "click", mapDoMapSearch);