chiark / gitweb /
script for tracking changes
[ypp-sc-tools.web-live.git] / yarrg / web / pirate-route
index a7d5eb25c2c210ba5c8d64f69929dfa23688bf80..42de303d16caf9bc960077596de6be4ba38d709c 100644 (file)
@@ -77,8 +77,38 @@ db_connect();
 % if (!$a{Dropdowns}) {
 Enter route (islands, or archipelagoes, separated by commas;
  abbreviations are OK):<br>
-<input type="text" name="routestring" size=80><br>
+
+<script type="text/javascript">
+textRoute_timeout=false;
+textRoute_request=false;
+textRoute_done='';
+textRoute_needed='';
+function textRoute_Later(){
+  window.clearTimeout(textRoute_timeout);
+  textRoute_timeout = window.setTimeout(textRoute_Needed, 500);
+}
+function textRoute_Needed(){
+  window.clearTimeout(textRoute_timeout);
+  //textRoute_element= document.getElementsByName('routestring').item(0);
+  //alert(textRoute_element.name);
+  textRoute_needed= textRoute_element.value;
+  textRoute_Request();
+}
+function textRoute_Request(){
+  if (textRoute_request || textRoute_needed==textRoute_done) {
+    alert('unneeded');
+    return;
+  }
+  textRoute_done= textRoute_needed;
+  alert(String.concat('needed! ',textRoute_done));
+}
+</script>
+
+<input type="text" name="routestring" size=80
+ onchange="textRoute_element= event.currentTarget; textRoute_Needed();"
+ onkeydown="textRoute_element= event.currentTarget; textRoute_Later();"><br>
 <div name="results"></div></br>
+
 % } else {
 
 <%perl>