line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::LinkEmbedder::Link::Text::Twitter; |
2
|
1
|
|
|
1
|
|
2270
|
use Mojo::Base 'Mojolicious::Plugin::LinkEmbedder::Link::Text'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
has media_id => sub { |
5
|
|
|
|
|
|
|
my $self = shift; |
6
|
|
|
|
|
|
|
my $path = $self->url->path; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
return $1 if $path =~ m!^/(\w+/status/\w+)/?$!; |
9
|
|
|
|
|
|
|
return $1 if $path =~ m!^/(\w+/status/\w+)/photo/\w+/?$!; |
10
|
|
|
|
|
|
|
return ''; |
11
|
|
|
|
|
|
|
}; |
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
0
|
0
|
|
sub provider_name {'Twitter'} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub to_embed { |
16
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
17
|
0
|
0
|
|
|
|
|
my $media_id = $self->media_id or return $self->SUPER::to_embed; |
18
|
0
|
|
|
|
|
|
my %args = @_; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
return $self->tag( |
21
|
|
|
|
|
|
|
div => class => 'link-embedder text-twitter', |
22
|
|
|
|
|
|
|
sub { |
23
|
|
|
|
|
|
|
join( |
24
|
|
|
|
|
|
|
'', |
25
|
|
|
|
|
|
|
$self->tag( |
26
|
|
|
|
|
|
|
blockquote => class => 'twitter-tweet', |
27
|
|
|
|
|
|
|
lang => $args{lang} || 'en', |
28
|
|
|
|
|
|
|
data => {conversation => $args{conversation} || 'none'}, |
29
|
|
|
|
|
|
|
sub { |
30
|
0
|
|
|
|
|
|
$self->tag(a => href => "https://twitter.com/$media_id", "Loading $media_id..."); |
31
|
|
|
|
|
|
|
} |
32
|
0
|
|
0
|
0
|
|
|
), |
|
|
|
0
|
|
|
|
|
33
|
|
|
|
|
|
|
'' |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
} |
36
|
0
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |