line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::LinkEmbedder::Link::Map::Google; |
2
|
1
|
|
|
1
|
|
2812
|
use Mojo::Base 'Mojolicious::Plugin::LinkEmbedder::Link'; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
6
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
has media_id => sub { shift->url->query->param('v') || '' }; |
5
|
0
|
|
|
0
|
0
|
|
sub provider_name {'Google'} |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub learn { |
8
|
0
|
|
|
0
|
0
|
|
my ($self, $c, $cb) = @_; |
9
|
|
|
|
|
|
|
|
10
|
0
|
0
|
|
|
|
|
return $self->SUPER::learn($c, $cb) unless $self->media_id; |
11
|
0
|
|
|
|
|
|
$self->$cb; |
12
|
0
|
|
|
|
|
|
$self; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub pretty_url { |
16
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
17
|
0
|
|
|
|
|
|
my $url = $self->url->clone; |
18
|
0
|
|
|
|
|
|
my $query = $url->query; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
$url; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub to_embed { |
24
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
25
|
0
|
0
|
|
|
|
|
my $media_id = $self->media_id or return $self->SUPER::to_embed; |
26
|
0
|
|
|
|
|
|
my $query = Mojo::Parameters->new; |
27
|
0
|
|
|
|
|
|
my %args = @_; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# |
30
|
|
|
|
|
|
|
$self->_iframe( |
31
|
|
|
|
|
|
|
src => "//www.youtube.com/embed/$media_id?$query", |
32
|
|
|
|
|
|
|
class => 'link-embedder video-youtube', |
33
|
|
|
|
|
|
|
width => $args{width}, |
34
|
|
|
|
|
|
|
height => $args{height} |
35
|
0
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |