1var isRegistered = false; 2var checkRegistration = false; 3var emailIsValid = false; 4 5jQuery(function () { 6 initRestrictedContentClicks(); 7}); 8 9var initRestrictedContentClicks = function () { 10 checkRegistration = false; 11 jQuery('body').on('click', '.ksys_auth_locked', function (event) { 12 event.preventDefault(); 13 var httpRedirect = jQuery(this).data('permalink'); 14 const authCookie = Cookies.get("ksys_sf_auth_lead"); 15 if (authCookie) { 16 const cookieParts = authCookie.split("|"); 17 if (jQuery(this).data('sflocked') == 0 || 18 (cookieParts.length === 2 && cookieParts[1] && cookieParts[1] !== "none") 19 ) { 20 window.location.href = httpRedirect; 21 return false; 22 } 23 } 24 25 initVerifyEmail(httpRedirect); 26 }); 27}; 28 29var initRegistration = function () { 30 Swal.fire({ 31 allowOutsideClick: true, 32 allowEscapeKey: true, 33 allowEnterKey: false, 34 showCancelButton: false, 35 showConfirmButton: true, 36 confirmButtonText: ksys_sf_auth.register_button_text || 'Register', 37 width: 800, 38 onClose: function () {
39 checkRegistration = false; 40 isRegistered = false; 41 emailIsValid = false; 42 }, 43 customClass: { 44 content: 'ksys-sf-auth-content-class' 45 }, 46 html: 47 ksys_sf_auth.ksys_sf_auth_registration_modal_content + 48 '<hr>' + 49 '<div style="width: 50%; padding:10px; float:left">' + 50 ' <div><label for="ksys-sf-auth-reg-last-name">' + ksys_sf_auth.ksys_sf_auth_register_lastname + ' *</label></div>' + 51 ' <input type="text" name="ksys-sf-auth-reg-last-name" id="ksys_reg_lastname">' + 52 '</div>' + 53 '<div style="width: 50%; padding:10px; float:left">' + 54 ' <div><label for="ksys-sf-auth-reg-first-name">' + ksys_sf_auth.ksys_sf_auth_register_firstname + ' *</label></div>' + 55 ' <input type="text" name="ksys-sf-auth-reg-first-name" id="ksys_reg_firstname">' + 56 '</div>' + 57 '<div style="width: 50%; padding:10px; float:left">' + 58 ' <div><label for="ksys-sf-auth-reg-email">' + ksys_sf_auth.ksys_sf_auth_register_email + ' *</label></div>' + 59 ' <input type="email" name="ksys-sf-auth-reg-email" id="ksys_reg_email">' + 60 '</div>' + 61 '<div style="width: 50%; padding:10px; float:left">' + 62 ' <div><label for="ksys-sf-auth-reg-phone-number">' + ksys_sf_auth.ksys_sf_auth_register_phone_number + ' *</label></div>' + 63 ' <input type="text" name="ksys-sf-auth-reg-phone-number" id="ksys_reg_phonenumber">' + 64 '</div>' + 65 '<div style="width: 50%; padding:10px; float:left">' + 66 ' <div><label for="ksys-sf-auth-reg-company">' + ksys_sf_auth.ksys_sf_auth_register_company + ' *</label></div>' + 67 ' <input type="text" name="ksys-sf-auth-reg-company" id="ksys_reg_company">' + 68 '</div>' + 69 '<div style="width: 50%; padding:10px; float:left">' + 70 ' <div><label for="ksys-sf-auth-reg-company-industry">' + ksys_sf_auth.ksys_sf_auth_register_industry + ' *</label></div>' + 71 ' <input type="text" name="ksys-sf-auth-reg-company-industry" id="ksys_reg_companyindustry">' + 72 '</div>', 73 preConfirm: function (verify) { 74 Swal.showLoading(); 75 jQuery('#ksys_reg_lastname').removeAttr('style'); 76 jQuery('#ksys_reg_firstname').removeAttr('style'); 77 jQuery('#ksys_reg_email').removeAttr('style'); 78 jQuery('#ksys_reg_phonenumber').removeAttr('style'); 79 jQuery('#ksys_reg_company').removeAttr('style'); 80 jQuery('#ksys_reg_companyindustry').removeAttr('style'); 81 var lastname = jQuery('#ksys_reg_lastname').val(); 82 var firstname = jQuery('#ksys_reg_firstname').val(); 83 var email = jQuery('#ksys_reg_email').val(); 84 var phonenumber = jQuery('#ksys_reg_phonenumber').val(); 85 var company = jQuery('#ksys_reg_company').val(); 86 var companyindustry = jQuery('#ksys_reg_companyindustry').val(); 87 88 var request = jQuery 89 .ajax({ 90 url: ksys_sf_auth.ajaxurl, 91 method: 'POST', 92 data: { 93 action: 'ksys_sf_auth_submit_registration', 94 _nonce: ksys_sf_auth.security, 95 lastname: lastname, 96 firstname: firstname, 97 email: email, 98 phonenumber: phonenumber, 99 company: company, 100 companyindustry: companyindustry 101 }, 102 dataType: 'json' 103 }) 104 .done(function (msg) { 105 if ( 106 !msg.registration_status && 107 typeof msg.message == 'object' 108 ) { 109 Swal.showValidationMessage( 110 'All fields must be filled in correctly.' 111 ); 112 jQuery.each(msg.message, function (index, value) { 113 console.log('#ksys_reg_' + index); 114 jQuery('#ksys_reg_' + index).css({ 115 border: '1px solid red' 116 }); 117 }); 118 } else if ( 119 msg.registration_status && 120 typeof msg.message == 'string' 121 ) { 122 initRegistrationThankyou(); 123 } 124 }) 125 .fail(function (jqXHR, textStatus) { 126 Swal.hideLoading(); 127 Swal.showValidationMessage('Request failed: ' + textStatus); 128 }); 129 130 return false;
131 } 132 }); 133}; 134 135var initRegistrationThankyou = function () { 136 // ksys_sf_auth_registration_thankyou_modal_content 137 // ksys_sf_auth_register_thankyou_button_text 138 Swal.fire({ 139 allowOutsideClick: true, 140 allowEscapeKey: true, 141 allowEnterKey: false, 142 showCancelButton: false, 143 showConfirmButton: true, 144 confirmButtonText: 145 ksys_sf_auth.ksys_sf_auth_register_thankyou_button_text || 'Close', 146 width: 800, 147 customClass: { 148 content: 'ksys-sf-auth-content-class' 149 }, 150 html: ksys_sf_auth.ksys_sf_auth_registration_thankyou_modal_content 151 }); 152}; 153 154var initVerifyEmail = function (httpRedirect) { 155 Swal.fire({ 156 allowOutsideClick: true, 157 allowEscapeKey: true, 158 allowEnterKey: false, 159 showCancelButton: false, 160 showConfirmButton: true, 161 confirmButtonText: ksys_sf_auth.verify_button_text || 'Verify Email', 162 width: 800, 163 customClass: { 164 content: 'ksys-sf-auth-content-class' 165 }, 166 html: 167 ksys_sf_auth.ksys_sf_auth_verify_modal_content + 168 '<div><label for="ksys-sf-auth-email">' + ksys_sf_auth.ksys_sf_auth_verify_email_label + ' *</label></div>' + 169 '<input type="email" id="ksys-sf-auth-email" class="wpx-input-text" name="ksys-sf-auth-email" required="required">' + 170 '<div><label for="ksys-sf-auth-rememberme">' + ksys_sf_auth.ksys_sf_auth_verify_remember + ' <input type="checkbox" id="ksys-sf-auth-rememberme" class="wpx-input-text" name="ksys-sf-auth-rememberme" required="required"></label></div>', 171 preConfirm: function (verify) {
172 checkRegistration = true; 173 Swal.showLoading(); 174 var request = jQuery 175 .ajax({ 176 url: ksys_sf_auth.ajaxurl, 177 method: 'POST', 178 data: { 179 action: 'ksys_sf_auth_verify_email', 180 _nonce: ksys_sf_auth.security, 181 email: jQuery('#ksys-sf-auth-email').val(), 182 post: jQuery('#ksys-sf-auth-postid').val(), 183 remember: jQuery('#ksys-sf-auth-rememberme').is( 184 ':checked' 185 ) 186 ? 1 187 : 0 188 }, 189 dataType: 'json' 190 }) 191 .done(function (msg) { 192 emailIsValid = false; 193 if (msg.registered) { 194 emailIsValid = true; 195 Swal.hideLoading(); 196 if (httpRedirect == '#') { 197 window.location.reload(); 198 } else { 199 window.location.href = 200 typeof httpRedirect === 'undefined' 201 ? '' 202 : httpRedirect; 203 } 204 isRegistered = true; 205 } else { 206 if (msg.message == 'email') { 207 Swal.showValidationMessage( 208 'Invalid email address.' 209 ); 210 } else { 211 emailIsValid = true; 212 isRegistered = false; 213 Swal.close(); 214 } 215 } 216 }) 217 .fail(function (jqXHR, textStatus) { 218 Swal.hideLoading(); 219 Swal.showValidationMessage('Request failed: ' + textStatus); 220 }); 221 222 return request; 223 }, 224 onClose: function () { 225 if (checkRegistration && !isRegistered && emailIsValid) { 226 initRegistration(); 227 return false; 228 } 229 } 230 }); 231};
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.