line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tags::HTML::GradientIndicator; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
150067
|
use strict; |
|
4
|
|
|
|
|
33
|
|
|
4
|
|
|
|
|
116
|
|
4
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
109
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
1047
|
use Class::Utils qw(set_params); |
|
4
|
|
|
|
|
61083
|
|
|
4
|
|
|
|
|
119
|
|
7
|
4
|
|
|
4
|
|
148
|
use Error::Pure qw(err); |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
1599
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = 0.02; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Constructor. |
12
|
|
|
|
|
|
|
sub new { |
13
|
7
|
|
|
7
|
1
|
6457
|
my ($class, @params) = @_; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Create object. |
16
|
7
|
|
|
|
|
19
|
my $self = bless {}, $class; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# 'CSS::Struct::Output' object. |
19
|
7
|
|
|
|
|
19
|
$self->{'css'} = undef; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Default gradient is left-right direction from red to violet. |
22
|
7
|
|
|
|
|
15
|
$self->{'css_background_image'} = 'linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet)'; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Gradient CSS class. |
25
|
7
|
|
|
|
|
13
|
$self->{'css_gradient_class'} = 'gradient'; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Height. |
28
|
7
|
|
|
|
|
14
|
$self->{'height'} = 30; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Unit. |
31
|
7
|
|
|
|
|
11
|
$self->{'unit'} = 'px'; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# Width. |
34
|
7
|
|
|
|
|
15
|
$self->{'width'} = 500; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# 'Tags::Output' object. |
37
|
7
|
|
|
|
|
11
|
$self->{'tags'} = undef; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Process params. |
40
|
7
|
|
|
|
|
22
|
set_params($self, @params); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# Check to 'CSS::Struct::Output' object. |
43
|
7
|
100
|
100
|
|
|
109
|
if ($self->{'css'} && ! $self->{'css'}->isa('CSS::Struct::Output')) { |
44
|
1
|
|
|
|
|
5
|
err "Parameter 'css' must be a 'CSS::Struct::Output::*' class."; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# Check to 'Tags' object. |
48
|
6
|
100
|
100
|
|
|
46
|
if (! $self->{'tags'} || ! $self->{'tags'}->isa('Tags::Output')) { |
49
|
2
|
|
|
|
|
8
|
err "Parameter 'tags' must be a 'Tags::Output::*' class."; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# Object. |
53
|
4
|
|
|
|
|
27
|
return $self; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Process 'Tags'. |
57
|
|
|
|
|
|
|
sub process { |
58
|
3
|
|
|
3
|
1
|
3353
|
my ($self, $percent_value) = @_; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# Value. |
61
|
3
|
|
|
|
|
10
|
my $value = $percent_value * ($self->{'width'} / 100); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# Main stars. |
64
|
|
|
|
|
|
|
$self->{'tags'}->put( |
65
|
|
|
|
|
|
|
['b', 'div'], |
66
|
|
|
|
|
|
|
['a', 'style', 'width: '.$value.$self->{'unit'}.';overflow: hidden;'], |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
['b', 'div'], |
69
|
3
|
|
|
|
|
33
|
['a', 'class', $self->{'css_gradient_class'}], |
70
|
|
|
|
|
|
|
['e', 'div'], |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
['e', 'div'], |
73
|
|
|
|
|
|
|
); |
74
|
|
|
|
|
|
|
|
75
|
3
|
|
|
|
|
562
|
return; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# Process 'CSS::Struct'. |
79
|
|
|
|
|
|
|
sub process_css { |
80
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
$self->{'css'}->put( |
83
|
|
|
|
|
|
|
['s', '.'.$self->{'css_gradient_class'}], |
84
|
|
|
|
|
|
|
['d', 'height', $self->{'height'}.$self->{'unit'}], |
85
|
|
|
|
|
|
|
['d', 'width', $self->{'width'}.$self->{'unit'}], |
86
|
|
|
|
|
|
|
['d', 'background-color', 'red'], |
87
|
0
|
|
|
|
|
|
['d', 'background-image', $self->{'css_background_image'}], |
88
|
|
|
|
|
|
|
['e'], |
89
|
|
|
|
|
|
|
); |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
return; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
__END__ |