PageSourceSearch

https://petrmach.cz/wp-content/themes/mioweb3/library/visualeditor/js/front.js?ver=1711299545

js petrmach.cz collected 2026-10-02 11:53:00 UTC 28,040 bytes, 1,066 lines download raw bytes

1jQuery(function ($) {
2
3	$('.background_video iframe').mwBackgroundVideo();
4	$('.open_video_lightbox').mwVideoPopup();
5	$('.open_element_lightbox').mwElementPopup();
6	$('.open_mw_popup').mwPopup();
7
8	$('.mw_cookie_management_container').mwCookieBar();
9
10	mw_init_contact_form('.ve_contact_form');
11	mw_init_form('.ve_check_form');
12
13
14	$(window).on('scroll', function (e) {
15		setParallaxScroll();
16	});
17	setParallaxScroll();
18
19
20	setFixedHeader();
21
22	// delay show
23	$(".row_container_delay").each(function () {
24		var $this = $(this);
25		setTimeout(function () {
26			/** Fade in to "flex" instead of "block" @see https://stackoverflow.com/a/28906733 */
27			$this
28				.css("display", "flex")
29				.hide()
30				.fadeIn("slow");
31		}, $this.attr('data-delay') * 1000);
32	});
33
34	$(".element_container_delay").each(function () {
35		var $this = $(this);
36		setTimeout(function () {
37			$this.fadeIn("slow");
38		}, $this.attr('data-delay') * 1000);
39	});
40
41	$(".video_element_gdpr_agree_but").click(function () {
42		var container = $(this).closest('.video_element_gdpr_content');
43		if(container.find('input').prop('checked'))
44		{
45			$('.video_element_gdpr_content').remove();
46			var date = new Date();
47			date.setDate(date.getDate() + 365);
48			document.cookie = "mw_allow_video_youtube=1;expires=" + date.toGMTString() + "; path=/";
49		}
50		else
51		{
52			container.remove();
53		}
54		return false;
55	});
56
57	/* ********************* Scroll  ******************** */
58	$('body').on('click', '.mw_scroll_tonext', function () {
59		var position = $(this).offset().top + 66;
60
61
62		// Subtract fixed header height
63		if (jQuery('.ve_fixed_header').length) {
64			position -= jQuery('#header').height()
65		}
66
67		$('html,body').animate({
68			scrollTop: position
69		}, 1000);
70		return false;
71	});
72
73	/* ********************* Tabulators  ******************** */
74	$(".mw_tabs").on('click', 'a', function () {
75		var target = $(this).attr('href');
76		var group = $(this).attr('data-group');
77		$(".mw_tabs_" + group + " a").removeClass("active");
78		$(this).addClass("active");
79		$("." + group + "_container > li").hide();
80		$(target).show();
81		return false;
82	});
83
84	/* ********************* Toggle target ******************** */
85	$('body').on('click', '.mw_toggle_container', function (event) {
86		var $this = $(this);
87		var tar = $this.attr('data-target');
88		if ($this.is('input[type=checkbox]')) {
89			var checked = $this.prop('checked');
90			if (checked)
91				$('#' + tar).show();
92			else
93				$('#' + tar).hide();
94		} else {
95			$('#' + tar).toggle();
96		}
97	});
98
99	$(window).resize(mw_debouncer(mw_recalculate_fb_page_plugin_width, 500))
100});
101
102function mw_recalculate_fb_page_plugin_width() {
103	var $fb = jQuery('.fb-page');
104	if (!$fb.length) {
105		return;
106	}
107
108	var init = false;
109
110	$fb.each(function () {
111		var $this = jQuery(this);
112		var elementWidth = parseInt($this.width());
113		var containerWidth = parseInt($this.parent().width());
114
115		if (containerWidth && elementWidth) {
116			var maxWidth = $this.attr('data-max-width') || 500;
117			var minWidth = 180;
118
119			containerWidth = Math.max(Math.min(containerWidth, maxWidth), minWidth);
120			if (elementWidth !== containerWidth) {
121				$this.attr('data-width', containerWidth);
122				$this.removeAttr('fb-iframe-plugin-query');
123				$this.html('');
124
125				init = true;
126			}
127		}
128	});
129
130	if (init) {
131		mw_init_facebook();
132	}
133}
134
135function mw_debouncer(func, timeout) {
136	var timeoutID, timeout = timeout || 200;
137	return function () {
138		var scope = this, args = arguments;
139		clearTimeout(timeoutID);
140		timeoutID = setTimeout(function () {
141			func.apply(scope, Array.prototype.slice.call(args));
142		}, timeout);
143	}
144}
145
146function mw_init_contact_form(target) {
147	jQuery(target).mwForm({
148		onsubmit: function (self, $form) {
149			var form = $form.serialize();
150			var button = self.$el.find("button");
151			button.addClass('working');
152			jQuery.post(ajaxurl, 'action=ve_send_contact_form&' + form, function (data) {
153
154				if (data.redirect) {
155					const target = self.$el.find('input[name="form_redirect_url"]').attr('data-target');
156					if (target === 'parent') {
157						parent.location.replace(data.redirect);
158					} else {
159						window.location.replace(data.redirect);
160					}
161				} else {
162					self.showMessage(data);
163					button.removeClass('working');
164				}
165			}).fail(function () {
166
167				self.showMessage({'sended': 'error', 'message': front_texts.nosended});
168				button.removeClass('working');
169
170			});
171			return false;
172		}
173	});
174}
175
176function mw_init_facebook() {
177	if (typeof FB.XFBML.parse === "undefined") {
178		console.log('Function "FB.XFBML.parse" is undefined')
179		return;
180	}
181
182	FB.XFBML.parse();
183}
184
185function mw_init_form(target) {
186	jQuery(target).mwForm();
187}
188
189function mw_load_added_ss_form(target, content) {
190	var $target = jQuery(target);
191
192	var old = window.document.write;
193	window.document.write = function (html) {
194		$target.html(html);
195		window.document.write = old;
196	}
197
198	$target.html(content);
199}
200
201function mw_load_added_script(target, url, html) {
202	var $target = jQuery(target);
203
204	if(html)
205		$target.html(html);
206
207	var script = document.createElement("script");
208	script.async = true;
209	script.src = url;
210	$target.append(script);
211}
212
213function mw_load_added_fapi_form(target, but_class, content, clientDetails) {
214	var $target = jQuery(target);
215
216	var old = window.document.write;
217	window.document.write = function (html) {
218		$target.html(html);
219		window.document.write = old;
220
221		mw_fill_fapi_form_old(clientDetails);
222		$target.find("#frm-submit").addClass(but_class);
223	}
224
225	mw_fill_fapi_form_new(clientDetails)
226
227	var wrapper = document.createElement('div');
228	wrapper.innerHTML= content;
229	var script = document.createElement('script');
230	script.src = wrapper.firstChild.src;
231	script.type = 'text/javascript';
232
233	$target.html('');
234	document.querySelector(target).append(script);
235
236	// Remove possibly loaded Fapi scripts because Fapi will load them again in it's internal initialization
237	var fapiInternalScripts = ['https://form.fapi.cz/js/jQueryFapi.js', 'https://form.fapi.cz/js/netteFormsFapi.js'];
238	jQuery('script').each(function () {
239		if (fapiInternalScripts.indexOf(this.src) !== -1) {
240			this.parentNode.removeChild(this);
241		}
242	});
243}
244
245function mw_load_fapi_form(target, but_class, clientDetails) {
246	var $target = jQuery(target);
247	mw_fill_fapi_form_old(clientDetails);
248	mw_fill_fapi_form_new(clientDetails)
249	$target.find("#frm-submit").addClass(but_class);
250}
251
252function mw_fill_fapi_form_old(clientDetails) {
253	if (clientDetails && clientDetails !== 'null') {
254		clientDetails = jQuery.parseJSON(clientDetails);
255		var $form = jQuery("#frm-showUserForm");
256		if (!$form.length) {
257			return;
258		}
259
260		var inputNames = ["name", "surname", "email", "mobil", "street", "city", "postcode", "company", "ic", "dic"];
261		for (var i in inputNames) {
262			var name = inputNames[i];
263			var value = clientDetails[name];
264			if (value !== undefined) {
265				$form.find("[name=" + name + "]").val(value);
266			}
267		}
268	}
269}
270
271function mw_fill_fapi_form_new(clientDetails) {
272	set_singleton_event_listener('fapiFormMounted', function (e) {
273		if (clientDetails && clientDetails !== 'null') {
274			var values = jQuery.parseJSON(clientDetails);
275			var formWrapper = e.detail.formWrapper || null;
276			if (formWrapper !== null) {
277				var inputNames = ["email", "phone", "first_name", "last_name", "company", "ico", "dic", "street", "city", "zip"];
278				for (var i in inputNames) {
279					var name = inputNames[i];
280					var value = values[name];
281					if (value !== undefined) {
282						var input = formWrapper.querySelector("[name=" + name + "]");
283						if (input !== null) {
284							input.value = value;
285						}
286					}
287				}
288			}
289		}
290	});
291}
292
293/** @see https://stackoverflow.com/a/17391426 */
294var set_singleton_event_listener = (function(element){
295	var handlers = {};
296	return function(evtName, func){
297		handlers.hasOwnProperty(evtName) && element.removeEventListener(evtName, handlers[evtName]);
298		if (func) {
299			handlers[evtName] = func;
300			element.addEventListener(evtName, func);
301		} else {
302			delete handlers[evtName];
303		}
304	};
305})(document);
306
307
308/* ********************* Fixed header  ******************** */
309function setFixedHeader() {
310	if (jQuery('.ve_fixed_header').length) {
311		var header_position = jQuery(".ve_fixed_header").offset();
312
313		jQuery(window).on('scroll load', function (e) {
314			var header_height = jQuery('#header').height();
315			var padding_bottom = header_height;
316			if (jQuery('.ve_fixed_header').length === 0) padding_bottom = 0;
317			if (jQuery('.mw_transparent_header').length) padding_bottom = 0;
318
319			var scroll = jQuery(window).scrollTop();
320			var fixed_desktop_only = jQuery(".ve_fixed_header").hasClass('ve_fixed_desktop_only');
321			if (scroll > header_position.top && (!fixed_desktop_only || jQuery(window).width() >= 767)) {
322				jQuery(".ve_fixed_header").addClass("ve_fixed_header_scrolled");
323				jQuery("header").css('paddingBottom', padding_bottom);
324
325				if (e.type === 'load' && window.location.hash) {
326					var anchor = document.querySelector(window.location.hash);
327					if (anchor !== null) {
328						var isScrolledToAnchor = Math.floor(anchor.getBoundingClientRect().top) === 0;
329						if (isScrolledToAnchor) {
330							// jQuery(window).scrollTop(scroll - header_height);
331							jQuery('html, body').animate({scrollTop: '-=' + header_height + 'px'}, 0);
332						}
333					}
334				}
335			} else {
336				jQuery(".ve_fixed_header_scrolled").removeClass("ve_fixed_header_scrolled");
337				jQuery("header").css('paddingBottom', '0');
338				//jQuery("header").height('auto');
339			}
340		});
341	}
342}
343
344function setParallaxScroll() {
345	if (jQuery('.background_parallax').length) {
346		jQuery('.background_parallax').each(function () {
347			var $el = jQuery(this);
348			updateParallax($el);
349		});
350	}
351}
352
353function updateParallax($el) {
354
355	var diff = jQuery(window).scrollTop() - $el.closest('.row').offset().top;
356	var yPos = +(diff * 0.4);
357
358	var coords = yPos + 'px';
359
360	$el.css({
361		backgroundPositionY: coords
362	});
363}
364
365
366/* ********************* FAQ  ******************** */
367function faqClick(element, cssid) {
368	jQuery(element).toggleClass('ve_faq_question_open');
369	jQuery(element).toggleClass('ve_faq_question_close');
370	jQuery(element).next(cssid + " .ve_faq_answer").slideToggle();
371}
372
373// smooth link scroll
374
375jQuery(function () {
376	jQuery('.menu a[href*="#"]:not([href="#"]),.ve_content_button[href*="#"]:not([href="#"]),.element_image a[href*="#"]:not([href="#"]),.entry_content a[href*="#"]:not([href="#"]),.mw_feature_title_link[href*="#"],.mw_icon_text a[href*="#"], .link_element_container a[href*="#"]:not([href="#"]), .title_element_c
376ontainer a[href*="#"]:not([href="#"])').on('click', function () {
377		if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
378			var target = jQuery(this.hash);
379			var $fixedHeader = jQuery('.ve_fixed_header');
380			var fixedHeaderHeight = $fixedHeader.height() || 0;
381			var fixedAndNotScrolled = $fixedHeader.hasClass('mw_transparent_header') && !$fixedHeader.hasClass('ve_fixed_header_scrolled');
382
383			if (fixedAndNotScrolled) {
384				// Because transparent header has absolute position
385				$fixedHeader.removeClass('mw_transparent_header');
386			}
387
388			target = target.length ? target : jQuery('[name=' + this.hash.slice(1) + ']');
389			if (target.length) {
390				jQuery('html,body').animate({
391					scrollTop: (target.offset().top - fixedHeaderHeight)
392				}, 1000, 'swing', function() {
393					if (fixedAndNotScrolled) {
394						$fixedHeader.addClass('mw_transparent_header');
395					}
396				});
397				if (jQuery('#mobile_nav').is(':visible')) {
398					jQuery('#header .header_nav_container').removeClass('open');
399					jQuery('.mw_mobile_nav_close_overlay').remove();
400					jQuery('body').removeClass('mobile_menu_opened');
401				}
402				return false;
403			}
404		}
405	});
406});
407
408
409function initialize_google_maps() {
410	jQuery('.mw_google_map_container').each(function () {
411		var def_setting = {
412			address: 'Praha',
413			zoom: 12,
414			scrollwheel: false,
415		};
416
417		var setting = JSON.parse(jQuery(this).attr('data-setting'));
418
419		setting = jQuery.extend(def_setting, setting);
420
421		initialize_google_map(jQuery(this).attr('id'), setting);
422
423	});
424}
425
426function initialize_google_map(map_id, setting) {
427	var address = setting.address;
428	var geocoder = new google.maps.Geocoder();
429	var map = new google.maps.Map(document.getElementById(map_id), {
430		zoom: setting.zoom,
431		scrollwheel: setting.scrollwheel,
432		center: {lat: -25.363, lng: 131.044}
433	});
434	if (geocoder) {
435		geocoder.geocode({
436			'address': address
437		}, function (results, status) {
438			if (status == google.maps.GeocoderStatus.OK) {
439				if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
440					map.setCenter(results[0].geometry.location);
441
442					var infowindow = new google.maps.InfoWindow({
443						content: '<b>' + address + '</b>',
444						size: new google.maps.Size(150, 50)
445					});
446
447					var marker = new google.maps.Marker({
448						position: results[0].geometry.location,
449						map: map,
450						title: address
451					});
452					google.maps.event.addListener(marker, 'click', function () {
453						infowindow.open(map, marker);
454					});
455
456				} else {
457					jQuery('#' + map_id + '_error').show();
458				}
459			} else {
460				jQuery('#' + map_id + '_error').show();
461			}
462		});
463	}
464	var mapdata = {
465		map: map,
466		adress: address
467	};
468	jQuery('#' + map_id).data('map', mapdata);
469}
470
471;(function (factory) {
472
473	if (typeof define === 'function' && define.amd) {
474		define(['jquery'], factory);
475	} else if (typeof exports !== 'undefined') {
476		module.exports = factory(require('jquery'));
477	} else {
478		factory(jQuery);
479	}
480
481})(function ($) {
482	// background video
483	var MwBackgroundVideo = (function (element) {
484
485		function _MwBackgroundVideo(element) {
486
487			this.$el = $(element);
488			this.$el.hide();
489			var self = this;
490
491			$(element).load(function () {
492				self.sizeTheVideo();
493				self.$el.show();
494			});
495			$(window).resize(function () {
496				self.sizeTheVideo();
497				console.log('resize');
498			});
499
500		}
501
502		return _MwBackgroundVideo;
503
504	})();
505
506	MwBackgroundVideo.prototype.sizeTheVideo = function () {
507
508		var w = this.$el.closest('div').width();
509		var h = this.$el.closest('div').height();
510
511		if (w > (h / 9 * 16)) {
512			this.$el.css({
513				'width': w + 'px',
514				'height': w / 16 * 9 + 'px',
515				'margin-left': -w / 2 + 'px',
516				'margin-top': -w / 32 * 9 + 'px'
517			});
518		} else {
519			this.$el.css({
520				'width': h / 9 * 16 + 'px',
521				'height': h + 'px',
522				'margin-left': -h / 9 * 8 + 'px',
523				'margin-top': -h / 2 + 'px'
524			});
525		}
526
527	}
528
529	$.fn.mwBackgroundVideo = function (options) {
530		return this.each(function (index, el) {
531			el.MwBackgroundVideo = new MwBackgroundVideo(el, options);
532		});
533	};
534
535	// popup
536	var MwPopup = (function (element) {
537
538		/**
539		 * Buffer of keys to open parent popups
540		 * @type {Array}
541		 */
542		var buffer = [];
543
544		function _MwPopup(element) {
545			this.$el = $(element);
546			var self = this;
547
548			this.$el.click(function () {
549				var key = $(this).attr('data-id');
550
551				open(self, key);
552
553				return false;
554			});
555		}
556
557		function open(self, key) {
558			var id = $("#ve_popup_container_" + key);
559			var popup_width = id.attr('data-width');
560			var background = id.attr('data-bg');
561			buffer.push(key);
562
563			var href = "#ve_popup_container_" + key;
564
565			$.colorbox({
566				width: "90%",
567				maxWidth: popup_width,
568				inline: true,
569				opacity: 0.8,
570				className: "colorbox_nobackground",
571				href: href,
572				onComplete: function () {
573					$(this).colorbox.resize();
574					$("#ve_popup_container_" + key + ' .ve_content_button').click(function () {
575						self.setCookie(key);
576					});
577					// Resize colorbox when FB page plugin inside is loaded
578					var observer = new MutationObserver(function(mutations) {
579						var height = mutations[0].target.style.height || null;
580						if (height !== null && height !== '0px') {
581							$(this).colorbox.resize();
582							observer.disconnect();
583							mw_recalculate_fb_page_plugin_width()
584						}
585					});
586					$(href + ' .fb-page > span').each(function () {
587						observer.observe($(this)[0], { attributes: true, attributeFilter: ['style'] });
588					});
589				},
590				onClosed: function () {
591					self.setCookie(key);
592
593					buffer.pop() // Remove current key
594					if (buffer.length >= 1) {
595						// Open parent popup if there is still some key in buffer
596						open(self, buffer.pop())
597					}
598				}
599			});
600
601			$("#cboxOverlay").css("background-color", background);
602		}
603
604		return _MwPopup;
605	})();
606
607	MwPopup.prototype.setCookie = function (key) {
608		var delay = $("#ve_popup_container_" + key).attr('data-delay');
609
610		var now = new Date();
611		var time = now.getTime();
612		var expireTime = time + 1000 * 3600 * delay * 24;
613		now.setTime(expireTime);
614		if (delay > 0) document.cookie = "ve_popup_" + key + "=1;expires=" + now.toGMTString() + "; path=/";
615	}
616
617	$.fn.mwPopup = function (options) {
618		return this.each(function (index, el) {
619			el.MwPopup = new MwPopup(el, options);
620		});
621	};
622
623	// video popup
624	var MwVideoPopup = (function (element) {
625
626		function _MwVideoPopup(element) {
627
628			this.$el = $(element);
629
630			this.$video = $(this.$el.attr('data-open')).find('iframe');
631
632			var video_url = this.$video.attr("src");
633			if (!this.$el.attr('data-mw-href') && video_url) this.$el.attr('data-mw-href', video_url);
634			this.$video.attr("src", "");
635
636			var self = this;
637
638			this.$el.colorbox({
639				inline: true,
640				href: self.$el.attr('data-open'),
641				maxWidth: "90%",
642				width: "800px",
643				onClosed: function () {
644					self.$video.attr("src", "");
645				},
646				onComplete: function () {
647					self.$video.attr("src", self.$el.attr('data-mw-href'));
648				}
649			});
650
651		}
652
653		return _MwVideoPopup;
654
655	})();
656
657	$.fn.mwVideoPopup = function (options) {
658		return this.each(function (index, el) {
659			el.MwVideoPopup = new MwVideoPopup(el, options);
660		});
661	};
662
663	// element popup
664	var MwElementPopup = (function (element) {
665
666		function _MwElementPopup(element) {
667			this.$el = $(element);
668			var self = this;
669
670			this.$el.colorbox({
671				inline: true,
672				href: self.$el.attr('data-popup'),
673				maxWidth: "90%",
674				width: "600px",
675			});
676
677		}
678
679		return _MwElementPopup;
680
681	})();
682
683	$.fn.mwElementPopup = function (options) {
684		return this.each(function (index, el) {
685			el.MwElementPopup = new MwElementPopup(el, options);
686		});
687	};
688
689	// contact form
690	var MwForm = (function (element) {
691
692		function _MwForm(element, settings) {
693			this.$el = $(element);
694
695			this.defaults = {
696				onsubmit: null,
697			};
698			this.settings = $.extend({}, this, this.defaults, settings);
699
700			var self = this;
701
702			if (this.$el.hasClass("ve_content_form_antispam")) {
703				this.$el.attr('action', this.$el.attr('data-action'));
704			}
705
706			this.$el.submit(function (e) {
707				var error = false;
708				var err_class = "ve_error_form";
709
710				self.$el.find(".ve_error_form").removeClass("ve_error_form");
711				self.$el.find(".ve_form_checkbox_container_error").removeClass("ve_form_checkbox_container_error");
712				self.$el.find(".ve_form_error_message").remove();
713
714				self.$el.find(".ve_form_required").each(function () {
715					if ($(this).hasClass('ve_form_checkbox')) {
716						if (!$(this).is(':checked')) error = true;
717					} else if ($(this).hasClass('ve_form_checkbox_container')) {
718
719						if ($('input:checkbox:checked', this).length < 1) {
720							error = true;
721							err_class = "ve_form_checkbox_container_error";
722						}
723
724					} else if ($(this).hasClass('ve_form_radio_container')) {
725
726						if ($('input:radio:checked', this).length < 1) {
727							error = true;
728							err_class = "ve_form_checkbox_container_error";
729						}
730
731					} else {
732						if ($(this).val() == "") error = true;
733					}
734
735					if (error) {
736						$(this).addClass(err_class);
737						var err = $(this).attr('data-errorm');
738						if (!err) err = front_texts.required;
739
740						if ($(this).hasClass('ve_form_checkbox')) {
741							$(this).closest('label').after('<div class="ve_form_error_message">' + err + '</p>');
742						} else $(this).after('<div class="ve_form_error_message">' + err + '</p>');
743
744						if (($(this).offset().top - 50) < $(window).scrollTop()) {
745							$('html, body').animate({
746								scrollTop: ($(this).offset().top - 50)
747							}, 500);
748						}
749
750						return false;
751					}
752				});
753
754				//check number
755				if (!error) {
756					self.$el.find(".ve_form_number").each(function () {
757						var value = $(this).val() || '';
758						var number = value.trim();
759
760						if (!$.isNumeric(number)) {
761							$(this).addClass("ve_error_form");
762							ret = false;
763							alert(front_texts.wrongnumber);
764							if (($(this).offset().top - 50) > $('body').offset().top) {
765								$('html, body').animate({
766									scrollTop: ($(this).offset().top - 50)
767								}, 500);
768							}
769							return false;
770						}
771					});
772				}
773
774				if (!error) {
775					var emailReg = /^([\w-+\.]+@([\w-]+\.)+[\w-]{2,10})?$/;
776					self.$el.find(".ve_form_email").each(function () {
777						var emailaddressVal = $(this).val().trim();
778						$(this).val(emailaddressVal);
779						if (!emailReg.test(emailaddressVal) || emailaddressVal == "") {
780							$(this).addClass("ve_error_form");
781							$(this).after('<div class="ve_form_error_message">' + front_texts.wrongemail + '</p>');
782							if (($(this).offset().top - 50) > $('body').offset().top) {
783								$('html, body').animate({
784									scrollTop: ($(this).offset().top - 50)
785								}, 500);
786							}
787							error = true;
788						}
789					});
790				}
791
792				if (error) {
793					return false;
794				}
795				// contact form sending
796				else {
797
798					if (self.settings.onsubmit) {
799						self.settings.onsubmit.call(this, self, $(this));
800						return false;
801					}
802
803					if(self.$el.hasClass('mw_funnel_contact_conversion')) {
804						var mail = self.$el.find(".ve_form_email").val();
805						var funnel_id = self.$el.attr('data-funnel');
806						$.ajax({
807							type: 'POST',
808							data: {"action": "mwSendMailConversion", "contact": mail, "funnel_id": funnel_id},
809							url: ajaxurl,
810							success: function (content) {
811								self.$el.off("submit");
812								self.$el.submit();
813								//console.log(content);
814							}
815						});
816						return false;
817					}
818				}
819
820
821			});
822
823			this.$el.on("click", ".ve_error_form", function () {
824				$(this).removeClass("ve_error_form");
825				$(this).closest('.ve_form_row').find('.ve_form_error_message').remove();
826			});
827			this.$el.find(".ve_form_message").click(function () {
828				self.closeMessage();
829			});
830
831		}
832
833		return _MwForm;
834
835	})();
836
837	MwForm.prototype.showMessage = function (data) {
838		this.$el.find('.ve_form_message span').html(data.message);
839		this.$el.find('.ve_form_message').removeClass('ve_form_message_error ve_form_message_ok').addClass('ve_form_message_' + data.sended).fadeIn(200);
840		if (data.sended == 'ok') {
841			this.clearForm();
842		}
843	}
844
845	MwForm.prototype.closeMessage = function () {
846		this.$el.find('.ve_form_message').fadeOut(200, function () {
847			$(this).find('span').html('');
848			$(this).removeClass('ve_form_message_error ve_form_message_ok');
849		});
850	}
851	MwForm.prototype.clearForm = function () {
852		this.$el.find(".ve_form_row input").each(function () {
853			$(this).val("");
854		});
855		this.$el.find(".ve_form_row textarea").val('');
856	}
857
858	$.fn.mwForm = function (options) {
859		return this.each(function (index, el) {
860			el.MwForm = new MwForm(el, options);
861		});
862	};
863
864	// element popup
865	var MwCookieBar = (function (element) {
866
867		function _MwCookieBar(element) {
868			this.$el = $(element);
869			var obj = this;
870
871			if(this.showCookieBar()) {
872				this.$el.show();
873			}
874
875			this.$el.find(".mw_cookie_open_setting").click(function () {
876				obj.$el.find(".mw_cookie_bar").hide();
877				obj.$el.find(".mw_cookie_setting_popup").show();
878
879				var cookie = obj.getCookie();
880				var preferences = false;
881				var marketing = false;
882				var analytics = false;
883
884				if(cookie) {
885					var cookieData = JSON.parse(cookie);
886					preferences = Boolean(cookieData.permissions.preferences);
887					marketing = Boolean(cookieData.permissions.marketing);
888					analytics = Boolean(cookieData.permissions.analytics);
889				}
890
891				obj.$el.find(".mw_cookie_setting_switch_preferences input").prop('checked', preferences);
892				obj.$el.find(".mw_cookie_setting_switch_marketing input").prop('checked', marketing);
893				obj.$el.find(".mw_cookie_setting_switch_analytics input").prop('checked', analytics);
894
895				return false;
896			});
897
898			this.$el.find(".mw_cookie_setting_form_item_head").click(function () {
899				var container = $(this).closest('.mw_cookie_setting_form_item');
900				container.find('.mw_cookie_setting_form_item_text').slideToggle();
901				container.find('.mw_cookie_setting_arrow').toggleClass('opened');
902			});
903
904			this.$el.find(".mw_switch").click(function(e) {
905		        e.stopPropagation();
906			});
907
908			// close popup
909			this.$el.find(".mw_cookie_setting_popup_close").click(function(e) {
910				obj.$el.find(".mw_cookie_bar").show();
911				obj.$el.find(".mw_cookie_setting_popup").hide();
912		        return false;
913			});
914
915			// allow all
916			this.$el.find(".mw_cookie_allow_all_button").click(function () {
917				obj.saveCookie();
918				window.location.reload();
919				obj.remove();
920				return false;
921			});
922
923			// deny all
924			this.$el.find(".mw_cookie_deny_all_button").click(function () {
925				obj.saveCookie(0,0,0,0);
926				if(obj.$el.hasClass('in_element_cookie_management')) {
927					window.location.reload();
928				}
929				else {
930					obj.remove();
931				}
932
933				return false;
934			});
935
936			// save setting
937			this.$el.find(".mw_cookie_save_setting").click(function () {
938				var preferences = 0;
939				var marketing = 0;
940				var analytics = 0;
941				var others = 0;
942				if(obj.$el.find('input:checked[name=preferences]').length)
943				{
944					preferences = 1;
945				}
946				if(obj.$el.find('input:checked[name=marketing]').length && obj.$el.find('input[name=marketing]'))
947				{
948					marketing = 1;
949				}
950				if(obj.$el.find('input:checked[name=analytics]').length)
951				{
952					analytics = 1;
953				}
954				obj.saveCookie(preferences, marketing, analytics, others);
955				window.location.reload();
956				obj.remove();
957				return false;
958			});
959		}
960
961		return _MwCookieBar;
962
963	})();
964
965	MwCookieBar.prototype.remove = function () {
966		if(this.$el.hasClass('mw_cookie_bar_management_container'))
967		{
968			this.$el.remove();
969		}
970		else
971		{
972			this.$el.find(".mw_cookie_setting_popup").hide();
973		}
974	}
975
976	MwCookieBar.prototype.showCookieBar = function () {
977		var cookie = this.getCookie();
978		if(cookie) {
979			return false;
980		}
981		else {
982			return true;
983		}
984	}
985
986	MwCookieBar.prototype.getCookie = function() {
987		const name = "mw_cookie_permissions=";
988		const cDecoded = decodeURIComponent(document.cookie); //to be careful
989		const cArr = cDecoded.split('; ');
990		let res = null;
991		cArr.forEach(val => {
992			if (val.indexOf(name) === 0) res = val.substring(name.length);
993		})
994		return res
995	}
996
997	MwCookieBar.prototype.saveCookie = function (preferences = 1, marketing = 1, analytics = 1, others = 1) {
998		var date = new Date();
999		var id = this.getId();
1000
1001		var json_str = JSON.stringify({
1002			'id': id,
1003			'date': date.toGMTString(),
1004			'permissions': {
1005				'preferences': preferences,
1006				'marketing': marketing,
1007				'analytics': analytics,
1008				'others': others,
1009			}
1010		});
1011
1012		date.setDate(date.getDate() + 365);
1013		document.cookie = 'mw_cookie_permissions=' + json_str + '; path=/; expires=' + date.toGMTString();
1014		if(!analytics)
1015		{
1016			document.cookie = 'mw_allow_video_youtube=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT';
1017		}
1018
1019		// save to db
1020		$.ajax({
1021			type: 'POST',
1022			data: {
1023				'action': 'mwSaveCookieConsent',
1024				'id': id,
1025				'preferences': preferences,
1026				'marketing': marketing,
1027				'analytics': analytics,
1028			},
1029			url: ajaxurl,
1030		});
1031	}
1032
1033	MwCookieBar.prototype.getId = function ()
1034	{
1035		var cookie = this.getCookie();
1036
1037		if(cookie) {
1038			var cookieData = JSON.parse(cookie);
1039			if(cookieData.id)
1040			{
1041				return cookieData.id;
1042			}
1043		}
1044
1045		var d = new Date().getTime();
1046		if (window.performance && typeof window.performance.now === "function")
1047		{
1048			d += performance.now();
1049			// use high-precision timer if available
1050		}
1051		var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c)
1052		{
1053			var r = (d + Math.random() * 16) % 16 | 0;
1054			d = Math.floor(d / 16);
1055			return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16);
1056		});
1057	    return uuid;
1058	}
1059
1060	$.fn.mwCookieBar = function (options) {
1061		return this.each(function (index, el) {
1062			el.MwCookieBar = new MwCookieBar(el, options);
1063		});
1064	};
1065
1066});

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.