1window.jQuery(document).ready(function() { 2 var $ = window.jQuery; 3 4 function closeKupoEmailForgottenDialog(closeRegistrationDialog = true) { 5 $('section.kupo-email-forgotten-dialog').addClass('inactive'); 6 $('section.kupo-email-forgotten-dialog').removeClass('active'); 7 $('.kupo-email-forgotten-window-loading-spinner').hide(); 8 $('form.kupo-email-forgotten-dialog-form').trigger('reset'); 9 $('.kupo-email-forgotten-content').show(); 10 $('.kupo-email-forgotten-send-mail-content').hide(); 11 $('.kupo-email-forgotten-send-mail-error-content').hide(); 12 13 if (closeRegistrationDialog && typeof closeKupoRegistrationDialog === 'function') { 14 closeKupoRegistrationDialog(); 15 } 16 } 17 18 if ($('section.kupo-email-forgotten-dialog').length > 1) { 19 for (let i = 1; i < $('section.kupo-email-forgotten-dialog').length; i++) { 20 $('section.kupo-email-forgotten-dialog')[i].remove(); 21 } 22 } 23 24 $('section.kupo-email-forgotten-dialog').detach().appendTo('body'); 25 26 $('button.kupo-close-email-forgotten-dialog, button.kupo-modal-email-forgotten-cancel_button').on('click', function () { 27 closeKupoEmailForgottenDialog(); 28 }); 29 30 $('.kupo-modal-email-forgotten-close_button').on('click', function (e) { 31 closeKupoEmailForgottenDialog(); 32 }); 33 34 $('button.kupo-modal-email-forgotten-return_button').on('click', function (e) { 35 e.preventDefault(); 36 e.stopPropagation(); 37 38 closeKupoEmailForgottenDialog(false); 39 40 $('section.kupo-registration-dialog').addClass('active'); 41 $('section.kupo-registration-dialog').removeClass('inactive'); 42 }); 43 44 $('button.cupo-modal-email-forgotten-cancel_button').on('click', function () { 45 closeKupoEmailForgottenDialog(); 46 }); 47 48 $('.kupo-email-forgotten-dialog').on('click', function (e) { 49 var dialogWindow = $('.kupo-email-forgotten-window'); 50 51 if (dialogWindow[0] && !dialogWindow[0].isSameNode(e.target) && !dialogWindow[0].contains(e.target)) { 52 closeKupoEmailForgottenDialog(); 53 } 54 }); 55 56 $(document).on('keyup', function (e) { 57 if (e.which === 27 || e.key === 'Escape' || e.code === 'Escape') { 58 closeKupoEmailForgottenDialog(); 59 } 60 }); 61 62 $('button.kupo-modal-email-forgotten-confirm_button').on('click', function (e) { 63 e.preventDefault(); 64 e.stopPropagation(); 65 66 if (!cupo_email_forgotten_dialog_script || typeof cupo_email_forgotten_dialog_script !== 'object') { 67 return; 68 } 69 70 var email1 = $('#email-forgotten_form_email_input-1').val() ?? ''; 71 var email2 = $('#email-forgotten_form_email_input-2').val() ?? ''; 72 var email3 = $('#email-forgotten_form_email_input-3').val() ?? ''; 73 74 if ( 75 typeof email1 !== 'string' || !isValidEmail(email1) 76 || (typeof email2 === 'string' && email2.trim().length > 0 && !isValidEmail(email2)) 77 || (typeof email3 === 'string' && email3.trim().length > 0 && !isValidEmail(email3)) 78 ) { 79 return; 80 } 81 82 $('.kupo-email-forgotten-window-loading-spinner').css('display', 'flex'); 83 84 $.ajax({ 85 type: 'POST', 86 url: cupo_email_forgotten_dialog_script.ajax_url, 87 data: { 88 'action': 'cupoEmailForgotten', 89 'data': { email1: email1, email2: email2, email3: email3 } 90 }, 91 success: function (data) { 92 data = typeof data === 'string' ? JSON.parse(data) : data; 93 94 $('.kupo-email-forgotten-window-loading-spinner').hide(); 95 $('.kupo-email-forgotten-content').hide(); 96 97 if (data && data.status === 'success') { 98 $('.kupo-email-forgotten-send-mail-content').show(); 99 } else { 100 showErrorMessage(data && data.error && typeof data.error === 'string' ? data.error : ''); 101 } 102 }, 103 error: function () { 104 showErrorMessage(); 105 } 106 }); 107 }); 108 109 function showErrorMessage(message = '') { 110 $('.kupo-email-forgotten-send-mail-error-content .kupo-mail-send-description > p').html(typeof message === 'string' && message.length > 0 111 ? message 112 : 'Es ist ein technischer Fehler aufgetreten. Bitte versuchen Sie es später erneut.' 113 ); 114 115 $('.kupo-email-forgotten-window-loading-spinner').hide(); 116 $('.kupo-email-forgotten-content').hide(); 117 $('.kupo-email-forgotten-send-mail-error-content').show(); 118 } 119 120 function isValidEmail(email) { 121 return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email); 122 } 123});
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.