line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::LinkEmbedder::Link::Video::Collegehumor; |
2
|
1
|
|
|
1
|
|
2420
|
use Mojo::Base 'Mojolicious::Plugin::LinkEmbedder::Link::Text::HTML'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
has media_id => sub { shift->url->path =~ m!/(\d+)/! ? $1 : '' }; |
5
|
0
|
|
|
0
|
0
|
|
sub provider_name {'Collegehumor'} |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub learn { |
8
|
0
|
|
|
0
|
0
|
|
my ($self, $c, $cb) = @_; |
9
|
|
|
|
|
|
|
|
10
|
0
|
0
|
|
|
|
|
if ($self->media_id) { |
11
|
0
|
|
|
|
|
|
$self->$cb; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
else { |
14
|
0
|
|
|
|
|
|
$self->SUPER::learn($c, $cb); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
return $self; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub to_embed { |
21
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
22
|
0
|
0
|
|
|
|
|
my $media_id = $self->media_id or return $self->SUPER::to_embed; |
23
|
0
|
|
|
|
|
|
my $src = Mojo::URL->new('http://www.collegehumor.com/e'); |
24
|
0
|
|
|
|
|
|
my %args = @_; |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
push @{$src->path}, $media_id; |
|
0
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
$self->_iframe( |
29
|
|
|
|
|
|
|
src => $src, |
30
|
|
|
|
|
|
|
class => 'link-embedder video-collegehumor', |
31
|
|
|
|
|
|
|
width => $args{width} || 600, |
32
|
0
|
|
0
|
|
|
|
height => $args{height} || 369 |
|
|
|
0
|
|
|
|
|
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |