https://www.hotelmanagement-network.com/wp-content/plugins/storefronts-gd/assets/js/app.js?ver=5.8.9
1document.addEventListener("DOMContentLoaded", function (event) { 2 const tabsPrev = document.querySelector(".c-tabs-nav__previous"); 3 const tabsNext = document.querySelector(".c-tabs-nav__next"); 4 const tabs = document.querySelectorAll(".c-tabs-nav__link"); 5 const permutiveFields = document.querySelectorAll( 6 "[name='Permutive_ID'], [name='permutive_user_id']", 7 ); 8 if (0 !== permutiveFields) { 9 for (let permField of permutiveFields) { 10 permField.value = localStorage.getItem("permutive-id"); 11 } 12 } 13 tabs.forEach((tab) => { 14 tab.addEventListener("click", function (e) { 15 e.preventDefault(); 16 const pos = this.dataset.position; 17 const panel = document.getElementById(`tab-panel-${pos}`); 18 document 19 .querySelectorAll(".c-tabs-nav__link.tab-is-active") 20 .forEach((el) => el.classList.remove("tab-is-active")); 21 this.classList.add("tab-is-active"); 22 document 23 .querySelector(".c-tabs-content__panel.tab-is-active") 24 .classList.remove("is-visible"); 25 setTimeout(function () { 26 document 27 .querySelector(".c-tabs-content__panel.tab-is-active") 28 .classList.remove("tab-is-active"); 29 panel.classList.add("tab-is-active"); 30 }, 300); 31 setTimeout(function () { 32 panel.classList.add("is-visible"); 33 }, 400); 34 if ( 35 document.querySelector( 36 `.c-tabs-nav__link[data-position="${Number(pos) - 1}"]`, 37 ) 38 ) { 39 tabsPrev.dataset.position = Number(pos) - 1; 40 tabsPrev.innerText = document.querySelector( 41 `.c-tabs-nav__link[data-position="${Number(pos) - 1}"]`, 42 ).innerText; 43 } else { 44 tabsPrev.dataset.position = "is-hidden"; 45 } 46 if ( 47 document.querySelector( 48 `.c-tabs-nav__link[data-position="${Number(pos) + 1}"]`, 49 ) 50 ) { 51 tabsNext.dataset.position = Number(pos) + 1; 52 tabsNext.innerText = document.querySelector( 53 `.c-tabs-nav__link[data-position="${Number(pos) + 1}"]`, 54 ).innerText; 55 } else { 56 tabsNext.dataset.position = "is-hidden"; 57 } 58 }); 59 }); 60 if (tabsPrev) { 61 tabsPrev.addEventListener("click", function (e) { 62 e.preventDefault(); 63 const pos = this.dataset.position; 64 const panel = document.getElementById(`tab-panel-${pos}`); 65 document 66 .querySelectorAll(".c-tabs-nav__link.tab-is-active") 67 .forEach((el) => el.classList.remove("tab-is-active")); 68 document 69 .querySelector(`.c-tabs-nav__link[data-position="${pos}"]`) 70 .classList.add("tab-is-active"); 71 document 72 .querySelector(".c-tabs-content__panel.tab-is-active") 73 .classList.remove("is-visible"); 74 setTimeout(function () { 75 document 76 .querySelector(".c-tabs-content__panel.tab-is-active") 77 .classList.remove("tab-is-active"); 78 panel.classList.add("tab-is-active"); 79 }, 300); 80 setTimeout(function () { 81 panel.classList.add("is-visible"); 82 }, 400); 83 tabsNext.dataset.position = Number(pos) + 1; 84 tabsNext.innerText = document.querySelector( 85 `.c-tabs-nav__link[data-position="${Number(pos) + 1}"]`, 86 ).innerText; 87 if ( 88 document.querySelector( 89 `.c-tabs-nav__link[data-position="${Number(pos) - 1}"]`, 90 ) 91 ) { 92 this.dataset.position = Number(pos) - 1; 93 this.innerText = document.querySelector( 94 `.c-tabs-nav__link[data-position="${Number(pos) - 1}"]`, 95 ).innerText; 96 } else { 97 this.dataset.position = "is-hidden"; 98 } 99 }); 100 } 101 102 if (tabsNext) { 103 tabsNext.addEventListener("click", function (e) { 104 e.preventDefault(); 105 const pos = Number(this.dataset.position); 106 const panel = document.getElementById(`tab-panel-${pos}`); 107 document 108 .querySelectorAll(".c-tabs-nav__link.tab-is-active") 109 .forEach((el) => el.classList.remove("tab-is-active")); 110 document 111 .querySelector(`.c-tabs-nav__link[data-position="${pos}"]`) 112 .classList.add("tab-is-active"); 113 document 114 .querySelector(".c-tabs-content__panel.tab-is-active") 115 .classList.remove("is-visible"); 116 setTimeout(function () { 117 document 118 .querySelector(".c-tabs-content__panel.tab-is-active") 119 .classList.remove("tab-is-active"); 120 panel.classList.add("tab-is-active"); 121 }, 300); 122 setTimeout(function () { 123 panel.classList.add("is-visible"); 124 }, 400); 125 if ( 126 document.querySelector( 127 `.c-tabs-nav__link[data-position="${Number(pos) + 1}"]`, 128 ) 129 ) { 130 tabsNext.dataset.position = Number(pos) + 1; 131 tabsNext.innerText = document.querySelector( 132 `.c-tabs-nav__link[data-position="${Number(pos) + 1}"]`, 133 ).innerText; 134 } else { 135 tabsNext.dataset.position = "is-hidden"; 136 } 137 tabsPrev.dataset.position = Number(pos) - 1; 138 tabsPrev.innerText = document.querySelector( 139 `.c-tabs-nav__link[data-position="${Number(pos) - 1}"]`, 140 ).innerText; 141 }); 142 } 143}); 144 145async function checkStoreFrontsEmail(email) { 146 return await useFetchedStoreFrontsEmails(email); 147} 148 149function checkfirstname(firstname) { 150 let valid = false;
151 const fn = firstname.value.trim(); 152 if (!isRequired(fn)) { 153 showError(firstname, "This field is mandatory"); 154 movePlaceholder(firstname); 155 } else if (firstname.value.length < 2) { 156 showError(firstname, "First name has to be more than 2 characters"); 157 movePlaceholder(firstname); 158 } else { 159 showSuccess(firstname); 160 movePlaceholder(firstname, true); 161 valid = true; 162 } 163 return valid; 164} 165 166function checklastname(lastname) { 167 let valid = false; 168 const ln = lastname.value.trim(); 169 if (!isRequired(ln)) { 170 showError(lastname, "This field is mandatory"); 171 movePlaceholder(lastname); 172 } else { 173 showSuccess(lastname); 174 movePlaceholder(lastname, true); 175 valid = true; 176 } 177 return valid; 178} 179 180function checkcompany(company) { 181 let valid = false; 182 const comp = company.value.trim(); 183 if (!isRequired(comp)) { 184 showError(company, "This field is mandatory"); 185 movePlaceholder(company); 186 } else { 187 showSuccess(company); 188 movePlaceholder(company, true); 189 valid = true; 190 } 191 return valid; 192} 193 194function checkjobtitle(jobtitle) { 195 let valid = false; 196 const jt = jobtitle.value.trim(); 197 if (!isRequired(jt)) { 198 showError(jobtitle, "This field is mandatory"); 199 movePlaceholder(jobtitle); 200 } else { 201 showSuccess(jobtitle); 202 movePlaceholder(jobtitle, true); 203 valid = true; 204 } 205 return valid; 206} 207 208function checkcountry(country) { 209 let valid = false; 210 const co = country.value; 211 if (!isRequired(co)) { 212 showError(country, "Please pick a country"); 213 movePlaceholder(country); 214 } else if (co == "0") { 215 showError(country, "Please pick a country"); 216 movePlaceholder(country); 217 valid = false; 218 return valid; 219 } else { 220 showSuccess(country); 221 movePlaceholder(country, true); 222 valid = true; 223 } 224 return valid; 225} 226 227function checkcountrycode(countrycode) { 228 let valid = false; 229 const code = countrycode.value; 230 if (!isRequired(code)) { 231 showError(countrycode, "Please pick a country code"); 232 movePlaceholder(countrycode); 233 } else if (code == "0") { 234 showError(countrycode, "Please pick a country code"); 235 movePlaceholder(countrycode); 236 valid = false; 237 return valid; 238 } else { 239 showSuccess(countrycode); 240 movePlaceholder(countrycode, true); 241 valid = true; 242 } 243 return valid; 244} 245 246function checkphone(phone) { 247 let valid = false; 248 const ph = phone.value.trim(); 249 if (!isRequired(ph)) { 250 showError(phone, "This field is mandatory"); 251 movePlaceholder(phone); 252 } else if (phone.value.length <= 3) { 253 showError(phone, "Please enter atleast 50 characters"); 254 movePlaceholder(phone); 255 } else { 256 showSuccess(phone); 257 movePlaceholder(phone, true); 258 valid = true; 259 } 260 return valid; 261} 262 263function checkGdpr(consent) { 264 let valid = false; 265 const con = consent.checked; 266 if (con) { 267 showSuccess(consent); 268 movePlaceholder(consent, true); 269 valid = true; 270 } else { 271 showError(consent, "This field is mandatory"); 272 movePlaceholder(consent); 273 } 274 return valid; 275} 276 277function checkmessage(enquiry) { 278 let valid = false; 279 const msg = enquiry.value; 280 if (!isRequired(msg)) { 281 showError(enquiry, "This field is mandatory"); 282 movePlaceholder(enquiry); 283 } else if (enquiry.value.length < 10) { 284 showError(enquiry, "Please enter more characters"); 285 movePlaceholder(enquiry); 286 } else { 287 showSuccess(enquiry); 288 movePlaceholder(enquiry, true); 289 valid = true; 290 } 291 return valid; 292} 293 294/*const checkGdpr = (consent) => { 295 let valid = false; 296 const vali = consent.checked; 297 if (vali) { 298 showSuccess(consent); 299 valid = true; 300 } else { 301 showError(consent, "Consent required"); 302 } 303 return valid; 304};*/ 305 306function validate(evt) { 307 var theEvent = evt || window.event; 308 // Handle paste 309 if (theEvent.type === "paste") { 310 key = event.clipboardData.getData("text/plain"); 311 } else { 312 // Handle key press 313 var key = theEvent.keyCode || theEvent.which; 314 key = String.fromCharCode(key); 315 } 316 var regex = /[0-9]|\./; 317 if (!regex.test(key)) { 318 theEvent.returnValue = false; 319 if (theEvent.preventDefault) theEvent.preventDefault(); 320 } 321} 322 323const isEmailValid = (email) => { 324 const re = 325 /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 326 return re.test(email); 327}; 328// this function returns true if the user input is empty 329const isRequired = (value) => (value === "" ? false : true); 330const showError = (input, message) => { 331 // get the form-field element 332 333 var formField = input.parentElement; 334 335 const error = formField.querySelector("small"); 336 //const label = formField; 337 error.textContent = message; 338 // input.style.border = "1px solid #EB0000"; 339 // label.style.color = "#EB0000"; 340 // label.style.fontSize = "14px"; 341}; 342 343const showSuccess = (input) => { 344 // get the form-field element 345 346 var formField = input.parentElement; 347 const error = formField.querySelector("small"); 348 // const label = formField; 349 error.textContent = ""; 350 // input.style.border = "1px solid #7F7F7F"; 351 // label.style.color = "#7F7F7F"; 352}; 353 354var storeFrontForm = document.querySelector("#newsletterForm"); 355if (storeFrontForm) { 356 var fields = storeFrontForm.querySelectorAll( 357 '.form-field > input[type="text"]', 358 ); 359 fields.forEach((element) => { 360 element.addEventListener("input", function () { 361 if (element.name.replace("_", "").toLowerCase() !== "jobfunction") { 362 var functionName = 363 "check" + element.name.replace("_", "").toLowerCase(); 364 window[functionName](element); 365 } 366 }); 367 }); 368 369 var emailField = storeFrontForm.querySelector('input[name="Email"]'); 370 if (emailField) { 371 var emailDebounceTimer; 372 emailField.addEventListener("input", function () { 373 clearTimeout(emailDebounceTimer); 374 emailDebounceTimer = setTimeout(function () { 375 checkStoreFrontsEmail(emailField); 376 }, 500); 377 }); 378 } 379} 380 381function formValidation( 382 form, 383 email = false, 384 firstname = false, 385 lastname = false, 386 company = false, 387 jobtitle = false, 388 country = false, 389 countrycode = false, 390 phone = false, 391 consent = false, 392 enquiry = false, 393) { 394 useFetchedStoreFrontsEmails(email).then((value) => { 395 var isValid = 396 (!email || value) && 397 (!firstname || checkfirstname(firstname)) && 398 (!lastname || checklastname(lastname)) && 399 (!company || checkcompany(company)) && 400 (!jobtitle || checkjobtitle(jobtitle)) && 401 (!country || checkcountry(country)) && 402 (!countrycode || checkcountrycode(countrycode)) && 403 (!phone || checkphone(phone)) && 404 (!consent || checkGdpr(consent)) && 405 (!enquiry || checkmessage(enquiry)); 406 407 if (!isValid) return; 408 409 var form_Id = form.id; 410 var recaptcha = 411 (document.getElementById("recaptch_secret_key") || {}).value || ""; 412 var NS_Company = jQuery('input[name="NS_Company"]').val(); 413 var NS_Site_Name = jQuery('input[name="NS_Site_Name"]').val(); 414 var NS_Form = jQuery('input[name="VMS_Form"]').val(); 415 if (recaptcha != "") { 416 jQuery.ajax({ 417 url: "/wp-content/plugins/vms-automation-gd/captcha.php", 418 data: jQuery("form#" + form_Id).serialize(), 419 type: "POST", 420 complete: function (response) { 421 //console.log("form submitted to curl ", data); 422 let data_captcha = JSON.parse(response.responseText); 423 if (data_captcha.status == "success") { 424 jQuery.ajax({ 425 url: "/wp-content/plugins/storefronts-gd/storefront-ajaxcall.php", 426 data: jQuery("form#newsletterForm").serialize(), 427 type: "POST", 428 success: function (data) { 429 //tracking 430 431 if ( 432 window.location.hostname == 433 "www.pharmaceutical-technology.com" || 434 window.location.hostname == "www.power-technology.com" || 435 window.location.hostname == "www.offshore-technology.com" 436 ) { 437 window._uxa = window._uxa || []; 438 if (typeof CS_CONF === "undefined") { 439 window._uxa.push([ 440 "setPath", 441 window.location.pathname + 442 window.location.hash.replace("#", "?__"), 443 ]); 444 var mt = document.createElement("script"); 445 mt.type = "text/javascript"; 446 mt.async = true; 447 mt.src = "//t.contentsquare.net/uxa/70aab1561db23.js"; 448 document.getElementsByTagName("head")[0].appendChild(mt); 449 } else { 450 window._uxa.push([ 451 "setPath", 452 window.location.pathname + 453 "?enquiry_submit_" + 454 NS_Company + 455 " " + 456 NS_Site_Name, 457 ]); 458 window._uxa.push(["trackPageview"]); 459 window._uxa.push([ 460 "trackPageEvent", 461 "Enquiry " + NS_Company + " " + NS_Site_Name, 462 ]); 463 } 464 } 465 console.log("form submitted to curl ", data); 466 }, 467 error: function (ex) { 468 //tracking 469 if ( 470 window.location.hostname == 471 "www.pharmaceutical-technology.com" || 472 window.location.hostname == "www.power-technology.com" || 473 window.location.hostname == "www.offshore-technology.com" 474 ) { 475 window._uxa = window._uxa || []; 476 if (typeof CS_CONF === "undefined") { 477 window._uxa.push([ 478 "setPath", 479 window.location.pathname + 480 window.location.hash.replace("#", "?__"), 481 ]); 482 var mt = document.createElement("script"); 483 mt.type = "text/javascript"; 484 mt.async = true; 485 mt.src = "//t.contentsquare.net/uxa/70aab1561db23.js"; 486 document.getElementsByTagName("head")[0].appendChild(mt); 487 } else { 488 window._uxa.push([ 489 "setPath",
490 "enquiry_submit_" + NS_Company + " " + NS_Site_Name, 491 ]); 492 window._uxa.push(["trackPageview"]); 493 window._uxa.push([ 494 "trackPageEvent", 495 "enquiry" + NS_Company + " " + NS_Site_Name, 496 ]); 497 } 498 } 499 console.log("form not submitted to curl"); 500 }, 501 }); 502 if (enquiry) { 503 if (jQuery("#successs-modal").length > 0) { 504 jQuery("#newsletterForm").trigger("reset"); 505 const modal = document.querySelector(".modal"); 506 const bodyMain = document.querySelector("body"); 507 if (modal) { 508 modal.style.display = "none"; 509 bodyMain.classList.remove("modal-open"); 510 bodyMain.style.overflow = ""; 511 } 512 const successMoadal = document.querySelector("#successs-modal"); 513 document.querySelector("#modal-two").classList.remove("open"); 514 successMoadal.classList.add("open"); 515 document 516 .querySelector("#successs-modal .close-modal") 517 .addEventListener("click", () => { 518 successMoadal.classList.remove("open"); 519 }); 520 } else { 521 form.style.display = "none"; 522 document 523 .getElementById("enquiry") 524 .classList.add("enquirySuccess"); 525 document.getElementById("enq-success").style.display = "block"; 526 } 527 } else { 528 if (jQuery("#successs-modal").length > 0) { 529 jQuery(".leaderrormsg").html( 530 "Your request has not been submitted! please try again.", 531 ); 532 } else { 533 form.style.display = "none"; 534 if (NS_Form == "License") { 535 window.location.replace( 536 window.location.hostname + "/thank-you-license", 537 ); 538 } else if (NS_Form == "Advertise") { 539 window.location.replace( 540 window.location.hostname + "/thank-you-advertise", 541 ); 542 } else { 543 document 544 .getElementById("enquiry3") 545 .classList.remove("hidden"); 546 } 547 } 548 } 549 } else { 550 document.getElementById("captcha").innerHTML = "Invalid Captcha"; 551 } 552 }, 553 error: function (ex) { 554 console.log("form not submitted to curl"); 555 }, 556 }); 557 } else { 558 jQuery.ajax({ 559 url: "/wp-content/plugins/storefronts-gd/storefront-ajaxcall.php", 560 data: jQuery("form#newsletterForm").serialize(), 561 type: "POST", 562 success: function (data) { 563 //tracking 564 if ( 565 window.location.hostname == "www.pharmaceutical-technology.com" || 566 window.location.hostname == "www.power-technology.com" || 567 window.location.hostname == "www.offshore-technology.com" 568 ) { 569 window._uxa = window._uxa || []; 570 if (typeof CS_CONF === "undefined") { 571 window._uxa.push([ 572 "setPath", 573 window.location.pathname + 574 window.location.hash.replace("#", "?__"), 575 ]); 576 var mt = document.createElement("script"); 577 mt.type = "text/javascript"; 578 mt.async = true; 579 mt.src = "//t.contentsquare.net/uxa/70aab1561db23.js"; 580 document.getElementsByTagName("head")[0].appendChild(mt); 581 } else { 582 window._uxa.push([ 583 "setPath", 584 "enquiry_submit_" + NS_Company + " " + NS_Site_Name, 585 ]); 586 window._uxa.push(["trackPageview"]); 587 window._uxa.push([ 588 "trackPageEvent", 589 "enquiry" + NS_Company + " " + NS_Site_Name, 590 ]); 591 } 592 } 593 console.log("form submitted to curl ", data); 594 }, 595 error: function (ex) { 596 //tracking 597 if ( 598 window.location.hostname == "www.pharmaceutical-technology.com" || 599 window.location.hostname == "www.power-technology.com" || 600 window.location.hostname == "www.offshore-technology.com" 601 ) { 602 window._uxa = window._uxa || []; 603 if (typeof CS_CONF === "undefined") { 604 window._uxa.push([ 605 "setPath", 606 window.location.pathname + 607 window.location.hash.replace("#", "?__"), 608 ]); 609 var mt = document.createElement("script"); 610 mt.type = "text/javascript"; 611 mt.async = true; 612 mt.src = "//t.contentsquare.net/uxa/70aab1561db23.js"; 613 document.getElementsByTagName("head")[0].appendChild(mt); 614 } else { 615 window._uxa.push([ 616 "setPath",
617 "enquiry_submit_" + NS_Company + " " + NS_Site_Name, 618 ]); 619 window._uxa.push(["trackPageview"]); 620 window._uxa.push([ 621 "trackPageEvent", 622 "enquiry" + NS_Company + " " + NS_Site_Name, 623 ]); 624 } 625 } 626 console.log("form not submitted to curl"); 627 }, 628 }); 629 if (enquiry) { 630 if (jQuery("#successs-modal").length > 0) { 631 jQuery("#newsletterForm").trigger("reset"); 632 const modal = document.querySelector(".modal"); 633 const bodyMain = document.querySelector("body"); 634 if (modal) { 635 modal.style.display = "none"; 636 bodyMain.classList.remove("modal-open"); 637 bodyMain.style.overflow = ""; 638 } 639 const successMoadal = document.querySelector("#successs-modal"); 640 document.querySelector("#modal-two").classList.remove("open"); 641 successMoadal.classList.add("open"); 642 document 643 .querySelector("#successs-modal .close-modal") 644 .addEventListener("click", () => { 645 successMoadal.classList.remove("open"); 646 }); 647 } else { 648 form.style.display = "none"; 649 document.getElementById("enquiry").classList.add("enquirySuccess"); 650 document.getElementById("enq-success").style.display = "block"; 651 } 652 // jQuery("#enquiry").html('<div id="successs-modal" style="display:block;"><div class="successs-modal-body"><img src="https://pr-gdm-57-b2b-gdm-figaro1.pantheonsite.io/mining-technology/wp-content/themes/goodlife-wp-B2B/assets/images/icons/success.png" alt="" data-src="https://pr-gdm-57-b2b-gdm-figaro1.pantheonsite.io/mining-technology/wp-content/themes/goodlife-wp-B2B/assets/images/icons/success.png" class="lazy-loaded"> <h2>Subscribed</h2> <p>You have successfully subscribed and will receive the next available issues</p><button class="modal-close-arrow button primary solid">Close</button></div></div>'); 653 } else { 654 if (jQuery("#successs-modal").length > 0) { 655 jQuery(".leaderrormsg").html( 656 "Your request has not been submitted! please try again.", 657 ); 658 } else { 659 form.style.display = "none"; 660 document.getElementById("enquiry3").classList.remove("hidden"); 661 } 662 } 663 } 664 }); 665} 666 667// function to add new span with the value of placeholder 668// @param: field - the field that you want to make red and move the placeholder 669// remove - if true it will remove the placeholder and the red border 670function movePlaceholder(field, remove = false) { 671 /*if (field.parentNode.getElementsByClassName('wrong').length <= 0) { 672 var newSpan = document.createElement("span"); 673 newSpan.classList.add('wrong'); 674 newSpan.innerHTML = field.placeholder + ' *'; 675 if(field.placeholder === undefined){ 676 //newSpan.innerHTML = "Country *"; 677 } 678 field.classList.add('wrong-field'); 679 var small = field.parentElement.querySelector('small') 680 field.parentNode.insertBefore(newSpan, small); 681 } 682 if (field.parentNode.querySelectorAll(".wrong").length > 0 && remove) { 683 field.parentNode.querySelectorAll(".wrong")[0].style.color = "#252524"; 684 field.classList.remove('wrong-field'); 685 }*/ 686} 687 688//toggle whitepaper form show 689const btnShow = document.querySelector(".whitepaper__show"); 690const enquiry_show = document.querySelector(".enquiry-form-show"); 691//const emailAdress = document.querySelector("#enq-email"); 692 693if (btnShow) { 694 btnShow.addEventListener("click", function () { 695 useFetchedStoreFrontsEmails(this.form.Email).then((value) => { 696 if (value) { 697 enquiry_show.classList.remove("hidden"); 698 btnShow.classList.add("hidden"); 699 //emailAdress.classList.add('full-width'); 700 } 701 }); 702 }); 703} 704 705//toggle custom arrow for country select tag 706document.addEventListener("click", function (evt) { 707 let selectField = document.querySelector( 708 ".enquiry__input--select.select--country", 709 ); 710 targetElement = evt.target; 711 if (selectField) { 712 if (targetElement == selectField) { 713 selectField.classList.toggle("active"); 714 } else { 715 selectField.classList.remove("active"); 716 } 717 } 718}); 719 720//Project single collapse 721function prjFunction() { 722 var prjbtn = document.getElementById("prjBtn"); 723 prjbtn.classList.toggle("prjtoggle--active"); 724 var prjtxt = document.getElementById("prjDIV"); 725 prjtxt.classList.toggle("prj-show"); 726} 727//Project single collapse end 728 729async function fetchingStoreFrontsEmails() { 730 const res = await fetch(urlToFetchStoreFrontsEmails); 731 const data = await res.text(); 732 return data; 733} 734 735async function useFetchedStoreFrontsEmails(email) { 736 let data = await fetchingStoreFrontsEmails(); 737 738 const excludedEmailsArr = data 739 .split(/\r?\n/) 740 .map((d) => d.trim()) 741 .filter((d) => d.length > 0); 742 743 let valid = false;
744 const ea = email.value.trim(); 745 let emailDomain = ea.split("@"); 746 747 if (excludedEmailsArr.includes(emailDomain[1])) { 748 showError(email, "Please enter a work/business email address"); 749 movePlaceholder(email); 750 } else if (!isRequired(ea)) { 751 showError(email, "This field is mandatory"); 752 movePlaceholder(email); 753 } else if (!isEmailValid(ea)) { 754 showError(email, "Email is not valid"); 755 movePlaceholder(email); 756 } else { 757 showSuccess(email); 758 movePlaceholder(email, true); 759 valid = true; 760 } 761 return valid; 762} 763 764const urlToFetchStoreFrontsEmails = 765 "/wp-content/plugins/storefronts-gd/free-disposable-email-providers.csv"; 766var reg = 767 /^([\w-\.]+@(?!gmail.com)(?!yahoo.com)(?!hotmail.com)(?!yahoo.co.in)(?!aol.com)(?!abc.com)(?!xyz.com)(?!pqr.com)(?!rediffmail.com)(?!live.com)(?!outlook.com)(?!me.com)(?!msn.com)(?!ymail.com)([\w-]+\.)+[\w-]{2,4})?$/;
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.