PageSourceSearch

https://mihailupea.com/wp-content/plugins/cost-calculator-contact-form-7/includes/js/front.js?ver=2.0.0

js mihailupea.com collected 2026-10-02 01:36:05 UTC 9,526 bytes, 311 lines download raw bytes

1jQuery(document).ready(function() {
2	if ( jQuery( ".wpcf7-form" ).length ) {
3
4		occostcf7_customradiobtn();
5		occostcf7_formulas();
6
7
8		jQuery("body").on("change",".wpcf7 input,.wpcf7 select",function(e){
9			occostcf7_formulas();
10		})
11
12
13
14		jQuery("input[type='number']").bind('keyup', function () {
15		  	occostcf7_formulas();
16		})
17
18
19
20		jQuery("input[type='text']").bind('keyup', function () {
21		  	occostcf7_formulas();
22		})
23
24
25
26		function occostcf7_customradiobtn(){
27			jQuery("form.wpcf7-form input").each(function (index) { 
28	       		if( jQuery(this).attr("type") == "radio" || jQuery(this).attr("type") == "checkbox" ) {
29	       			var inputval = jQuery(this).attr("value");
30
31	       			if(inputval.indexOf("--") != -1){
32		       			jQuery(this).val('');
33		       			jQuery(this).parent().find('span.wpcf7-list-item-label').text('Required Pro Version for add Custom Label');  
34	       			}
35	       		}
36	       	})
37			jQuery("form.wpcf7-form select option").each(function (index) {
38		       	if(jQuery(this).attr("type") === undefined) {
39		       		var selectval = jQuery(this).attr("value");
40		       		if(selectval.indexOf("--") != -1){
41			       		jQuery(this).attr("value",'');
42			       		jQuery(this).text('Required Pro Version for add Custom Label');
43		       		}		
44		       	}
45	       	})  
46		}
47
48
49		function occostcf7_formulas(){
50		   	var total = 0;
51	       	var match;
52	       	var reg =[]; 
53
54	      	jQuery("form.wpcf7-form input").each(function () { 
55	       		if( jQuery(this).attr("type") == "checkbox" || jQuery(this).attr("type") == "radio"  ) {
56	       			var name = jQuery(this).attr("name").replace("[]", "");
57	       			reg.push(name);
58	       			//alert($(this).attr("name"));
59	       		}else{
60	       			reg.push(jQuery(this).attr("name"));
61	       		}
62	       	})
63
64	       	jQuery("form.wpcf7-form select").each(function () {
65	       		var name_select = jQuery(this).attr("name").replace("[]", "");
66	       		reg.push(name_select);
67	       	})
68
69	       	reg = costcf7duplicates_type(reg);
70	       	var all_tag = new RegExp( reg.join("|"));
71	       	jQuery( ".occf7cal-total" ).each(function( index ) {
72	       		var precision = jQuery(this).attr("precision");
73	       		var prefix = jQuery(this).attr("prefix");
74	       		var eq = jQuery(this).data('formulas');
75	       		var type = '';
76	       		if(eq != '' || eq.length != 0){
77					while ( match = all_tag.exec( eq ) ){
78						var perfact_match = costcf7wordInString(eq,match[0]);
79						if(perfact_match != false){
80							var type = jQuery("input[name="+match[0]+"]").attr("type");
81							if( type === undefined ) {
82								var type = jQuery("input[name='"+match[0]+"[]']").attr("type");
83							}
84							//console.log(type);
85							if( type =="checkbox" ){
86								var vl = 0;
87								jQuery("input[name='"+match[0]+"[]']:checked").each(function () {
88									var attr = jQuery(this).attr('price');
89									//console.log(attr);
90									if (typeof attr !== typeof undefined && attr !== false) {
91										vl += new Number(attr);
92									} else {
93										vl += new Number(jQuery(this).val());
94									}
95								});
96							}else if( type == "radio"){
97								var attr = jQuery("input[name='"+match[0]+"']:checked").attr('price');
98								if (typeof attr !== typeof undefined && attr !== false) {
99									var vl = attr;
100								} else {
101									 var vl = jQuery("input[name='"+match[0]+"']:checked").val();
102								}
103							}else if( type === undefined ){
104								var check_select = jQuery("select[name="+match[0]+"]").val();
105								//console.log('--'+check_select+'--')
106								if(check_select === undefined){
107									var vl = 0;
108									jQuery("select[name='"+match[0]+"[]'] option:selected").each(function () {
109										var attr = jQuery(this).attr('price');
110										if (typeof attr !== typeof undefined && attr !== false) {
111											vl += new Number(attr);
112										} else {
113											vl += new Number(jQuery(this).val());
114										}
115									});
116								} else {
117									var vl = 0;
118									jQuery("select[name="+match[0]+"] option:selected").each(function () {
119										var attr = jQuery(this).attr('price');
120										if (typeof attr !== typeof undefined && attr !== false) {
121											vl += new Number(attr);
122										} else {
123											vl += new Number(jQuery(this).val());
124										}
125									});
126								}
127							}else{
128								var attr = jQuery("input[name="+match[0]+"]").attr('price');
129								if (typeof attr !== typeof undefined && attr !== false) {
130								    var vl = attr;
131								} else {
132									var vl = jQuery("input[name="+match[0]+"]").val();	
133								}
134							}
135							if(!jQuery.isNumeric(vl)){
136								vl = 0;
137								//alert("value must be numeric");
138							}
139						}else{
140						 	var error = 1;
141						}
142						eq = eq.replace( match[0], vl );
143						nueq = '';
144						neq = eq;
145						var neqf = '';
146						if(eq.indexOf("sqrt") != -1){
147							var neweq = eq.split(" ");
148							for(var i = 0; i < neweq.length; i++){
149								if(neweq[i].indexOf("sqrt") != -1){
150								   var sqrt = neweq[i].match("sqrt((.*))");
151								   var sqrtd = sqrt[1].replace(/[()]/g,'')
152								   var sqrtroot = Math.sqrt(parseInt(sqrtd));
153								   neq = neq.replace( sqrt[1], sqrtroot );
154								}     
155						     }
156						     nueq = neq.split("sqrt").join('');
157						}
158						if(nueq === ''){
159							neqf = eq;
160						} else {
161						 	neqf = nueq;
162						}
163					}
164	       		}else{
165	       			alert("Please Enter Formula in Calculator");
166	       			return false;
167	       		}
168	       		if(error == 1){
169	       			alert("Please Enter Valid Formula in Calculator");
170	       			return false;
171	       		}
172				try{
173					var fresult = ''; 
174				    var r = eval( neqf ); // Evaluate the final equation
175				    if( precision != undefined ) {
176				      	fresult = r.toFixed(precision);
177					} else {
178						fresult = r;
179					}
180
181					total = fresult;
182					//console.log('--'+total);
183
184				}
185				catch(e)
186				{
187					alert( "Error:" + neqf );
188				}
189
190				if(index === 0){
191					if( prefix != undefined ) {
192						jQuery(this).val(prefix + total);
193					}else{
194						jQuery(this).val(total);
195					}
196				} else {
197					jQuery(this).val('Required Pro Version for add Custom Label');
198				}
199			});
200		}
201	}
202	
203	jQuery(".costcf7caloc_slider_div").each(function() {
204     	var step=jQuery(this).attr("step");
205	    var min=jQuery(this).attr("min");
206	    var max=jQuery(this).attr("max");
207	    var istep = parseInt(step);
208	    var imin = parseInt(min);
209	    var imax = parseInt(max);
210	    var prefixx=jQuery(this).attr("prefix");
211	    var prefixpos=jQuery(this).attr("prefixpos");
212	    var color=jQuery(this).attr("color");
213	    var caltoltip=jQuery(this).attr("caltoltip");
214	    
215	    var current_attr = jQuery(this);
216	    if(caltoltip == "top"){
217	    	var costcf7tooltip = jQuery('<div id="ctooltip" class="costcf7top"/>').css({
218		        top: -35,
219		    })
220	    }
221	    if(caltoltip == "right"){
222	    	var costcf7tooltip = jQuery('<div id="ctooltip" class="costcf7right"/>').css({ 
223		        left: 35			    
224		    })
225	    }
226	    if(caltoltip == "bottom"){
227	    	var costcf7tooltip = jQuery('<div id="ctooltip" class="costcf7bottom"/>').css({
228		        bottom: -35
229		    })
230	    }
231	    if(caltoltip == "left"){
232	    	var costcf7tooltip = jQuery('<div id="ctooltip" class="costcf7left"/>').css({
233		        right: 35
234		    })
235	    }
236	    
237	    
238
239	    if(prefixx == null){
240	    	prefix = " ";
241	    }else{
242	    	prefix = prefixx;
243	    }
244
245	    if(prefixpos == "left") {
246	        costcf7tooltip.text(prefix + min);
247	    }else {  
248	        costcf7tooltip.text(min + prefix);        
249	    }
250	
251
252	    jQuery(this).slider({
253	        step:istep,
254	        min:imin,
255	        max:imax,
256	        values: imin,
257	        create: attachSlider,
258	        slide: function( event, ui ) {
259	        	current_attr.find(".costcf7caloc_slider").val(ui.value);
260	        	
261	        	occostcf7_formulas();
262	        	var clr = jQuery(this).attr("color");
263	        	var pre = jQuery(this).attr("prefix");
264	        	if(pre == null){
265			    	prefix = " ";
266			    }else{
267			    	prefix = pre;
268			    }
269	        	
270
271		    	if(prefixpos == "left"){
272	                current_attr.find("#ctooltip").text(prefix  + ui.value);  
273	            }else {
274	               current_attr.find("#ctooltip").text(ui.value + prefix);
275	            }
276
277			   	current_attr.find(".ui-state-default").css("background-color",clr); 
278	        }        
279		}).find(".ui-slider-handle").append(costcf7tooltip).hover(function() {
280	    	costcf7tooltip.show()
281	    })
282	    function attachSlider() {
283	        jQuery(this).find(".ui-slider-handle").css("background-color",color);
284	    }
285	});
286	
287	
288
289	function costcf7duplicates_type(arr) {
290	    var obj = {};
291	    var ret_arr = [];
292	    for (var i = 0; i < arr.length; i++) {
293	        obj[arr[i]] = true;
294	    }
295	    //console.log(obj);
296	    for (var key in obj) {
297	    	if("_wpcf7" == key || "_wpcf7_version" == key  || "_wpcf7_locale" == key  || "_wpcf7_unit_tag" == key || "_wpnonce" == key || "undefined" == key  || "_wpcf7_container_post" == key || "_wpcf7_nonce" == key  ){
298
299	    	}else {
300	    		ret_arr.push(key);
301	    	}
302	    }
303	    return ret_arr;
304	}
305
306
307	function costcf7wordInString(s, word){
308	  return new RegExp( '\\b' + word + '\\b', 'i').test(s);
309	}
310
311});

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.