No regular expressions were active.
|
|
1 |
|
(function(
$) {
|
|
|
2 |
|
|
|
|
3 |
|
|
|
|
4 |
|
//Web
Forms 2.0
|
|
|
5 |
|
window
.webforms
= 1;
|
|
|
6 |
|
if(win
dow['webfo
rms']) {
|
|
|
7 |
|
$(
document).
ready(func
tion() {
|
|
|
8 |
|
|
|
|
9 |
|
$("input
").each(fu
nction() {
|
|
|
10 |
|
if(t
his.getAtt
ribute("ty
pe") == "r
ange") {
|
|
|
11 |
|
var cur =
$(this);
|
|
|
12 |
|
var slider
= $("<div
class='ui
-slider'><
/div>").cs
s({ width:
cur.inner
Width()+"p
x", height
: cur.inne
rHeight()+
"px" }).in
sertAfter(
cur);
|
|
|
13 |
|
var handle
= $("<div
class='ui
-slider-ha
ndle'></di
v>").appen
dTo(slider
);
|
|
|
14 |
|
|
|
|
15 |
|
|
|
|
16 |
|
slider.css
({
|
|
|
17 |
|
"posit
ion": cur.
css("posit
ion") == "
absolute"
? "absolut
e" : "rela
tive",
|
|
|
18 |
|
"left"
: cur.css(
"left"),
|
|
|
19 |
|
"right
": cur.css
("right"),
|
|
|
20 |
|
"zInde
x": cur.cs
s("zIndex"
),
|
|
|
21 |
|
"float
": cur.css
("float"),
|
|
|
22 |
|
"clear
": cur.css
("clear")
|
|
|
23 |
|
});
|
|
|
24 |
|
cur.css({
position:
"absolute"
, opacity:
0, top: "
-1000px",
left: "-10
00px" });
|
|
|
25 |
|
|
|
|
26 |
|
slider.sli
der({
|
|
|
27 |
|
maxVal
ue: cur.at
tr("max"),
|
|
|
28 |
|
minVal
ue: cur.at
tr("min"),
|
|
|
29 |
|
startV
alue: this
.getAttrib
ute("value
"),
|
|
|
30 |
|
steppi
ng: cur.at
tr("step")
,
|
|
|
31 |
|
change
: function
(e, ui) {
cur[0].val
ue = ui.va
lue; cur[0
].setAttri
bute("valu
e", ui.val
ue); }
|
|
|
32 |
|
});
|
|
|
33 |
|
|
|
|
34 |
|
slider = s
lider.slid
erInstance
();
|
|
|
35 |
|
|
|
|
36 |
|
cur.bind("
keydown",
function(e
) {
|
|
|
37 |
|
var o
= slider.i
nteraction
.options;
|
|
|
38 |
|
switch
(e.keyCode
) {
|
|
|
39 |
|
ca
se 37:
|
|
|
40 |
|
slider.m
oveTo(slid
er.interac
tion.curVa
lue+o.minV
alue-(o.st
epping ||
1));
|
|
|
41 |
|
break;
|
|
|
42 |
|
ca
se 39:
|
|
|
43 |
|
slider.m
oveTo(slid
er.interac
tion.curVa
lue+o.minV
alue+(o.st
epping ||
1));
|
|
|
44 |
|
break;
|
|
|
45 |
|
}
|
|
|
46 |
|
if(e.k
eyCode !=
9) return
false;
|
|
|
47 |
|
});
|
|
|
48 |
|
|
|
|
49 |
|
};
|
|
|
50 |
|
});
|
|
|
51 |
|
|
|
|
52 |
|
})
;
|
|
|
53 |
|
}
|
|
|
54 |
|
|
|
|
55 |
|
//Make
nodes sel
ectable by
expressio
n
|
|
|
56 |
|
$.exte
nd($.expr[
':'], { sl
ider: "('
'+a.classN
ame+' ').i
ndexOf(' u
i-slider '
)" });
|
|
|
57 |
|
|
|
|
58 |
|
$.fn.s
lider = fu
nction(o)
{
|
|
|
59 |
|
re
turn this.
each(funct
ion() {
|
|
|
60 |
|
new $.ui
.slider(th
is, o);
|
|
|
61 |
|
})
;
|
|
|
62 |
|
}
|
|
|
63 |
|
|
|
|
64 |
|
//Macr
os for ext
ernal meth
ods that s
upport cha
ining
|
|
|
65 |
|
var me
thods = "d
estroy,ena
ble,disabl
e,moveTo".
split(",")
;
|
|
|
66 |
|
for(va
r i=0;i<me
thods.leng
th;i++) {
|
|
|
67 |
|
va
r cur = me
thods[i],
f;
|
|
|
68 |
|
ev
al('f = fu
nction() {
var a = a
rguments;
return thi
s.each(fun
ction() {
if(jQuery(
this).is("
.ui-slider
")) jQuery
.data(this
, "ui-slid
er")["'+cu
r+'"](a);
}); }');
|
|
|
69 |
|
$.
fn["slider
"+cur.subs
tr(0,1).to
UpperCase(
)+cur.subs
tr(1)] = f
;
|
|
|
70 |
|
};
|
|
|
71 |
|
|
|
|
72 |
|
//get
instance m
ethod
|
|
|
73 |
|
$.fn.s
liderInsta
nce = func
tion() {
|
|
|
74 |
|
if
($(this[0]
).is(".ui-
slider"))
return $.d
ata(this[0
], "ui-sli
der");
|
|
|
75 |
|
re
turn false
;
|
|
|
76 |
|
};
|
|
|
77 |
|
|
|
|
78 |
|
$.ui.s
lider = fu
nction(el,
o) {
|
|
|
79 |
|
|
|
|
80 |
|
va
r options
= {};
|
|
|
81 |
|
o
= o || {};
|
|
|
82 |
|
$.
extend(opt
ions, o);
|
|
|
83 |
|
$.
extend(opt
ions, {
|
|
|
84 |
|
axis: o.
axis || (e
l.offsetWi
dth < el.o
ffsetHeigh
t ? 'verti
cal' : 'ho
rizontal')
,
|
|
|
85 |
|
maxValue
: parseInt
(o.maxValu
e) || 100,
|
|
|
86 |
|
minValue
: parseInt
(o.minValu
e) || 0,
|
|
|
87 |
|
startVal
ue: parseI
nt(o.start
Value) ||
0,
|
|
|
88 |
|
_start:
function(h
, p, c, t,
e) {
|
|
|
89 |
|
self
.start.app
ly(t, [sel
f, e]); //
Trigger t
he start c
allback
|
|
|
90 |
|
},
|
|
|
91 |
|
_beforeS
top: funct
ion(h, p,
c, t, e) {
|
|
|
92 |
|
self
.stop.appl
y(t, [self
, e]); //
Trigger th
e start ca
llback
|
|
|
93 |
|
},
|
|
|
94 |
|
_drag: f
unction(h,
p, c, t,
e) {
|
|
|
95 |
|
self
.drag.appl
y(t, [self
, e]); //
Trigger th
e start ca
llback
|
|
|
96 |
|
},
|
|
|
97 |
|
startCon
dition: fu
nction() {
|
|
|
98 |
|
retu
rn !self.d
isabled;
|
|
|
99 |
|
}
|
|
|
100 |
|
})
;
|
|
|
101 |
|
|
|
|
102 |
|
va
r self = t
his;
|
|
|
103 |
|
va
r o = opti
ons;
|
|
|
104 |
|
$.
data(el, "
ui-slider"
, this);
|
|
|
105 |
|
o.
stepping =
parseInt(
o.stepping
) || (o.st
eps ? o.ma
xValue/o.s
teps : 0);
|
|
|
106 |
|
o.
realValue
= (o.maxVa
lue - o.mi
nValue);
|
|
|
107 |
|
|
|
|
108 |
|
|
|
|
109 |
|
th
is.handle
= options.
handle ? $
(options.h
andle, el)
: $('.ui-
slider-han
dle', el);
|
|
|
110 |
|
if
(this.hand
le.length
== 1) {
|
|
|
111 |
|
this.int
eraction =
new $.ui.
mouseInter
action(thi
s.handle[0
], options
);
|
|
|
112 |
|
this.mul
tipleHandl
es = false
;
|
|
|
113 |
|
}
else {
|
|
|
114 |
|
this.int
eractions
= [];
|
|
|
115 |
|
this.han
dle.each(f
unction()
{
|
|
|
116 |
|
self
.interacti
ons.push(n
ew $.ui.mo
useInterac
tion(this,
options))
;
|
|
|
117 |
|
});
|
|
|
118 |
|
this.mul
tipleHandl
es = true;
|
|
|
119 |
|
}
|
|
|
120 |
|
|
|
|
121 |
|
th
is.element
= el;
|
|
|
122 |
|
$(
this.eleme
nt).addCla
ss("ui-sli
der");
|
|
|
123 |
|
|
|
|
124 |
|
|
|
|
125 |
|
if
(o.axis ==
'horizont
al') {
|
|
|
126 |
|
this.par
entSize =
$(this.ele
ment).oute
rWidth() -
this.hand
le.outerWi
dth();
|
|
|
127 |
|
this.pro
p = 'left'
;
|
|
|
128 |
|
}
|
|
|
129 |
|
|
|
|
130 |
|
if
(o.axis ==
'vertical
') {
|
|
|
131 |
|
this.par
entSize =
$(this.ele
ment).oute
rHeight()
- this.han
dle.outerH
eight();
|
|
|
132 |
|
this.pro
p = 'top';
|
|
|
133 |
|
}
|
|
|
134 |
|
|
|
|
135 |
|
if
(!this.mul
tipleHandl
es) {
|
|
|
136 |
|
$(el).bi
nd('click'
, function
(e) { self
.click.app
ly(self, [
e]); });
|
|
|
137 |
|
if(!isNa
N(o.startV
alue)) thi
s.moveTo(o
.startValu
e,options.
realValue,
null, fal
se);
|
|
|
138 |
|
}
|
|
|
139 |
|
|
|
|
140 |
|
}
|
|
|
141 |
|
|
|
|
142 |
|
$.exte
nd($.ui.sl
ider.proto
type, {
|
|
|
143 |
|
cu
rrentTarge
t: null,
|
|
|
144 |
|
la
stTarget:
null,
|
|
|
145 |
|
de
stroy: fun
ction() {
|
|
|
146 |
|
$(this.e
lement).re
moveClass(
"ui-slider
").removeC
lass("ui-s
lider-disa
bled");
|
|
|
147 |
|
if( this
.multipleH
andles ) {
|
|
|
148 |
|
for(
var iInd
= 0; iInd
< this.int
eractions.
length; iI
nd ++ )
|
|
|
149 |
|
this.inter
actions[iI
nd].destro
y();
|
|
|
150 |
|
} else {
|
|
|
151 |
|
this
.interacti
on.destroy
();
|
|
|
152 |
|
}
|
|
|
153 |
|
},
|
|
|
154 |
|
en
able: func
tion() {
|
|
|
155 |
|
$(this.e
lement).re
moveClass(
"ui-slider
-disabled"
);
|
|
|
156 |
|
this.dis
abled = fa
lse;
|
|
|
157 |
|
},
|
|
|
158 |
|
di
sable: fun
ction() {
|
|
|
159 |
|
$(this.e
lement).ad
dClass("ui
-slider-di
sabled");
|
|
|
160 |
|
this.dis
abled = tr
ue;
|
|
|
161 |
|
},
|
|
|
162 |
|
no
nvalidRang
e: functio
n(self) {
|
|
|
163 |
|
|
|
|
164 |
|
for(var
i=0;i<this
.interacti
ons.length
;i++) {
|
|
|
165 |
|
if(s
elf == thi
s.interact
ions[i]) {
|
|
|
166 |
|
if(this.in
teractions
[i-1]) {
|
|
|
167 |
|
if(thi
s.interact
ions[i-1].
curValue >
this.inte
ractions[i
].curValue
) return t
his.intera
ctions[i-1
].curValue
;
|
|
|
168 |
|
}
|
|
|
169 |
|
|
|
|
170 |
|
if(this.in
teractions
[i+1]) {
|
|
|
171 |
|
if(thi
s.interact
ions[i+1].
curValue <
this.inte
ractions[i
].curValue
) return t
his.intera
ctions[i+1
].curValue
;
|
|
|
172 |
|
}
|
|
|
173 |
|
}
|
|
|
174 |
|
}
|
|
|
175 |
|
|
|
|
176 |
|
return f
alse;
|
|
|
177 |
|
|
|
|
178 |
|
},
|
|
|
179 |
|
pr
epareCallb
ackObj: fu
nction(sel
f,m) {
|
|
|
180 |
|
|
|
|
181 |
|
var cur
= this;
|
|
|
182 |
|
var func
= functio
n() {
|
|
|
183 |
|
var
retVal = [
];
|
|
|
184 |
|
for(
var i=0;i<
cur.intera
ctions.len
gth;i++) {
|
|
|
185 |
|
retVal.pus
h((cur.int
eractions[
i].curValu
e || 0)+se
lf.options
.minValue)
;
|
|
|
186 |
|
}
|
|
|
187 |
|
retu
rn retVal;
|
|
|
188 |
|
};
|
|
|
189 |
|
|
|
|
190 |
|
return {
|
|
|
191 |
|
hand
le: self.h
elper,
|
|
|
192 |
|
pixe
l: m,
|
|
|
193 |
|
valu
e: self.cu
rValue+sel
f.options.
minValue,
|
|
|
194 |
|
valu
es: this.m
ultipleHan
dles ? fun
c() : self
.curValue+
self.optio
ns.minValu
e,
|
|
|
195 |
|
slid
er: self
|
|
|
196 |
|
}
|
|
|
197 |
|
},
|
|
|
198 |
|
cl
ick: funct
ion(e) {
|
|
|
199 |
|
var o =
this.inter
action.opt
ions;
|
|
|
200 |
|
var poin
ter = [e.p
ageX,e.pag
eY];
|
|
|
201 |
|
var offs
et = $(thi
s.interact
ion.elemen
t).offsetP
arent().of
fset({ bor
der: false
});
|
|
|
202 |
|
if(this.
interactio
n.element
== e.targe
t || this.
disabled)
return;
|
|
|
203 |
|
|
|
|
204 |
|
this.int
eraction.p
ickValue =
this.inte
raction.cu
rValue;
|
|
|
205 |
|
this.dra
g.apply(th
is.interac
tion, [thi
s, e, [poi
nter[0]-of
fset.left-
this.handl
e[0].offse
tWidth/2,p
ointer[1]-
offset.top
-this.hand
le[0].offs
etHeight/2
]]);
|
|
|
206 |
|
|
|
|
207 |
|
if(this.
interactio
n.pickValu
e != this.
interactio
n.curValue
)
|
|
|
208 |
|
$(th
is.element
).triggerH
andler("sl
idechange"
, [e, this
.prepareCa
llbackObj(
this.inter
action)],
o.change);
|
|
|
209 |
|
|
|
|
210 |
|
},
|
|
|
211 |
|
st
art: funct
ion(that,
e) {
|
|
|
212 |
|
|
|
|
213 |
|
var o =
this.optio
ns;
|
|
|
214 |
|
$(that.e
lement).tr
iggerHandl
er("slides
tart", [e,
that.prep
areCallbac
kObj(this)
], o.start
);
|
|
|
215 |
|
this.pic
kValue = t
his.curVal
ue;
|
|
|
216 |
|
|
|
|
217 |
|
return f
alse;
|
|
|
218 |
|
|
|
|
219 |
|
},
|
|
|
220 |
|
st
op: functi
on(that, e
) {
|
|
|
221 |
|
|
|
|
222 |
|
var o =
this.optio
ns;
|
|
|
223 |
|
$(that.e
lement).tr
iggerHandl
er("slides
top", [e,
that.prepa
reCallback
Obj(this)]
, o.stop);
|
|
|
224 |
|
if(this.
pickValue
!= this.cu
rValue) $(
that.eleme
nt).trigge
rHandler("
slidechang
e", [e, th
at.prepare
CallbackOb
j(this)],
o.change);
|
|
|
225 |
|
|
|
|
226 |
|
return f
alse;
|
|
|
227 |
|
|
|
|
228 |
|
},
|
|
|
229 |
|
dr
ag: functi
on(that, e
, pos) {
|
|
|
230 |
|
|
|
|
231 |
|
var o =
this.optio
ns;
|
|
|
232 |
|
this.pos
= pos ||
[this.pos[
0]-this.el
ement.offs
etWidth/2,
this.pos[
1]-this.el
ement.offs
etHeight/2
];
|
|
|
233 |
|
|
|
|
234 |
|
if(o.axi
s == 'hori
zontal') v
ar m = thi
s.pos[0];
|
|
|
235 |
|
if(o.axi
s == 'vert
ical') v
ar m = thi
s.pos[1];
|
|
|
236 |
|
|
|
|
237 |
|
|
|
|
238 |
|
var p =
that.paren
tSize;
|
|
|
239 |
|
var prop
= that.pr
op;
|
|
|
240 |
|
|
|
|
241 |
|
if(m < 0
) m = 0;
|
|
|
242 |
|
if(m > p
) m = p;
|
|
|
243 |
|
|
|
|
244 |
|
this.cur
Value = (M
ath.round(
(m/p)*o.re
alValue));
|
|
|
245 |
|
if(o.ste
pping) {
|
|
|
246 |
|
this
.curValue
= Math.rou
nd(this.cu
rValue/o.s
tepping)*o
.stepping;
|
|
|
247 |
|
m =
((this.cur
Value)/o.r
ealValue)
* p;
|
|
|
248 |
|
}
|
|
|
249 |
|
|
|
|
250 |
|
if(that.
interactio
ns) {
|
|
|
251 |
|
nonv
alidRange
= that.non
validRange
(this);
|
|
|
252 |
|
if(n
onvalidRan
ge) {
|
|
|
253 |
|
this.curVa
lue = nonv
alidRange;
|
|
|
254 |
|
m = ((this
.curValue)
/o.realVal
ue) * p;
|
|
|
255 |
|
}
|
|
|
256 |
|
}
|
|
|
257 |
|
|
|
|
258 |
|
$(this.e
lement).cs
s(prop, m+
'px');
|
|
|
259 |
|
$(that.e
lement).tr
iggerHandl
er("slide"
, [e, that
.prepareCa
llbackObj(
this,m)],
o.slide);
|
|
|
260 |
|
return f
alse;
|
|
|
261 |
|
|
|
|
262 |
|
},
|
|
|
263 |
|
mo
veTo: func
tion(op) {
|
|
|
264 |
|
var valu
e = op[0]
|| 0;
|
|
|
265 |
|
var inde
x = op[1]
|| 0;
|
|
|
266 |
|
var fire
Triggers =
op[2] ||
false;
|
|
|
267 |
|
var myHa
ndle;
|
|
|
268 |
|
|
|
|
269 |
|
if(this.
multipleHa
ndles) {
|
|
|
270 |
|
if(
index == u
ndefined )
|
|
|
271 |
|
index = 0;
|
|
|
272 |
|
else
if( this.
interactio
ns[index]
== undefin
ed )
|
|
|
273 |
|
return fal
se;
|
|
|
274 |
|
|
|
|
275 |
|
myHa
ndle = thi
s.interact
ions[index
];
|
|
|
276 |
|
} else i
f( index =
= 0 )
|
|
|
277 |
|
myHa
ndle = thi
s.interact
ion;
|
|
|
278 |
|
else
|
|
|
279 |
|
retu
rn false;
|
|
|
280 |
|
|
|
|
281 |
|
var o =
myHandle.o
ptions;
|
|
|
282 |
|
var offs
et = $(myH
andle.elem
ent).offse
tParent().
offset({ b
order: fal
se });
|
|
|
283 |
|
myHandle
.pickValue
= myHandl
e.curValue
;
|
|
|
284 |
|
value =
value - o.
minValue;
|
|
|
285 |
|
|
|
|
286 |
|
var modi
fier = o.r
ealValue;
|
|
|
287 |
|
|
|
|
288 |
|
var p =
this.paren
tSize;
|
|
|
289 |
|
var prop
= this.pr
op;
|
|
|
290 |
|
|
|
|
291 |
|
m = Math
.round(((v
alue)/modi
fier) * p)
;
|
|
|
292 |
|
|
|
|
293 |
|
if(m < 0
) m = 0;
|
|
|
294 |
|
if(m > p
) m = p;
|
|
|
295 |
|
|
|
|
296 |
|
myHandle
.curValue
= (Math.ro
und((m/p)*
o.realValu
e));
|
|
|
297 |
|
if(o.ste
pping) {
|
|
|
298 |
|
myHa
ndle.curVa
lue = Math
.round(myH
andle.curV
alue/o.ste
pping)*o.s
tepping;
|
|
|
299 |
|
m =
((myHandle
.curValue)
/o.realVal
ue) * p;
|
|
|
300 |
|
}
|
|
|
301 |
|
|
|
|
302 |
|
$(myHand
le.element
).css(prop
, m);
|
|
|
303 |
|
|
|
|
304 |
|
/* if(fi
reTriggers
&& myHand
le.pickVal
ue != myHa
ndle.curVa
lue && !p)
|
|
|
305 |
|
$(th
is.element
).triggerH
andler("sl
idechange"
, [this.el
ement, thi
s.prepareC
allbackObj
(myHandle)
], o.chang
e);
|
|
|
306 |
|
|
|
|
307 |
|
if(fireT
riggers)
|
|
|
308 |
|
$(th
is.element
).triggerH
andler("sl
ide", [thi
s.element,
this.prep
areCallbac
kObj(myHan
dle)], o.s
lide); */
|
|
|
309 |
|
}
|
|
|
310 |
|
});
|
|
|
311 |
|
|
|
|
312 |
|
})($);
|