PageSourceSearch

https://stolitsa.info/nassets/d5b79c02/checkbox.js?v=1765633900

js stolitsa.info collected 2026-10-09 21:59:18 UTC 1,719 bytes, 69 lines download raw bytes

1function CheckboxFieldWidget() {
2
3    this.checkboxEl = null;
4
5    this.initEl = function( $el, field, value ) {
6
7        var widget = this;
8
9		var id = Math.round( Math.random() * 10000 );
10		var name = "r" + id;
11
12        this.yesEl = $("<input type='radio'>");
13		this.yesEl.attr( 'name', name );
14		this.yesEl.attr( 'id', name );
15		this.yesEl.on( 'change', function() { widget.changed() } );
16		this.yesEl.prop('checked', true );
17
18		var labelYes =  'Да';
19		var labelNo = 'Нет';
20
21		if (typeof Yii != 'undefined') {
22			labelYes = Yii.t( "common", "Yes" );
23			labelNo = Yii.t( "common", "No" );
24		}
25
26
27		$yesWrapperEl = $( "<label>" + labelYes + "</label>" );
28        this.yesEl.prependTo( $yesWrapperEl );
29
30		this.noEl=  $("<input type='radio'>");
31		this.noEl.attr( 'name', name );
32		this.noEl.attr( 'id', name );
33		this.noEl.on( 'change', function() { widget.changed() } );
34
35		$noWrapperEl = $( "<label style='margin-left: 20px'>" + labelNo + "</label>" );
36		this.noEl.prependTo( $noWrapperEl );
37
38		$controlEl = $("<div></div>")
39
40		$yesWrapperEl.appendTo( $controlEl )
41		$noWrapperEl.appendTo( $controlEl  )
42
43        this.initFieldEl( $el, $controlEl, field )
44		this.setValue( value )
45    }
46
47    this.getValue = function() {
48		return { 'checked' : this.yesEl.prop( 'checked' ) ? 1 : 0 };
49    };
50
51	this.setValue = function( value ) {
52		if( value ) {
53			if ( value.checked == 1 ) {
54				this.yesEl.prop('checked', true );
55				this.noEl.prop('checked', false );
56			} else {
57				this.yesEl.prop('checked', false );
58				this.noEl.prop('checked', true );
59			}
60		}
61	}
62
63}
64
65extend( CheckboxFieldWidget, FieldWidget )
66CheckboxFieldWidget.prototype = new FieldWidget()
67
68
69window.logicFieldWidgets["checkbox"] = CheckboxFieldWidget

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.