PageSourceSearch

https://www.internationalaccountingbulletin.com/wp-content/plugins…/js/supplement-app.js?ver=1.1.0

js internationalaccountingbulletin.com collected 2026-09-24 22:21:01 UTC 14,335 bytes, 443 lines download raw bytes

1function checkStoreFrontsEmail(email) {
2  useFetchedStoreFrontsEmails(email);
3};
4
5function checkfirstname(firstname) {
6  let valid = false;
7  const fn = firstname.value.trim();
8  if (!isRequireds(fn)) {
9    showErrors(firstname, "This field is mandatory");
10    movePlaceholder(firstname);
11  } else if (firstname.value.length < 2) {
12    showErrors(firstname, "First name has to be more than 2 characters");
13    movePlaceholder(firstname);
14  } else {
15    showSuccesss(firstname);
16    movePlaceholder(firstname, true)
17    valid = true;
18  }
19  return valid;
20};
21
22function checklastname(lastname) {
23  let valid = false;
24  const ln = lastname.value.trim();
25  if (!isRequireds(ln)) {
26    showErrors(lastname, "This field is mandatory");
27    movePlaceholder(lastname);
28  } else {
29    showSuccesss(lastname);
30    movePlaceholder(lastname, true);
31    valid = true;
32  }
33  return valid;
34};
35
36function checkcompany(company) {
37  let valid = false;
38  const comp = company.value.trim();
39  if (!isRequireds(comp)) {
40    showErrors(company, "This field is mandatory");
41    movePlaceholder(company);
42  } else {
43    showSuccesss(company);
44    movePlaceholder(company, true);
45    valid = true;
46  }
47  return valid;
48};
49
50function checkjobtitle(jobtitle) {
51  let valid = false;
52  const jt = jobtitle.value.trim();
53  if (!isRequireds(jt)) {
54    showErrors(jobtitle, "This field is mandatory");
55    movePlaceholder(jobtitle);
56  } else {
57    showSuccesss(jobtitle);
58    movePlaceholder(jobtitle, true);
59    valid = true;
60  }
61  return valid;
62};
63
64function checkIndustry(industry) {
65  let valid = false;
66  const ind = industry.value.trim();
67  if (!isRequired(ind)) {
68      showError(industry.parentElement, "This field is mandatory");
69  } else {
70      showSuccess(industry.parentElement);
71      valid = true;
72  }
73  return valid;
74};
75
76function checkcountry(country) {
77  let valid = false;
78  const co = country.value;
79  if (!isRequireds(co)) {
80    showErrors(country, "Please pick a country");
81    movePlaceholder(country);
82  } else if (co == "0") {
83    showErrors(country, "Please pick a country");
84    movePlaceholder(country);
85    valid = false;
86    return valid;
87  } else {
88    showSuccesss(country);
89    movePlaceholder(country, true);
90    valid = true;
91  }
92  return valid;
93};
94
95function checkcountrycode(countrycode) {
96  let valid = false;
97  const code = countrycode.value;
98  if (!isRequireds(code)) {
99    showErrors(countrycode, "Please pick a country code");
100    movePlaceholder(countrycode);
101  } else if (code == "0") {
102    showErrors(countrycode, "Please pick a country code");
103    movePlaceholder(countrycode);
104    valid = false;
105    return valid;
106  } else {
107    showSuccesss(countrycode);
108    movePlaceholder(countrycode, true);
109    valid = true;
110  }
111  return valid;
112};
113
114function checkphone(phone) {
115  let valid = false;
116  const ph = phone.value.trim();
117  if (!isRequireds(ph)) {
118    showErrors(phone, "This field is mandatory");
119    movePlaceholder(phone);
120  } else if (phone.value.length <= 3) {
121    showErrors(phone, "Please enter atleast 50 characters");
122    movePlaceholder(phone);
123  } else {
124    showSuccesss(phone);
125    movePlaceholder(phone, true);
126    valid = true;
127  }
128  return valid;
129};
130
131function checkGdpr(consent) {
132  let valid = false;
133  const con = consent.checked;
134  if (con) {
135    showSuccesss(consent);
136    movePlaceholder(consent, true);
137    valid = true;
138  } else {
139    showErrors(consent, "This field is mandatory");
140    movePlaceholder(consent);
141  }
142  return valid;
143};
144
145function checkmessage(enquiry) {
146  let valid = false;
147  const msg = enquiry.value;
148  if (!isRequireds(msg)) {
149    showErrors(enquiry, "This field is mandatory");
150    movePlaceholder(enquiry);
151  } else if (enquiry.value.length < 10) {
152    showErrors(enquiry, "Please enter more characters");
153    movePlaceholder(enquiry);
154  } else {
155    showSuccesss(enquiry);
156    movePlaceholder(enquiry, true);
157    valid = true;
158  }
159  return valid;
160};
161
162/*const checkGdpr = (consent) => {
163  let valid = false;
164  const vali = consent.checked;
165  if (vali) {
166    showSuccesss(consent);
167    valid = true;
168  } else {
169    showErrors(consent, "Consent required");
170  }
171  return valid;
172};*/
173
174function validate(evt) {
175  var theEvent = evt || window.event;
176  // Handle paste
177  if (theEvent.type === "paste") {
178    key = event.clipboardData.getData("text/plain");
179  } else {
180    // Handle key press
181    var key = theEvent.keyCode || theEvent.which;
182    key = String.fromCharCode(key);
183  }
184  var regex = /[0-9]|\./;
185  if (!regex.test(key)) {
186    theEvent.returnValue = false;
187    if (theEvent.preventDefault) theEvent.preventDefault();
188  }
189}
190
191const isEmailValids = (email) => {
192  const re =
193    /^(([^<>()\[\]\\.,;:\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,}))$/;
194  return re.test(email);
195};
196// this function returns true if the user input is empty
197const isRequireds = (value) => (value === "" ? false : true);
198const showErrors = (input, message) => {
199  // get the form-field element
200  var formField = input.parentElement;
201  const error = formField.querySelector("small");
202  //const label = formField;
203  error.textContent = message;
204};
205
206const showSuccesss = (input) => {
207  // get the form-field element
208  var formField = input.parentElement;
209  const error = formField.querySelector("small");
210  // const label = formField;
211  error.textContent = "";
212  // input.style.border = "1px solid #7F7F7F";
213  // label.style.color = "#7F7F7F";
214};
215
216
217// var storeFrontForm = document.querySelector('#supplements-enquiry');
218// if (storeFrontForm) {
219//   var fields = storeFrontForm.querySelectorAll('.form-field > input[type="text"]');
220//   fields.forEach(element => {
221//     element.addEventListener("input", function () {
222//       if (element.name.replace('_', '').toLowerCase() !== 'jobfunction') {
223//         var functionName = 'check' + element.name.replace('_', '').toLowerCase();
224//         window[functionName](element);
225//       }
226//     });
227//   });
228// }
229
230function formValidationSupplement(form, email = false, phone = false, firstname = false, lastname = false, company = false, industry = false, country = false, jobtitle = false,  consent = false) {
231  useFetchedStoreFrontsEmails(email).then((value) => {
232    if (email) {
233      if (!value) return false;
234    }
235    if (phone) {
236      if (!checkphone(phone)) return false;
237    }
238    if (firstname) {
239      if (!checkfirstname(firstname)) return false;
240    }
241    if (lastname) {
242      if (!checklastname(lastname)) return false;
243    }
244    if (company) {
245      if (!checkcompany(company)) return false;
246    }
247    if (industry) {
248      if (!checkIndustry(industry)) return false;
249    }
250    if (country) {
251      if (!checkcountry(country)) return false;
252    }
253    if (jobtitle) {
254      if (!checkjobtitle(jobtitle)) return false;
255    }
256    if (consent) {
257      if (!checkGdpr(consent)) return false;
258    }
259    var enquiry = false;
260    var form_Id = form.id;
261    var recaptcha = ((document.getElementById("recaptch_secret_key") || {}).value) || "";
262    var NS_Company = jQuery('input[name="NS_Company"]').val();
263	  var NS_Site_Name = jQuery('input[name="NS_Site_Name"]').val();
264    var NS_Form = jQuery('input[name="VMS_Form"]').val();
265    if (recaptcha != '') {
266      jQuery.ajax({
267        url: "/wp-content/plugins/vms-automation-gd/captcha.php",
268        data: jQuery("form#" + form_Id).serialize(),
269        type: "POST",
270        complete: function (response) {
271          //console.log("form submitted to curl ", data);
272          let data_captcha = JSON.parse(response.responseText);
273          if (data_captcha.status == 'success') {
274            jQuery.ajax({
275              url: "/wp-content/plugins/supplements-gd/supplement-ajaxcall.php",
276              data: jQuery("form#supplements-enquiry").serialize(),
277              type: "POST",
278              success: function (data) {
279                const isFormSubmit = JSON.parse(data);
280                if(isFormSubmit.redirectUri != ""){
281                  document.getElementById("supplement-form-container").style.display = "none";
282                  document.getElementById("thank-you-message").style.display = "block";
283                }else{
284                  console.log("form is not submitted successfully");
285                }
286              },
287              error: function (ex) {
288                console.log("form not submitted to curl");
289              },
290            });
291            if (enquiry) {
292              if (jQuery('#successs-modal').length > 0) {
293                jQuery("#newsletterForm").trigger("reset");
294                const successMoadal = document.querySelector('#successs-modal');
295                document.querySelector('#modal-two').classList.remove('open');
296                successMoadal.classList.add('open');
297                document.querySelector('#successs-modal .close-modal').addEventListener('click', () => {
298                  successMoadal.classList.remove('open');
299                });
300              }
301              else {
302                form.style.display = "none";
303                document.getElementById("enquiry").classList.add("enquirySuccess");
304                document.getElementById("enq-success").style.display = "block";
305              }
306            }
307            else {
308              if (jQuery('#successs-modal').length > 0) {
309                jQuery('.leaderrormsg').html("Your request has not been submitted! please try again.");
310              }
311              else {
312                form.style.display = "none";
313                if(NS_Form == "License"){
314                  window.location.replace(window.location.hostname+"/thank-you-license");
315                }else if(NS_Form == "Advertise"){
316                  window.location.replace(window.location.hostname+"/thank-you-advertise");
317                }else{
318                  //document.getElementById('enquiry3').classList.remove("hidden");
319                }
320              }
321
322            }
323          }
324          else {
325            document.getElementById("captcha").innerHTML = "Invalid Captcha";
326          }
327        },
328        error: function (ex) {
329          console.log("form not submitted to curl");
330        },
331      });
332    }
333    else {
334      jQuery.ajax({
335        url: "/wp-content/plugins/supplements-gd/supplement-ajaxcall.php",
336        data: jQuery("form#supplements-enquiry").serialize(),
337        type: "POST",
338        success: function (data) {
339			 //tracking 
340			if((window.location.hostname == "www.pharmaceutical-technology.com") || (window.location.hostname == "www.power-technology.com") || (window.location.hostname == "www.offshore-technology.com")){
341				window._uxa = window._uxa || [];
342				if (typeof CS_CONF === 'undefined') {
343				window._uxa.push(['setPath', window.location.pathname + window.location.hash.replace('#', '?__')]);
344				var mt = document.createElement('script'); mt.type = 'text/javascript'; mt.async = true;
345				mt.src = '//t.contentsquare.net/uxa/70aab1561db23.js';
346				document.getElementsByTagName('head')[0].appendChild(mt);
347				}
348				else {
349				window._uxa.push(["setPath", "enquiry_submit_"  + NS_Company+' '+ NS_Site_Name]);    
350				window._uxa.push(["trackPageview"]);
351				window._uxa.push(['trackPageEvent', 'enquiry' + NS_Company+' '+ NS_Site_Name]);
352				}
353			 }
354          console.log("form submitted to curl ", data);
355        },
356        error: function (ex) {
357			 //tracking
358			if((window.location.hostname == "www.pharmaceutical-technology.com") || (window.location.hostname == "www.power-technology.com") || (window.location.hostname == "www.offshore-technology.com")){
359				window._uxa = window._uxa || [];
360				if (typeof CS_CONF === 'undefined') {
361				window._uxa.push(['setPath', window.location.pathname + window.location.hash.replace('#', '?__')]);
362				var mt = document.createElement('script'); mt.type = 'text/javascript'; mt.async = true;
363				mt.src = '//t.contentsquare.net/uxa/70aab1561db23.js';
364				document.getElementsByTagName('head')[0].appendChild(mt);
365				}
366				else {
367				window._uxa.push(["setPath", "enquiry_submit_"  + NS_Company+' '+ NS_Site_Name]);    
368				window._uxa.push(["trackPageview"]);
369				window._uxa.push(['trackPageEvent', 'enquiry' + NS_Company+' '+ NS_Site_Name]);
370				}
371			
372			}
373          console.log("form not submitted to curl");
374        },
375      });
376      
377    }
378  });
379}
380
381
382//toggle custom arrow for country select tag
383document.addEventListener("click", function (evt) {
384  let selectField = document.querySelector(".enquiry__input--select.select--country");
385  targetElement = evt.target;
386  if (selectField) {
387    if (targetElement == selectField) {
388      selectField.classList.toggle('active');
389    } else {
390      selectField.classList.remove('active');
391    }
392  }
393});
394
395//Project single collapse
396function prjFunction() {
397  var prjbtn = document.getElementById("prjBtn");
398  prjbtn.classList.toggle("prjtoggle--active");
399  var prjtxt = document.getElementById("prjDIV");
400  prjtxt.classList.toggle("prj-show");
401}
402//Project single collapse end
403
404async function fetchingStoreFrontsEmails() {
405  const res = await fetch(urlToFetchStoreFrontsEmailss);
406  const data = res.text();
407  return data;
408}
409
410async function useFetchedStoreFrontsEmails(email) {
411  let data = await fetchingStoreFrontsEmails();
412  data = data.replace(/\n/g, '');
413
414  const excludedEmailsArr = data.split(",");
415  excludedEmailsArr.shift();
416
417  for (let i = 0; i < excludedEmailsArr.length; ++i) {
418    excludedEmailsArr[i] = excludedEmailsArr[i].replace(/(\r\n|\n|\r)/gm, "");
419  }
420
421  let valid = false;
422  const ea = email.value.trim();
423  let emailDomain = ea.split("@");
424
425  if (excludedEmailsArr.includes(emailDomain[1])) {
426    showErrors(email, "Please enter a work/business email address");
427    movePlaceholder(email)
428  } else if (!isRequireds(ea)) {
429    showErrors(email, "This field is mandatory");
430    movePlaceholder(email)
431  } else if (!isEmailValids(ea)) {
432    showErrors(email, "Email is not valid");
433    movePlaceholder(email);
434  } else {
435    showSuccesss(email);
436    movePlaceholder(email, true)
437    valid = true;
438  }
439  return valid;
440}
441
442const urlToFetchStoreFrontsEmailss = "/wp-content/plugins/storefronts-gd/free-disposable-email-providers.csv";
443var reg = /^([\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.