1(function($) { 2 3 window.addEventListener('message', function(event) { 4 5 if (event.origin !== window.location.origin) { 6 return; 7 } 8 9 if (event.data.type === 'google_success') { 10 window.location.href = '/my-account/'; 11 } 12 13 if (event.data.type === 'google_error') { 14 alert(event.data.message); 15 16 $('.auth-google-btn').prop('disabled', false); 17 } 18 19 }); 20 21 $(document).ready(function() { 22 23 $('.auth-google-btn').on('click', function(e) { 24 e.preventDefault(); 25 26 const $btn = $(this); 27 28 const mode = $btn.hasClass('signin') ? 'signin' : 'signup'; 29 30 $btn.prop('disabled', true); 31 32 $.post('/wp-admin/admin-ajax.php', { 33 action: 'create_account_google', 34 mode: mode 35 }, function(response) { 36 37 if (response.success && response.data.auth_url) { 38 openGooglePopup(response.data.auth_url); 39 } else { 40 $btn.prop('disabled', false); 41 } 42 43 }); 44 45 }); 46 47 function openGooglePopup(authUrl) { 48 49 const w = 500; 50 const h = 600; 51 const left = (screen.width - w) / 2; 52 const top = (screen.height - h) / 2; 53 54 const popup = window.open( 55 authUrl, 56 'google_auth', 57 `width=${w},height=${h},left=${left},top=${top}` 58 ); 59 60 const timer = setInterval(function() { 61 if (!popup || popup.closed) { 62 clearInterval(timer); 63 $('.auth-google-btn').prop('disabled', false); 64 } 65 }, 500); 66 } 67 68 }); 69 70})(jQuery);
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.