1(function () { 2 function verifyAndRedirect(link) { 3 if (link.classList.contains('is-verifying')) { 4 return; 5 } 6 if (typeof grecaptcha === 'undefined' || !window.A360LoginRecaptcha) { 7 return; 8 } 9 10 var targetUrl = link.getAttribute('data-login-url'); 11 var targetWindow = link.getAttribute('data-login-target') || '_self'; 12 13 // Open the destination tab synchronously, inside the click's user-gesture 14 // context, so a popup blocker doesn't swallow it once we navigate it after 15 // the async verification round-trip below. 16 var pendingTab = targetWindow === '_blank' ? window.open('about:blank', '_blank') : null; 17 18 link.classList.add('is-verifying'); 19 20 grecaptcha.ready(function () { 21 grecaptcha.execute(A360LoginRecaptcha.siteKey, { action: 'login_redirect' }).then(function (token) { 22 var formData = new FormData(); 23 formData.append('action', 'a360_verify_login_recaptcha'); 24 formData.append('nonce', A360LoginRecaptcha.nonce); 25 formData.append('token', token); 26 27 fetch(A360LoginRecaptcha.ajaxUrl, { 28 method: 'POST', 29 credentials: 'same-origin', 30 body: formData 31 }) 32 .then(function (response) { return response.json(); }) 33 .then(function (data) { 34 link.classList.remove('is-verifying'); 35 if (data && data.success) { 36 if (pendingTab) { 37 pendingTab.location.href = targetUrl; 38 } else { 39 window.location.href = targetUrl; 40 } 41 } else { 42 if (pendingTab) { 43 pendingTab.close(); 44 } 45 window.alert('We could not verify your request. Please refresh the page and try again.'); 46 } 47 }) 48 .catch(function () { 49 link.classList.remove('is-verifying'); 50 if (pendingTab) { 51 pendingTab.close(); 52 } 53 window.alert('Something went wrong verifying your request. Please try again.'); 54 }); 55 }).catch(function () { 56 link.classList.remove('is-verifying'); 57 if (pendingTab) { 58 pendingTab.close(); 59 } 60 }); 61 }); 62 } 63 64 function bindLoginLinks() { 65 var links = document.querySelectorAll('.js-recaptcha-login'); 66 links.forEach(function (link) { 67 link.addEventListener('click', function (e) { 68 e.preventDefault(); 69 verifyAndRedirect(link); 70 }); 71 }); 72 } 73 74 if (document.readyState === 'loading') { 75 document.addEventListener('DOMContentLoaded', bindLoginLinks); 76 } else { 77 bindLoginLinks(); 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.