PageSourceSearch

https://brts.md/wp-content/themes/brts-theme/js/e-delivery-form-handler.js?ver=5455

js brts.md collected 2026-09-27 01:05:43 UTC 2,102 bytes, 62 lines download raw bytes

1document.addEventListener("DOMContentLoaded", function () {
2  const form = document.getElementById("document-delivery-form");
3
4  if (form) {
5    form.addEventListener("submit", function (event) {
6      event.preventDefault();
7
8      const formData = new FormData(this);
9      const messageDiv = document.getElementById("form-message");
10
11      fetch("/wp-admin/admin-ajax.php", {
12        method: "POST",
13        body: formData,
14      })
15        .then((response) => response.text())
16        .then((text) => {
17          // Extrage partea JSON din răspuns
18          const jsonMatch = text.match(/\{.*\}/);
19          if (jsonMatch) {
20            return JSON.parse(jsonMatch[0]);
21          }
22          throw new Error("Nu s-a găsit un răspuns JSON");
23        })
24        .then((data) => {
25          if (data.success) {
26            // Afișează mesajul de succes
27            messageDiv.textContent = data.data;
28            messageDiv.style.display = "block";
29            messageDiv.classList.remove("hidden");
30            messageDiv.classList.add("text-green-600", "font-semibold");
31
32            // Resetează formularul
33            form.reset();
34
35            // Redirecționează după un delay
36            setTimeout(() => {
37              window.location.href = "/";
38            }, 2000);
39          } else {
40            // Afișează mesajul de eroare
41            messageDiv.textContent = data.data;
42            messageDiv.style.display = "block";
43            messageDiv.classList.remove("hidden");
44            messageDiv.classList.add("text-red-600", "font-semibold");
45          }
46
47          // Ascunde mesajul după 5 secunde
48          setTimeout(() => {
49            messageDiv.classList.add("hidden");
50          }, 5000);
51        })
52        .catch((error) => {
53          console.error("Error:", error);
54          messageDiv.textContent =
55            "A apărut o eroare. Vă rugăm să încercați din nou.";
56          messageDiv.style.display = "block";
57          messageDiv.classList.remove("hidden");
58          messageDiv.classList.add("text-red-600", "font-semibold");
59        });
60    });
61  }
62});

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.