line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::TweetButton; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
2400
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
79
|
|
4
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
71
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
14
|
use base 'Mojolicious::Plugin'; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
267
|
|
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
18
|
use Mojo::ByteStream; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
739
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.0005'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub register { |
13
|
3
|
|
|
3
|
1
|
103
|
my ($self, $app, $conf) = @_; |
14
|
|
|
|
|
|
|
|
15
|
3
|
100
|
|
|
|
12
|
$conf->{count} = 'vertical' if !$conf->{count}; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$app->renderer->add_helper( |
18
|
|
|
|
|
|
|
tweet_button => sub { |
19
|
24
|
|
|
24
|
|
47441
|
my $c = shift; |
20
|
24
|
|
|
|
|
49
|
my %args = @_; |
21
|
|
|
|
|
|
|
|
22
|
24
|
|
100
|
|
|
99
|
$args{url} ||= $conf->{url}; |
23
|
24
|
|
100
|
|
|
77
|
$args{via} ||= $conf->{via}; |
24
|
24
|
|
100
|
|
|
78
|
$args{related} ||= $conf->{related}; |
25
|
24
|
|
100
|
|
|
80
|
$args{lang} ||= $conf->{lang}; |
26
|
24
|
100
|
|
|
|
52
|
$args{count} = $conf->{count} if !$args{count}; |
27
|
|
|
|
|
|
|
|
28
|
24
|
|
|
|
|
34
|
my $attrs = ''; |
29
|
24
|
|
|
|
|
41
|
foreach my $name (qw/url text count via related lang/) { |
30
|
144
|
100
|
|
|
|
308
|
$attrs .= qq/ data-$name="$args{$name}"/ if $args{$name}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
24
|
|
|
|
|
48
|
my $tag = <<"EOF"; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
EOF |
36
|
24
|
|
|
|
|
65
|
return Mojo::ByteStream->new($tag); |
37
|
|
|
|
|
|
|
} |
38
|
3
|
|
|
|
|
19
|
); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |