PageSourceSearch

https://www.le-chatel-des-vivaces.com/modules/sendinblue/views/js/back-in-stock.js?year=2026

js le-chatel-des-vivaces.com collected 2026-10-02 10:37:53 UTC 2,722 bytes, 79 lines download raw bytes

1document.addEventListener('click', function(e) {
2    const submitBtn = e.target.closest('button.brevo-stock-notification-submit');
3    if (!submitBtn) {
4        return;
5    }
6
7    const container = submitBtn.closest('.sendinblue-back-in-stock-container');
8    if (!container) {
9        return;
10    }
11
12    const productId = container.getAttribute('data-product-id');
13    const backinstockUrl = container.getAttribute('data-backinstock-url');
14
15    const formWrapper = container.querySelector('.sendinblue-form');
16    const emailInput = container.querySelector('input[name="email"]');
17    const hiddenProductId = container.querySelector('input[name="product_id"]');
18    const hiddenAction = container.querySelector('input[name="action"]');
19    const messageDiv = container.querySelector('[id^="sendinblue-message-"]');
20
21    if (!formWrapper || !emailInput) {
22        return;
23    }
24
25    const email = (emailInput.value || '').trim();
26    if (!email) {
27        if (messageDiv) {
28            messageDiv.style.display = 'block';
29            messageDiv.innerHTML = '<div class="alert alert-danger">Please enter a valid email address.</div>';
30        }
31        return;
32    }
33
34    if (submitBtn.disabled) {
35        return;
36    }
37
38    submitBtn.disabled = true;
39    const originalText = submitBtn.textContent;
40    submitBtn.textContent = 'Subscribing...';
41
42    if (messageDiv) {
43        messageDiv.style.display = 'none';
44    }
45
46    const formData = new FormData();
47    formData.append('product_id', hiddenProductId ? hiddenProductId.value : productId);
48    formData.append('action', hiddenAction ? hiddenAction.value : 'subscribe');
49    formData.append('email', email);
50
51    // Send AJAX request
52    fetch(backinstockUrl, {
53        method: 'POST',
54        body: formData,
55        credentials: 'same-origin'
56    })
57    .then(response => response.json())
58    .then(data => {
59        if (messageDiv) {
60            messageDiv.style.display = 'block';
61            if (data && data.success) {
62                messageDiv.innerHTML = '<div class="alert alert-success">' + (data.message || 'Subscribed successfully!') + '</div>';
63                formWrapper.style.display = 'none';
64            } else {
65                messageDiv.innerHTML = '<div class="alert alert-danger">' + (data && data.message ? data.message : 'Failed to subscribe. Please try again.') + '</div>';
66            }
67        }
68    })
69    .catch(() => {
70        if (messageDiv) {
71            messageDiv.style.display = 'block';
72            messageDiv.innerHTML = '<div class="alert alert-danger">An error occurred. Please try again.</div>';
73        }
74    })
75    .finally(() => {
76        submitBtn.disabled = false;
77        submitBtn.textContent = originalText;
78    });
79});

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.