PageSourceSearch

https://www.kadeco.be/wp-content/themes/sandbox/lib/custom/custom.js?ver=1

js kadeco.be collected 2026-10-07 22:04:15 UTC 16,297 bytes, 701 lines download raw bytes

1/**
2 * Woocommerce add to cart ajax
3 */ 
4 
5 
6
7 jQuery('.radio_dropdown.closed').on('click', function(e) {
8	 jQuery(this).removeClass('closed');
9 });
10 
11 jQuery('.radio_dropdown .radio_dropdown_list_wrapper .radio_dropdown_list input[type="radio"]').on('click', function(e) {
12	 	e.stopPropagation();
13		var parent = jQuery(this).parent().parent().parent();
14		parent.addClass('closed');
15		console.log(parent);
16		parent.find('.radio_dropdown_selected').html(jQuery(this).data('fontname'));
17		
18		var fontfam = jQuery(this).data('fontfam');
19		var previewfontsize = jQuery(this).data('prevsize');
20		jQuery(this).parent().parent().parent().parent().parent().prev().find('input[type="text"]').css('font-family', fontfam).css('font-size', previewfontsize);
21	});
22 
23/* 
24jQuery('.choosing-font').change(function() {
25
26    var fontfam = jQuery(this).data('fontfam');
27    var previewfontsize = jQuery(this).data('prevsize');
28		jQuery(this).parent().parent().prev().find('input[type="text"]').css('font-family', fontfam).css('font-size', previewfontsize);
29});
30*/
31
32
33
34
35/*
36jQuery(document).on('click', '.single_add_to_cart_button', function (e) {
37    e.preventDefault();
38
39    var $thisbutton = jQuery(this),
40            $form = $thisbutton.closest('form.cart'),
41            id = $thisbutton.val(),
42            product_qty = $form.find('input[name=quantity]').val() || 1,
43            product_id = $form.find('input[name=product_id]').val() || id,
44            variation_id = $form.find('input[name=variation_id]').val() || 0;
45						custom_field_testveld = $form.find('input[name=testveld]').val() || 0;
46						//custom_fields = $form.find('input[name=custom_input_fields]').val() || 0;
47						
48						testveld = $form.find('input[name=testveld]').val() || 0;
49						
50						custom_input_fields = {};
51						
52						jQuery('input[name^="custom_input_fields"]').each(function() {
53							if(jQuery(this).attr('type') == 'radio'){
54								if(jQuery(this).is(':checked')){
55									var key = jQuery(this).data('count');
56									var soortveld = jQuery(this).data('soortveld');
57									var veldnaam = jQuery(this).data('veldnaam');
58									var value = jQuery(this).val();
59								}
60							} else {
61									var key = jQuery(this).data('count');
62									var soortveld = jQuery(this).data('soortveld');
63									var veldnaam = jQuery(this).data('veldnaam');
64									var value = jQuery(this).val();
65							}
66							
67							var field = {};
68							field['soortveld'] = soortveld;
69							field['veldnaam'] = veldnaam;
70							field['value'] = value;
71							custom_input_fields[key] = field;
72						});
73						
74						console.log(custom_input_fields);
75						
76
77
78		var proceed = false;
79		if($form.hasClass("variations_form")){
80			if(variation_id == 0){
81				proceed = false;
82			} else {
83				proceed = true;
84			}
85		} else {
86			proceed = true;
87		}
88		
89		//alert('test-'+product_qty+"-"+product_id+"-"+variation_id);
90		
91		if(proceed){
92				
93	    var data = {
94	        action: 'woocommerce_ajax_add_to_cart',
95	        product_id: product_id,
96	        product_sku: '',
97	        quantity: product_qty,
98	        variation_id: variation_id,
99	        //testveld : testveld,
100	        custom_input_fields : custom_input_fields
101	    };
102	
103	    jQuery(document.body).trigger('adding_to_cart', [$thisbutton, data]);
104	
105	    jQuery.ajax({
106	        type: 'post',
107	        url: wc_add_to_cart_params.ajax_url,
108	        data: data,
109	        beforeSend: function (response) {
110	            $thisbutton.removeClass('added').addClass('loading');
111	        },
112	        complete: function (response) {
113	            $thisbutton.addClass('added').removeClass('loading');
114	        },
115	        success: function (response) {
116
117	            if (response.error & response.product_url) {
118	                window.location = response.product_url;
119	                return;
120	            } else {
121	                //jQuery(document.body).trigger('added_to_cart', [response.fragments, response.cart_hash, $thisbutton]);
122	                jQuery(document.body).trigger('added_to_cart', [response.fragments, response.cart_hash], $thisbutton);
123	                
124	                // open cart
125	                jQuery(".cartwidgetarea").fadeIn();
126	                // reload cart count
127	                
128	                update_cart_count();
129	            }
130	        },
131	    });
132			
133		}
134    return false;
135});
136*/
137
138
139
140
141//var logsAjaxUrl;
142var ajax_cart_count_url = jQuery('.ajax_cart_count_url').val();
143
144function update_cart_count(){
145
146	var data = {};
147	var dataEncoded = encodeURIComponent(JSON.stringify(data));
148	var result = null;
149	var scriptUrl = ajax_cart_count_url + '?data=' + dataEncoded;
150
151	jQuery.ajax({
152		cache: false, url: scriptUrl, type: 'get', dataType: 'html', async: false, timeout: 500,
153		success: function(data) {
154			
155			jQuery(".ajax-cart-item-count").html(data);
156		},
157		fail: function(data, strError) {
158			alert("ERROR");
159		}
160	});
161	
162}
163
164
165
166
167	
168jQuery( window ).resize(function() {
169  // MASONRY GALLERY     
170  jQuery('.masonry-gallery-home').masonry({
171	  itemSelector: '.gallery-item-col',
172	  columnWidth: '.grid-sizer',
173	  percentPosition: true,
174	});
175})
176
177window.addEventListener('resize', Superclamp.reclampAll);
178
179
180window.addEventListener('resize', img_cover_container);
181
182
183
184jQuery(document).ready(function($) {
185	
186	img_cover_container();
187		
188	//var html = jQuery('.eswcac-field').find('label').html();
189	//alert(html);
190	/*
191	jQuery('.eswcac-field').find('label').addClass("choose-checkbox-label").attr('for', 'badplugincheckbox');
192	jQuery('.eswcac-field').find('input').addClass("choose-checkbox").attr('id', 'badplugincheckbox');
193	var movecheckbox = jQuery('.eswcac-field').find('label').html();
194	jQuery('.eswcac-field').find('label').html("");
195	alert(movecheckbox);
196	jQuery('.eswcac-field').find('label').after(movecheckbox);
197	*/
198	
199	/*
200	if(jQuery('.ywapo_options_container').length){
201		jQuery('.ywapo_options_container').
202	}
203	*/
204 
205 
206 
207	
208	//mobilemenu functions
209	jQuery('.mobilemenu-kadeco nav ul li a').on('click touchend', function(e) {
210		
211		if(jQuery(this).parent('li').hasClass('menu-item-has-children')){
212			e.preventDefault();
213			jQuery(this).parent('li').find('> ul').slideToggle('fast');
214		}
215
216	});
217	
218	
219	jQuery('.mobilemenulink').on('click', function(e) {
220		e.preventDefault();
221		jQuery('.mobilemenu-kadeco').addClass('visible');
222	});
223	
224	jQuery('.mobilemenu-close').on('click', function(e) {
225		e.preventDefault();
226		jQuery('.mobilemenu-kadeco').removeClass('visible');
227	});
228	
229	
230	//jQuery('.ywapo_group_container h3').removeClass('toggle-open');
231	//alert('dsf');
232	
233	
234	jQuery('.ywapo_group_container h3').click(function(e) {
235		//e.preventDefault();
236		
237		jQuery('.ywapo_group_container h3').removeClass('toggle-open');
238		jQuery('.ywapo_group_container h3').addClass('toggle-closed');
239		jQuery('.ywapo_options_container').show();
240		
241		setTimeout(function(){
242				jQuery('.ywapo_group_container h3').removeClass('toggle-open');
243				jQuery('.ywapo_group_container h3').addClass('toggle-closed');
244				jQuery('.ywapo_options_container').show();
245		}, 1000);
246		
247	});
248	
249	//jQuery('.toggle-open').unbind( "click" );
250	
251	
252	new WOW().init();
253
254	jQuery("a.showlogin").click(function() {
255		window.dispatchEvent(new Event('resize'));
256		setTimeout(function(){
257				window.dispatchEvent(new Event('resize'));
258		}, 1000);
259	});
260	jQuery("a.showcoupon").click(function() {
261		window.dispatchEvent(new Event('resize'));
262		setTimeout(function(){
263				window.dispatchEvent(new Event('resize'));
264		}, 1000);
265	});
266	
267	// cart close btn
268	jQuery('.cartwidgetarea a.close').remove();
269	jQuery('.cartwidgetarea .widget_shopping_cart').append('<a class="close fa fa-times"></a>');
270
271	jQuery('.cartwidgetarea .widget_shopping_cart .close').click(function() {
272		jQuery('.cartwidgetarea').fadeOut();
273	});
274		
275	
276	    	
277	/*
278	jQuery('.een-carousel').owlCarousel({
279	    loop:true,
280	    margin:10,
281	    nav:true,
282	    responsive:{
283	        0:{
284	            items:1
285	        },
286	        600:{
287	            items:3
288	        },
289	        1000:{
290	            items:5
291	        }
292	    }
293	});
294	*/
295	
296	
297	
298  // MASONRY GALLERY     
299  jQuery('.masonry-gallery-home').masonry({
300	  itemSelector: '.gallery-item-col',
301	  columnWidth: '.grid-sizer',
302	  percentPosition: true,
303	});
304	function explode(){
305  	jQuery('.masonry-gallery-home').masonry({
306			itemSelector: '.gallery-item-col',
307			columnWidth: '.grid-sizer',
308			percentPosition: true,
309		});
310		
311		console.log('masonry');
312	}
313	setTimeout(explode, 1000);	
314	
315	
316	
317
318	jQuery('section.featured-products .owl-carousel').owlCarousel({
319	    loop:true,
320	    margin:10,
321	    nav:true,
322	    autoplay:true,
323			autoplayTimeout:3500,
324			autoplayHoverPause:true,
325			
326	    responsive:{
327	      0:{
328	          items:1
329	      },
330	      610:{
331	          items:2
332	      },
333	      768:{
334	          items:2
335	      },
336	      992:{
337	          items:3
338	      },
339	      1100:{
340	          items:4
341	      },
342	      1200:{
343	          items:2
344	      },
345	      1400:{
346	          items:3
347	      }
348	    },
349	    navText: ["",""]
350	});
351
352
353
354
355
356
357	var carousel = jQuery('.single-product-img-carousel.owl-carousel').owlCarousel({
358	    loop:true,
359	    margin:10,
360	    nav:true,
361	    autoplay:true,
362			autoplayTimeout:3500,
363			autoplayHoverPause:true,
364			
365	    responsive:{
366	      0:{
367	          items:1
368	      },
369	      576:{
370	          items:1
371	      },
372	      768:{
373	          items:1
374	      },
375	      992:{
376	          items:1
377	      }
378	    },
379	    navText: ["",""]
380	});
381	
382	
383	
384	
385	
386	
387
388
389
390
391	
392	
393	checkClasses();
394  carousel.on('translated.owl.carousel', function(event) {
395      checkClasses();
396  });
397
398  function checkClasses(){
399      var total = $('.single-product-img-carousel .owl-stage .owl-item.active').length;
400
401      $('.single-product-img-carousel .owl-stage .owl-item').removeClass('firstActiveItem lastActiveItem');
402
403      $('.single-product-img-carousel .owl-stage .owl-item.active').each(function(index){
404          if (index === 0) {
405              // this is the first one
406              $(this).addClass('firstActiveItem');
407          }
408          if (index === total - 1 && total>1) {
409              // this is the last one
410              $(this).addClass('lastActiveItem');
411          }
412      });
413  }
414  
415  
416 
417		
418		
419		addQuantitiyIncrementbtns();
420		
421		
422		function addQuantitiyIncrementbtns() {
423			
424
425			var updateCartButton = jQuery("button[name='update_cart']");
426			updateCartButton.prop('disabled', false);
427			
428			jQuery('.quantity').each(function(i, obj) {
429			    //test
430			    
431			    
432			    if ( jQuery(this).children("input[type='number']").length > 0 ) {
433				    
434				    
435						jQuery(this).append('<i class="fal fa-plus-circle plus"></i>');
436						jQuery(this).prepend('<i class="fal fa-minus-circle min"></i>');
437						
438						window.dispatchEvent(new Event('resize'));
439
440						jQuery(this).find('.plus').click(function() {
441							var vally = jQuery(this).parent().find('input').val();
442							vally = +vally + +1;
443							jQuery(this).parent().find('input').val(vally);
444							
445							
446							if ( updateCartButton.length > 0 ) {
447								updateCartButton.trigger('click');
448								setTimeout(addQuantitiyIncrementbtns, 2000);
449							}
450							
451							
452						});
453						jQuery(this).find('.min').click(function() {
454							var vally = jQuery(this).parent().find('input').val();
455							
456							if(vally > 0){
457								vally = +vally - +1;
458							}
459							
460							jQuery(this).parent().find('input').val(vally);
461							
462							
463							if ( updateCartButton.length > 0 ) {
464								updateCartButton.trigger('click');
465								setTimeout(addQuantitiyIncrementbtns, 2000);
466							}
467							
468							
469						});
470					}
471			});
472			
473		}
474
475  
476	
477
478
479	/*
480	jQuery('section.featured-products ul.productss').owlCarousel({
481	    loop:true,
482	    margin:10,
483	    nav:false,
484	    autoplay:true,
485			autoplayTimeout:3500,
486			autoplayHoverPause:true,
487		
488			smartSpeed: 1000,
489    
490	    responsive:{
491        0:{
492            items:1
493        },
494        576:{
495            items:2
496        },
497        768:{
498            items:3
499        },
500        992:{
501            items:3
502        }
503	    }
504	});
505	*/
506	
507	
508	
509	
510	
511	/*
512
513	jQuery('.scrolldownhome .fas').on('click touchend', function(e) {
514	
515		jQuery('html, body').animate({
516		  scrollTop: jQuery("section.home-intro").offset().top - 200
517		}, 500);
518	  
519	});
520	
521	
522	jQuery('.scrolldown .fas').on('click touchend', function(e) {
523	
524		jQuery('html, body').animate({
525		  scrollTop: jQuery(".scrollheredown").offset().top - 0
526		}, 500);
527	  
528	});
529	
530	
531	jQuery('.arrow-up .fas').on('click touchend', function(e) {
532	
533		jQuery('html, body').animate({
534		  scrollTop: jQuery(".main-wrapper").offset().top - 200
535		}, 500);
536	  
537	});
538	
539	
540	
541	jQuery('.realisaties-slider.owl-carousel').owlCarousel({
542		autoplay:true,
543		autoplayTimeout:6000,
544	    animateOut: 'fadeOut',
545	    animateIn: 'fadeInRightBig',
546	    items:2,
547	    margin:0,
548	    stagePadding:0,
549	    smartSpeed:450,
550	    nav:true,
551	    navText: ['', ''],
552	    loop: true
553	});
554	
555	
556	*/
557	
558	
559	
560	//$('.clamp-me').clamp();
561	//$('.looped-product a h2').clamp();
562	
563	
564	
565	jQuery('.looped-product .short-description p').clamp();
566	
567
568	setTimeout(function(){
569  	window.dispatchEvent(new Event('resize'));
570	}, 2000);
571
572	
573	
574	jQuery('.navmenu-kadeco a').on('click mouseenter', function(e) {
575		e.preventDefault();
576		//jQuery('body').toggleClass('modal-open');
577		
578		var classes = jQuery(this).parent().attr('class');
579		const classesarr = classes.split(" ");
580		var cname = classesarr.slice(-1);
581		console.log(cname);
582		
583		//const result = classes.filter(c => c.startsWith() > 6);
584
585		
586		jQuery('.product-menu-wrapper').removeClass('hidden');
587		jQuery('.product-menu-close-wrapper').removeClass('hidden');
588		
589		jQuery('.product-menu-wrapper').find('nav > ul > li').hide();
590		jQuery('.product-menu-wrapper').find('nav > ul > li.'+cname[0]).show();
591	});
592	
593	jQuery('.product-menu-wrapper').on('mouseleave', function(e) {
594		e.preventDefault();
595		jQuery('.product-menu-wrapper').addClass('hidden');
596		jQuery('.product-menu-close-wrapper').addClass('hidden');
597	});
598	
599	
600	jQuery(document).mouseup(function(e) 
601	{
602		var container = jQuery(".product-menu-wrapper, .navmenu-kadeco a");
603	
604		// if the target of the click isn't the container nor a descendant of the container
605		if (!container.is(e.target) && container.has(e.target).length === 0) 
606		{
607			jQuery('.product-menu-wrapper').addClass('hidden');
608			jQuery('.product-menu-close-wrapper').addClass('hidden');
609		}
610	});
611
612	
613	
614	/*
615	jQuery('.shopmenu-item-allproducts a').on('click', function(e) {
616		e.preventDefault();
617		//jQuery('body').toggleClass('modal-open');
618		jQuery('.product-menu-wrapper').toggleClass('hidden');
619		jQuery('.product-menu-close-wrapper').toggleClass('hidden');
620	});
621	jQuery('.product-menu-close-wrapper').on('click', function(e) {
622		e.preventDefault();
623		jQuery('.product-menu-wrapper').addClass('hidden');
624		jQuery('.product-menu-close-wrapper').addClass('hidden');
625	});
626	*/
627	
628	
629	
630	/*
631	jQuery('.search-bar-close-button').on('click', function() {
632		jQuery('body').removeClass('modal-open');
633		jQuery('.search-bar-wrapper').addClass('hidden');
634	});
635	
636	jQuery('.search-bar-wrapper').on('click', function(e) {
637		if (e.target !== this)
638			return;
639			
640		jQuery('body').removeClass('modal-open');
641		jQuery('.search-bar-wrapper').addClass('hidden');
642	});
643   */ 
644
645	
646	
647});
648
649
650
651
652function img_cover_container(){
653	
654	jQuery('img.cover-container').each(function(index, obj) {
655		
656		var img = jQuery(obj);
657		
658		var containerclass = img.data('containerclass');
659		if(containerclass){
660			var container = jQuery(obj).parents("."+containerclass);
661		} else {
662			var container = jQuery(obj).parent();
663		}
664		
665		if(img.get(0).naturalWidth){
666
667			var containerratio = container.width() / container.height();
668			var imgratio = img.width() / img.height();
669			console.log(containerratio+" > "+imgratio);
670			container.addClass('container-to-cover');
671			
672			if(containerratio > imgratio){
673				img.css('width', '100%');
674				img.css('height', 'auto');
675			} else {
676				img.css('height', '100%');
677				img.css('width', 'auto');
678			}
679				
680		} else {
681			img.load(function(){
682				var containerratio = container.width() / container.height();
683				var imgratio = img.width() / img.height();
684				console.log(containerratio+" > "+imgratio);
685				container.addClass('container-to-cover');
686				
687				if(containerratio > imgratio){
688					img.css('width', '100%');
689					img.css('height', 'auto');
690				} else {
691					img.css('height', '100%');
692					img.css('width', 'auto');
693				}
694			});
695		}
696		
697
698	});
699}
700
701

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.