PageSourceSearch

https://bel31projects.ru/nassets/7bc22803/select.js?v=1765633899

js bel31projects.ru collected 2026-09-28 09:06:12 UTC 3,416 bytes, 114 lines download raw bytes

1jQuery.widget( 'gc.selectField', $.gc.abstractField, {
2
3	build: function() {
4		this.buildValuesList();
5	},
6
7	buildValuesList: function() {
8		if ( this.field.settings.valueList )
9		{
10			var values = this.field.settings.valueList.split("\n");
11			this.inputBlock.empty();
12
13			if ( ! this.field.settings.showAllValues ) {
14				$input = $('<select/>');
15
16                if ( this.field.id ) {
17                    $input.attr('id', 'field-input-' + this.field.id);
18                }
19
20				$input.appendTo( this.inputBlock );
21				this.input = $input;
22
23				if ( this.field.settings.emptyValueText && this.field.settings.emptyValueText != "" ) {
24					var option = $('<option></option>');
25					option.attr( 'value', "" );
26					option.html( this.field.settings.emptyValueText );
27					option.appendTo( this.input );
28				}
29
30				for( i = 0; i < values.length; i++ ) {
31					var value = values[i];
32					var option = $('<option></option>');
33					option.attr( 'value', value );
34					option.html( value );
35					option.appendTo( this.input );
36				}
37			}
38			else {
39				if ( this.field.settings.emptyValueText && this.field.settings.emptyValueText != "" )
40				{
41					$label = $( "<label></label>" );
42					$label.html( this.field.settings.emptyValueText );
43
44					var $option = $('<input type="radio" name="field-value-' + this.field.id + '">');
45					$option.attr( 'value', "" );
46					$option.prependTo( $label );
47					$option.prop('checked', true)
48
49					$label.appendTo( this.inputBlock );
50				}
51
52				for( i = 0; i < values.length; i++ )
53				{
54					var value = values[i];
55
56					$label = $( "<label></label>" );
57					$label.html( value );
58
59					var $option = $('<input type="radio" name="field-value-' + this.field.id + '">');
60					$option.attr( 'value', value );
61					$option.prependTo( $label );
62
63					$label.appendTo( this.inputBlock );
64				}
65
66			}
67		}
68	},
69
70	initEditor: function( settingsEl ) {
71		$.gc.abstractField.prototype.initEditor.call(this, settingsEl );
72
73		this.valueListInput = this.makeInputTextarea( 'valueList', Yii.t( "common", "Value list" ) );
74		this.showAllValuesCheckbox = this.makeInputCheckbox( 'showAllValues', Yii.t( "common", "Show all values" ) );
75		this.emptyValueTextInput = this.makeInputField( 'emptyValueText', Yii.t( "common", "Empty value text" ) );
76
77		if (window.params_52) {
78			this.valuesGroupTextarea = this.makeInputTextarea('valueListGroups', Yii.t( "common", "Matching options to groups"));
79			this.valuesGroupTextarea.val(this.field.settings.valueListGroups);
80		}
81
82		//this.valueListInput = this.makeInputTextarea( 'value_list', Yii.t( "common", "Value list" ) )
83	},
84
85	getField: function() {
86		var result = $.gc.abstractField.prototype.getField.call(this);
87		result.settings = {};
88		result.settings.valueList = this.valueListInput.val();
89		result.settings.showAllValues = this.showAllValuesCheckbox.prop('checked');
90		result.settings.emptyValueText = this.emptyValueTextInput.val();
91		if ( this.valuesGroupTextarea ) {
92			result.settings.valueListGroups = this.valuesGroupTextarea.val();
93		}
94		return result;
95	},
96
97	rebuild: function() {
98		$.gc.abstractField.prototype.rebuild.call(this);
99		if ( this.field.settings.valueList ) {
100			this.buildValuesList();
101			//this.input.attr( 'size', this.field.settings.size )
102		}
103	},
104
105	getValue: function() {
106		if ( this.field.settings.showAllValues ) {
107			return this.inputBlock.find( 'input:checked').val();
108		}
109		else {
110			return this.input.val();
111		}
112
113	}
114} );

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.