chiark / gitweb /
script for tracking changes
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 11 Aug 2009 16:55:24 +0000 (17:55 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 11 Aug 2009 16:55:24 +0000 (17:55 +0100)
yarrg/web/pirate-route

index a7d5eb2..42de303 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>