| 1 | package Text::Livedoor::Wiki::Plugin::Function::Jimakuin; | ||||||||||||
| 2 | 11 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | 11 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 11 | ▶ | use base qw/Text::Livedoor::Wiki::Plugin::Function/; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 11 | ▶ | use Text::Livedoor::Wiki::Utils; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 11 | __PACKAGE__->function_name('jimakuin'); | |||||||||||
| 7 | |||||||||||||
| 8 | 11 | ▶ | sub prepare_args { | ||||||||||
|
Subroutine
prepare_args: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||
| 9 | 11 | my $class= shift; | |||||||||||
| 10 | 11 | my $args = shift; | |||||||||||
| 11 | 11 | ▶ | die 'no arg' unless scalar @$args ; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 12 | 10 | my $url = $args->[0]; | |||||||||||
| 13 | 10 | ▶ | die 'url is not invalid' unless $url =~ m{^http://(?:[a-zA-Z0-9\-]+\.)?jimaku\.in/w/([a-zA-Z0-9\_][^/]+)/([a-zA-Z0-9\_][^/]+)}i; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 14 | 9 | my ( $code1 , $code2 ) = $url =~ m{^http://(?:[a-zA-Z0-9\-]+\.)?jimaku\.in/w/([a-zA-Z0-9\_][^/]+)/([a-zA-Z0-9\_][^/]+)}; | |||||||||||
| 15 | 9 | return { url => $url , code1 => $code1 , code2 => $code2 }; | |||||||||||
| 16 | } | ||||||||||||
| 17 | 9 | ▶ | sub prepare_value { | ||||||||||
|
Subroutine
prepare_value: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||
| 18 | 9 | my $class = shift; | |||||||||||
| 19 | 9 | ▶ | my $value = shift || ''; | ||||||||||
|
Condition100%2/2
shift() || ''
MC/DC100%1/1
shift() || ''
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||
| 20 | 9 | my $width = 425; | |||||||||||
| 21 | 9 | my $height= 380; | |||||||||||
| 22 | |||||||||||||
| 23 | 9 | ($width , $height ) | |||||||||||
| 24 | = Text::Livedoor::Wiki::Utils::get_width_height( $value , { width => $width , height => $height }) ; | ||||||||||||
| 25 | 9 | return { width => $width , height => $height }; | |||||||||||
| 26 | } | ||||||||||||
| 27 | |||||||||||||
| 28 | 8 | ▶ | sub process { | ||||||||||
|
Subroutine
process: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 29 | 8 | my ( $class, $inline, $data ) = @_; | |||||||||||
| 30 | 8 | my $url = $data->{args}{url}; | |||||||||||
| 31 | 8 | my $code1= $data->{args}{code1}; | |||||||||||
| 32 | 8 | my $code2= $data->{args}{code2}; | |||||||||||
| 33 | 8 | my $width = $data->{value}{width}; | |||||||||||
| 34 | 8 | my $height= $data->{value}{height}; | |||||||||||
| 35 | |||||||||||||
| 36 | 8 | my $html = <<"END_JIMAKUIN_TMPL"; | |||||||||||
| 37 | <div class="link_jimakuin"> | ||||||||||||
| 38 | <object width="$width" height="$height"> | ||||||||||||
| 39 | <param name="movie" value="http://swf.jimaku.in/v/$code1/$code2"> | ||||||||||||
| 40 | </param> | ||||||||||||
| 41 | <param name="wmode" value="transparent"></param> | ||||||||||||
| 42 | <embed src="http://swf.jimaku.in/v/$code1/$code2" | ||||||||||||
| 43 | type="application/x-shockwave-flash" wmode="transparent" | ||||||||||||
| 44 | width="$width" height="$height"></embed></object> | ||||||||||||
| 45 | </div> | ||||||||||||
| 46 | END_JIMAKUIN_TMPL | ||||||||||||
| 47 | |||||||||||||
| 48 | 8 | $html =~ s/\n$//; | |||||||||||
| 49 | |||||||||||||
| 50 | 8 | return $html ; | |||||||||||
| 51 | |||||||||||||
| 52 | } | ||||||||||||
| 53 | |||||||||||||
| 54 | 1 | ▶ | sub process_mobile { '' } | ||||||||||
|
Subroutine
process_mobile: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 55 | |||||||||||||
| 56 | 11 | 1; | |||||||||||
| 57 | |||||||||||||
| 58 | =head1 NAME | ||||||||||||
| 59 | |||||||||||||
| 60 | Text::Livedoor::Wiki::Plugin::Function::Jimakuin - jimaku.in Function Plugin | ||||||||||||
| 61 | |||||||||||||
| 62 | =head1 DESCRIPTION | ||||||||||||
| 63 | |||||||||||||
| 64 | lets watch and read! | ||||||||||||
| 65 | |||||||||||||
| 66 | =head1 SYNOPSIS | ||||||||||||
| 67 | |||||||||||||
| 68 | &jimakuin(http://jimaku.in/w/kdtdRNTdNb8/oTkZXUNFw_B) | ||||||||||||
| 69 | &jimakuin(http://jimaku.in/w/kdtdRNTdNb8/oTkZXUNFw_B){100,200} | ||||||||||||
| 70 | &jimakuin(http://jimaku.in/w/kdtdRNTdNb8/oTkZXUNFw_B){100} | ||||||||||||
| 71 | &jimakuin(http://jimaku.in/w/kdtdRNTdNb8/oTkZXUNFw_B){,200} | ||||||||||||
| 72 | |||||||||||||
| 73 | =head1 FUNCTION | ||||||||||||
| 74 | |||||||||||||
| 75 | =head2 prepare_args | ||||||||||||
| 76 | |||||||||||||
| 77 | =head2 prepare_value | ||||||||||||
| 78 | |||||||||||||
| 79 | =head2 process | ||||||||||||
| 80 | |||||||||||||
| 81 | =head2 process_mobile | ||||||||||||
| 82 | |||||||||||||
| 83 | =head1 AUTHOR | ||||||||||||
| 84 | |||||||||||||
| 85 | polocky | ||||||||||||
| 86 | |||||||||||||
| 87 | =cut | ||||||||||||