PageSourceSearch

https://www.knoxalliance.com/wp-content/plugins/emma-emarketing-plugin/assets/js/emma.js?ver=201706140834

js knoxalliance.com collected 2026-10-02 12:24:35 UTC 4,985 bytes, 146 lines download raw bytes

1jQuery(document).ready(function($) {
2	
3	$('.recaptcha-popup').on('click', function(e){
4		
5		// Fade out the pop up
6		$(this).fadeOut(400, function(){
7			$(this).addClass('hidden');
8			
9			// Reset the form submit button and form classes
10			$('.activeForm').find('input.waiting').removeClass('waiting');
11			$('.activeForm').removeClass('activeForm');
12			
13		});
14	}).children().click(function(){return false;});
15	
16	// Watch the validation field to change, if it changes...probably a spam bot - disable the submit button
17	$('input[name="validation"]').on( 'change', function(e){
18		
19		if ( $(this).val() !== '' ) {
20			var thisForm = $(e.target).closest('#emma-subscription-form');
21			var thisWrap = $(e.target).closest('.emma-wrap');
22			var thisFormUnique = thisForm.attr('data-form-unique');
23			
24			$('#emma-form-submit-' + thisFormUnique).attr('disabled', 'disabled');
25			
26		} else {
27			
28			$('#emma-form-submit-' + thisFormUnique).removeAttr('disabled');
29			
30		}
31		
32	});
33	
34	$(document).on('click', '#emma-form input[name="emma_form_submit"]:not(.waiting)', function(e){
35		//prevent the form from actually submitting and refreshing the page
36		e.preventDefault();
37		e.stopPropagation();
38		
39		var thisButton = $(e.target);
40		
41		// Make sure there's only one active form
42		if ( $('.activeForm').length > 0 && typeof captchaExists !== "undefined" && ! thisButton.hasClass("passed-captcha"))
43			return false;
44		
45		var thisForm = $(e.target).closest('#emma-subscription-form');
46		var thisWrap = $(e.target).closest('.emma-wrap');
47		var thisFormUnique = thisForm.attr('data-form-unique');
48		
49		thisForm.addClass('activeForm');
50		
51		// Maybe run some other code to handle our reCAPTCHAs
52		if ( typeof captchaExists !== "undefined" ) {
53			
54			// See if we've passed the captcha yet. If not, show the popup, render the captcha
55			if ( ! thisButton.hasClass("passed-captcha") ) {
56				// We haven't passed our captcha yet
57				thisButton.addClass("waiting");
58				
59				if ( $('#recaptcha-container-' + thisFormUnique).children().length == 0 ) {
60					grecaptcha.render(
61						'recaptcha-container-' + thisFormUnique,
62						{
63							"sitekey": recaptchaSiteKey,
64							"callback": goodCaptcha,
65						});
66				}
67				
68				$('#recaptcha-popup-' + thisFormUnique + '.hidden').fadeIn(400, function(){
69					$(this).removeClass("hidden");
70				});
71				
72				return false;
73			} else {
74				
75				// Hide the popup
76				$("#recaptcha-popup-" + thisFormUnique ).addClass('hidden').hide();
77			
78			}
79			
80		}
81		
82		// If a status already exists, fade it out in sync with the form then remove it.
83		if ($('.emma-status').length > 0) {
84			$('.emma-status').fadeOut({
85				duration:300, 
86				queue: false, 
87				complete: function(){
88					$('.emma-status').remove();
89				}
90			});
91		}
92		
93		// Fade out the form, show a little spinner thing
94		thisForm.fadeOut({
95			duration: 300,
96			queue: false,
97			complete: function(){
98				// Show the WordPress default spinner
99				$('<div class="spinner"></div>').prependTo(thisWrap).show();
100				
101				// Now let's submit the form via AJAX
102				var data = {
103					'action': 'emma_ajax_form_submit',
104					'emma_email': $('#emma-subscription-form[data-form-unique="' + thisFormUnique + '"] input[name="emma_main_input"]').val(),
105					'emma_firstname': $('#emma-subscription-form[data-form-unique="' + thisFormUnique + '"] input[name="emma_firstname"]').val(),
106					'emma_lastname': $('#emma-subscription-form[data-form-unique="' + thisFormUnique + '"] input[name="emma_lastname"]').val(),
107					'emma_signup_form_id': $('#emma-subscription-form[data-form-unique="' + thisFormUnique + '"] input[name="emma_signup_form_id"]').val(),
108					'emma_send_confirmation': $('#emma-subscription-form[data-form-unique="' + thisFormUnique + '"] input[name="emma_send_confirmation"]').val(),
109					'validation': $('#emma-subscription-form[data-form-unique="' + thisFormUnique + '"] input[name="validation"]').val(),
110					'token': $('#emma-subscription-form[data-form-unique="' + thisFormUnique + '"] #g-recaptcha-response').val(),
111				};
112				
113				jQuery.post(ajax_object.ajax_url, data, function(response) {
114					var errorClass = '';
115					var hasError = false;
116					
117					// Check for errors
118					if ( response.data.code > 800) {
119						errorClass = 'emma-alert';
120						hasError = true;
121						response.data.tracking_pixel = '<p style="display:none !important;">Error occured. No tracking pixel placed.</p>';
122					} else {
123						errorClass = '';
124					}
125					
126					// Display the status
127					thisWrap.prepend('<div class="emma-status ' + errorClass + '" style="display:none;">' + response.data.status_txt + '</div>' + response.data.tracking_pixel);
128					
129					// Show/Hide stuff
130					$('.spinner').delay(800).fadeOut(300, function(){
131						$('.spinner').remove();
132						$('.emma-status').fadeIn(300);
133						
134						// If we have an error, we need to show the form again
135						if (hasError == true) {
136							thisForm.fadeIn(300);
137						}
138					});
139
140				});
141				
142				thisForm.removeClass('activeForm');
143			}
144		});
145	});
146});

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.