PageSourceSearch

https://i-sosna.ru/bitrix/templates/adaptive/js/jcf.checkbox.js?17854450162748

js i-sosna.ru collected 2026-10-04 16:08:12 UTC 2,748 bytes, 88 lines download raw bytes

1// custom checkbox module
2jcf.addModule({
3	name:'checkbox',
4	selector:'input[type="checkbox"]',
5	defaultOptions: {
6		wrapperClass:'chk-area',
7		focusClass:'chk-focus',
8		checkedClass:'chk-checked',
9		labelActiveClass:'chk-label-active',
10		uncheckedClass:'chk-unchecked',
11		disabledClass:'chk-disabled',
12		chkStructure:'<span></span>'
13	},
14	setupWrapper: function(){
15		jcf.lib.addClass(this.fakeElement, this.options.wrapperClass);
16		this.fakeElement.innerHTML = this.options.chkStructure;
17		this.realElement.parentNode.insertBefore(this.fakeElement, this.realElement);
18		jcf.lib.event.add(this.realElement, 'click', this.onRealClick, this);
19		this.refreshState();
20	},
21	isLinkTarget: function(target, limitParent) {
22		while(target.parentNode || target === limitParent) {
23			if(target.tagName.toLowerCase() === 'a') {
24				return true;
25			}
26			target = target.parentNode;
27		}
28	},
29	onFakePressed: function() {
30		jcf.modules[this.name].superclass.onFakePressed.apply(this, arguments);
31		if(!this.realElement.disabled) {
32			this.realElement.focus();
33		}
34	},
35	onFakeClick: function(e) {
36		jcf.modules[this.name].superclass.onFakeClick.apply(this, arguments);
37		this.tmpTimer = setTimeout(jcf.lib.bind(function(){
38			this.toggle();
39		},this),10);
40		if(!this.isLinkTarget(e.target, this.labelFor)) {
41			return false;
42		}
43	},
44	onRealClick: function(e) {
45		setTimeout(jcf.lib.bind(function(){
46			this.refreshState();
47		},this),10);
48		e.stopPropagation();
49	},
50	toggle: function(e){
51		if(!this.realElement.disabled) {
52			if(this.realElement.checked) {
53				this.realElement.checked = false;
54			} else {
55				this.realElement.checked = true;
56			}
57		}
58		this.refreshState();
59		jcf.lib.fireEvent(this.realElement, 'change');
60		return false;
61	},
62	refreshState: function(){
63		if(this.realElement.checked) {
64			jcf.lib.addClass(this.fakeElement, this.options.checkedClass);
65			jcf.lib.removeClass(this.fakeElement, this.options.uncheckedClass);
66			if(this.labelFor) {
67				jcf.lib.addClass(this.labelFor, this.options.labelActiveClass);
68			}
69		} else {
70			jcf.lib.removeClass(this.fakeElement, this.options.checkedClass);
71			jcf.lib.addClass(this.fakeElement, this.options.uncheckedClass);
72			if(this.labelFor) {
73				jcf.lib.removeClass(this.labelFor, this.options.labelActiveClass);
74			}
75		}
76		if(this.realElement.disabled) {
77			jcf.lib.addClass(this.fakeElement, this.options.disabledClass);
78			if(this.labelFor) {
79				jcf.lib.addClass(this.labelFor, this.options.labelDisabledClass);
80			}
81		} else {
82			jcf.lib.removeClass(this.fakeElement, this.options.disabledClass);
83			if(this.labelFor) {
84				jcf.lib.removeClass(this.labelFor, this.options.labelDisabledClass);
85			}
86		}
87	}
88});

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.