Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
I
i20rzslider
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jedife
i20rzslider
Commits
2fe464dd
Commit
2fe464dd
authored
Dec 12, 2013
by
Rafal Zajac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generate min nad css
parent
564b38d0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
rzslider.min.css
dist/rzslider.min.css
+1
-1
rzslider.min.js
dist/rzslider.min.js
+2
-2
No files found.
dist/rzslider.min.css
View file @
2fe464dd
/*! angularjs-slider - v0.0.1 - (c) Rafal Zajac <rzajac@gmail.com>, https://github.com/rzajac/angularjs-slider.git - 2013-12-1
1
*/
/*! angularjs-slider - v0.0.1 - (c) Rafal Zajac <rzajac@gmail.com>, https://github.com/rzajac/angularjs-slider.git - 2013-12-1
2
*/
rzslider
{
position
:
relative
;
display
:
inline-block
;
width
:
100%
;
height
:
2px
;
margin
:
30px
0
15px
0
;
vertical-align
:
middle
}
rzslider
span
{
position
:
absolute
;
display
:
inline-block
;
white-space
:
nowrap
}
rzslider
span
.base
{
width
:
100%
;
height
:
100%
;
padding
:
0
}
rzslider
span
.bar
{
z-index
:
0
;
width
:
100%
;
height
:
100%
;
background
:
#fff
}
rzslider
span
.bar.selection
{
z-index
:
1
;
width
:
0
;
background
:
#67b700
}
rzslider
span
.pointer
{
top
:
-15px
;
z-index
:
2
;
width
:
32px
;
height
:
32px
;
cursor
:
pointer
;
background-color
:
#fff
;
-webkit-border-radius
:
16px
;
-moz-border-radius
:
16px
;
border-radius
:
16px
}
rzslider
span
.pointer
:after
{
position
:
absolute
;
top
:
12px
;
left
:
12px
;
width
:
8px
;
height
:
8px
;
background
:
#71818e
;
-webkit-border-radius
:
4px
;
-moz-border-radius
:
4px
;
border-radius
:
4px
;
content
:
''
}
rzslider
span
.pointer
:hover:after
{
background-color
:
#67b700
}
rzslider
span
.pointer.active
:after
{
background-color
:
#67b700
}
rzslider
span
.bubble
{
top
:
-32px
;
padding
:
1px
3px
1px
3px
;
color
:
#67b700
;
cursor
:
default
}
rzslider
span
.bubble.selection
{
top
:
15px
}
\ No newline at end of file
dist/rzslider.min.js
View file @
2fe464dd
/*! angularjs-slider - v0.0.1 - (c) Rafal Zajac <rzajac@gmail.com>, https://github.com/rzajac/angularjs-slider.git - 2013-12-1
1
*/
angular
.
module
(
"rzModule"
,[]).
factory
(
"Slider"
,[
"$timeout"
,
"$document"
,
function
(
a
,
b
){
var
c
=
function
(
a
,
b
,
c
){
this
.
scope
=
a
,
this
.
attributes
=
c
,
this
.
element
=
b
,
this
.
range
=
void
0
===
c
.
rzSliderModel
&&
void
0
!==
c
.
rzSliderLow
&&
void
0
!==
c
.
rzSliderHigh
,
this
.
refLow
=
this
.
range
?
"rzSliderLow"
:
"rzSliderModel"
,
this
.
refHigh
=
"rzSliderHigh"
,
this
.
barWidth
=
0
,
this
.
ptrHalfWidth
=
0
,
this
.
minOffset
=
0
,
this
.
maxOffset
=
0
,
this
.
minValue
=
0
,
this
.
maxValue
=
0
,
this
.
valueRange
=
0
,
this
.
offsetRange
=
0
,
this
.
precision
=
0
,
this
.
step
=
0
,
this
.
tracking
=
""
,
this
.
fullBar
=
null
,
this
.
selBar
=
null
,
this
.
minPtr
=
null
,
this
.
maxPtr
=
null
,
this
.
selLab
=
null
,
this
.
flrLab
=
null
,
this
.
ceilLab
=
null
,
this
.
lowLab
=
null
,
this
.
highLab
=
null
,
this
.
cmbLab
=
null
,
this
.
init
()};
return
c
.
prototype
=
{
init
:
function
(){
var
b
=
this
;
void
0
===
this
.
attributes
.
rzSliderTranslate
&&
(
this
.
scope
.
rzSliderTranslate
=
function
(
a
){
return
a
.
value
}),
this
.
setMinAndMax
(),
this
.
valueRange
=
this
.
maxValue
-
this
.
minValue
,
this
.
precision
=
void
0
===
this
.
scope
.
rzSliderPrecision
?
0
:
+
this
.
scope
.
rzSliderPrecision
,
this
.
step
=
void
0
===
this
.
scope
.
rzSliderStep
?
1
:
+
this
.
scope
.
rzSliderStep
,
this
.
cacheElemHandles
(),
this
.
calcViewDimensions
(),
a
(
function
(){
b
.
setPointers
(),
b
.
adjustLabels
(),
b
.
bindToInputEvents
()}),
angular
.
element
(
window
).
on
(
"resize"
,
angular
.
bind
(
this
,
this
.
calcViewDimensions
)),
this
.
scope
.
$watch
(
this
.
refLow
,
function
(){
b
.
setPointers
(),
b
.
adjustLabels
()}),
this
.
range
&&
this
.
scope
.
$watch
(
this
.
refHigh
,
function
(){
b
.
setPointers
(),
b
.
adjustLabels
()}),
void
0
!==
this
.
scope
.
rzSliderFloor
&&
this
.
scope
.
$watch
(
"rzSliderFloor"
,
function
(){
b
.
setMinAndMax
(),
b
.
setPointers
(),
b
.
adjustLabels
()}),
void
0
!==
this
.
scope
.
rzSliderCeil
&&
this
.
scope
.
$watch
(
"rzSliderCeil"
,
function
(){
b
.
setMinAndMax
(),
b
.
setPointers
(),
b
.
adjustLabels
()})},
setMinAndMax
:
function
(){
this
.
minValue
=
void
0
===
this
.
scope
.
rzSliderFloor
?
0
:
+
this
.
scope
.
rzSliderFloor
,
this
.
maxValue
=
void
0
===
this
.
scope
.
rzSliderCeil
?
this
.
range
?
this
.
scope
[
this
.
refHigh
]:
this
.
scope
[
this
.
refLow
]:
+
this
.
scope
.
rzSliderCeil
},
cacheElemHandles
:
function
(){
angular
.
forEach
(
this
.
element
.
children
(),
function
(
a
,
b
){
var
c
=
angular
.
element
(
a
);
switch
(
b
){
case
0
:
this
.
fullBar
=
c
;
break
;
case
1
:
this
.
selBar
=
c
;
break
;
case
2
:
this
.
minPtr
=
c
;
break
;
case
3
:
this
.
maxPtr
=
c
;
break
;
case
4
:
this
.
selLab
=
c
;
break
;
case
5
:
this
.
flrLab
=
c
;
break
;
case
6
:
this
.
ceilLab
=
c
;
break
;
case
7
:
this
.
lowLab
=
c
;
break
;
case
8
:
this
.
highLab
=
c
;
break
;
case
9
:
this
.
cmbLab
=
c
}},
this
),
this
.
range
||
(
this
.
cmbLab
.
remove
(),
this
.
highLab
.
remove
(),
this
.
maxPtr
.
remove
(),
this
.
selBar
.
remove
(),
this
.
selLab
.
remove
())},
calcViewDimensions
:
function
(){
var
a
=
this
.
offsetWidth
(
this
.
minPtr
);
this
.
ptrHalfWidth
=
a
/
2
,
this
.
barWidth
=
this
.
offsetWidth
(
this
.
fullBar
),
this
.
minOffset
=
0
,
this
.
maxOffset
=
this
.
barWidth
-
a
,
this
.
offsetRange
=
this
.
maxOffset
-
this
.
minOffset
},
setPointers
:
function
(){
var
a
,
b
,
c
,
d
,
e
,
f
;
this
.
setLeft
(
this
.
ceilLab
,
this
.
barWidth
-
this
.
offsetWidth
(
this
.
ceilLab
)),
b
=
this
.
percentValue
(
this
.
scope
[
this
.
refLow
]),
c
=
this
.
setLeft
(
this
.
minPtr
,
this
.
percentToOffset
(
b
)),
this
.
setLeft
(
this
.
lowLab
,
c
-
this
.
halfOffsetWidth
(
this
.
lowLab
)
+
this
.
ptrHalfWidth
),
this
.
range
&&
(
a
=
this
.
percentValue
(
this
.
scope
[
this
.
refHigh
]),
d
=
this
.
setLeft
(
this
.
maxPtr
,
this
.
percentToOffset
(
a
)),
this
.
setLeft
(
this
.
highLab
,
d
-
this
.
halfOffsetWidth
(
this
.
highLab
)
+
this
.
ptrHalfWidth
),
e
=
this
.
setLeft
(
this
.
selBar
,
c
+
this
.
ptrHalfWidth
),
f
=
this
.
percentToOffset
(
a
-
b
),
this
.
selBar
.
css
({
width
:
f
+
"px"
}),
this
.
setLeft
(
this
.
cmbLab
,
e
+
f
/
2
-
this
.
halfOffsetWidth
(
this
.
cmbLab
)
+
1
),
this
.
setLeft
(
this
.
selLab
,
e
+
f
/
2
-
this
.
halfOffsetWidth
(
this
.
selLab
)
+
1
),
this
.
scope
.
rzSliderDiff
=
this
.
roundStep
(
this
.
scope
[
this
.
refHigh
]
-
this
.
scope
[
this
.
refLow
]))},
adjustLabels
:
function
(){
var
a
=
this
.
highLab
;
this
.
fitToBar
(
this
.
lowLab
),
this
.
range
&&
(
this
.
fitToBar
(
this
.
highLab
),
this
.
fitToBar
(
this
.
selLab
),
this
.
gap
(
this
.
lowLab
,
this
.
highLab
)
<
10
?(
this
.
hideEl
(
this
.
lowLab
),
this
.
hideEl
(
this
.
highLab
),
this
.
fitToBar
(
this
.
cmbLab
),
this
.
showEl
(
this
.
cmbLab
),
a
=
this
.
cmbLab
):(
this
.
showEl
(
this
.
lowLab
),
this
.
showEl
(
this
.
highLab
),
this
.
hideEl
(
this
.
cmbLab
),
a
=
this
.
highLab
)),
this
.
gap
(
this
.
flrLab
,
this
.
lowLab
)
<
5
?
this
.
hideEl
(
this
.
flrLab
):
this
.
range
?
this
.
gap
(
this
.
flrLab
,
a
)
<
5
?
this
.
hideEl
(
this
.
flrLab
):
this
.
showEl
(
this
.
flrLab
):
this
.
showEl
(
this
.
flrLab
),
this
.
gap
(
this
.
lowLab
,
this
.
ceilLab
)
<
5
?
this
.
hideEl
(
this
.
ceilLab
):
this
.
range
?
this
.
gap
(
a
,
this
.
ceilLab
)
<
5
?
this
.
hideEl
(
this
.
ceilLab
):
this
.
showEl
(
this
.
ceilLab
):
this
.
showEl
(
this
.
ceilLab
)},
roundStep
:
function
(
a
){
var
b
=
this
.
step
,
c
=
Math
.
pow
(
10
,
this
.
precision
),
d
=
(
a
-
this
.
minValue
)
%
b
,
e
=
d
>
b
/
2
?
a
+
b
-
d
:
a
-
d
;
return
+
(
e
*
c
/
c
).
toFixed
(
this
.
precision
)},
hideEl
:
function
(
a
){
return
a
.
css
({
opacity
:
0
})},
showEl
:
function
(
a
){
return
a
.
css
({
opacity
:
1
})},
offsetLeft
:
function
(
a
){
return
a
[
0
].
offsetLeft
},
offsetWidth
:
function
(
a
){
return
a
[
0
].
offsetWidth
},
halfOffsetWidth
:
function
(
a
){
return
a
[
0
].
offsetWidth
/
2
},
setLeft
:
function
(
a
,
b
){
return
a
.
css
({
left
:
b
+
"px"
}),
b
},
fitToBar
:
function
(
a
){
this
.
setLeft
(
a
,
Math
.
min
(
Math
.
max
(
0
,
this
.
offsetLeft
(
a
)),
this
.
barWidth
-
this
.
offsetWidth
(
a
)))},
gap
:
function
(
a
,
b
){
return
this
.
offsetLeft
(
b
)
-
this
.
offsetLeft
(
a
)
-
this
.
offsetWidth
(
a
)},
percentValue
:
function
(
a
){
return
(
a
-
this
.
minValue
)
/
this
.
valueRange
*
100
},
percentOffset
:
function
(
a
){
return
(
a
-
this
.
minOffset
)
/
this
.
offsetRange
*
100
},
percentToOffset
:
function
(
a
){
return
a
*
this
.
offsetRange
/
100
},
bindToInputEvents
:
function
(){
this
.
minPtr
.
on
(
"mousedown"
,
angular
.
bind
(
this
,
this
.
onStart
,
this
.
minPtr
,
this
.
refLow
)),
this
.
range
&&
this
.
maxPtr
.
on
(
"mousedown"
,
angular
.
bind
(
this
,
this
.
onStart
,
this
.
maxPtr
,
this
.
refHigh
)),
this
.
minPtr
.
on
(
"touchstart"
,
angular
.
bind
(
this
,
this
.
onStart
,
this
.
minPtr
,
this
.
refLow
)),
this
.
range
&&
this
.
maxPtr
.
on
(
"touchstart"
,
angular
.
bind
(
this
,
this
.
onStart
,
this
.
maxPtr
,
this
.
refHigh
))},
onStart
:
function
(
a
,
c
,
d
){
""
===
this
.
tracking
&&
(
this
.
tracking
=
c
,
a
.
addClass
(
"active"
),
d
.
stopPropagation
(),
d
.
preventDefault
(),
d
.
touches
?(
b
.
on
(
"touchmove"
,
angular
.
bind
(
this
,
this
.
onMove
)),
b
.
on
(
"touchend"
,
angular
.
bind
(
this
,
this
.
onEnd
,
a
))):(
b
.
on
(
"mousemove"
,
angular
.
bind
(
this
,
this
.
onMove
)),
b
.
on
(
"mouseup"
,
angular
.
bind
(
this
,
this
.
onEnd
,
a
))))},
onMove
:
function
(
a
){
var
b
,
c
,
d
,
e
=
a
.
clientX
||
a
.
touches
[
0
].
clientX
;
b
=
e
-
this
.
element
[
0
].
getBoundingClientRect
().
left
-
this
.
ptrHalfWidth
,
b
=
Math
.
max
(
Math
.
min
(
b
,
this
.
maxOffset
),
this
.
minOffset
),
c
=
this
.
percentOffset
(
b
),
d
=
this
.
minValue
+
this
.
valueRange
*
c
/
100
,
this
.
range
&&
(
this
.
tracking
===
this
.
refLow
&&
d
>=
this
.
scope
[
this
.
refHigh
]?(
this
.
tracking
=
this
.
refHigh
,
this
.
minPtr
.
removeClass
(
"active"
),
this
.
maxPtr
.
addClass
(
"active"
)):
d
<=
this
.
scope
[
this
.
refLow
]
&&
(
this
.
tracking
=
this
.
refLow
,
this
.
maxPtr
.
removeClass
(
"active"
),
this
.
minPtr
.
addClass
(
"active"
))),
this
.
scope
[
this
.
tracking
]
=
this
.
roundStep
(
d
),
this
.
setPointers
(),
this
.
adjustLabels
(),
this
.
scope
.
$apply
()},
onEnd
:
function
(
a
,
c
){
a
.
removeClass
(
"active"
),
c
.
touches
?(
b
.
unbind
(
"touchmove"
),
b
.
unbind
(
"touchend"
)):(
b
.
unbind
(
"mousemove"
),
b
.
unbind
(
"mouseup"
)),
this
.
tracking
=
""
}},
c
}]).
directive
(
"rzslider"
,[
"Slider"
,
function
(
a
){
return
{
restrict
:
"E"
,
scope
:{
rzSliderFloor
:
"=?"
,
rzSliderCeil
:
"=?"
,
rzSliderStep
:
"@"
,
rzSliderPrecision
:
"@"
,
rzSliderModel
:
"=?"
,
rzSliderLow
:
"=?"
,
rzSliderHigh
:
"=?"
,
rzSliderTranslate
:
"&"
},
template
:
'<span class="bar"></span><span class="bar selection"></span><span class="pointer"></span><span class="pointer"></span><span class="bubble selection"></span><span class="bubble limit" ng-bind="rzSliderTranslate({value: rzSliderFloor})"></span><span class="bubble limit" ng-bind="rzSliderTranslate({value: rzSliderCeil})" class="bubble limit"></span><span class="bubble"></span><span class="bubble"></span><span class="bubble"></span>'
,
compile
:
function
(
b
,
c
){
var
d
=
b
.
children
(),
e
=
void
0
===
c
.
rzSliderModel
&&
void
0
!==
c
.
rzSliderLow
&&
void
0
!==
c
.
rzSliderHigh
,
f
=
e
?
"rzSliderLow"
:
"rzSliderModel"
,
g
=
"rzSliderHigh"
;
return
c
.
rzSliderTranslate
&&
c
.
$set
(
"rzSliderTranslate"
,
""
+
c
.
rzSliderTranslate
+
"(value)"
),
angular
.
element
(
d
[
4
]).
attr
(
"ng-bind"
,
"rzSliderTranslate({value: rzSliderDiff})"
),
angular
.
element
(
d
[
7
]).
attr
(
"ng-bind"
,
"rzSliderTranslate({value: "
+
f
+
"})"
),
angular
.
element
(
d
[
8
]).
attr
(
"ng-bind"
,
"rzSliderTranslate({value: "
+
g
+
"})"
),
angular
.
element
(
d
[
9
]).
attr
(
"ng-bind-html"
,
"rzSliderTranslate({value: "
+
f
+
'}) + " - " + rzSliderTranslate({value: '
+
g
+
"})"
),{
post
:
function
(
b
,
c
,
d
){
return
new
a
(
b
,
c
,
d
)}}}}}]);
/*! angularjs-slider - v0.0.1 - (c) Rafal Zajac <rzajac@gmail.com>, https://github.com/rzajac/angularjs-slider.git - 2013-12-1
2
*/
angular
.
module
(
"rzModule"
,[]).
value
(
"throttle"
,
function
(
a
,
b
,
c
){
var
d
,
e
,
f
,
g
=
Date
.
now
||
function
(){
return
(
new
Date
).
getTime
()},
h
=
null
,
i
=
0
;
c
||
(
c
=
{});
var
j
=
function
(){
i
=
c
.
leading
===!
1
?
0
:
g
(),
h
=
null
,
f
=
a
.
apply
(
d
,
e
),
d
=
e
=
null
};
return
function
(){
var
k
=
g
();
i
||
c
.
leading
!==!
1
||
(
i
=
k
);
var
l
=
b
-
(
k
-
i
);
return
d
=
this
,
e
=
arguments
,
0
>=
l
?(
clearTimeout
(
h
),
h
=
null
,
i
=
k
,
f
=
a
.
apply
(
d
,
e
),
d
=
e
=
null
):
h
||
c
.
trailing
===!
1
||
(
h
=
setTimeout
(
j
,
l
)),
f
}}).
factory
(
"Slider"
,[
"$timeout"
,
"$document"
,
"throttle"
,
function
(
a
,
b
,
c
){
var
d
=
function
(
a
,
b
,
c
){
this
.
scope
=
a
,
this
.
attributes
=
c
,
this
.
element
=
b
,
this
.
range
=
void
0
===
c
.
rzSliderModel
&&
void
0
!==
c
.
rzSliderLow
&&
void
0
!==
c
.
rzSliderHigh
,
this
.
refLow
=
this
.
range
?
"rzSliderLow"
:
"rzSliderModel"
,
this
.
refHigh
=
"rzSliderHigh"
,
this
.
barWidth
=
0
,
this
.
ptrHalfWidth
=
0
,
this
.
minOffset
=
0
,
this
.
maxOffset
=
0
,
this
.
minValue
=
0
,
this
.
maxValue
=
0
,
this
.
highValOffsetPerc
=
0
,
this
.
lowValOffsetPerc
=
0
,
this
.
valueRange
=
0
,
this
.
offsetRange
=
0
,
this
.
precision
=
0
,
this
.
step
=
0
,
this
.
tracking
=
""
,
this
.
fullBar
=
null
,
this
.
selBar
=
null
,
this
.
minPtr
=
null
,
this
.
maxPtr
=
null
,
this
.
selLab
=
null
,
this
.
flrLab
=
null
,
this
.
ceilLab
=
null
,
this
.
lowLab
=
null
,
this
.
highLab
=
null
,
this
.
cmbLab
=
null
,
this
.
init
()};
return
d
.
prototype
=
{
init
:
function
(){
var
b
=
this
;
void
0
===
this
.
attributes
.
rzSliderTranslate
&&
(
this
.
scope
.
rzSliderTranslate
=
function
(
a
){
return
a
.
value
}),
this
.
setMinAndMax
(),
this
.
valueRange
=
this
.
maxValue
-
this
.
minValue
,
this
.
precision
=
void
0
===
this
.
scope
.
rzSliderPrecision
?
0
:
+
this
.
scope
.
rzSliderPrecision
,
this
.
step
=
void
0
===
this
.
scope
.
rzSliderStep
?
1
:
+
this
.
scope
.
rzSliderStep
,
this
.
cacheElemHandles
(),
this
.
calcViewDimensions
(),
a
(
function
(){
b
.
updateHandles
(
"both"
),
b
.
adjustLabels
(
"timeout"
),
b
.
bindToInputEvents
()}),
angular
.
element
(
window
).
on
(
"resize"
,
angular
.
bind
(
this
,
this
.
calcViewDimensions
)),
this
.
scope
.
$watch
(
this
.
refLow
,
function
(){
b
.
updateHandles
(
"low"
),
b
.
adjustLabels
(
"refLow"
)}),
this
.
range
&&
this
.
scope
.
$watch
(
this
.
refHigh
,
function
(){
b
.
updateHandles
(
"high"
),
b
.
adjustLabels
(
"refHigh"
)}),
void
0
!==
this
.
scope
.
rzSliderFloor
&&
this
.
scope
.
$watch
(
"rzSliderFloor"
,
function
(){
b
.
setMinAndMax
(),
b
.
updateHandles
(
"both"
),
b
.
adjustLabels
(
"floor"
)}),
void
0
!==
this
.
scope
.
rzSliderCeil
&&
this
.
scope
.
$watch
(
"rzSliderCeil"
,
function
(){
b
.
setMinAndMax
(),
b
.
updateHandles
(
"both"
),
b
.
adjustLabels
(
"ceil"
)})},
setMinAndMax
:
function
(){
this
.
minValue
=
void
0
===
this
.
scope
.
rzSliderFloor
?
0
:
+
this
.
scope
.
rzSliderFloor
,
this
.
maxValue
=
void
0
===
this
.
scope
.
rzSliderCeil
?
this
.
range
?
this
.
scope
[
this
.
refHigh
]:
this
.
scope
[
this
.
refLow
]:
+
this
.
scope
.
rzSliderCeil
},
cacheElemHandles
:
function
(){
angular
.
forEach
(
this
.
element
.
children
(),
function
(
a
,
b
){
var
c
=
angular
.
element
(
a
);
switch
(
b
){
case
0
:
this
.
fullBar
=
c
;
break
;
case
1
:
this
.
selBar
=
c
;
break
;
case
2
:
this
.
minPtr
=
c
;
break
;
case
3
:
this
.
maxPtr
=
c
;
break
;
case
4
:
this
.
selLab
=
c
;
break
;
case
5
:
this
.
flrLab
=
c
;
break
;
case
6
:
this
.
ceilLab
=
c
;
break
;
case
7
:
this
.
lowLab
=
c
;
break
;
case
8
:
this
.
highLab
=
c
;
break
;
case
9
:
this
.
cmbLab
=
c
}},
this
),
this
.
range
||
(
this
.
cmbLab
.
remove
(),
this
.
highLab
.
remove
(),
this
.
maxPtr
.
remove
(),
this
.
selBar
.
remove
(),
this
.
selLab
.
remove
())},
calcViewDimensions
:
function
(){
var
a
=
this
.
offsetWidth
(
this
.
minPtr
);
this
.
ptrHalfWidth
=
a
/
2
,
this
.
barWidth
=
this
.
offsetWidth
(
this
.
fullBar
),
this
.
minOffset
=
0
,
this
.
maxOffset
=
this
.
barWidth
-
a
,
this
.
offsetRange
=
this
.
maxOffset
-
this
.
minOffset
,
this
.
setLeft
(
this
.
ceilLab
,
this
.
barWidth
-
this
.
offsetWidth
(
this
.
ceilLab
))},
updateHandles
:
function
(
a
){
return
"low"
===
a
?(
this
.
updateLowHandle
(),
this
.
range
&&
this
.
updateSelectionBar
(),
void
0
):
"high"
===
a
?(
this
.
updateHighHandle
(),
this
.
range
&&
this
.
updateSelectionBar
(),
void
0
):(
this
.
updateLowHandle
(),
this
.
updateHighHandle
(),
this
.
updateSelectionBar
(),
void
0
)},
updateLowHandle
:
function
(){
var
a
;
this
.
lowValOffsetPerc
=
this
.
percentValue
(
this
.
scope
[
this
.
refLow
]),
a
=
this
.
setLeft
(
this
.
minPtr
,
this
.
percentToOffset
(
this
.
lowValOffsetPerc
)),
this
.
setLeft
(
this
.
lowLab
,
a
-
this
.
halfOffsetWidth
(
this
.
lowLab
)
+
this
.
ptrHalfWidth
)},
updateHighHandle
:
function
(){
var
a
;
this
.
highValOffsetPerc
=
this
.
percentValue
(
this
.
scope
[
this
.
refHigh
]),
a
=
this
.
setLeft
(
this
.
maxPtr
,
this
.
percentToOffset
(
this
.
highValOffsetPerc
)),
this
.
setLeft
(
this
.
highLab
,
a
-
this
.
halfOffsetWidth
(
this
.
highLab
)
+
this
.
ptrHalfWidth
)},
updateSelectionBar
:
function
(){
var
a
,
b
;
a
=
this
.
setLeft
(
this
.
selBar
,
this
.
percentToOffset
(
this
.
lowValOffsetPerc
)
+
this
.
ptrHalfWidth
),
b
=
this
.
percentToOffset
(
this
.
highValOffsetPerc
-
this
.
lowValOffsetPerc
),
this
.
selBar
.
css
({
width
:
b
+
"px"
}),
this
.
setLeft
(
this
.
cmbLab
,
a
+
b
/
2
-
this
.
halfOffsetWidth
(
this
.
cmbLab
)
+
1
),
this
.
setLeft
(
this
.
selLab
,
a
+
b
/
2
-
this
.
halfOffsetWidth
(
this
.
selLab
)
+
1
),
this
.
scope
.
rzSliderDiff
=
this
.
roundStep
(
this
.
scope
[
this
.
refHigh
]
-
this
.
scope
[
this
.
refLow
])},
adjustLabels
:
function
(){
var
a
=
this
.
highLab
;
this
.
fitToBar
(
this
.
lowLab
),
this
.
range
&&
(
this
.
fitToBar
(
this
.
highLab
),
this
.
fitToBar
(
this
.
selLab
),
this
.
gap
(
this
.
lowLab
,
this
.
highLab
)
<
10
?(
this
.
hideEl
(
this
.
lowLab
),
this
.
hideEl
(
this
.
highLab
),
this
.
fitToBar
(
this
.
cmbLab
),
this
.
showEl
(
this
.
cmbLab
),
a
=
this
.
cmbLab
):(
this
.
showEl
(
this
.
lowLab
),
this
.
showEl
(
this
.
highLab
),
this
.
hideEl
(
this
.
cmbLab
),
a
=
this
.
highLab
)),
this
.
gap
(
this
.
flrLab
,
this
.
lowLab
)
<
5
?
this
.
hideEl
(
this
.
flrLab
):
this
.
range
?
this
.
gap
(
this
.
flrLab
,
a
)
<
5
?
this
.
hideEl
(
this
.
flrLab
):
this
.
showEl
(
this
.
flrLab
):
this
.
showEl
(
this
.
flrLab
),
this
.
gap
(
this
.
lowLab
,
this
.
ceilLab
)
<
5
?
this
.
hideEl
(
this
.
ceilLab
):
this
.
range
?
this
.
gap
(
a
,
this
.
ceilLab
)
<
5
?
this
.
hideEl
(
this
.
ceilLab
):
this
.
showEl
(
this
.
ceilLab
):
this
.
showEl
(
this
.
ceilLab
),
"timeout"
===
arguments
[
0
]
&&
(
d
.
prototype
.
adjustLabels
=
c
(
d
.
prototype
.
adjustLabels
,
350
))},
roundStep
:
function
(
a
){
var
b
=
this
.
step
,
c
=
Math
.
pow
(
10
,
this
.
precision
),
d
=
(
a
-
this
.
minValue
)
%
b
,
e
=
d
>
b
/
2
?
a
+
b
-
d
:
a
-
d
;
return
+
(
e
*
c
/
c
).
toFixed
(
this
.
precision
)},
hideEl
:
function
(
a
){
return
a
.
css
({
opacity
:
0
})},
showEl
:
function
(
a
){
return
a
.
css
({
opacity
:
1
})},
offsetLeft
:
function
(
a
){
return
a
[
0
].
offsetLeft
},
offsetWidth
:
function
(
a
){
return
a
[
0
].
offsetWidth
},
halfOffsetWidth
:
function
(
a
){
return
a
[
0
].
offsetWidth
/
2
},
setLeft
:
function
(
a
,
b
){
return
a
.
css
({
left
:
b
+
"px"
}),
b
},
fitToBar
:
function
(
a
){
this
.
setLeft
(
a
,
Math
.
min
(
Math
.
max
(
0
,
this
.
offsetLeft
(
a
)),
this
.
barWidth
-
this
.
offsetWidth
(
a
)))},
gap
:
function
(
a
,
b
){
return
this
.
offsetLeft
(
b
)
-
this
.
offsetLeft
(
a
)
-
this
.
offsetWidth
(
a
)},
percentValue
:
function
(
a
){
return
(
a
-
this
.
minValue
)
/
this
.
valueRange
*
100
},
percentOffset
:
function
(
a
){
return
(
a
-
this
.
minOffset
)
/
this
.
offsetRange
*
100
},
percentToOffset
:
function
(
a
){
return
a
*
this
.
offsetRange
/
100
},
bindToInputEvents
:
function
(){
this
.
minPtr
.
on
(
"mousedown"
,
angular
.
bind
(
this
,
this
.
onStart
,
this
.
minPtr
,
this
.
refLow
)),
this
.
range
&&
this
.
maxPtr
.
on
(
"mousedown"
,
angular
.
bind
(
this
,
this
.
onStart
,
this
.
maxPtr
,
this
.
refHigh
)),
this
.
minPtr
.
on
(
"touchstart"
,
angular
.
bind
(
this
,
this
.
onStart
,
this
.
minPtr
,
this
.
refLow
)),
this
.
range
&&
this
.
maxPtr
.
on
(
"touchstart"
,
angular
.
bind
(
this
,
this
.
onStart
,
this
.
maxPtr
,
this
.
refHigh
))},
onStart
:
function
(
a
,
c
,
d
){
var
e
;
if
(
""
===
this
.
tracking
){
switch
(
this
.
tracking
=
c
,
c
){
case
"rzSliderModel"
:
case
"rzSliderLow"
:
e
=
"low"
;
break
;
case
"rzSliderHigh"
:
e
=
"high"
}
a
.
addClass
(
"active"
),
d
.
stopPropagation
(),
d
.
preventDefault
(),
d
.
touches
?(
b
.
on
(
"touchmove"
,
angular
.
bind
(
this
,
this
.
onMove
,
e
)),
b
.
on
(
"touchend"
,
angular
.
bind
(
this
,
this
.
onEnd
,
a
))):(
b
.
on
(
"mousemove"
,
angular
.
bind
(
this
,
this
.
onMove
,
e
)),
b
.
on
(
"mouseup"
,
angular
.
bind
(
this
,
this
.
onEnd
,
a
)))}},
onMove
:
function
(
a
,
b
){
var
c
,
d
,
e
,
f
=
b
.
clientX
||
b
.
touches
[
0
].
clientX
;
c
=
f
-
this
.
element
[
0
].
getBoundingClientRect
().
left
-
this
.
ptrHalfWidth
,
c
=
Math
.
max
(
Math
.
min
(
c
,
this
.
maxOffset
),
this
.
minOffset
),
d
=
this
.
percentOffset
(
c
),
e
=
this
.
minValue
+
this
.
valueRange
*
d
/
100
,
this
.
range
&&
(
this
.
tracking
===
this
.
refLow
&&
e
>=
this
.
scope
[
this
.
refHigh
]?(
this
.
scope
[
this
.
tracking
]
=
this
.
scope
[
this
.
refHigh
],
this
.
tracking
=
this
.
refHigh
,
this
.
minPtr
.
removeClass
(
"active"
),
this
.
maxPtr
.
addClass
(
"active"
)):
e
<=
this
.
scope
[
this
.
refLow
]
&&
(
this
.
scope
[
this
.
tracking
]
=
this
.
scope
[
this
.
refLow
],
this
.
tracking
=
this
.
refLow
,
this
.
maxPtr
.
removeClass
(
"active"
),
this
.
minPtr
.
addClass
(
"active"
))),
this
.
scope
[
this
.
tracking
]
=
this
.
roundStep
(
e
),
this
.
updateHandles
(
a
),
this
.
adjustLabels
(
"onMove"
),
this
.
scope
.
$apply
()},
onEnd
:
function
(
a
,
c
){
a
.
removeClass
(
"active"
),
c
.
touches
?(
b
.
unbind
(
"touchmove"
),
b
.
unbind
(
"touchend"
)):(
b
.
unbind
(
"mousemove"
),
b
.
unbind
(
"mouseup"
)),
this
.
tracking
=
""
}},
d
}]).
directive
(
"rzslider"
,[
"Slider"
,
function
(
a
){
return
{
restrict
:
"E"
,
scope
:{
rzSliderFloor
:
"=?"
,
rzSliderCeil
:
"=?"
,
rzSliderStep
:
"@"
,
rzSliderPrecision
:
"@"
,
rzSliderModel
:
"=?"
,
rzSliderLow
:
"=?"
,
rzSliderHigh
:
"=?"
,
rzSliderTranslate
:
"&"
},
template
:
'<span class="bar"></span><span class="bar selection"></span><span class="pointer"></span><span class="pointer"></span><span class="bubble selection"></span><span class="bubble limit" ng-bind="rzSliderTranslate({value: rzSliderFloor})"></span><span class="bubble limit" ng-bind="rzSliderTranslate({value: rzSliderCeil})" class="bubble limit"></span><span class="bubble"></span><span class="bubble"></span><span class="bubble"></span>'
,
compile
:
function
(
b
,
c
){
var
d
=
b
.
children
(),
e
=
void
0
===
c
.
rzSliderModel
&&
void
0
!==
c
.
rzSliderLow
&&
void
0
!==
c
.
rzSliderHigh
,
f
=
e
?
"rzSliderLow"
:
"rzSliderModel"
,
g
=
"rzSliderHigh"
;
return
c
.
rzSliderTranslate
&&
c
.
$set
(
"rzSliderTranslate"
,
""
+
c
.
rzSliderTranslate
+
"(value)"
),
angular
.
element
(
d
[
4
]).
attr
(
"ng-bind"
,
"rzSliderTranslate({value: rzSliderDiff})"
),
angular
.
element
(
d
[
7
]).
attr
(
"ng-bind"
,
"rzSliderTranslate({value: "
+
f
+
"})"
),
angular
.
element
(
d
[
8
]).
attr
(
"ng-bind"
,
"rzSliderTranslate({value: "
+
g
+
"})"
),
angular
.
element
(
d
[
9
]).
attr
(
"ng-bind-html"
,
"rzSliderTranslate({value: "
+
f
+
'}) + " - " + rzSliderTranslate({value: '
+
g
+
"})"
),{
post
:
function
(
b
,
c
,
d
){
return
new
a
(
b
,
c
,
d
)}}}}}]);
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment