summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-09-08 13:00:23 +0200
committerYorhel <git@yorhel.nl>2009-09-08 13:00:36 +0200
commitfd7bf9ae671cfd128ac8f8465bd7958a1eb05a8a (patch)
tree7187732d312e47ac060344941f1d5153e67c6bed /lib
parent869aff4e43d1c849d3757591aacdc3746c06edb3 (diff)
Added random VN link in menu
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/Handler/VNPage.pm7
-rw-r--r--lib/VNDB/Util/LayoutHTML.pm1
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm
index 510d2dfc..48732530 100644
--- a/lib/VNDB/Handler/VNPage.pm
+++ b/lib/VNDB/Handler/VNPage.pm
@@ -8,11 +8,18 @@ use VNDB::Func;
YAWF::register(
+ qr{v/rand} => \&rand,
qr{v([1-9]\d*)/rg} => \&rg,
qr{v([1-9]\d*)(?:\.([1-9]\d*))?} => \&page,
);
+sub rand {
+ my $self = shift;
+ $self->resRedirect('/v'.$self->dbVNGet(results => 1, order => 'RANDOM()')->[0]{id}, 'temp');
+}
+
+
sub rg {
my($self, $vid) = @_;
diff --git a/lib/VNDB/Util/LayoutHTML.pm b/lib/VNDB/Util/LayoutHTML.pm
index 774c2d09..72e3fbef 100644
--- a/lib/VNDB/Util/LayoutHTML.pm
+++ b/lib/VNDB/Util/LayoutHTML.pm
@@ -74,6 +74,7 @@ sub _menu {
a href => '/hist', mt '_menu_recent_changes'; br;
a href => '/t', mt '_menu_discussion_board'; br;
a href => '/d6', mt '_menu_faq'; br;
+ a href => '/v/rand', mt '_menu_randvn'; br;
a href => 'irc://irc.synirc.net/vndb', '#vndb';
lit ' (<a href="http://cgiirc.synirc.net/?chan=%23vndb">'.mt('_menu_webchat').'</a>)';
end;