line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Livedoor::Wiki::Plugin::Function::GoogleVideo; |
2
|
11
|
|
|
11
|
|
78
|
use warnings; |
|
11
|
|
|
|
|
21
|
|
|
11
|
|
|
|
|
445
|
|
3
|
11
|
|
|
11
|
|
76
|
use strict; |
|
11
|
|
|
|
|
24
|
|
|
11
|
|
|
|
|
522
|
|
4
|
11
|
|
|
11
|
|
74
|
use base qw/Text::Livedoor::Wiki::Plugin::Function/; |
|
11
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
574
|
|
5
|
11
|
|
|
11
|
|
945
|
use Text::Livedoor::Wiki::Utils; |
|
11
|
|
|
|
|
30
|
|
|
11
|
|
|
|
|
80
|
|
6
|
|
|
|
|
|
|
__PACKAGE__->function_name('googlevideo'); |
7
|
|
|
|
|
|
|
__PACKAGE__->operation_regexp(q{(docid=\d+|^\d+$)}); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# what's is difference between google video and youtube. |
10
|
|
|
|
|
|
|
sub prepare_args { |
11
|
21
|
|
|
21
|
1
|
27
|
my $class= shift; |
12
|
21
|
|
|
|
|
25
|
my $args = shift; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# no argument |
15
|
21
|
100
|
|
|
|
72
|
die 'no arg' unless scalar @$args; |
16
|
|
|
|
|
|
|
|
17
|
19
|
|
|
|
|
102
|
my ( $docid ) = $args->[0] =~ /(docid=-?\d+|^-?\d+$)/; |
18
|
|
|
|
|
|
|
# no doc id |
19
|
19
|
100
|
|
|
|
84
|
die 'no docid' unless $docid; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# do not need it |
22
|
16
|
|
|
|
|
38
|
$docid =~ s/docid=//; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# ok |
25
|
16
|
|
|
|
|
60
|
return { docid => $docid } ; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
sub prepare_value { |
28
|
16
|
|
|
16
|
1
|
23
|
my $class = shift; |
29
|
16
|
|
|
|
|
20
|
my $value = shift; |
30
|
16
|
|
|
|
|
20
|
my $width = 340; |
31
|
16
|
|
|
|
|
18
|
my $height = 280; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# do not need space |
34
|
16
|
|
100
|
|
|
47
|
$value ||= ''; |
35
|
16
|
|
|
|
|
37
|
$value =~ s/\s//g; |
36
|
16
|
|
|
|
|
71
|
($width , $height ) |
37
|
|
|
|
|
|
|
= Text::Livedoor::Wiki::Utils::get_width_height( $value , { width => $width , height => $height }) ; |
38
|
|
|
|
|
|
|
|
39
|
16
|
|
|
|
|
74
|
return { width => $width , height => $height }; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub process { |
43
|
15
|
|
|
15
|
1
|
21
|
my ( $class, $inline , $data ) = @_; |
44
|
15
|
|
|
|
|
26
|
my $docid = $data->{args}{docid}; |
45
|
15
|
|
|
|
|
21
|
my $width = $data->{value}{width}; |
46
|
15
|
|
|
|
|
24
|
my $height= $data->{value}{height}; |
47
|
|
|
|
|
|
|
|
48
|
15
|
|
|
|
|
54
|
my $html = <<"END_GOOGLEVIDEO_TMPL"; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
type="application/x-shockwave-flash" |
55
|
|
|
|
|
|
|
style="width:${width}px; height:${height}dpx;" id="VideoPlayback" flashvars="" wmode="opaque"> |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
END_GOOGLEVIDEO_TMPL |
60
|
|
|
|
|
|
|
|
61
|
15
|
|
|
|
|
56
|
$html =~ s/\n$//; |
62
|
15
|
|
|
|
|
92
|
return $html; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
1
|
|
|
1
|
1
|
6
|
sub process_mobile { '' } |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 NAME |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Text::Livedoor::Wiki::Plugin::Function::GoogleVideo - Google Video Function Plugin |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 DESCRIPTION |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
let's watch google video. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 SYNOPSIS |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
&googlevideo(http://video.google.co.jp/videoplay?docid=-694264032177935779&ei=sh8VSsrpFpTewgP-sb1x&q=livedoor+viedo.google) |
80
|
|
|
|
|
|
|
&googlevideo(-694264032177935779) |
81
|
|
|
|
|
|
|
&googlevideo(-694264032177935779){99,88} |
82
|
|
|
|
|
|
|
&googlevideo(-694264032177935779){,99} |
83
|
|
|
|
|
|
|
&googlevideo(-694264032177935779){99} |
84
|
|
|
|
|
|
|
&googlevideo(-694264032177935779){99,} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 FUNCTION |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head2 prepare_args |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 prepare_value |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 process |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 process_mobile |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 AUTHOR |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
polocky |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=cut |