Revert "insert flattr javascript via sanitize, not format hook"
This reverts commit 3ef8864122
.
Most aggregators block javascript and so it would display uglily.
Need to find a way to fallback to static buttons instead.
master
parent
3ef8864122
commit
efd8e93c5b
|
@ -8,7 +8,7 @@ use IkiWiki 3.00;
|
||||||
sub import {
|
sub import {
|
||||||
hook(type => "getsetup", id => "flattr", call => \&getsetup);
|
hook(type => "getsetup", id => "flattr", call => \&getsetup);
|
||||||
hook(type => "preprocess", id => "flattr", call => \&preprocess);
|
hook(type => "preprocess", id => "flattr", call => \&preprocess);
|
||||||
hook(type => "sanitize", id => "flattr", call => \&sanitize, last => 1);
|
hook(type => "format", id => "flattr", call => \&format);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub getsetup () {
|
sub getsetup () {
|
||||||
|
@ -54,16 +54,17 @@ sub preprocess (@) {
|
||||||
'</a>';
|
'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
sub sanitize (@) {
|
sub format (@) {
|
||||||
my %params=@_;
|
my %params=@_;
|
||||||
|
|
||||||
# Add flattr's javascript to pages with flattr buttons.
|
# Add flattr's javascript to pages with flattr buttons.
|
||||||
if ($flattr_pages{$params{page}}) {
|
if ($flattr_pages{$params{page}}) {
|
||||||
return flattrjs().$params{content};
|
if (! ($params{content}=~s!^(<body[^>]*>)!$1.flattrjs()!em)) {
|
||||||
}
|
# no <body> tag, probably in preview mode
|
||||||
else {
|
$params{content}=flattrjs().$params{content};
|
||||||
return $params{content};
|
}
|
||||||
}
|
}
|
||||||
|
return $params{content};
|
||||||
}
|
}
|
||||||
|
|
||||||
my $js_cached;
|
my $js_cached;
|
||||||
|
|
Loading…
Reference in New Issue