PageSourceSearch

https://xperf.ai/xperf-contact.js?v=20260812-contact-v1

js xperf.ai collected 2026-10-05 13:20:31 UTC 2,573 bytes, 76 lines download raw bytes

1(() => {
2  "use strict";
3
4  const WEB3FORMS_ACCESS_KEY = "57ef7717-5611-4ff8-99fa-d97f4221be56";
5
6  function setupContactForm() {
7    const form = document.getElementById("xperf-contact-form");
8    const errorPanel = document.getElementById("xperf-contact-error");
9    const errorMessage = document.getElementById("xperf-contact-error-message");
10    const successPanel = document.getElementById("xperf-contact-success");
11    const submitLabel = document.getElementById("xperf-contact-submit-label");
12
13    if (!form || !errorPanel || !errorMessage || !successPanel || !submitLabel) return;
14
15    const controls = Array.from(form.querySelectorAll("[data-contact-control]"));
16
17    const setSubmitting = (isSubmitting) => {
18      controls.forEach((control) => {
19        control.disabled = isSubmitting;
20      });
21      submitLabel.textContent = isSubmitting ? "Sending…" : "Submit";
22    };
23
24    const showError = (message) => {
25      errorMessage.textContent = message;
26      errorPanel.hidden = false;
27    };
28
29    form.addEventListener("submit", async (event) => {
30      event.preventDefault();
31      errorPanel.hidden = true;
32      errorMessage.textContent = "";
33
34      const formData = new FormData(form);
35      formData.set(
36        "newsletter_opt_in",
37        formData.has("newsletter_opt_in") ? "Yes" : "No",
38      );
39      formData.append("access_key", WEB3FORMS_ACCESS_KEY);
40
41      const firstName = String(formData.get("first_name") ?? "").trim();
42      const lastName = String(formData.get("last_name") ?? "").trim();
43      const senderName = [firstName, lastName].filter(Boolean).join(" ") || "unknown sender";
44
45      formData.append("subject", `New contact form submission from ${senderName}`);
46      formData.append("from_name", "XPerf Website Contact Form");
47      setSubmitting(true);
48
49      try {
50        const response = await fetch("https://api.web3forms.com/submit", {
51          method: "POST",
52          body: formData,
53        });
54        const data = await response.json();
55
56        if (response.ok && data.success) {
57          form.hidden = true;
58          successPanel.hidden = false;
59          return;
60        }
61
62        showError(data.message ?? "Submission failed. Please try again.");
63      } catch (error) {
64        showError(error instanceof Error ? error.message : "Network error. Please try again.");
65      } finally {
66        setSubmitting(false);
67      }
68    });
69  }
70
71  if (document.readyState === "loading") {
72    document.addEventListener("DOMContentLoaded", setupContactForm, { once: true });
73  } else {
74    setupContactForm();
75  }
76})();

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.