PageSourceSearch

https://37signals.com/assets/js/modules/signup.js

js 37signals.com collected 2026-10-01 07:06:25 UTC 1,487 bytes, 73 lines download raw bytes

1function ready() {
2
3  var signup = document.querySelector('.signup');
4
5  if(signup) {
6
7    var signupForm = document.getElementById('mc-embedded-subscribe-form');
8    var signupInput = document.getElementById('mce-EMAIL');
9    var signupButton = signupForm.querySelector('button');
10
11    signupForm.addEventListener('submit', (e) => {
12
13      e.preventDefault();
14
15      signupInput.value = signupInput.value.trim();
16
17      if(signupInput.value) {
18
19        var isValid = /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(signupInput.value);
20
21        if(isValid) {
22
23          fetch(signupForm.action, {
24
25            body: new FormData(signupForm),
26            method: signupForm.method,
27            mode: 'no-cors'
28
29          }).then(() => {
30
31            signupForm.reset();
32
33            signupButton.disabled = false;
34
35            if(signup.classList.contains('signup--jobs')) {
36
37              location.assign('/jobs/thanks');
38
39            } else if(signup.classList.contains('signup--policies')) {
40
41              location.assign('/policies/updates/thanks');
42
43            }
44
45          });
46
47          signupButton.disabled = true;
48
49        } else {
50
51          signupForm.classList.add('error');
52
53        }
54
55      }
56
57    });
58
59    var removeError = () => {
60
61      signupForm.classList.remove('error');
62
63    };
64
65    signupInput.addEventListener('click', removeError);
66    signupInput.addEventListener('focus', removeError);
67    signupInput.addEventListener('input', removeError);
68
69  }
70
71}
72
73export { ready };

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.