PageSourceSearch

https://agile-news.com/assets/js/contact-form.js?v=20260814-contact-v1

js agile-news.com collected 2026-10-02 14:11:07 UTC 2,139 bytes, 65 lines download raw bytes

1/** VUGA Network public contact form. */
2(function () {
3  'use strict';
4
5  const ENDPOINT = 'https://newsadmin.vugaenterprises.com/api/public/contact';
6
7  function value(form, name) {
8    const field = form.elements.namedItem(name);
9    return field ? String(field.value || '').trim() : '';
10  }
11
12  document.querySelectorAll('[data-contact-form]').forEach(function (form) {
13    const status = form.querySelector('[data-contact-status]');
14    const submit = form.querySelector('button[type="submit"]');
15    let submitting = false;
16
17    form.addEventListener('submit', async function (event) {
18      event.preventDefault();
19      if (submitting) return;
20      if (typeof form.reportValidity === 'function' && !form.reportValidity()) return;
21
22      submitting = true;
23      form.setAttribute('aria-busy', 'true');
24      if (submit) submit.disabled = true;
25      if (status) {
26        status.className = 'vuga-contact-status is-pending';
27        status.textContent = 'Sending your message…';
28      }
29
30      try {
31        const response = await fetch(ENDPOINT, {
32          method: 'POST',
33          credentials: 'omit',
34          headers: {
35            Accept: 'application/json',
36            'Content-Type': 'application/json',
37          },
38          body: JSON.stringify({
39            name: value(form, 'name'),
40            email: value(form, 'email'),
41            subject: value(form, 'subject'),
42            message: value(form, 'message'),
43            company: value(form, 'company'),
44          }),
45        });
46        if (!response.ok) throw new Error('Contact submission failed');
47
48        form.reset();
49        if (status) {
50          status.className = 'vuga-contact-status is-success';
51          status.textContent = 'Your message has been sent. Thank you.';
52        }
53      } catch (_error) {
54        if (status) {
55          status.className = 'vuga-contact-status is-error';
56          status.textContent = 'We could not send your message. Please try again.';
57        }
58      } finally {
59        submitting = false;
60        form.removeAttribute('aria-busy');
61        if (submit) submit.disabled = false;
62      }
63    });
64  });
65}());

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.