PageSourceSearch

https://mcbu.edu.tr/vendor/email-form/validate.js?v=7IwiegMGXP3AkGxutSFR6VcAd7be-Yp6wJXOG9lublE

js mcbu.edu.tr collected 2026-10-02 05:54:00 UTC 2,608 bytes, 81 lines download raw bytes

1
2(function () {
3  "use strict";
4
5  let forms = document.querySelectorAll('.email-form');
6
7  forms.forEach( function(e) {
8    e.addEventListener('submit', function(event) {
9      event.preventDefault();
10
11      let thisForm = this;
12
13      let action = thisForm.getAttribute('action');
14      let recaptcha = thisForm.getAttribute('data-recaptcha-site-key');
15      
16      if( ! action ) {
17        displayError(thisForm, 'The form action property is not set!');
18        return;
19      }
20      thisForm.querySelector('.loading').classList.add('d-block');
21      thisForm.querySelector('.error-message').classList.remove('d-block');
22      thisForm.querySelector('.sent-message').classList.remove('d-block');
23
24      let formData = new FormData( thisForm );
25
26      if ( recaptcha ) {
27        if(typeof grecaptcha !== "undefined" ) {
28          grecaptcha.ready(function() {
29            try {
30              grecaptcha.execute(recaptcha, {action: 'email_form_submit'})
31              .then(token => {
32                formData.set('recaptcha-response', token);
33                email_form_submit(thisForm, action, formData);
34              })
35            } catch(error) {
36              displayError(thisForm, error);
37            }
38          });
39        } else {
40          displayError(thisForm, 'The reCaptcha javascript API url is not loaded!')
41        }
42      } else {
43        email_form_submit(thisForm, action, formData);
44      }
45    });
46  });
47
48  function email_form_submit(thisForm, action, formData) {
49    fetch(action, {
50      method: 'POST',
51      body: formData,
52      headers: {'X-Requested-With': 'XMLHttpRequest'}
53    })
54    .then(response => {
55      if( response.ok ) {
56        return response.text();
57      } else {
58        throw new Error(`${response.status} ${response.statusText} ${response.url}`); 
59      }
60    })
61    .then(data => {
62      thisForm.querySelector('.loading').classList.remove('d-block');
63      const sentMessage = thisForm.querySelector('.sent-message');
64      const messageText = data && data.trim() ? data.trim() : 'Ilginize Tesekkur Ederiz.';
65      sentMessage.textContent = messageText;
66      sentMessage.classList.add('d-block');
67      thisForm.reset(); 
68    })
69    .catch((error) => {
70      displayError(thisForm, error);
71    });
72  }
73
74  function displayError(thisForm, error) {
75    thisForm.querySelector('.loading').classList.remove('d-block');
76    const errorMessage = thisForm.querySelector('.error-message');
77    errorMessage.textContent = error;
78    errorMessage.classList.add('d-block');
79  }
80
81})();

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.