line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MozRepl::Plugin::OpenNewTab; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
36
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use base qw(MozRepl::Plugin::Base); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2240
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
444510
|
use MozRepl::Util; |
|
1
|
|
|
|
|
59536
|
|
|
1
|
|
|
|
|
13
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
MozRepl::Plugin::OpenNewTab - Open new tab and url. |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 VERSION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
version 0.01 |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
use MozRepl; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my $repl = MozRepl->new; |
27
|
|
|
|
|
|
|
$repl->setup({ plugins => { plugins => [qw/OpenNewTab/] } }); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
$repl->open_new_tab({ url => "http://d.hatena.ne.jp/ZIGOROu/", selected => 1 }); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 DESCRIPTION |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Add open_new_tab() method to L. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 METHODS |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 execute($ctx, $args) |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=over 4 |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=item $ctx |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Context object. See L. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=item $args |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Hash reference. |
48
|
|
|
|
|
|
|
See below detail. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=over 4 |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item url |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item selected |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=back |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=back |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub execute { |
63
|
0
|
|
|
0
|
1
|
|
my ($self, $ctx, $args) = @_; |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
my $params = {}; |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
$params->{repl} = $ctx->repl; |
68
|
0
|
|
|
|
|
|
$params->{url} = MozRepl::Util->javascript_value($args->{url}); |
69
|
0
|
0
|
|
|
|
|
$params->{selected} = ($args->{selected}) ? "true" : "false"; |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
my $command = $self->process('execute', $params); |
72
|
0
|
|
|
|
|
|
my $result = $ctx->execute($command); |
73
|
|
|
|
|
|
|
|
74
|
0
|
0
|
|
|
|
|
return ($result eq 'true') ? 1 : 0; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 method_name() |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Return constant value, "open_new_tab". |
80
|
|
|
|
|
|
|
Used by method name adding method to L object. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub method_name { |
85
|
0
|
|
|
0
|
1
|
|
return "open_new_tab"; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 AUTHOR |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Toru Yamaguchi, C<< >> |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 BUGS |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
95
|
|
|
|
|
|
|
C, or through the web interface at |
96
|
|
|
|
|
|
|
L. I will be notified, and then you'll automatically be |
97
|
|
|
|
|
|
|
notified of progress on your bug as I make changes. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Copyright 2007 Toru Yamaguchi, All Rights Reserved. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
104
|
|
|
|
|
|
|
under the same terms as Perl itself. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=cut |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
1; # End of MozRepl::Plugin::OpenNewTab |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
__DATA__ |