line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::LinkEmbedder::Link::Text::Twitter; |
2
|
1
|
|
|
1
|
|
613
|
use Mojo::Base 'Mojolicious::Plugin::LinkEmbedder::Link::Text'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
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
|
1
|
|
sub provider_name {'Twitter'} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub to_embed { |
16
|
0
|
|
|
0
|
1
|
|
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; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=encoding utf8 |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 NAME |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Mojolicious::Plugin::LinkEmbedder::Link::Text::Twitter - twitter.com link |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 DESCRIPTION |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
This class inherit from L. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 media_id |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
$str = $self->media_id; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Example C<$str>: "/username/status/123456789". |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 provider_name |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 METHODS |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 to_embed |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Returns the HTML code for javascript embedding this tweet. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 AUTHOR |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Jan Henning Thorsen |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |