chiark / gitweb /
AJAX route validator fixes
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 12 Aug 2009 10:30:30 +0000 (11:30 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 12 Aug 2009 10:30:30 +0000 (11:30 +0100)
yarrg/web/pirate-route
yarrg/web/routetextstring

index e414e6e..612c577 100644 (file)
@@ -82,7 +82,7 @@ Enter route (islands, or archipelagoes, separated by |s or commas;
  abbreviations are OK):<br/>
 
 <script type="text/javascript">
-tr_uri= "routetextstring?format=json"
+tr_uri= "routetextstring?format=json&type=text/xml"
                + "&ocean=<% uri_escape($a{Ocean}) %>";
 
 tr_timeout=false;
@@ -125,7 +125,7 @@ function tr_Ready() {
 
 <input type="text" name="routestring" size=80
  onchange="tr_element= event.currentTarget; tr_Needed();"
- onkeydown="tr_element= event.currentTarget; tr_Later();"><br>
+ onkeyup="tr_element= event.currentTarget; tr_Later();"><br>
 <div name="routeresults">&nbsp;</div><br/>
 
 % } else {
index c39d48b..4202ce9 100644 (file)
@@ -29,7 +29,8 @@ if ($format =~ 'json') {
        $r->content_type($ctype or $format);
        $output= sub { print to_json({
                success => 1,
-               show => encode_entities($canontext),
+               show => length $canontext ? encode_entities($canontext)
+                       : '&nbsp;',
        })};
        $output_wrong= sub { print to_json({
                success => 0,