PageSourceSearch

https://www.covenanthouse.org/themes/custom/covenant_house/js/email-footer.js?tluhyd

js covenanthouse.org collected 2026-10-01 11:27:43 UTC 1,339 bytes, 37 lines download raw bytes

1(function (Drupal, drupalSettings, $, once) {
2
3  "use strict";
4
5  Drupal.behaviors.emailFooterSignup = {
6
7    attach: function (context, settings) {
8      const signupForms = once('emailFooter', '.site-footer-email-signup-form', context);
9      $(signupForms).each(function () {
10        $(this).on('submit', function(e) {
11          // Prevent the form from submitting normally
12          e.preventDefault();
13
14          // Get the email value from the input field
15          var email = $(this).find('input[name="email"]').val();
16
17          // Send a POST request to our Drupal endpoint which forwards to EveryAction
18          $.ajax({
19            type: "POST",
20            url: '/api/email-signup',
21            data: { 'email': email },
22            dataType: 'json',
23            success: function(responseData) {
24              // On successful response, show thank you message
25              $('.site-footer-email-signup').html('<p>Thank you for signing up!</p>').addClass('wysiwyg-content');
26              $('.site-footer-email-signup-form').hide();
27            },
28            error: function(jqXHR, textStatus, errorThrown) {
29              console.error('Email signup error:', jqXHR.status, jqXHR.responseText, textStatus, errorThrown);
30            }
31          });
32        });
33      });
34    }
35  }
36
37})(Drupal, drupalSettings, jQuery, once);

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.