line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Waft::jQuery; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
99937
|
use 5.005; |
|
3
|
|
|
|
|
6
|
|
4
|
3
|
|
|
3
|
|
13
|
use strict; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
59
|
|
5
|
3
|
|
|
3
|
|
19
|
use vars qw( $VERSION ); |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
156
|
|
6
|
3
|
50
|
|
3
|
|
5
|
BEGIN { eval { require warnings } ? 'warnings'->import : ( $^W = 1 ) } |
|
3
|
|
|
|
|
1309
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
require NEXT; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
$VERSION = '0.00_01'; |
11
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
$Waft::jQuery::Name = 'Waft.jQuery'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub convert_text_part { |
16
|
2
|
|
|
2
|
0
|
20
|
my ($self, $text_part, $break) = @_; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my @text_parts |
19
|
2
|
|
|
|
|
19
|
= split /\b \Q$Waft::jQuery::Name\E \. /xms, $text_part; |
20
|
|
|
|
|
|
|
|
21
|
2
|
|
|
|
|
13
|
my $code = $self->NEXT::convert_text_part( shift(@text_parts), $break ); |
22
|
|
|
|
|
|
|
|
23
|
2
|
|
|
|
|
170
|
while ( @text_parts ) { |
24
|
2
|
|
|
|
|
3
|
my $text_part = shift @text_parts; |
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
|
|
6
|
( my $method, $text_part ) = split / \b /xms, $text_part, 2; |
27
|
|
|
|
|
|
|
|
28
|
2
|
100
|
|
|
|
6
|
if ($method eq 'get') { |
|
|
50
|
|
|
|
|
|
29
|
1
|
|
|
|
|
1
|
$code .= q{$Waft::Self->output_jquery_request_script('get');}; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
elsif ($method eq 'post') { |
32
|
1
|
|
|
|
|
2
|
$code .= q{$Waft::Self->output_jquery_request_script('post');}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
2
|
|
|
|
|
8
|
$code .= $self->NEXT::convert_text_part($text_part, $break); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
2
|
|
|
|
|
139
|
return $code; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub output_jquery_request_script { |
42
|
1
|
|
|
1
|
0
|
549
|
my ($self, $method) = @_; |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
4
|
my $page = $self->jquery_escape($self->page); |
45
|
1
|
|
|
|
|
4
|
my $joined_values |
46
|
|
|
|
|
|
|
= $self->jquery_escape( $self->join_values('ALL_VALUES') ); |
47
|
1
|
|
|
|
|
4
|
my $url = $self->jquery_escape($self->url); |
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
2
|
my $javascript = qq{( function (action, data, callback, type) { |
50
|
|
|
|
|
|
|
if ( jQuery.isFunction(data) ) { |
51
|
|
|
|
|
|
|
callback = data; |
52
|
|
|
|
|
|
|
data = {}; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
else if (data == undefined) { |
55
|
|
|
|
|
|
|
data = {}; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
var waft_v_tag = jQuery('input:hidden[name=\\'v\\']').get(0); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
data['s'] = '$page'; |
61
|
|
|
|
|
|
|
data['v'] = waft_v_tag ? jQuery(waft_v_tag).val() : '$joined_values'; |
62
|
|
|
|
|
|
|
data[action] = ''; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
return jQuery.$method('$url', data, callback, type); |
65
|
|
|
|
|
|
|
} )}; |
66
|
|
|
|
|
|
|
|
67
|
1
|
|
|
|
|
38
|
$javascript =~ s/ (?: \x0D\x0A | [\x0A\x0D] ) \s* / /gxms; |
68
|
|
|
|
|
|
|
|
69
|
1
|
|
|
|
|
3
|
$self->output($javascript); |
70
|
|
|
|
|
|
|
|
71
|
1
|
|
|
|
|
4
|
return; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub jquery_escape { |
75
|
4
|
|
|
4
|
0
|
178
|
my ($self, $value) = @_; |
76
|
|
|
|
|
|
|
|
77
|
4
|
|
|
|
|
19
|
$value =~ s/ (['"\\]) /\\$1/gxms; |
78
|
4
|
|
|
|
|
7
|
$value =~ s/ \x0A /\\n/gxms; |
79
|
4
|
|
|
|
|
5
|
$value =~ s/ \x0D /\\r/gxms; |
80
|
4
|
|
|
|
|
5
|
$value =~ s/ < /\\x3C/gxms; |
81
|
4
|
|
|
|
|
4
|
$value =~ s/ > /\\x3E/gxms; |
82
|
|
|
|
|
|
|
|
83
|
4
|
|
|
|
|
9
|
return $value; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub output_jquery_sync_script { |
87
|
1
|
|
|
1
|
0
|
559
|
my ($self) = @_; |
88
|
|
|
|
|
|
|
|
89
|
1
|
|
|
|
|
4
|
$self->output($self->make_jquery_sync_script); |
90
|
|
|
|
|
|
|
|
91
|
1
|
|
|
|
|
3
|
return; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub make_jquery_sync_script { |
95
|
1
|
|
|
1
|
0
|
0
|
my ($self) = @_; |
96
|
|
|
|
|
|
|
|
97
|
1
|
|
|
|
|
4
|
my $joined_values |
98
|
|
|
|
|
|
|
= $self->jquery_escape( $self->join_values('ALL_VALUES') ); |
99
|
1
|
|
|
|
|
2
|
my $javascript |
100
|
|
|
|
|
|
|
= qq{jQuery('input:hidden[name=\\'v\\']').val('$joined_values');}; |
101
|
|
|
|
|
|
|
|
102
|
1
|
|
|
|
|
3
|
return $javascript; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
0
|
|
|
0
|
0
|
|
sub jquery_sync_script { $_[0]->make_jquery_sync_script(@_[1 .. $#_]) } |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
1; |
108
|
|
|
|
|
|
|
__END__ |