(function($) {
//Web Forms 2.0
window.webforms = 1;
if(window['webforms']) {
$(document).ready(function() {
$("input").each(function() {
if(this.getAttribute("type") == "range") {
var cur = $(this);
var slider = $("
").css({ width: cur.innerWidth()+"px", height: cur.innerHeight()+"px" }).insertAfter(cur);
var handle = $("").appendTo(slider);
slider.css({
"position": cur.css("position") == "absolute" ? "absolute" : "relative",
"left": cur.css("left"),
"right": cur.css("right"),
"zIndex": cur.css("zIndex"),
"float": cur.css("float"),
"clear": cur.css("clear")
});
cur.css({ position: "absolute", opacity: 0, top: "-1000px", left: "-1000px" });
slider.slider({
maxValue: cur.attr("max"),
minValue: cur.attr("min"),
startValue: this.getAttribute("value"),
stepping: cur.attr("step"),
change: function(e, ui) { cur[0].value = ui.value; cur[0].setAttribute("value", ui.value); },
});
slider = slider.sliderInstance();
cur.bind("keydown", function(e) {
var o = slider.interaction.options;
switch(e.keyCode) {
case 37:
slider.moveTo(slider.interaction.curValue+o.minValue-(o.stepping || 1));
break;
case 39:
slider.moveTo(slider.interaction.curValue+o.minValue+(o.stepping || 1));
break;
}
if(e.keyCode != 9) return false;
});
};
});
});
}
//Make nodes selectable by expression
$.extend($.expr[':'], { slider: "(' '+a.className+' ').indexOf(' ui-slider ')" });
$.fn.slider = function(o) {
return this.each(function() {
new $.ui.slider(this, o);
});
}
//Macros for external methods that support chaining
var methods = "destroy,enable,disable,moveTo".split(",");
for(var i=0;i this.interactions[i].curValue) return this.interactions[i-1].curValue;
}
if(this.interactions[i+1]) {
if(this.interactions[i+1].curValue < this.interactions[i].curValue) return this.interactions[i+1].curValue;
}
}
}
return false;
},
prepareCallbackObj: function(self,m) {
var cur = this;
var func = function() {
var retVal = [];
for(var i=0;i p) m = p;
this.curValue = (Math.round((m/p)*o.realValue));
if(o.stepping) {
this.curValue = Math.round(this.curValue/o.stepping)*o.stepping;
m = ((this.curValue)/o.realValue) * p;
}
if(that.interactions) {
nonvalidRange = that.nonvalidRange(this);
if(nonvalidRange) {
this.curValue = nonvalidRange;
m = ((this.curValue)/o.realValue) * p;
}
}
$(this.element).css(prop, m+'px');
$(that.element).triggerHandler("slide", [e, that.prepareCallbackObj(this,m)], o.slide);
return false;
},
moveTo: function(value,scale,changeslide,p) { // renamed from goto to moveTo as goto is reserved javascript word
if(this.multipleHandles) return false; //TODO: Multiple handle moveTo function
var o = this.interaction.options;
var offset = $(this.interaction.element).offsetParent().offset({ border: false });
this.interaction.pickValue = this.interaction.curValue;
value = value-o.minValue;
var modifier = scale || o.realValue;
var p = this.parentSize;
var prop = this.prop;
m = Math.round(((value)/modifier) * p);
if(m < 0) m = 0;
if(m > p) m = p;
this.interaction.curValue = (Math.round((m/p)*o.realValue));
if(o.stepping) {
this.interaction.curValue = Math.round(this.interaction.curValue/o.stepping)*o.stepping;
m = ((this.interaction.curValue)/o.realValue) * p;
}
$(this.interaction.element).css(prop, m+'px');
if(!changeslide && this.interaction.pickValue != this.interaction.curValue && !p)
$(this.element).triggerHandler("slidechange", [e, this.prepareCallbackObj(this.interaction)], o.change);
if(changeslide)
$(this.element).triggerHandler("slide", [e, this.prepareCallbackObj(this.interaction)], o.slide);
}
});
})($);