line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::LinkEmbedder::Link::Map::Google; |
2
|
1
|
|
|
1
|
|
432
|
use Mojo::Base 'Mojolicious::Plugin::LinkEmbedder::Link'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
has media_id => sub { shift->url->query->param('v') || '' }; |
5
|
0
|
|
|
0
|
1
|
|
sub provider_name {'Google'} |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub learn { |
8
|
0
|
|
|
0
|
1
|
|
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
|
1
|
|
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
|
1
|
|
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; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=encoding utf8 |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 NAME |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Mojolicious::Plugin::LinkEmbedder::Link::Map::Google - maps.google.com link |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 DESCRIPTION |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
This class inherit from L. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 media_id |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 provider_name |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
"Google". |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 METHODS |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 learn |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 pretty_url |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Returns L without "eurl", "mode" and "search" query params. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 to_embed |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Returns the HTML code for an iframe embedding this movie. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 SEE ALSO |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
L. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |