PageSourceSearch

https://resurs-media.ru/js/radio.js

js resurs-media.ru collected 2026-10-08 04:17:36 UTC 2,945 bytes, 98 lines download raw bytes

1jQuery(document).ready(function(){
2		jQuery(".niceRadio").each(
3		/* при загрузке страницы меняем обычные на стильные radio */
4		function() {
5			 changeRadioStart(jQuery(this));
6		});
7		});
8
9		function changeRadio(el)
10		/* 
11			функция смены вида и значения radio при клике на контейнер
12		*/
13		{
14			//alert();
15			var el = el,
16				input = el.find("input").eq(0);
17			var nm=input.attr("name");
18				
19			jQuery(".niceRadio input").each(
20			
21			function() {
22			 
23				if((jQuery(this).attr("name")==nm) && (el.attr("class").indexOf("niceRadioDisabled")==-1))
24				{
25					jQuery(this).parent().removeClass("radioChecked");
26						 //  	alert($(this).attr('value'));
27				}
28
29			   
30			});					  
31			
32			
33			if(el.attr("class").indexOf("niceRadioDisabled")==-1)
34			{	
35				el.addClass("radioChecked");
36				input.attr("checked", true);
37			}
38
39			return true;
40		}
41
42		function changeVisualRadio(input)
43		{
44		}
45
46		function changeRadioStart(el)
47		/* 
48			новый контрол выглядит так <span class="niceRadio"><input type="radio" name="[name radio]" id="[id radio]" [checked="checked"] /></span>
49			новый контрол получает теже name, id и другие атрибуты что и были у обычного
50		*/
51		{
52
53		try
54		{
55		var el = el,
56			radioName = el.attr("name"),
57			radioId = el.attr("id"),
58			radioChecked = el.attr("checked"),
59			radioDisabled = el.attr("disabled"),
60			radioTab = el.attr("tabindex"),
61			radioValue = el.attr("value");
62		/*	if(radioChecked)
63				el.after("<span class='niceRadio radioChecked' tabindex='"+radioTab+"'>"+
64					"<input type='radio'"+
65					"name='"+radioName+"'"+
66					"id='"+radioId+"'"+
67					"checked='"+radioChecked+"'"+
68					"tabindex='"+radioTab+"'"+
69					"value='"+radioValue+"' /></span>");
70			else
71				el.after("<span class='niceRadio' tabindex='"+radioTab+"'>"+
72					"<input type='radio'"+
73					"name='"+radioName+"'"+
74					"id='"+radioId+"'"+
75					"tabindex='"+radioTab+"'"+
76					"value='"+radioValue+"' /></span>");
77			*/
78			/* если контрол disabled - добавляем соответсвующий класс для нужного вида и добавляем атрибут disabled для вложенного radio */		
79			if(radioDisabled)
80			{
81				el.next().addClass("niceRadioDisabled");
82				el.next().find("input").eq(0).attr("disabled","disabled");
83			}
84			
85			/* цепляем обработчики стилизированным radio */		
86			el.bind("mousedown", function(e) { changeRadio(jQuery(this)) });
87			
88			if(jQuery.browser.msie)	el.next().find("input").eq(0).bind("click", function(e) { changeVisualRadio(jQuery(this)) });	
89			else el.next().find("input").eq(0).bind("change", function(e) { changeVisualRadio(jQuery(this)) });
90			el.remove();
91		}
92		catch(e)
93		{
94			// если ошибка, ничего не делаем
95		}
96
97			return true;
98		}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.