PageSourceSearch

https://auticiel.com/wp-content/plugins/gravityforms/js/conditional_logic.js?ver=2.7.15

js auticiel.com collected 2026-09-27 20:59:38 UTC 24,002 bytes, 699 lines download raw bytes

1
2var __gf_timeout_handle;
3
4gform.addAction( 'gform_input_change', function( elem, formId, fieldId ) {
5	if( ! window.gf_form_conditional_logic ) {
6		return;
7	}
8	var dependentFieldIds = rgars( gf_form_conditional_logic, [ formId, 'fields', gformExtractFieldId( fieldId ) ].join( '/' ) );
9	if( dependentFieldIds ) {
10		gf_apply_rules( formId, dependentFieldIds );
11	}
12}, 10 );
13
14function gf_apply_rules(formId, fields, isInit){
15
16	jQuery(document).trigger( 'gform_pre_conditional_logic', [ formId, fields, isInit ] );
17	gform.utils.trigger( {
18		event: 'gform/conditionalLogic/applyRules/start',
19		native: false,
20		data: { formId: formId, fields: fields, isInit: isInit },
21	} );
22	for(var i=0; i < fields.length; i++){
23		gf_apply_field_rule(formId, fields[i], isInit, function(){
24			var is_last_field = ( i >= fields.length - 1 );
25			if( is_last_field ) {
26				jQuery(document).trigger('gform_post_conditional_logic', [formId, fields, isInit]);
27				gform.utils.trigger( {
28					event: 'gform/conditionalLogic/applyRules/end',
29					native: false,
30					data: { formId: formId, fields: fields, isInit: isInit },
31				} );
32				if(window["gformCalculateTotalPrice"]){
33					window["gformCalculateTotalPrice"](formId);
34				}
35			}
36		});
37	}
38}
39
40function gf_check_field_rule(formId, fieldId, isInit, callback){
41
42	//if conditional logic is not specified for that field, it is supposed to be displayed
43	var conditionalLogic = gf_get_field_logic( formId, fieldId );
44	if ( ! conditionalLogic ) {
45		return 'show';
46	}
47
48	var action = gf_get_field_action(formId, conditionalLogic["section"]);
49
50	//If section is hidden, always hide field. If section is displayed, see if field is supposed to be displayed or hidden
51	if(action != "hide")
52		action = gf_get_field_action(formId, conditionalLogic["field"]);
53
54	return action;
55}
56
57/**
58 * Retrieves the conditional logic properties for the specified field.
59 *
60 * @since 2.4.16
61 *
62 * @param {(string|number)} formId  The ID of the current form.
63 * @param {(string|number)} fieldId The ID of the current field.
64 *
65 * @return {(boolean|object)} False or the field conditional logic properties.
66 */
67function gf_get_field_logic(formId, fieldId) {
68	var formConditionalLogic = rgars( window, 'gf_form_conditional_logic/' + formId );
69	if ( ! formConditionalLogic ) {
70		return false;
71	}
72
73	var conditionalLogic = rgars( formConditionalLogic, 'logic/' + fieldId );
74	if ( conditionalLogic ) {
75		return conditionalLogic;
76	}
77
78	var dependents = rgar( formConditionalLogic, 'dependents' );
79	if ( ! dependents ) {
80		return false;
81	}
82
83	// Attempting to get section field conditional logic instead.
84	for ( var key in dependents ) {
85		if ( dependents[key].indexOf( fieldId ) !== -1 ) {
86			return rgars( formConditionalLogic, 'logic/' + key );
87		}
88	}
89
90	return false;
91}
92
93function gf_apply_field_rule(formId, fieldId, isInit, callback){
94
95	var action = gf_check_field_rule(formId, fieldId, isInit, callback);
96
97	gf_do_field_action(formId, action, fieldId, isInit, callback);
98
99	var conditionalLogic = window["gf_form_conditional_logic"][formId]["logic"][fieldId];
100	//perform conditional logic for the next button
101	if(conditionalLogic["nextButton"]){
102		action = gf_get_field_action(formId, conditionalLogic["nextButton"]);
103		gf_do_next_button_action(formId, action, fieldId, isInit);
104	}
105
106}
107
108function gf_get_field_action(formId, conditionalLogic){
109	if(!conditionalLogic)
110		return "show";
111
112	var matches = 0;
113	for(var i = 0; i < conditionalLogic["rules"].length; i++){
114		/**
115		 * Filter the conditional logic rule before it is evaluated on the frontend.
116		 *
117		 * @param {object}          rule             The conditional logic rule about to be evaluated.
118		 * @param {(string|number)} formId           The current form ID.
119		 * @param {object}          conditionalLogic All details required to evaluate an objects conditional logic.
120		 *
121		 * @since 2.4.22
122		 */
123		var rule = gform.applyFilters( 'gform_rule_pre_evaluation', jQuery.extend( {}, conditionalLogic["rules"][i] ), formId, conditionalLogic );
124		if(gf_is_match(formId, rule))
125			matches++;
126	}
127
128	var action;
129	if( (conditionalLogic["logicType"] == "all" && matches == conditionalLogic["rules"].length) || (conditionalLogic["logicType"] == "any"  && matches > 0) )
130		action = conditionalLogic["actionType"];
131	else
132		action = conditionalLogic["actionType"] == "show" ? "hide" : "show";
133
134	return action;
135}
136
137function gf_is_match( formId, rule ) {
138
139	var $               = jQuery,
140		inputId         = rule['fieldId'],
141		fieldId         = gformExtractFieldId( inputId ),
142		inputIndex      = gformExtractInputIndex( inputId ),
143		isInputSpecific = inputIndex !== false,
144		$inputs;
145
146	if( isInputSpecific ) {
147		$inputs = $( '#input_{0}_{1}_{2}'.gformFormat( formId, fieldId, inputIndex ) );
148	} else {
149		$inputs = $( 'input[id="input_{0}_{1}"], input[id^="input_{0}_{1}_"], input[id^="choice_{0}_{1}_"], select#input_{0}_{1}, textarea#input_{0}_{1}'.gformFormat( formId, fieldId ) );
150	}
151
152	var isCheckable = $.inArray( $inputs.attr( 'type' ), [ 'checkbox', 'radio' ] ) !== -1;
153	var isMatch     = isCheckable ? gf_is_match_checkable( $inputs, rule, formId, fieldId ) : gf_is_match_default( $inputs.eq( 0 ), rule, formId, fieldId );
154
155	return gform.applyFilters( 'gform_is_value_match', isMatch, formId, rule );
156}
157
158function gf_is_match_checkable( $inputs, rule, formId, fieldId ) {
159
160	// Rule is checking if the checkable is/isn't blank. Return a specific check for that use-case.
161	if ( rule.value === '' ) {
162		return rule.operator === 'is' ? gf_is_checkable_empty( $inputs ) : ! gf_is_checkable_empty( $inputs );
163	}
164
165	var isMatch = false;
166
167	$inputs.each( function() {
168
169		var $input           = jQuery( this ),
170			fieldValue       = gf_get_value( $input.val() ),
171			isRangeOperator  = jQuery.inArray( rule.operator, [ '<', '>' ] ) !== -1,
172			isStringOperator = jQuery.inArray( rule.operator, [ 'contains', 'starts_with', 'ends_with' ] ) !== -1;
173
174		// if we are looking for a specific value and this is not it, skip
175		if( fieldValue != rule.value && ! isRangeOperator && ! isStringOperator ) {
176			return; // continue
177		}
178
179		// force an empty value for unchecked items
180		if( ! $input.is( ':checked' ) ) {
181			fieldValue = '';
182		}
183		// if the 'other' choice is selected, get the value from the 'other' text input
184		else if ( fieldValue == 'gf_other_choice' ) {
185			fieldValue = jQuery( '#input_{0}_{1}_other'.gformFormat( formId, fieldId ) ).val();
186		}
187
188		if( gf_matches_operation( fieldValue, rule.value, rule.operator ) ) {
189			isMatch = true;
190			return false; // break
191		}
192
193	} );
194
195	return isMatch;
196}
197
198/**
199 * Check if a collection of checkable inputs has any checked,
200 * or if they are all unchecked.
201 *
202 * @param {jQuery} $inputs A collection of inputs to check.
203 *
204 * @returns {boolean}
205 */
206function gf_is_checkable_empty( $inputs ) {
207	var isEmpty = true;
208
209	$inputs.each( function() {
210		if ( jQuery( this ).is( ':checked' ) ) {
211			isEmpty = false;
212		}
213	} );
214
215	return isEmpty;
216}
217
218function gf_is_match_default( $input, rule, formId, fieldId ) {
219
220	var val           = $input.val(),
221		values        = ( val instanceof Array ) ? val : [ val ], // transform regular value into array to support multi-select (which returns an array of selected items)
222		matchCount    = 0,
223		valuesLength  = Math.max( values.length, 1 ); // jQuery 3.0: Make sure our length is at least 1 so that the following loop fires.
224
225	for( var i = 0; i < valuesLength; i++ ) {
226
227		// fields with pipes in the value will use the label for conditional logic comparison
228		var hasLabel   = values[i] ? values[i].indexOf( '|' ) >= 0 : true,
229			fieldValue = gf_get_value( values[i] );
230
231		var fieldNumberFormat = gf_get_field_number_format( rule.fieldId, formId, 'value' );
232		if( fieldNumberFormat && ! hasLabel ) {
233			fieldValue = gf_format_number( fieldValue, fieldNumberFormat );
234		}
235
236		var ruleValue = rule.value;
237		//if ( fieldNumberFormat ) {
238		//	ruleValue = gf_format_number( ruleValue, fieldNumberFormat );
239		//}
240
241		if( gf_matches_operation( fieldValue, ruleValue, rule.operator ) ) {
242			matchCount++;
243		}
244
245	}
246
247	// if operator is 'isnot', none of the values can match
248	var isMatch = rule.operator == 'isnot' ? matchCount == valuesLength : matchCount > 0;
249
250	return isMatch;
251}
252
253function gf_format_number( value, fieldNumberFormat ) {
254
255	decimalSeparator = '.';
256
257	if( fieldNumberFormat == 'currency' ) {
258		decimalSeparator = gformGetDecimalSeparator( 'currency' );
259	} else if( fieldNumberFormat == 'decimal_comma' ) {
260		decimalSeparator = ',';
261	} else if( fieldNumberFormat == 'decimal_dot' ) {
262		decimalSeparator = '.';
263	}
264
265	// transform to a decimal dot number
266	value = gformCleanNumber( value, '', '', decimalSeparator );
267
268	/**
269	 * Looking at format specified by wp locale creates issues. When performing conditional logic, all numbers will be formatted to decimal dot and then compared that way. AC
270	 */
271	// now transform to number specified by locale
272	// if( window['gf_number_format'] && window['gf_number_format'] == 'decimal_comma' ) {
273	//     value = gformFormatNumber( value, -1, ',', '.' );
274	// }
275
276	if( ! value ) {
277		value = 0;
278	}
279
280	number = value.toString();
281
282	return number;
283}
284
285function gf_try_convert_float(text){
286
287	/*
288	 * The only format that should matter is the field format. Attempting to do this by WP locale creates a lot of issues with consistency.
289	 * var format = window["gf_number_format"] == "decimal_comma" ? "decimal_comma" : "decimal_dot";
290	 */
291
292	var format = 'decimal_dot';
293	if( gformIsNumeric( text, format ) ) {
294		var decimal_separator = format == "decimal_comma" ? "," : ".";
295		return gformCleanNumber( text, "", "", decimal_separator );
296	}
297
298	return text;
299}
300
301function gf_matches_operation(val1, val2, operation){
302	val1 = val1 ? val1.toLowerCase() : "";
303	val2 = val2 ? val2.toLowerCase() : "";
304
305	switch(operation){
306		case "is" :
307			return val1 == val2;
308			break;
309
310		case "isnot" :
311			return val1 != val2;
312			break;
313
314		case ">" :
315			val1 = gf_try_convert_float(val1);
316			val2 = gf_try_convert_float(val2);
317
318			return gformIsNumber(val1) && gformIsNumber(val2) ? val1 > val2 : false;
319			break;
320
321		case "<" :
322			val1 = gf_try_convert_float(val1);
323			val2 = gf_try_convert_float(val2);
324
325			return gformIsNumber(val1) && gformIsNumber(val2) ? val1 < val2 : false;
326			break;
327
328		case "contains" :
329			return val1.indexOf(val2) >=0;
330			break;
331
332		case "starts_with" :
333			return val1.indexOf(val2) ==0;
334			break;
335
336		case "ends_with" :
337			var start = val1.length - val2.length;
338			if(start < 0)
339				return false;
340
341			var tail = val1.substring(start);
342			return val2 == tail;
343			break;
344	}
345	return false;
346}
347
348function gf_get_value(val){
349	if(!val)
350		return "";
351
352	val = val.split("|");
353	return val[0];
354}
355
356function gf_do_field_action(formId, action, fieldId, isInit, callback){
357	var conditional_logic = window["gf_form_conditional_logic"][formId];
358	var dependent_fields = conditional_logic["dependents"][fieldId];
359
360	for(var i=0; i < dependent_fields.length; i++){
361		var targetId = fieldId == 0 ? "#gform_submit_button_" + formId : "#field_" + formId + "_" + depen
361dent_fields[i];
362		var defaultValues = conditional_logic["defaults"][dependent_fields[i]];
363
364		//calling callback function on the last dependent field, to make sure it is only called once
365		do_callback = (i+1) == dependent_fields.length ? callback : null;
366
367		/**
368		 * Allow add-ons to abort gf_do_action() function.
369		 *
370		 * @since 2.6.2
371		 *
372		 * @param bool   $doAbort      The value being filtered. True to abort conditional logic action, false to continue. Defaults to false.
373		 * @param string $action       The conditional logic action that will be performed. Possible values: show or hide
374		 * @param string $targetId     HTML element id that will be the targed of the conditional logic action.
375		 * @param bool   $doAnimation  True to perform animation while showing/hiding field. False to hide/show field without animation.
376		 * @param array  $defaultValue Array containg default field values.
377		 * @param bool   $isInit       True if form is being initialized (i.e. before user has interacted with any input). False otherwise.
378		 * @param array  $formId       The current form ID.
379		 * @param func   $do_callback   Callback function to be executed after conditional logic is executed.
380		 */
381		let abort = gform.applyFilters( 'gform_abort_conditional_logic_do_action', false, action, targetId, conditional_logic[ "animation" ], defaultValues, isInit, formId, do_callback );
382		if ( ! abort ) {
383			gf_do_action( action, targetId, conditional_logic[ "animation" ], defaultValues, isInit, do_callback, formId );
384		}
385
386		gform.doAction('gform_post_conditional_logic_field_action', formId, action, targetId, defaultValues, isInit);
387	}
388}
389
390function gf_do_next_button_action(formId, action, fieldId, isInit){
391	var conditional_logic = window["gf_form_conditional_logic"][formId];
392	var targetId = "#gform_next_button_" + formId + "_" + fieldId;
393
394	/**
395	 * Allow add-ons to abort gf_do_action() function.
396	 *
397	 * @since 2.6.2
398	 *
399	 * @param bool   $doAbort      The value being filtered. True to abort conditional logic action, false to continue. Defaults to false.
400	 * @param string $action       The conditional logic action that will be performed. Possible values: show or hide
401	 * @param string $targetId     HTML element id that will be the targed of the conditional logic action.
402	 * @param bool   $doAnimation  True to perform animation while showing/hiding field. False to hide/show field without animation.
403	 * @param array  $defaultValue Array containg default field values.
404	 * @param bool   $isInit       True if form is being initialized (i.e. before user has interacted with any input). False otherwise.
405	 * @param array  $formId       The current form ID.
406	 * @param func   $do_callback   Callback function to be executed after conditional logic is executed.
407	 */
408	let abort = gform.applyFilters( 'gform_abort_conditional_logic_do_action', false, action, targetId, conditional_logic[ "animation" ], null, isInit, formId, null );
409	if ( ! abort ) {
410		gf_do_action( action, targetId, conditional_logic[ "animation" ], null, isInit, null, formId );
411	}
412}
413
414function gf_do_action(action, targetId, useAnimation, defaultValues, isInit, callback, formId){
415	var $target = jQuery( targetId );
416
417	/**
418	 * Do not re-enable inputs that are disabled by default. Check if field's inputs have been assessed. If not, add
419	 * designator class so these inputs are exempted below.
420	 */
421	if( ! $target.data( 'gf-disabled-assessed' ) ) {
422		$target.find( ':input:disabled' ).addClass( 'gf-default-disabled' );
423		$target.data( 'gf-disabled-assessed', true );
424	}
425
426	// honeypot should not be impacted by conditional logic.
427	if( $target.hasClass( 'gfield--type-honeypot') ) {
428		return;
429	}
430
431	if(action == "show"){
432
433		// reset tabindex for selects
434		$target.find( 'select' ).each( function() {
435			var $select = jQuery( this );
436			$select.attr( 'tabindex', $select.data( 'tabindex' ) );
437		} );
438
439		if(useAnimation && !isInit){
440			if($target.length > 0){
441				$target.find(':input:hidden:not(.gf-default-disabled)').removeAttr( 'disabled' );
442				if ( $target.is( 'input[type="submit"]' ) || $target.hasClass( 'gform_next_button' ) ) {
443					$target.removeAttr( 'disabled' ).css( 'display', '' );
444					$target.attr( 'data-conditional-logic', 'hidden' );
445					if ( '1' == gf_legacy.is_legacy ) {
446						// for legacy markup, remove screen reader class.
447						$target.removeClass( 'screen-reader-text' );
448					}
449				}
450				$target.slideDown(callback);
451			} else if(callback){
452				callback();
453			}
454		}
455		else{
456
457			var display = $target.data('gf_display');
458
459			// set display if previous (saved) display isn't set for any reason
460			if ( display == '' || display == 'none' ){
461				display = '1' === gf_legacy.is_legacy ? 'list-item' : 'block';
462			}
463			$target.find(':input:hidden:not(.gf-default-disabled)').removeAttr( 'disabled' ).attr( 'data-conditional-logic', 'visible' );
464
465			// Handle conditional submit and next buttons.
466			if ( $target.is( 'input[type="submit"]' ) || $target.hasClass( 'gform_next_button' ) ) {
467				$target.removeAttr( 'disabled' ).css( 'display', '' );
468				$target.attr( 'data-conditional-logic', 'visible' );
469				if ( '1' == gf_legacy.is_legacy ) {
470					// for legacy markup, remove screen reader class.
471					$target.removeClass( 'screen-reader-text' );
472				}
473			} else {
474				$target.css( 'display', display );
475				if( display == 'none' ) {
476					$target.attr( 'data-conditional-logic', 'hidden' );
477				} else {
478					$target.attr( 'data-conditional-logic', 'visible' );
479				}
480			}
481
482			if(callback){
483				callback();
484			}
485		}
486	}
487	else{
488
489		//if field is not already hidden, reset its values to the default
490		var child = $target.children().first();
491		if (child.length > 0){
492			var reset = gform.applyFilters('gform_reset_pre_conditional_logic_field_action', true, formId, targetId, defaultValues, isInit);
493
494			if(reset && !gformIsHidden(child)){
495				gf_reset_to_default(targetId, defaultValues);
496			}
497		}
498
499		// remove tabindex and stash as a data attr for selects
500		$target.find( 'select' ).each( function() {
501			var $select = jQuery( this );
502			$select.data( 'tabindex', $select.attr( 'tabindex' ) ).removeAttr( 'tabindex' );
503		} );
504
505		//Saving existing display so that it can be reset when showing the field
506		if( ! $target.data('gf_display') ){
507			$target.data('gf_display', $target.css('display'));
508		}
509
510		if(useAnimation && !isInit){
511			if( $target.is( 'input[type="submit"]' ) || $target.hasClass( 'gform_next_button' ) ) {
512				$target.attr( 'disabled', 'disabled' ).hide();
513				if ( '1' === gf_legacy.is_legacy ) {
514					// for legacy markup, let screen readers read the button.
515					$target.addClass( 'screen-reader-text' );
516				}
517			} else if ( $target.length > 0 && $target.is( ":visible" ) ) {
518				$target.slideUp( callback );
519			} else if ( callback ) {
520				callback();
521			}
522		} else{
523
524			// Handle conditional submit and next buttons.
525			if ( $target.is( 'input[type="submit"]' ) || $target.hasClass( 'gform_next_button' ) ) {
526				$target.attr( 'disabled', 'disabled' ).hide();
527				$target.attr( 'data-conditional-logic', 'hidden' );
528				if ( '1' === gf_legacy.is_legacy ) {
529					// for legacy markup, let screen readers read the button.
530					$target.addClass( 'screen-reader-text' );
531				}
532			} else {
533				$target.css( 'display', 'none' );
534				$target.attr( 'data-conditional-logic', 'hidden' );
535			}
536			$target.find(':input:hidden:not(.gf-default-disabled)').attr( 'disabled', 'disabled' );
537			if(callback){
538				callback();
539			}
540		}
541	}
542
543}
544
545function gf_reset_to_default(targetId, defaultValue){
546
547	var dateFields = jQuery( targetId ).find( '.gfield_date_month input, .gfield_date_day input, .gfield_date_year input, .gfield_date_dropdown_month select, .gfield_date_dropdown_day select, .gfield_date_dropdown_year select' );
548	if( dateFields.length > 0 ) {
549
550		dateFields.each( function(){
551
552			var element = jQuery( this );
553
554			// defaultValue is associative array (i.e. [ m: 1, d: 13, y: 1987 ] )
555			if( defaultValue ) {
556
557				var key = 'd';
558				if (element.parents().hasClass('gfield_date_month') || element.parents().hasClass('gfield_date_dropdown_month') ){
559					key = 'm';
560				}
561				else if(element.parents().hasClass('gfield_date_year') || element.parents().hasClass('gfield_date_dropdown_year') ){
562					key = 'y';
563				}
564
565				val = defaultValue[ key ];
566
567			}
568			else{
569				val = "";
570			}
571
572			if(element.prop("tagName") == "SELECT" && val != '' )
573				val = parseInt(val, 10);
574
575
576			if(element.val() != val)
577				element.val(val).trigger("change");
578			else
579				element.val(val);
580
581		});
582
583		return;
584	}
585
586	//cascading down conditional logic to children to support nested conditions
587	//text fields and drop downs, filter out list field text fields name with "_shim"
588	var target = jQuery(targetId).find( 'select, input[type="text"]:not([id*="_shim"]), input[type="number"], input[type="hidden"], input[type="email"], input[type="tel"], input[type="url"], textarea' );
589	var target_index = 0;
590
591	// When a List field is hidden via conditional logic during a page submission, the markup will be reduced to a
592	// single row. Add enough rows/inputs to satisfy the default value.
593	if( defaultValue && target.parents( '.ginput_list' ).length > 0 && target.length < defaultValue.length ) {
594		while( target.length < defaultValue.length ) {
595			gformAddListItem( target.eq( 0 ), 0 );
596			target = jQuery(targetId).find( 'select, input[type="text"]:not([id*="_shim"]), input[type="number"], textarea' );
597		}
598	}
599
600	target.each(function(){
601
602		var val = "";
603
604		var element = jQuery(this);
605
606		// Only reset Single Product and Shipping hidden inputs.
607		if( element.is( '[type="hidden"]' ) && ! gf_is_hidden_pricing_input( element ) ) {
608			return;
609		}
610
611		//get name of previous input field to see if it is the radio button which goes with the "Other" text box
612		//otherwise field is populated with input field name
613		var radio_button_name = element.prev("input").attr("value");
614		if(radio_button_name == "gf_other_choice"){
615			val = element.attr("value");
616		}
617		else if( jQuery.isArray( defaultValue ) && ! element.is( 'select[multiple]' ) ) {
618			val = defaultValue[target_index];
619		}
620		else if(jQuery.isPlainObject(defaultValue)){
621			val = defaultValue[element.attr("name")];
622			if( ! val && element.attr( 'id' ) ) {
623				// 'input_123_3_1' => '3.1'
624				var inputId = element.attr( 'id' ).split( '_' ).slice( 2 ).join( '.' );
625				val = defaultValue[ inputId ];
626			}
627			if( ! val && element.attr( 'name' ) ) {
628				var inputId = element.attr( 'name' ).split( '_' )[1];
629				val = defaultValue[ inputId ];
630			}
631		}
632		else if(defaultValue){
633			val = defaultValue;
634		}
635
636		if( element.is('select:not([multiple])') && ! val ) {
637			val = element.find( 'option' ).not( ':disabled' ).eq(0).val();
638		}
639
640		if(element.val() != val) {
641			element.val(val).trigger('change');
642			if (element.is('select') && element.next().hasClass('chosen-container')) {
643				element.trigger('chosen:updated');
644			}
645			// Check for Single Product & Shipping input and force visual price update.
646			if( gf_is_hidden_pricing_input( element ) ) {
647				var ids = gf_get_ids_by_html_id( element.parents( '.gfield' ).attr( 'id' ) );
648				jQuery( '#input_' + ids[0] + '_' + ids[1] ).text( gformFormatMoney( element.val() ) );
649				element.val( gformFormatMoney( element.val() ) );
650			}
651		}
652		else{
653			element.val(val);
654		}
655
656		target_index++;
657	});
658
659	//checkboxes and radio buttons
660	var elements = jQuery(targetId).find('input[type="radio"], input[type="checkbox"]:not(".copy_values_activated")');
661
662	elements.each(function(){
663
664		//is input currently checked?
665		var isChecked = jQuery(this).is(':checked') ? true : false;
666
667		//does input need to be marked as checked or unchecked?
668		var doCheck = defaultValue ? jQuery.inArray(jQuery(this).attr('id'), defaultValue) > -1 : false;
669
670		//if value changed, trigger click event
671		if(isChecked != doCheck){
672			//setting input as checked or unchecked appropriately
673
674			if(jQuery(this).attr("type") == "checkbox"){
675				jQuery(this).trigger('click');
676			}
677			else{
678				jQuery(this).prop('checked', doCheck).change();
679			}
680
681		}
682	});
683
684}
685
686function gf_is_hidden_pricing_input( element ) {
687
688	// Check for Single Product fields.
689	if( element.attr( 'id' ) && element.attr( 'id' ).indexOf( 'ginput_base_price' ) === 0 ) {
690		return true;
691	}
692
693	if( element.attr( 'type' ) !== 'hidden' ) {
694		return false;
695	}
696
697	// Check for Shipping fields.
698	return element.parents( '.gfield_shipping' ).length;
699}

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.