summaryrefslogtreecommitdiff
path: root/lib/VNDB/Handler/Misc.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-08-06 11:39:32 +0200
committerYorhel <git@yorhel.nl>2009-08-06 11:40:16 +0200
commit753a2d8c6b69ae86e5968b9672992b7b60341067 (patch)
tree6f2bc56f01a162fe0c36aa947b6d943a36fde6f2 /lib/VNDB/Handler/Misc.pm
parentd0804fb02a8a4d0656fe7255ab6ab8b06aee03c7 (diff)
Added OpenSearch plugin + autodetection
Diffstat (limited to 'lib/VNDB/Handler/Misc.pm')
-rw-r--r--lib/VNDB/Handler/Misc.pm22
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/VNDB/Handler/Misc.pm b/lib/VNDB/Handler/Misc.pm
index a2d346d8..ceae11ce 100644
--- a/lib/VNDB/Handler/Misc.pm
+++ b/lib/VNDB/Handler/Misc.pm
@@ -4,7 +4,7 @@ package VNDB::Handler::Misc;
use strict;
use warnings;
-use YAWF ':html';
+use YAWF ':html', ':xml';
use VNDB::Func;
@@ -15,6 +15,7 @@ YAWF::register(
qr{nospam}, \&nospam,
qr{([vrp])([1-9]\d*)/(lock|hide)}, \&itemmod,
qr{we-dont-like-ie6}, \&ie6message,
+ qr{opensearch\.xml}, \&opensearch,
# redirects for old URLs
qr{(.*[^/]+)/+}, sub { $_[0]->resRedirect("/$_[1]", 'perm') },
@@ -372,5 +373,24 @@ sub ie6message {
}
+sub opensearch {
+ my $self = shift;
+ $self->resHeader('Content-Type' => 'application/opensearchdescription+xml');
+ xml;
+ tag 'OpenSearchDescription',
+ xmlns => 'http://a9.com/-/spec/opensearch/1.1/', 'xmlns:moz' => 'http://www.mozilla.org/2006/browser/search/';
+ tag 'ShortName', 'VNDB';
+ tag 'LongName', 'VNDB.org visual novel search';
+ tag 'Description', 'Search visual vovels on VNDB.org';
+ tag 'Image', width => 16, height => 16, type => 'image/x-icon', $self->{url}.'/favicon.ico'
+ if -s "$VNDB::ROOT/www/favicon.ico";
+ tag 'Url', type => 'text/html', method => 'get', template => $self->{url}.'/v/all?q={searchTerms}', undef;
+ tag 'Url', type => 'application/opensearchdescription+xml', rel => 'self', template => $self->{url}.'/opensearch.xml', undef;
+ tag 'Query', role => 'example', searchTerms => 'Tsukihime', undef;
+ tag 'moz:SearchForm', $self->{url}.'/v/all';
+ end;
+}
+
+
1;