PageSourceSearch

https://www.celaya.gob.mx/wp-content/plugins/bt_cost_calculator/cc.main.js?ver=7.1.2

js celaya.gob.mx collected 2026-10-02 17:47:30 UTC 32,790 bytes, 1,047 lines download raw bytes

1
2(function( $ ) {
3	
4	var is_rtl = false;
5	var rtl_direction = 1;
6	
7	// ---------------
8	// Functions start
9	// ---------------
10	
11	window.bt_cc_subtotal = ';var setSubtotal = function( id, val, ignore_format ) {' +
12	'if ( arguments.length < 2 || ! jQuery( "#btSubtotalId"+id ) ) return;' +
13	'var c = jQuery( "#btSubtotalId" + id ).closest( ".btQuoteBooking" );' +
14	'if ( ignore_format !== true ) val = bt_cc_currency_format( c, val );' +
15	'var currency = c.data( "currency" );' +
16	'var currency_after = c.data( "currency_after" );' +
17	'var currency_space = c.data( "currency_space" );' +
18	'var hide_total = c.data( "hide_total" );' +
19	'if ( currency != "" && ignore_format !== true ) {' +
20		'if ( currency_after == "yes" ) {' +
21			'if ( currency_space == "yes" ) {' +
22				'val = val + " " + currency;' +
23			'} else {' +
24				'val = val + currency;' +
25			'}' +
26		'} else {' +
27			'if ( currency_space == "yes" ) {' +
28				'val = currency + " " + val;' +
29			'} else {' +
30				'val = currency + val;' +
31			'}' +
32		'}' +
33	'}' +
34	'jQuery( "#btSubtotalId" + id ).data( "val", val );' +
35	'if ( hide_total == "yes" ) {' +
36		'jQuery( "#btSubtotalId" + id ).hide();' +
37		'return;' +
38	'}' +
39	'jQuery( "#btSubtotalId" + id ).find( ".btQuoteSubtotalCalc" ).html( val );' +
40	'};';
41	
42	// Base functions 
43	 
44	window.bt_parse_float = function( x ) {
45		r = parseFloat( x );
46		if ( isNaN( r ) ) r = 0;
47		return r;
48	}
49	
50	$.fn.bt_cc_lock = function(){
51		$(this).addClass( 'btCCLock' );
52		return $(this);
53	}
54	
55	$.fn.bt_cc_unlock = function(){
56		$(this).removeClass( 'btCCLock' );
57		return $(this);
58	}
59	
60	// function to be called from element conditions 
61
62	window.bt_cc_set_slider_value = function( elem, value, calc ){
63		if ( elem.slider( 'instance' ) ) { 
64			elem.slider( 'value', value );
65			elem.find('.btQuoteSliderValue').html( value );	
66			if ( calc ) {
67				bt_quote_total( elem.closest( '.btQuoteBooking' ) );
68				bt_paypal_items( elem.closest( '.btQuoteBooking' ) );
69			}
70		}
71
72	}
73	window.bt_cc_get_slider_value = function( elem ){
74		if ( elem.slider( 'instance' ) ) {
75			val = bt_parse_float( elem.find('.btQuoteSliderValue').html() );
76		} else {
77			val = bt_parse_float( elem.data( 'initial-value' ) );
78		}
79		return val;
80		
81	}
82	
83	$.fn.bt_cc_set_value = function( value ){
84		if ( value !== null && value !== 'undefined' && value !== undefined ) {
85			var initial_value = value;	
86		} else {
87			var initial_value = $( this ).find( '.btQuoteElement' ).data( 'initial-value' );	
88		}
89		if ( $( this ).find( '.btQuoteItemInput > .btQuoteSelect' ).length > 0 ) {
90			var oDropdown = $( this ).find( '.btQuoteSelect' ).data("dd");
91			if ( oDropdown !== undefined ) {
92				bt_cc_init_dropdown( oDropdown, "#"+$( this ).attr('id'), initial_value );	
93			}	
94		} else if ( $( this ).find( '.btQuoteItemInput > .btQuoteSlider' ).length > 0 ) {
95			if ( $( this ).find( '.btQuoteItemInput > .btQuoteSlider' ).slider( 'instance' ) ) {
96				bt_cc_set_slider_value( $( this ).find( '.btQuoteItemInput > .btQuoteSlider' ), initial_value );
97			} else {
98				/* W3 Tiotal cache safe path */
99				setTimeout( bt_cc_set_slider_value, 2000, $( this ).find( '.btQuoteItemInput > .btQuoteSlider' ), initial_value, true );
100			}
101			
102		} else if ( $( this ).find( '.btQuoteItemInput > .btQuoteText' ).length > 0 ) {
103			$( this ).find( '.btQuoteText' ).val( initial_value );
104		} else if ( $( this ).find( '.btQuoteItemInput > .btQuoteSwitch' ).length > 0 ) {
105			if ( 
106			( $( this ).find( '.btQuoteSwitch' ).data('on') == initial_value && !$( this ).find( '.btQuoteSwitch' ).hasClass('on') ) || 
107			( $( this ).find( '.btQuoteSwitch' ).data('off') == initial_value && $( this ).find( '.btQuoteSwitch' ).hasClass('on') )
108			) {
109				$( this ).find( '.btQuoteSwitch' ).trigger('click');
110			}
111		}
112		bt_cc_eval_conditions( initial_value, $( this ).find( '.btQuoteElement' ).data( 'condition' ) );
113		bt_quote_total( $( this ).closest( '.btQuoteBooking' ) );
114		bt_paypal_items( $( this ).closest( '.btQuoteBooking' ) );
115		return $(this);
116	}
117	
118	window.bt_cc_eval_conditions = function( val, conditions ){
119		// alert(conditions);
120		if ( conditions == '' || conditions == undefined ) return false;
121		if ( val == '' ) val = 0;	
122
123		if ( conditions.indexOf(';') == -1 ) {
124			conditions = atob( conditions );
125			var bt_cc_conditions = conditions.split(/\r?\n/);
126		} else {
127			var bt_cc_conditions = conditions.split("#bt_cc_nl#");
128		}
129		$.each( bt_cc_conditions, function( index, value ) {
130			if ( bt_cc_conditions[index] != undefined ) {
131				var bt_cc_single_condition = bt_cc_conditions[index].split(";");
132				var eval_action  = bt_cc_single_condition[2];
133				if ( bt_cc_single_condition[3] == 'lock' ) {
134					eval_action += '.bt_cc_lock()';	
135				} else if ( bt_cc_single_condition[3] == 'unlock' ) {
136					eval_action += '.bt_cc_unlock()';	
137				}
138				if ( bt_cc_single_condition[0] != '' ) {
139					var eval_code =  'if ( ' + val + decodeURIComponent( bt_cc_single_condition[0] ) + ' ) { $(\'#' + bt_cc_single_condition[1] +  '\').' + eval_action + '; }' ;
140					eval( eval_code );	
141				}				
142			}
143
144		});
145		return false;
146	}
147
148	// Paypal calculation
149	
150	window.bt_paypal_items = function( c ) {
151					
152		$( c ).each(function() {
153		
154			if ( $( this ).find( '.btPayPalButton' ).length > 0 ) {
155				
156				var form = $( this ).find( '.btPayPalButton' ).next();
157				form.find( '.btPayPalItem' ).remove();
158				
159				var x = 0;
160		
161				// items not in multiply and group
162				$( this ).find( '.btQuoteBookingForm' ).find( '.btQuoteItem' ).not( '.btQuoteMBlock .btQuoteItem' ).not( '.btQuoteGBlock .btQuoteItem' ).each(function() {
163					
164					var unit_price = 0;
165					var val = 0;
166					
167					var selected_name = '';
168
169					$( this ).find( '.btQuoteText' ).each(function() {
170						unit_price = bt_parse_float( $( this ).data( 'price' ) );
171						val = bt_parse_float( $( this ).val() );
172					});
173					
174					$( this ).find( '.btQuoteSelect' ).find( '._msddli_.selected' ).each(function() {
175						unit_price = bt_parse_float( $( this ).data( 'value' ) );
176						val = 1;
177						selected_name = $( this ).find( '.ddlabel' )[0].innerHTML;
178						if ( $( this ).is( ':first-child' ) ) {
179							selected_name = '';
180						}
181					});
182					
183					var is_slider = false;
184					$( this ).find( '.btQuoteSlider' ).each(function() {
185						unit_price = bt_parse_float( $( this ).data( 'price' ) );
186						val = bt_cc_get_slider_value ( $( this ) );
187						is_slider = true;
188					});
189					
190					$( this ).find( '.btQuoteSwitch' ).each(function() {
191						if ( $( this ).hasClass( 'on' ) ) {
192							unit_price = bt_parse_float( $( this ).data( 'on' ) );
193						} else {
194							unit_price = bt_parse_float( $( this ).data( 'off' ) );
195						}
196						val = 1;
197					});
198
199					var label = $( this ).find( 'label' ).html();
200					
201					if ( is_slider ) {
202						label = label + ': ' + val;
203					}
204					
205					if ( selected_name != '' ) {
206						selected_name = selected_name.replace( '<span class="description">', '/' );
207						selected_name = selected_name.replace( '</span>', '' );
208						if ( label.endsWith( '?' ) || label.endsWith( ':' ) ) {
209							label = label + ' ' + selected_name;
210						} else {
211							label = label + ': ' + selected_name;
212						}
213						
214					}
215
216					val = val * unit_price;
217					
218		
219					if ( label !== undefined && val > 0 ) {
220						x++;
221						val = val.toFixed( 2 );
222						form.append( '<input type="hidden" name="item_name_' + x + '" value="' + label + '" class="btPayPalItem"><input type="hidden" name="amount_' + x + '" value="' + val + '" class="btPayPalItem">' );
223					}
224				});
225				
226				
227				// multiply
228				
229				$( this ).find( '.btQuoteBookingForm' ).find( '.btQuoteMBlock' ).each(function() {
230
231					var m_total = 1;
232					var m_first = true;
233					var m_val = 0;
234					var selected_name = '';
235					var label = '';
236					
237					$( this ).find( '.btQuoteItem' ).each(function() {
238				
239						$( this ).find( '.btQuoteText' ).each(function() {
240							var unit_price = bt_parse_float( $( this ).data( 'price' ) );
241							var val = bt_parse_float( $( this ).val() );
242							val = val * unit_price;
243							if ( m_first ) {
244								m_val = val;
245								label = $( this ).closest( '.btQuoteItem' ).find( 'label' ).html();
246							} else {
247								m_total *= val;
248							}
249							m_first = false;
250						});
251						
252						$( this ).find( '.btQuoteSelect' ).find( '._msddli_.selected' ).each(function() {
253							var val = bt_parse_float( $( this ).data( 'value' ) );
254							if ( m_first ) {
255								m_val = val;
256								label = $( this ).closest( '.btQuoteItem' ).find( 'label' ).html();
257								selected_name = $( this ).find( '.ddlabel' )[0].innerHTML;
258								selected_name = selected_name.substring( 0, selected_name.indexOf( '<span' ) );
259								if ( $( this ).is( ':first-child' ) ) {
260									selected_name = '';
261								}
262								if ( selected_name != '' ) label = label + ': ' + selected_name;											
263							} else {
264								m_total *= val;
265							}
266							m_first = false;
267						});
268						
269						$( this ).find( '.btQuoteSlider' ).each(function() {
270							var unit_price = bt_parse_float( $( this ).data( 'price' ) );
271							// var val = bt_parse_float( $( this ).slider( 'value' ) );
272							var val = bt_cc_get_slider_value ( $( this ) );
273							val = val * unit_price;
274							if ( m_first ) {
275								m_val = val;
276								label = $( this ).closest( '.btQuoteItem' ).find( 'label' ).html();
277							} else {
278								m_total *= val;
279							}
280							m_first = false;
281						});
282						
283						$( this ).find( '.btQuoteSwitch' ).each(function() {
284							if ( $( this ).hasClass( 'on' ) ) {
285								var val = bt_parse_float( $( this ).data( 'on' ) );
286							} else {
287								var val = bt_parse_float( $( this ).data( 'off' ) );
288							}							
289							if ( m_first ) {
290								m_val = val;
291								label = $( this ).closest( '.btQuoteItem' ).find( 'label' ).html();
292							} else {
293								m_total *= val;
294							}
295							m_first = false;
296						});
297						
298						
299					});
300					
301					if ( m_total > 0 && m_val > 0 ) {
302						x++;
303						m_val = m_val.toFixed( 2 );
304						form.append( '<input type="hidden" name="item_name_' + x + '" value="' + label + '" class="btPayPalItem"><input type="hidden" name="amount_' + x + '" value="' + m_val + '" class="btPayPalItem"><input type="hidden" name="quantity_' + x + '" value="' + m_total + '" class="btPayPalItem">' );
305					}
306
307				});
308				
309				
310				// group
311				
312				$( this ).find( '.btQuoteBookingForm' ).find( '.btQuoteGBlock' ).each(function() {
313					
314					var eval_code = $( this ).data( 'eval' );
315					
316					var paypal_label = $( this ).data( 'paypal_label' );
317						
318					var group_array = [];
319					
320					$( this ).find( '.btQuoteItem' ).each(function() {
321						
322						var val;
323				
324						$( this ).find( '.btQuoteText' ).each(function() {
325							var unit_price = bt_parse_float( $( this ).data( 'price' ) );
326							val = bt_parse_float( $( this ).val() );
327							val = val * unit_price;
328						});
329						
330						$( this ).find( '.btQuoteSelect' ).find( '._msddli_.selected' ).each(function() {
331							val = bt_parse_float( $( this ).data( 'value' ) );
332						});
333						
334						$( this ).find( '.btQuoteSlider' ).each(function() {
335							var unit_price = bt_parse_float( $( this ).data( 'price' ) );
336							// val = bt_parse_float( $( this ).slider( 'value' ) );
337							val = bt_cc_get_slider_value ( $( this ) );
338							val = val * unit_price;
339						});
340						
341						$( this ).find( '.btQuoteSwitch' ).each(function() {
342							if ( $( this ).hasClass( 'on' ) ) {
343								val = bt_parse_float( $( this ).data( 'on' ) );
344							} else {
345								val = bt_parse_float( $( this ).data( 'off' ) );
346							}
347						});
348						
349						group_array.push( val );
350						
351					});
352					
353					var patt = /\$\d+/igm;
354					var match = eval_code.match( patt );
355
356					if ( match === null ) {
357						eval_code = atob( eval_code );
358						match = eval_code.match( patt );
359					}
360
361					if ( match === null ) {
362						return;
363					}
364					
365					for ( var i = 0; i < match.length; i++ ) {
366						eval_code = eval_code.replace( match[ i ], group_array[ i ] );
367					}
368					
369					eval_code =  window.bt_cc_subtotal + eval_code;
370					
371					var g_total = eval( '(function() {' + decodeURIComponent(eval_code) + '}())' );
372					
373					if ( paypal_label != '' && g_total > 0 ) {
374						x++;
375						g_total = g_total.toFixed( 2 );
376						form.append( '<input type="hidden" name="item_name_' + x + '" value="' + paypal_label + '" class="btPayPalItem"><input type="hidden" name="amount_' + x + '" value="' + g_total + '" class="btPayPalItem"><input type="hidden" name="quantity_' + x + '" value="1" class="btPayPalItem">' );
377					}
378
379				});
380			}
381		});
382	}
383	
384	// Currency format
385	
386	window.bt_cc_currency_format = function( c, n ) {
387		var regex = /(\d)(?=(\d{3})+\.)/g;
388		var regex_replace = '$1,';
389		
390		var format = c.data( 'total_format' );
391		var decimals = c.data( 'total_decimals' );
392
393		if ( format == 'currency_1' || format == 'currency_2' || format == 'currency_3' ) {
394			
395			n = n.toFixed( decimals );
396			
397			if ( format == 'currency_2' || format == 'currency_3' ) {
398				n = n.replace( '.', ',' );
399				regex = /(\d)(?=(\d{3})+\,)/g;
400				if ( format == 'currency_2' ) {
401					regex_replace = '$1.';
402				} else if ( format == 'currency_3' ) {
403					regex_replace = '$1 ';
404				}
405			}
406			
407			n = n.replace( regex, regex_replace );
408			
409		} else if ( format == 'decimal_1' || format == 'decimal_2' ) {
410			
411			n = parseFloat( n.toFixed( decimals ) ).toString();
412			if ( format == 'decimal_2' ) {
413				n = n.replace( '.', ',' );
414			}
415			
416		} else if ( format == 'rounded' ) {
417			
418			n = Math.round( n );
419			
420		}
421		
422		return n;
423	}
424	
425	// Total calculation
426	
427	window.bt_quote_total = function( c ) {
428		
429		var c = $( c );
430	
431		total = 0;
432		
433
434		c.find( '.btQuoteText' ).not( '.btQuoteMBlock .btQuoteText' ).not( '.btQuoteGBlock .btQuoteText' ).each(function() {
435			var unit_price = bt_parse_float( $( this ).data( 'price' ) );
436			var val = bt_parse_float( $( this ).val() );
437			val = val * unit_price;
438			total += val;
439		});
440		
441		c.find( '.btQuoteSelect' ).not( '.btQuoteMBlock .btQuoteSelect' ).not( '.btQuoteGBlock .btQuoteSelect' ).find( '._msddli_.selected' ).each(function() {
442			var val = bt_parse_float( $( this ).data( 'value' ) );
443			total += val;
444		});
445		
446		c.find( '.btQuoteSlider' ).not( '.btQuoteMBlock .btQuoteSlider' ).not( '.btQuoteGBlock .btQuoteSlider' ).each(function() {
447			var unit_price = bt_parse_float( $( this ).data( 'price' ) );
448			var offset = bt_parse_float( $( this ).data( 'offset' ) );
449			var val = bt_cc_get_slider_value ( $( this ) );
450			val = val * unit_price;
451			total += val;
452			if ( ! $( this ).closest( '.btQuoteBooking' ).find( '.btPayPalButton' ).length > 0 ) {
453				total += offset;
454			}
455		});
456		
457		c.find( '.btQuoteSwitch' ).not( '.btQuoteMBlock .btQuoteSwitch' ).not( '.btQuoteGBlock .btQuoteSwitch' ).each(function() {
458			if ( $( this ).hasClass( 'on' ) ) {
459				total += bt_parse_float( $( this ).data( 'on' ) );
460			} else {
461				total += bt_parse_float( $( this ).data( 'off' ) );
462			}
463		});
464							
465		
466		// multiply
467		
468		c.find( '.btQuoteMBlock' ).each(function() {
469								
470			var m_total = 0;
471			var m_first = true;
472			$( this ).find( '.btQuoteText' ).each(function() {
473									   
474				var unit_price = bt_parse_float( $( this ).data( 'price' ) );
475				var val = bt_parse_float( $( this ).val() );
476				val = val * unit_price;
477				if ( m_first ) {
478					m_total = val;
479				} else {
480					m_total *= val;
481				}
482				m_first = false;
483											 
484			});
485			
486			$( this ).find( '.btQuoteSelect' ).find( '._msddli_.selected' ).each(function() {
487										
488										  
489				var val = bt_parse_float( $( this ).data( 'value' ) );
490										   
491				if ( m_first ) {
492					m_total = val;
493				} else {
494					m_total *= val;
495				}
496				m_first = false;
497											
498			});
499			
500			$( this ).find( '.btQuoteSlider' ).each(function() {
501									   
502				var unit_price = bt_parse_float( $( this ).data( 'price' ) );
503				var offset = bt_parse_float( $( this ).data( 'offset' ) );
504				//var val = bt_parse_float( $( this ).slider( 'value' ) );
505				var val = bt_cc_get_slider_value ( $( this ) );
506				val = val * unit_price;
507				if ( m_first ) {
508					m_total = val;
509				} else {
510					m_total *= val;
511				}
512				m_total += offset;
513				m_first = false;
514										   
515			});
516			
517			$( this ).find( '.btQuoteSwitch' ).each(function() {
518									   
519				if ( $( this ).hasClass( 'on' ) ) {
520					var val = bt_parse_float( $( this ).data( 'on' ) );
521				} else {
522					var val = bt_parse_float( $( this ).data( 'off' ) );
523				}							
524				if ( m_first ) {
525					m_total = val;
526				} else {
527					m_total *= val;
528				}
529				m_first = false;
530											
531			});
532									
533			
534			total += m_total;
535			
536		});
537							
538						  
539		
540		// group
541		
542		c.find( '.btQuoteGBlock' ).each(function() {
543			
544			var eval_code = $( this ).data( 'eval' );
545			
546			var group_array = [];
547			
548			$( this ).find( '.btQuoteItem .btQuoteItemInput' ).each(function() {
549				
550				var val = 0;
551				
552				$( this ).find( '.btQuoteText' ).each(function() {
553					var unit_price = bt_parse_float( $( this ).data( 'price' ) );
554					val = bt_parse_float( $( this ).val() );
555					val = val * unit_price;
556				});
557				
558				$( this ).find( '.btQuoteSelect' ).find( '._msddli_.selected' ).each(function() {							
559					val = bt_parse_float( $( this ).data( 'value' ) );	
560				});
561				
562				$( this ).find( '.btQuoteSlider' ).each(function() {
563					var unit_price = bt_parse_float( $( this ).data( 'price' ) );
564					var offset = bt_parse_float( $( this ).data( 'offset' ) );
565					val = bt_cc_get_slider_value( $( this ) );
566					val = val * unit_price;
567				});
568				
569				$( this ).find( '.btQuoteSwitch' ).each(function() {
570					if ( $( this ).hasClass( 'on' ) ) {
571						val = bt_parse_float( $( this ).data( 'on' ) );
572					} else {
573						val = bt_parse_float( $( this ).data( 'off' ) );
574					}
575				});
576				
577				group_array.push( val );
578
579			});
580
581			var patt = /\$\d+/igm;
582			var match = eval_code.match( patt );
583
584			if ( match === null ) {
585				eval_code = atob( eval_code );
586				match = eval_code.match( patt );
587			}
588
589			if ( match === null ) {
590				return;
591			}
592
593			for ( var i = 0; i < match.length; i++ ) {
594				eval_code = eval_code.replace( match[ i ], group_array[ i ] );
595			}
596			
597			eval_code =  window.bt_cc_subtotal + eval_code;
598			
599			var g_total = eval( '(function() {' + decodeURIComponent( eval_code ) + '}())' );
600			
601			total += g_total;
602			
603		});
604		
605		total = bt_cc_currency_format( c, total );
606
607		c.find( '.btQuoteTotalCalc' ).html( total );
608		c.data( 'total', total );
609	}
610
611	// Init functions
612	
613	// Dropdown init
614
615	window.bt_cc_init_dropdown = function( elem, id, index ) {
616		elem.set( "selectedIndex", index );
617		var ui2 = $( id ).find( '._msddli_.selected' );
618		var val = elem.getData().data.value;
619		ui2.data( 'value', val );
620		bt_cc_eval_conditions( val, ui2.closest( '.btQuoteSelect' ).data( 'condition' ) );
621		bt_quote_total( ui2.closest( '.btQuoteBooking' ) );
622		bt_paypal_items( ui2.closest( '.btQuoteBooking' ) );
623	}
624	
625	// Base init
626	
627	window.bt_cc_init = function( ) {
628		
629		$( ".btQuoteBooking" ).each(function( index ) {
630			var c = $( this );
631
632			
633			
634			// Init elements 
635			
636			c.find( '.btContactDate' ).datepicker({
637				prevText: window.bt_cc_translate['prev'],
638				nextText: window.bt_cc_translate['next'],
639				dateFormat: c.data( 'date_format' ),
640				dayNamesMin: [ window.bt_cc_translate['su'], window.bt_cc_translate['mo'], window.bt_cc_translate['tu'], window.bt_cc_translate['we'], window.bt_cc_translate['th'], window.bt_cc_translate['fr'], window.bt_cc_translate['sa'] ],
641				monthNames: [ window.bt_cc_translate['january'], window.bt_cc_translate['february'], window.bt_cc_translate['march'], window.bt_cc_translate['april'], window.bt_cc_translate['may'], window.bt_cc_translate['june'], window.bt_cc_translate['july'], window.bt_cc_translate['august'], window.bt_cc_translate['september'], window.bt_cc_translate['october'], window.bt_cc_translate['november'], window.bt_cc_translate['december'] ],
642				beforeShow: function( input, inst ) {
643					$( '.ui-datepicker' ).addClass( 'btDatePicker' );
644				}
645			});
646			c.find( '.btQuoteSlider' ).each(function() {
647				$( this ).slider({
648					min: ! window.is_rtl ? $( this ).data( 'min' ) : -$( this ).data( 'max' ),
649					max: ! window.is_rtl ? $( this ).data( 'max' ) : -$( this ).data( 'min' ),
650					step: $( this ).data( 'step' ),
651					value: ! window.is_rtl ? $( this ).data( 'value' ) : -$( this ).data( 'value' ),
652					change: function( event, ui ) { 
653						$( this ).find('.btQuoteSliderValue').html( window.rtl_direction * $( this ).slider( 'value' ) );
654						bt_cc_eval_conditions( window.rtl_direction * $( this ).slider( 'value' ), $( this ).data( 'condition' ) );
655					}
656				});
657				bt_cc_eval_conditions( window.rtl_direction * $( this ).data( 'value' ), $( this ).data( 'condition' ) );
658			});
659			
660			c.find( '.ui-slider-handle' ).each(function() {
661				$( this ).append( $( this ).closest( '.btQuoteItemInput' ).find( $( '.btQuoteSliderValue' ) ) );
662			});
663			
664
665			c.find( '.btQuoteSlider' ).each(function() {
666				var this_slider = $( this );
667				$( this ).slider({
668					slide: function( event, ui ) {
669						var val = window.rtl_direction * ui.value; 
670						this_slider.slider( 'value', val );
671						this_slider.find('.btQuoteSliderValue').html( val );
672						bt_quote_total( c );
673						bt_paypal_items( c );
674					}
675				});
676			});			
677
678			
679			c.find( '.btQuoteSwitch' ).on( 'click', function() {
680				if ( $( this ).hasClass( 'on' ) ) { 
681					$( this ).removeClass( 'on' );
682					bt_cc_eval_conditions( $( this ).data( 'off' ), $( this ).data( 'condition' ) );
683				} else {
684					$( this ).addClass( 'on' );
685					bt_cc_eval_conditions( $( this ).data( 'on' ), $( this ).data( 'condition' ) );
686				}
687				bt_quote_total( c );
688				bt_paypal_items( c );
689			});
690			
691			c.find( '.btQuoteSwitch' ).each( function() {
692				if ( $( this ).hasClass( 'on' ) ) { 
693					bt_cc_eval_conditions( $( this ).data( 'on' ), $( this ).data( 'condition' ) );
694				} else {
695					bt_cc_eval_conditions( $( this ).data( 'off' ), $( this ).data( 'condition' ) );
696				}
697			});
698			
699			c.find( '.btPayPalButton' ).on( 'click', function() {
700				$( this ).next().submit();
701			});
702			
703			c.find( '.btQuoteText' ).each(function() {
704				bt_cc_eval_conditions( $( this ).val(), $( this ).data( 'condition' ) );
705			});
706			
707			c.find( '.btQuoteText' ).keyup(function() {
708				bt_quote_total( c );
709				bt_paypal_items( c );
710				bt_cc_eval_conditions( $( this ).val(), $( this ).data( 'condition' ) );
711			});
712			
713			c.find( '.btContactNext' ).click(function() {
714				$( 'html, body' ).delay( 1000 ).animate({
715					scrollTop: ( $( this ).closest( '.btQuoteBooking' ).find( '.btTotalQuoteContactGroup' ).offset().top - 30 )
716				}, 400 );
717				
718				var contact_group = $( this ).closest( '.btQuoteBooking' ).find( '.btTotalQuoteContactGroup' );
719				
720				$( this ).closest( '.btQuoteBooking' ).find( '.btTotalQuoteContactGroup' ).addClass( 'btActive' );
721				$( this ).closest( '.btQuoteBooking' ).find( '.btQuoteBookingForm' ).removeClass( 'btActive' );
722			});
723
724			c.find( '.btContactSubmit' ).click(function() {
725
726				c.find( '.btContactFieldError' ).removeClass( 'btContactFieldError' );
727		
728				var val = true;
729				
730				c.find( '.btContactField' ).each(function() {
731					if ( $( this ).parent().hasClass( 'btContactFieldMandatory' ) 
732					&& ( ( $( this ).val() == '' && ! $( this ).hasClass( 'btContactTime' ) ) 
733					|| ( $( this ).hasClass( 'btContactTime' ) && $( this ).hasClass( 'btNotSelected' ) ) ) ) {
734						$( this ).parent().addClass( 'btContactFieldError' );
735						val = false;
736					}
737				});
738				
739				if ( ! val ) {
740					c.find( '.btSubmitMessage' ).hide().html( c.data( 'message_mandatory' ) ).fadeIn();
741					return false;
742				}
743
744				var quote = '';
745				var back = 0;
746				var bt_is_odd = function( n ) {
747					return ( n % 2 ) == 1;
748				}
749
750				c.find( '.btQuoteItem, .btQuoteSubtotal' ).each(function() {
751					
752					back++;
753					var item_val = 0;
754					var selected_name = '';
755					
756					var is_text = false;
757					var text_val;
758					$( this ).find( '.btQuoteText' ).each(function() {
759						var unit_price = bt_parse_float( $( this ).data( 'price' ) );
760						text_val = bt_parse_float( $( this ).val() );
761						item_val = text_val * unit_price;
762						is_text = true;
763					});
764					
765					$( this ).find( '.btQuoteSelect' ).find( '._msddli_.selected' ).each(function() {
766						selected_name = $( this ).find( '.ddlabel' )[0].innerHTML;
767						if ( $( this ).is( ':first-child' ) ) {
768							selected_name = '';
769						}
770						item_val = bt_parse_float( $( this ).data( 'value' ) );
771					});
772					
773					var is_slider = false;
774					var slider_val;
775					$( this ).find( '.btQuoteSlider' ).each(function() {
776						var unit_price = bt_parse_float( $( this ).data( 'price' ) );
777						// slider_val = bt_parse_float( $( this ).slider( 'value' ) );
778						slider_val = bt_cc_get_slider_value ( $( this ) );
779						item_val = slider_val * unit_price;
780						is_slider = true;
781					});
782
783					$( this ).find( '.btQuoteSwitch' ).each(function() {
784						if ( $( this ).hasClass( 'on' ) ) {
785							item_val = bt_parse_float( $( this ).data( 'on' ) );
786						} else {
787							item_val = bt_parse_float( $( this ).data( 'off' ) );
788						}
789					});
790					
791					var label = $( this ).find( 'label' ).html();
792					
793					if ( is_slider ) {
794						label = label + ': ' + slider_val;
795					}
796					
797					if ( is_text ) {
798						label = label + ': ' + text_val;
799					}
800					
801					if ( selected_name != '' ) {
802						selected_name = selected_name.replace( '<span class="description">', '/' );
803						selected_name = selected_name.replace( '</span>', '' );
804						label = label + ': ' + selected_name;
805					}
806					
807					var background = '';
808					if ( bt_is_odd( back ) ) background = ' ' + 'style="background:#eee;"';
809					
810					item_val = bt_cc_currency_format( c, item_val );
811					
812					// subtotal
813					if ( $( this ).hasClass( 'btQuoteSubtotal' ) ) {
814						label = $( this ).data( 'label' );
815						item_val = $( this ).data( 'val' );
816					}
817					
818					if ( label !== undefined && label !== null ) {
819						quote += encodeURI( '<tr' + background + '>\r\n<td style="padding:.5em;">' + label + '</td>\r\n<td style="text-align:right;padding:.5em;">' + item_val + '</td>\r\n</tr>' ) + "\r\n";
820					}
821					
822				});
823				
824				var recaptcha_response = '';
825				if ( typeof grecaptcha !== 'undefined' ) {
826					var recaptcha_response = grecaptcha.getResponse( c.find( '.g-rec' ).data( 'widget_id' ) );
827					grecaptcha.reset( c.find( '.g-rec' ).data( 'widget_id' ) );
828				}
829				
830				var email_confirmation = 'no';
831				if ( c.find( '.bt_cc_email_confirmation' ).length ) {
832					if ( c.find( '.bt_cc_email_confirmation' ).prop( 'checked' ) ) {
833						email_confirmation = 'yes';
834					}
835				} else {
836					email_confirmation = 'yes';
837				}
838
839				var email_gdpr = 'no';
840				if ( c.find( '.bt_cc_email_gdpr' ).length ) {
841					if ( c.find( '.bt_cc_email_gdpr' ).prop( 'checked' ) ) {
842						email_gdpr = 'yes';
843					}
844				} else {
845					email_gdpr = 'yes';
846				}
847
848				if ( email_gdpr == 'no' ) {
849					c.find( '.btSubmitMessage' ).html(c.data( 'email_gdpr_not_text' ) );
850					return false;
851				}
852				
853
854				var data = {
855					'action': 'bt_cc',
856					'recaptcha_response': recaptcha_response,
857					'recaptcha_secret': c.data( 'rec_secret_key' ),
858					'admin_email': c.data( 'admin_email' ),
859					'email_client': c.data( 'email_client' ),
860					'currency': c.data( 'currency' ),
861					'currency_after': c.data( 'currency_after' ),
862					'currency_space': c.data( 'currency_space' ),
863					'email_confirmation': email_confirmation,
864					'url_confirmation': c.data( 'url_confirmation' ),
865					'subject': c.data( 'subject' ),
866					'email_header': c.data( 'email_header' ),
867					'email_footer': c.data( 'email_footer' ),
868					'quote' : quote,
869					'total' : c.data( 'total' ),
870					'total_text' : c.data( 'total_text' ),
871					'name' : c.find( '.btContactName' ).val(),
872					'email' : c.find( '.btContactEmail' ).val(),
873					'phone' : c.find( '.btContactPhone' ).val(),
874					'address' : c.find( '.btContactAddress' ).val(),
875					'date' : c.find( '.btContactDate' ).val(),
876					'time' : c.find( '.btContactTime option:selected' ).val(),
877					'date_text': c.data( 'date_text' ),
878					'time_text': c.data( 'time_text' ),
879					'message' : c.find( '.btContactMessage' ).val(),
880					'bt_cc_nonce': c.data( 'bt_cc_nonce' ),
881					'email_gdpr': c.data( 'email_gdpr' ),
882					'email_gdpr_text': c.data( 'email_gdpr_text' ),
883					'email_gdpr_not_text': c.data( 'email_gdpr_not_text' )
884				};
885				
886				c.find( '.btSubmitMessage' ).hide().html( c.data( 'message_please_wait' ) ).fadeIn();
887
888				$.ajax({
889					type: 'POST',
890					url: c.data( 'url_ajax' ),
891					data: data,
892					async: true,
893					success: function( response ) {
894						response = $.trim( response );
895						if ( response == 'ok' ) {
896							if ( c.data( 'url_confirmation' ) == '' || c.data( 'url_confirmation' ) == null ) {
897								c.find( '.btSubmitMessage' ).hide().html( c.data( 'message_success' ) ).fadeIn();
898							} else {
899								window.location = c.data( 'url_confirmation' );
900							}
901							
902						} else {
903							c.find( '.btSubmitMessage' ).hide().html( c.data( 'message_error' ) ).fadeIn();
904						}
905					},
906					error: function( xhr, status, error ) {
907						c.find( '.btSubmitMessage' ).hide().html( c.data( 'message_error' ) ).fadeIn();
908					}
909				});
910				
911				return false;
912			
913			});
914			
915			// CF 7 support
916			
917			c.find( '.wpcf7-submit' ).click(function() {
918
919	
920				var val = true;
921				var quote = '';
922
923				c.find( '.btQuoteItem, .btQuoteSubtotal' ).each(function() {
924					var item_val = 0;
925					var selected_name = '';
926					
927					var text_val;
928					var is_text = false;
929					$( this ).find( '.btQuoteText' ).each(function() {
930						var unit_price = bt_parse_float( $( this ).data( 'price' ) );
931						text_val = bt_parse_float( $( this ).val() );
932						item_val = text_val * unit_price;
933						is_text = true;
934					});
935					
936					$( this ).find( '.btQuoteSelect' ).find( '._msddli_.selected' ).each(function() {
937						selected_name = $( this ).find( '.ddlabel' )[0].innerHTML;
938						if ( $( this ).is( ':first-child' ) ) {
939							selected_name = '';
940						}
941						item_val = bt_parse_float( $( this ).data( 'value' ) );
942					});
943					
944					var is_slider = false;
945					var slider_val;
946					$( this ).find( '.btQuoteSlider' ).each(function() {
947						var unit_price = bt_parse_float( $( this ).data( 'price' ) );
948						// slider_val = bt_parse_float( $( this ).slider( 'value' ) );
949						slider_val = bt_cc_get_slider_value ( $( this ) );
950						item_val = slider_val * unit_price;
951						is_slider = true;
952					});
953
954					$( this ).find( '.btQuoteSwitch' ).each(function() {
955						if ( $( this ).hasClass( 'on' ) ) {
956							item_val = bt_parse_float( $( this ).data( 'on' ) );
957						} else {
958							item_val = bt_parse_float( $( this ).data( 'off' ) );
959						}
960					});
961					
962					var label = $( this ).find( 'label' ).html();
963					
964					if ( is_slider ) {
965						label = label + ' (' + slider_val + ') ' ;
966					}
967					
968					if ( is_text ) {
969						label = label + ' (' + text_val + ') ' ;
970					}
971					
972					if ( selected_name != '' ) {
973						selected_name = selected_name.replace( '<span class="description">', '/' );
974						selected_name = selected_name.replace( '</span>', '' );
975						label = label + ' (' + selected_name + ') ';
976					}
977						
978					item_val = bt_cc_currency_format( c, item_val );
979					
980					// subtotal
981					if ( $( this ).hasClass( 'btQuoteSubtotal' ) ) {
982						label = $( this ).data( 'label' );
983						item_val = $( this ).data( 'val' );
984					}
985					
986					if ( label !== undefined && label !== null ) {
987						quote += label + ': ' + item_val + "\r\n";
988					}
989					
990				});
991
992				var currency_text = '';
993				var currency_space = '';
994				if(c.data( 'currency_space' ) == 'yes'){
995					currency_space = ' ';
996				}
997
998				if(c.data( 'currency' ) != ''){
999					if(c.data( 'currency_after' ) == 'yes'){
1000						currency_text = c.data( 'total' ) + currency_space + c.data( 'currency' );
1001					} else {
1002						currency_text = c.data( 'currency' ) + currency_space + c.data( 'total' );
1003					}
1004				} else {
1005					currency_text = c.data( 'total' );
1006				}
1007				
1008				quote += c.data( 'total_text' ) + ': ' + currency_text + "\r\n";
1009				
1010				c.find( 'input[name=bt-cc-data]' ).val( quote );
1011
1012			});
1013			
1014				
1015			
1016			var total = 0;
1017			total = total.toFixed( 2 );
1018			bt_quote_total( c );
1019			bt_paypal_items( c );
1020		});	
1021
1022
1023		
1024	}
1025	
1026	// ---------------
1027	// Functions end
1028	// ---------------
1029
1030	// Init
1031	
1032	var bt_cc_init_finished = false;
1033	
1034	document.addEventListener( 'readystatechange', function() { 
1035		if ( ! bt_cc_init_finished && ( document.readyState === 'interactive' || document.readyState === 'complete' ) ) {
1036			
1037			// base variables
1038			window.is_rtl = $( 'body' ).hasClass( 'rtl' );
1039			window.rtl_direction = !window.is_rtl ? 1 : -1;
1040			
1041			bt_cc_init();
1042			bt_cc_init_finished = true;
1043			
1044		}
1045	});
1046	
1047})( jQuery );

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.