PageSourceSearch

https://lavoce.info/wp-content/plugins/mailup-email-and-newsletter…/js/mailup-public.js?ver=1.2.7.1790236575

js lavoce.info collected 2026-09-24 08:43:20 UTC 3,224 bytes, 121 lines download raw bytes

1(function ($) {
2	"use strict";
3	$(window).load(function () {
4		var $mup_form = $("#mupwp-form");
5
6		$mup_form.validate({
7			errorElement: 'span',
8			rules: {
9				email: true,
10			},
11			highlight: function (element) {
12				$(element).addClass("error");
13				if ($(element).is(':checkbox')) {
14					$(element).closest('label').addClass('error');
15				}
16			},
17			unhighlight: function (element) {
18				$(element).removeClass("error");
19				if ($(element).is(':checkbox')) {
20					$(element).closest('label').removeClass("error");
21				}
22			},
23			errorPlacement: function (error, element) {
24				if (!element.is(':checkbox')) {
25					error.insertAfter(element);
26				}
27			},
28			submitHandler: function (form) {
29				save_form(getFormData($(form)));
30				return false;
31			},
32		});
33
34		function save_form($form) {
35			var ajax_url = mailup_params.ajax_url;
36			$.ajax({
37				type: "POST",
38				url: ajax_url,
39				data: {
40					action: "mupwp_save_contact",
41					ajaxNonce: mailup_params.ajaxNonce,
42					parameters: $form,
43				},
44				beforeSend: function () {
45					$mup_form.find(".ajax-loader").addClass("active");
46					$mup_form.find(".feedback").removeClass('error');
47					$(":submit", $('#mupwp-form')).prop('disabled', true);
48					$mup_form.find(".feedback").text('');
49				},
50				success: function (res) {
51					$mup_form.find(".feedback").text(res.data);
52					$mup_form.trigger("reset");
53				},
54				error: function (xhr) {
55					var res = xhr.responseJSON;
56					$mup_form.find(".feedback").addClass('error').text(res.data);
57				},
58				complete: function (data) {
59					$mup_form.find(".ajax-loader").removeClass("active");
60					$(":submit", $mup_form).prop('disabled', false);
61					$mup_form.find(".feedback").fadeIn().delay(5000).queue(function (n) {
62						$(this).fadeOut("slow");
63						n();
64					});
65				}
66			});
67		}
68
69		function getFormData($form) {
70			var unindexed_array = $form.serializeArray();
71			var indexed_array = {};
72			var indexed_fields = {};
73			var indexed_terms = {};
74
75			$.map(unindexed_array, function (n) {
76				if ($.isNumeric(n['name'])) {
77					indexed_fields[n['name']] = n['value']
78				}
79				else if (n['name'].startsWith('term')) {
80					var id_term = n['name'][n['name'].length - 1];
81					indexed_terms[id_term] = n['value'];
82				}
83				else {
84					indexed_array[n['name']] = n['value'];
85				}
86			});
87
88			indexed_array['fields'] = indexed_fields;
89			indexed_array['terms'] = indexed_terms;
90			return indexed_array;
91		}
92	});
93
94	/**
95	 * All of the code for your public-facing JavaScript source
96	 * should reside in this file.
97	 *
98	 * Note: It has been assumed you will write jQuery code here, so the
99	 * $ function reference has been prepared for usage within the scope
100	 * of this function.
101	 *
102	 * This enables you to define handlers, for when the DOM is ready:
103	 *
104	 * $(function() {
105	 *
106	 * });
107	 *
108	 * When the window is loaded:
109	 *
110	 * $( window ).load(function() {
111	 *
112	 * });
113	 *
114	 * ...and/or other possibilities.
115	 *
116	 * Ideally, it is not considered best practise to attach more than a
117	 * single DOM-ready or window-load handler for a particular page.
118	 * Although scripts in the WordPress core, Plugins and Themes may be
119	 * practising this, we should strive to set a better example in our own work.
120	 */
121})(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.