PageSourceSearch

https://www.mcallister.com/js/vendor/contact.js?version=1787687783

js mcallister.com collected 2026-10-02 19:09:49 UTC 2,037 bytes, 72 lines download raw bytes

1function contactForm(options) {
2	document.addEventListener('DOMContentLoaded', function() {
3		var recaptcha = options.recaptcha;
4		handleFormProcessing(options);
5
6		if (recaptcha !== null && typeof recaptcha.key !== 'undefined') {
7			setToken(recaptcha.key, recaptcha.action, recaptcha.inputElement || null);
8		}
9	});
10}
11
12function setToken(key, action, inputElement) {
13	var $el = inputElement || document.getElementById('recaptcha_token');
14
15	// Use the Enterprise API (enterprise.js) when present, otherwise the classic
16	// API (api.js). Lets one published file serve both classic and Enterprise
17	// sites — the only per-site change is which Google script tag is loaded.
18	var gre = (window.grecaptcha && window.grecaptcha.enterprise) ? window.grecaptcha.enterprise : window.grecaptcha;
19
20	if (!gre || !$el) {
21		return;
22	}
23
24	gre.ready(function() {
25		gre.execute(key, { action: action }).then(function(token) {
26			var badge = document.querySelector('.grecaptcha-badge');
27			if (badge) {
28				badge.classList.add('active');
29			}
30			$el.value = token;
31		});
32
33		setInterval(function() {
34			gre.execute(key, { action: action }).then(function(token) {
35				$el.value = token;
36			});
37		}, 60 * 2 * 1000);
38	});
39}
40
41function handleFormProcessing(options) {
42	var form = document.getElementById(options.formId);
43
44	if (!form) {
45		return;
46	}
47
48	// Hard guard against an accidental double-submit. The previous cosmetic
49	// button-hide did NOT stop a second submission via the Enter key or a fast
50	// re-click while the POST was in flight, which produced duplicate inquiries.
51	// A one-shot flag cancels any further submit on this form.
52	var submitting = false;
53
54	form.addEventListener('submit', function(e) {
55		if (submitting) {
56			e.preventDefault();
57			return;
58		}
59		submitting = true;
60
61		var submit = document.getElementById('submit');
62		if (submit) {
63			submit.disabled = true;
64			submit.style.display = 'none';
65		}
66
67		var processing = document.getElementById('processing');
68		if (processing) {
69			processing.style.display = 'inline-block';
70		}
71	});
72}

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.