2012-02-28 19:11:08 +00:00
|
|
|
$(document).ready(function(){
|
|
|
|
$(".niceRadio").each(function() {
|
|
|
|
changeRadioStart($(this));
|
|
|
|
});
|
2012-02-08 14:01:00 +00:00
|
|
|
});
|
|
|
|
|
2012-02-28 19:11:08 +00:00
|
|
|
function changeRadio(el) {
|
|
|
|
var el = el, input = el.find("input").eq(0);
|
|
|
|
var nm = input.attr("name");
|
2012-02-08 14:01:00 +00:00
|
|
|
|
2012-02-28 19:11:08 +00:00
|
|
|
$(".niceRadio input").each(
|
2012-02-08 14:01:00 +00:00
|
|
|
|
2012-02-28 19:11:08 +00:00
|
|
|
function() {
|
|
|
|
if($(this).attr("name")==nm) {
|
|
|
|
$(this).parent().removeClass("radioChecked");
|
|
|
|
}
|
|
|
|
});
|
2012-02-08 14:01:00 +00:00
|
|
|
|
2012-02-28 19:11:08 +00:00
|
|
|
if(el.attr("class").indexOf("niceRadioDisabled")==-1) {
|
|
|
|
el.addClass("radioChecked");
|
|
|
|
input.attr("checked", true);
|
|
|
|
}
|
2012-02-08 14:01:00 +00:00
|
|
|
|
2012-02-28 19:11:08 +00:00
|
|
|
return true;
|
2012-02-08 14:01:00 +00:00
|
|
|
}
|
|
|
|
|
2012-02-28 19:11:08 +00:00
|
|
|
function changeVisualRadio(input) {
|
|
|
|
|
|
|
|
var wrapInput = input.parent();
|
|
|
|
var nm=input.attr("name");
|
|
|
|
|
|
|
|
$(".niceRadio input").each(function() {
|
|
|
|
if($(this).attr("name")==nm)
|
|
|
|
{
|
|
|
|
$(this).parent().removeClass("radioChecked");
|
|
|
|
}
|
|
|
|
});
|
2012-02-14 16:05:41 +00:00
|
|
|
|
2012-02-28 19:11:08 +00:00
|
|
|
if(input.attr("checked"))
|
|
|
|
{
|
|
|
|
wrapInput.addClass("radioChecked");
|
|
|
|
}
|
2012-02-08 14:01:00 +00:00
|
|
|
}
|
|
|
|
|
2012-02-28 19:11:08 +00:00
|
|
|
function changeRadioStart(el) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
var el = el,
|
|
|
|
radioName = el.attr("name"),
|
|
|
|
radioId = el.attr("id"),
|
|
|
|
radioChecked = el.attr("checked"),
|
|
|
|
radioDisabled = el.attr("disabled"),
|
|
|
|
radioTab = el.attr("tabindex"),
|
|
|
|
radioValue = el.attr("value");
|
|
|
|
|
|
|
|
if(radioChecked) {
|
|
|
|
el.after("<span class='niceRadio radioChecked'>"+
|
|
|
|
"<input type='radio'"+
|
|
|
|
"name='"+radioName+"'"+
|
|
|
|
"id='"+radioId+"'"+
|
|
|
|
"checked='"+radioChecked+"'"+
|
|
|
|
"tabindex='"+radioTab+"'"+
|
|
|
|
"value='"+radioValue+"' /></span>");
|
|
|
|
} else {
|
|
|
|
el.after("<span class='niceRadio'>"+
|
|
|
|
"<input type='radio'"+
|
|
|
|
"name='"+radioName+"'"+
|
|
|
|
"id='"+radioId+"'"+
|
|
|
|
"tabindex='"+radioTab+"'"+
|
|
|
|
"value='"+radioValue+"' /></span>");
|
|
|
|
}
|
|
|
|
|
|
|
|
if(radioDisabled) {
|
|
|
|
el.next().addClass("niceRadioDisabled");
|
|
|
|
el.next().find("input").eq(0).attr("disabled","disabled");
|
|
|
|
}
|
|
|
|
|
|
|
|
el.next().bind("mousedown", function(e) {
|
2012-04-23 10:50:42 +01:00
|
|
|
if (e.which === 1) {
|
2012-04-09 18:11:39 +01:00
|
|
|
changeRadio($(this));
|
|
|
|
};
|
2012-03-02 17:45:20 +00:00
|
|
|
$(this).find("input:radio").change();
|
2012-02-28 19:11:08 +00:00
|
|
|
});
|
|
|
|
if($.browser.msie) {
|
|
|
|
el.next().find("input").eq(0).bind("click", function(e) {
|
|
|
|
changeVisualRadio($(this))
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
el.next().find("input").eq(0).bind("change", function(e) {
|
|
|
|
changeVisualRadio($(this))
|
|
|
|
});
|
|
|
|
}
|
|
|
|
el.remove();
|
|
|
|
}
|
|
|
|
|
|
|
|
catch(e) { }
|
|
|
|
|
|
|
|
return true;
|
2012-02-08 14:01:00 +00:00
|
|
|
}
|