PageSourceSearch

https://www.vistra.com/themes/custom/vistra2024/js/opt-in-banner.js?tlu1y1

js vistra.com collected 2026-09-24 18:13:12 UTC 1,689 bytes, 43 lines download raw bytes

1(function (Drupal, once) {
2  Drupal.behaviors.emailCheckFormToggle = {
3    attach: function (context) {
4      // Use 'once' to ensure this only attaches once per instance
5      once('emailCheckFormToggle', '.initial-form a', context).forEach(function (a) {
6        a.addEventListener('click', function (event) {
7          event.preventDefault(); // Prevent link default
8
9          // Scope everything to the closest .initial-form container
10          const $initialForm = $(a).closest('.initial-form');
11          const $hubspotWrapper = $initialForm.closest('.form-group').find('.hubspot-wrapper');
12          const $hubspotForm = $hubspotWrapper.find('.hubspot-form form');
13
14          // Get the email field within this instance
15          const emailField = $initialForm.find('.initial-email-field')[0];
16          const emailValue = emailField ? emailField.value.trim() : '';
17
18          // Simple email validation regex
19          const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
20
21          if (emailPattern.test(emailValue)) {
22            // Hide only this instance of the initial form
23            $initialForm.hide();
24
25            // Populate HubSpot form's email field (in the same section)
26            const $hubspotEmail = $hubspotForm.find('[name="email"]');
27            if ($hubspotEmail.length) {
28              $hubspotEmail
29                .val(emailValue)
30                .trigger('input')
31                .trigger('change');
32            }
33
34            $hubspotWrapper.slideDown(800);
35          } else {
36            // Show error message only within this form
37            $initialForm.find('.error-message').show();
38          }
39        });
40      });
41    }
42  };
43})(Drupal, 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.