From 7031695ce7767c196f2ef0f279bf4e3c7931c211 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 11 Aug 2009 19:40:15 +0100 Subject: [PATCH] AJAX route validator improved --- yarrg/web/pirate-route | 2 +- yarrg/web/routetextstring | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/yarrg/web/pirate-route b/yarrg/web/pirate-route index f58d47c..58f8f28 100644 --- a/yarrg/web/pirate-route +++ b/yarrg/web/pirate-route @@ -123,7 +123,7 @@ function textRoute_Ready() {
-

+
 

% } else { diff --git a/yarrg/web/routetextstring b/yarrg/web/routetextstring index 0e4ae6e..b84fd84 100644 --- a/yarrg/web/routetextstring +++ b/yarrg/web/routetextstring @@ -6,6 +6,10 @@ $string <%perl> +# typical url for this script: +# http://www.chiark.greenend.org.uk/ucgi/~clareb/mason/pirates/routetextstring?format=json&ocean=Midnight&string=d + + use CommodsWeb; use HTML::Entities; use JSON; @@ -29,7 +33,7 @@ if ($format =~ 'json') { })}; $output_wrong= sub { print to_json({ success => 0, - show => encode_entities($_[0]), + show => $_[0], })}; } @@ -47,7 +51,7 @@ foreach my $each (split m#[/|,]#, $string) { if (!@$results) { $err->('no island or arch matches "%s"'); } elsif (@$results > 3) { - $err->(''); + $err->(' '); } elsif (@$results > 1) { my @m= map { $_->[2] } @$results; $err->('ambiguous island or arch "%s", could be '. -- 2.30.2