This makes the javascript be added to rss feeds, which allows the buttons
to be displayed by aggregators. At least, if the aggregator does not
sanitize javascript.
sub import {
hook(type => "getsetup", id => "flattr", call => \&getsetup);
hook(type => "preprocess", id => "flattr", call => \&preprocess);
sub import {
hook(type => "getsetup", id => "flattr", call => \&getsetup);
hook(type => "preprocess", id => "flattr", call => \&preprocess);
- hook(type => "format", id => "flattr", call => \&format);
+ hook(type => "sanitize", id => "flattr", call => \&sanitize, last => 1);
my %params=@_;
# Add flattr's javascript to pages with flattr buttons.
if ($flattr_pages{$params{page}}) {
my %params=@_;
# Add flattr's javascript to pages with flattr buttons.
if ($flattr_pages{$params{page}}) {
- if (! ($params{content}=~s!^(<body[^>]*>)!$1.flattrjs()!em)) {
- # no <body> tag, probably in preview mode
- $params{content}=flattrjs().$params{content};
- }
+ return flattrjs().$params{content};
+ }
+ else {
+ return $params{content};
- return $params{content};