PageSourceSearch

https://www.lechpoznan.pl/view/basic/scripts/js/jquery.niceform/radio.js?v=18

js lechpoznan.pl collected 2026-10-02 08:02:53 UTC 2,034 bytes, 86 lines download raw bytes

1//# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //
2//# RADIO
3(function($) {
4
5	$.fn.radioFx = function(config) {
6		//:
7		var defaults = {};
8
9		//:
10		var options = $.extend({}, defaults, config);
11
12		//:
13    return this.each(function() {
14			var $node						= $(this);
15			var $input					= $node.find('input');
16			var $inputName			= $input.attr('name');
17			var $inputChecked		= $input.prop('checked');
18			var $inputDisabled	= $input.prop('disabled');
19
20			$node.attr('data-name', $inputName);
21			$node.find('span').addClass('Text');
22			$node.prepend('<span class="Icon" />');
23
24			if ( $inputChecked ) {
25				$node.addClass('Checked');
26			}
27
28			$node
29			.on('click.radioEvent', function(e) {
30				var target	= e.target;
31				var tagname	= target.tagName.toLowerCase();
32
33				if ( tagname != 'a' ) {
34					stopEvent(e);
35
36					if ( !$inputDisabled ) {
37						toggleCheckedRadio( $(this) );
38					}
39				}
40	    });
41
42			$node.find('a')
43			.on('click.radioEvent', function(e) {
44				stopEvent(e);
45
46				var aUrl		= $(this).attr('href');
47        var aTarget	= $(this).attr('target');
48
49				window.open(aUrl, aTarget);
50
51				return false;
52	    });
53		});
54
55		//:
56		function toggleCheckedRadio(_obj) {
57			var dataName = _obj.attr('data-name');
58
59			if ( !_obj.find('input').prop('checked') ) {
60				_obj.parents('form').find('.Radio.Checked[data-name="' + dataName + '"]').removeClass('Checked');								//: 1
61				_obj.parents('form').find('.Radio.Checked[data-name="' + dataName + '"]').find('input').prop('checked', false);	//: 2
62
63				_obj.addClass('Checked');									//: 1
64				_obj.find('input').prop('checked', true);	//: 2
65			}
66
67			_obj.find('input').trigger('change');
68		}
69	};
70
71})(jQuery);
72
73
74
75//# INIT RADIO
76$(document).ready(function() {
77
78	var $formRadio = $('form .Radio');
79
80	if ( $formRadio.length > 0 ) {
81		$formRadio.radioFx();
82	}
83
84});
85
86

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.