summaryrefslogtreecommitdiff
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
parentd0804fb02a8a4d0656fe7255ab6ab8b06aee03c7 (diff)
Added OpenSearch plugin + autodetection
-rw-r--r--ChangeLog1
-rw-r--r--lib/VNDB/Handler/Misc.pm22
-rw-r--r--lib/VNDB/Util/LayoutHTML.pm1
3 files changed, 23 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 99cf2664..8a6e3a4f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,7 @@
- No more $self->multiCmd in the VNDB code
- Extended IRC bot functionality
- Tag cache regenerated daily rather than hourly
+ - Added OpenSearch plugin + autodetection
2.5 - 2009-07-09
- Hide NSFW images in diff viewer (unless NSFW warnings are disabled)
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;
diff --git a/lib/VNDB/Util/LayoutHTML.pm b/lib/VNDB/Util/LayoutHTML.pm
index 2cf3fc40..b5813330 100644
--- a/lib/VNDB/Util/LayoutHTML.pm
+++ b/lib/VNDB/Util/LayoutHTML.pm
@@ -21,6 +21,7 @@ sub htmlHeader { # %options->{ title, js, noindex, search }
title $o{title};
Link rel => 'shortcut icon', href => '/favicon.ico', type => 'image/x-icon';
Link rel => 'stylesheet', href => $self->{url_static}.'/s/'.$skin.'/style.css?'.$self->{version}, type => 'text/css', media => 'all';
+ Link rel => 'search', type => 'application/opensearchdescription+xml', title => 'VNDB VN Search', href => $self->{url}.'/opensearch.xml';
if($o{js}) {
script type => 'text/javascript', src => $self->{url_static}.'/f/forms.js?'.$self->{version}; end;
}