line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::FormWidgets::Slider; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
897
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
48
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
5
|
1
|
|
|
1
|
|
19
|
use parent 'HTML::FormWidgets'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors( qw(config display) ); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub init { |
10
|
1
|
|
|
1
|
1
|
3
|
my ($self, $args) = @_; |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
|
|
9
|
$self->config ( { knob_class => q(".knob"), |
13
|
|
|
|
|
|
|
mode => q("horizontal"), |
14
|
|
|
|
|
|
|
offset => 0, |
15
|
|
|
|
|
|
|
range => 'false', |
16
|
|
|
|
|
|
|
snap => 'true', |
17
|
|
|
|
|
|
|
steps => 100, |
18
|
|
|
|
|
|
|
wheel => 'true', } ); |
19
|
1
|
|
|
|
|
12
|
$self->default( 50 ); |
20
|
1
|
|
|
|
|
6
|
$self->display( 1 ); |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
5
|
return; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub render_field { |
26
|
1
|
|
|
1
|
1
|
2
|
my ($self, $args) = @_; |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
5
|
my $hacc = $self->hacc; |
29
|
1
|
|
|
|
|
5
|
my $id = $args->{name}.'_slider'; |
30
|
1
|
|
|
|
|
5
|
my $size = int ((log $self->config->{steps}) / (log 10)); |
31
|
1
|
|
|
|
|
7
|
my $html = q(); |
32
|
1
|
|
|
|
|
1
|
my $text; |
33
|
|
|
|
|
|
|
|
34
|
1
|
50
|
|
|
|
4
|
if ($self->display) { |
35
|
1
|
|
|
|
|
16
|
$html .= $hacc->textfield( { class => 'ifield numeric', |
36
|
|
|
|
|
|
|
name => $args->{name}, |
37
|
|
|
|
|
|
|
readonly => 'readonly', |
38
|
|
|
|
|
|
|
size => $size, |
39
|
|
|
|
|
|
|
value => $args->{default} } ); |
40
|
|
|
|
|
|
|
} |
41
|
0
|
|
|
|
|
0
|
else { $self->add_hidden( $args->{name}, $args->{default} ) } |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
|
|
74
|
$text = $hacc->span( { class => 'knob' } ); |
44
|
1
|
|
|
|
|
34
|
$text = $hacc->span( { class => 'slider', id => $id }, $text ); |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
28
|
for (0 .. 10) { |
47
|
11
|
|
|
|
|
282
|
my $style = 'left: '.(-1 + $_ * 20).'px;'; |
48
|
|
|
|
|
|
|
|
49
|
11
|
|
|
|
|
70
|
$text .= $hacc->span( { class => 'tick', style => $style } ); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
33
|
$html .= $hacc->span( { class => 'slider_group' }, $text ); |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
|
|
33
|
$self->config->{default_v} = $args->{default}; |
55
|
1
|
|
|
|
|
10
|
$self->config->{name } = '"'.$args->{name}.'"'; |
56
|
|
|
|
|
|
|
|
57
|
1
|
|
|
|
|
7
|
$self->add_literal_js( 'sliders', $id, $self->config ); |
58
|
|
|
|
|
|
|
|
59
|
1
|
|
|
|
|
4
|
return $html; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__END__ |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# Local Variables: |
67
|
|
|
|
|
|
|
# mode: perl |
68
|
|
|
|
|
|
|
# tab-width: 3 |
69
|
|
|
|
|
|
|
# End: |
70
|
|
|
|
|
|
|
|