PageSourceSearch

https://glassit.co/js/login.js?t=072720263

js glassit.co collected 2026-10-02 06:09:35 UTC 29,275 bytes, 893 lines download raw bytes

1var isLogin = false;
2var isRegisration = false;
3var lrformDatastring;
4var contactformDatastring;
5var landingformDatastring;
6let request_type = "";
7
8var onloadLoginRecaptchaCallback = function() {
9  grecaptcha.render('recaptchaElm', {
10    'sitekey' : '6LdvGtQZAAAAAP6R5IERPp5bZpDEh5CjY4UuDlGH',
11    'data-size': 'compact',
12    'callback': 'successfulLoginCaptchaUserResponse'
13  });
14};
15
16var onloadContactUsRecaptchaCallback = function() {
17  grecaptcha.render('recaptchaElm2', {
18    'sitekey' : '6LdvGtQZAAAAAP6R5IERPp5bZpDEh5CjY4UuDlGH',
19    'data-size': 'compact',
20    'callback': 'successfulContactUsCaptchaUserResponse'
21  });
22};
23
24var onloadLandingFormRecaptchaCallback = function() {
25  grecaptcha.render('recaptchaElm3', {
26    'sitekey' : '6LdvGtQZAAAAAP6R5IERPp5bZpDEh5CjY4UuDlGH',
27    'data-size': 'compact',
28    'callback': 'successfulLandingFormCaptchaUserResponse'
29  });
30};
31
32var onloadAlertFormRecaptchaCallback = function() {
33  grecaptcha.render('recaptchaElm4', {
34    'sitekey' : '6LdvGtQZAAAAAP6R5IERPp5bZpDEh5CjY4UuDlGH',
35    'data-size': 'compact',
36    'callback': 'successfulAlertFormCaptchaUserResponse'
37  });
38};
39
40function successfulLoginCaptchaUserResponse(g_recaptcha_response) {
41  doSubmitRegisterLoginForm(g_recaptcha_response);
42}
43
44function successfulContactUsCaptchaUserResponse(g_recaptcha_response) {
45  doSubmitContactUsForm(g_recaptcha_response);
46}
47
48function successfulLandingFormCaptchaUserResponse(g_recaptcha_response) {
49  doSubmitLandingForm(g_recaptcha_response);
50}
51
52function successfulAlertFormCaptchaUserResponse(g_recaptcha_response) {
53  doSubmitAlertPriceForm(g_recaptcha_response)
54}
55
56function getCookie(cname) {
57  let name = cname + "=";
58  let decodedCookie = decodeURIComponent(document.cookie);
59  let ca = decodedCookie.split(';');
60  for(var i = 0; i <ca.length; i++) {
61    let c = ca[i];
62    while (c.charAt(0) == ' ') {
63      c = c.substring(1);
64    }
65    if (c.indexOf(name) == 0) {
66      return c.substring(name.length, c.length);
67    }
68  }
69  return "";
70}
71
72function email_invalid(s){
73	let at = 0;
74	at = s.indexOf("@") ;
75	if(at!= -1 && at!= 1){
76		let as = 0;
77		as = (parseInt(s.length) - at);
78		if(as<=64){	//Max domain name length
79			//Valid characters for a domain name are letters, numbers and a hyphen (-).
80			//Other special characters like the underscore (_) or an exclamation mark (!) are NOT permitted.
81			let re = /^[a-zA-Z0-9\._\-]+@[a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,4}$/;
82			if(re.test(s)){
83				return false;	//The email pattern was found
84			}else{
85				return true;
86			}
87		}else{
88			return true;
89		}
90	}else{
91		return true;
92	}
93}
94
95function ValidLoginFields(user, passw) {
96  if (email_invalid(user)) {
97    $("#login-username").next().html("Valid email required").css('color', 'red').focus();
98    return false;
99  }
100  else {
101    $("#login-username").next().html("Your email").css('color', '').focus();
102  }
103
104  if (!/[A-Z]+.*[0-9]+|[0-9]+.*[A-Z]+/.test(passw)) {
105    $("#login-password").next().html("Valid password required").css('color', 'red').focus();
106    return false;
107  }
108  else {
109    $("#login-password").next().html("Your password").css('color', '').focus();
110    return true;
111  }
112}
113
114function ValidRegistrationFields(login, passw, passw_Ver) {
115  if (email_invalid(login)) {
116    $("#form24").next().html("Valid email required").css('color', 'red').focus();
117    return false;
118  }
119  else {
120    $("#form24").next().html("Your email").css('color', '').focus();
121  }
122
123  if (!/[A-Z]+.*[0-9]+|[0-9]+.*[A-Z]+/.test(passw)) {
124    $("#form25").next().html("Valid password required").css('color', 'red').focus();
125    return false;
126  }
127  else {
128    $("#form25").next().html("Your password").css('color', '').focus();
129  }
130
131  if (passw != passw_Ver) {
132    $("#form26").next().html("Password verification failed").css('color', 'red').focus();
133    return false;
134  }
135  else {
136    $("#form26").next().html("Repeat password").css('color', '').focus();
137  }
138
139  return true;
140}
141
142function ValidContactUsFields(n,e,s,m) {
143  if (n.length <= 1) {
144    $("#contactUs_name").next().html("Name required").css('color', 'red').focus();
145    return false;
146  }
147  else {
148    $("#contactUs_name").next().html("Your name").css('color', '').focus();
149  }
150
151  if (email_invalid(e)) {
152    $("#contactUs_email").next().html("Valid email required").css('color', 'red').focus();
153    return false;
154  }
155  else {
156    $("#contactUs_email").next().html("Your email").css('color', '').focus();
157  }
158
159  if (s.length <= 1) {
160    $("#contactUs_subject").next().html("Subject required").css('color', 'red').focus();
161    return false;
162  }
163  else {
164    $("#contactUs_subject").next().html("Subject").css('color', '').focus();
165  }
166
167  if (m.length <= 1) {
168    $("#contactUs_message").next().html("Message cannot be empty").css('color', 'red').focus();
169    return false;
170  }
171  else {
172    $("#contactUs_message").next().html("Your message").css('color', '').focus();
173  }
174
175  return true;
176}
177
178function landingFormSubmit() {
179  landingformDatastring = '';
180  let landingForm = $("#landing-form");
181  let url = landingForm.find("#landingGURL").val();
182  let email = landingForm.find("#landingUserEmail").val();
183  let landingPwd = landingForm.find("#landingUserPwd");
184  let passw = landingPwd.val();
185  if (passw == "") {
186    landingPwd.next().html("Password required").css('color', 'red').focus();
187    return false;
188  }
189  else if (passw.length < 7) {
190    landingPwd.next().html("Password too short").css('color', 'red').focus();
191    return false;
192  }
193  else if (!/[A-Z]+/.test(passw)) {
194    landingPwd.next().html("Capital letter required").css('color', 'red').focus();
195    return false;
196  }
197  else if (!/[0-9]+/.test(passw)) {
198    landingPwd.next().html("Number 0-9 required").css('color', 'red').focus();
199    return false;
200  }
201  else {
202    landingPwd.next().html("new password").css('color', '');
203  }
204  
205  landingformDatastring += 'rlogin=' + email + '&newP=' + encodeURIComponent(passw) + '&newP_confirmation=' + encodeURIComponent(passw) + '&url=' + encodeURIComponent(url);
206
207  let isCaptchaScriptLoaded = false;
208  try {
209    if (grecaptcha) {
210      isCaptchaScriptLoaded = true;
211    }
212  } catch (err) { console.log("Captcha script loaded first time"); }
213
214  if (!isCaptchaScriptLoaded) {
215    var recaptchaAPIScript = document.createElement('script');
216    recaptchaAPIScript.setAttribute('type', 'text/javascript');
217    recaptchaAPIScript.setAttribute('src', 'https://www.google.com/recaptcha/api.js?onload=onloadLandingFormRecaptchaCallback&render=explicit');
218    recaptchaAPIScript.setAttribute('async', true);
219    recaptchaAPIScript.setAttribute('defer', true);
220    document.body.appendChild(recaptchaAPIScript);
221  }
222  else if (isCaptchaScriptLoaded) {
223    grecaptcha.reset();
224  }
225
226  if (window.confirm("A valid payment method is required to access the free trial. Do you wish to continue?")) {
227    doSubmitLandingForm("");
228  }
229
230  return false;
231}
232
233function contactFormSubmit() {
234  contactformDatastring = '';
235  let form = $("#contact-form");
236  let name = form.find("#contactUs_name").val();
237  let email = form.find("#contactUs_email").val();
238  let subject = form.find("#contactUs_subject").val();
239  let msg = form.find("#contactUs_message").val();
240
241  if (ValidContactUsFields(name,email,subject,msg)) {
242    contactformDatastring += 'name=' + encodeURIComponent(name) + '&email=' + email + '&subject=' + encodeURIComponent(subject) + '&msg=' + encodeURIComponent(msg);
243  }
244  else {
245    return false;
246  }
247
248  var recaptchaAPIScript = document.createElement('script');
249  recaptchaAPIScript.setAttribute('type', 'text/javascript');
250  recaptchaAPIScript.setAttribute('src', 'https://www.google.com/recaptcha/api.js?onload=onloadContactUsRecaptchaCallback&render=explicit');
251  recaptchaAPIScript.setAttribute('async', true);
252  recaptchaAPIScript.setAttribute('defer', true);
253  document.body.appendChild(recaptchaAPIScript);
254}
255
256function registerFormSubmit() {
257  lrformDatastring = '';
258  let login_username = $("#login-username").val();
259  let login_password = $("#login-password").val();
260  let registration_login = $("#form24").val();
261  let newP = $("#form25").val();
262  let newP_confirmation = $("#form26").val();
263  let activeTab = $("#registerForm a.active");
264
265  //let isRegistration = activeTab.text().indexOf("egister") != -1;
266  //let isLogin = activeTab.text().indexOf("ogin") != -1;
267  isRegistration = $("#register").is(":visible");
268  isLogin = $("#login").is(":visible");
269
270  //pre-process, in case user filled out both 
271  if (login_username !="" && login_password != "" && registration_login != "" && newP != "" && newP_confirmation != "") {
272    if(isLogin) {
273      registration_login = "";
274      newP = "";
275      newP_confirmation = "";
276    }
277    else if (isRegistration) {
278      login_username = "";
279      login_password = "";
280    }
281  }
282
283  if (isLogin && ValidLoginFields(login_username, login_password)) {
284    lrformDatastring += 'login=' + login_username + '&pwd=' + encodeURIComponent(login_password);
285    request_type = "login";
286  }
287  else if (isRegistration && ValidRegistrationFields(registration_login, newP, newP_confirmation)) {
288    lrformDatastring +=  'rlogin=' + registration_login + '&newP=' + encodeURIComponent(newP) + '&newP_confirmation=' + encodeURIComponent(newP_confirmation);
289    request_type = "register";
290  }
291  else {
292    return false;
293  }
294
295  let isCaptchaScriptLoaded = false;
296  try {
297    if (grecaptcha) {
298      isCaptchaScriptLoaded = true;
299    }
300  } catch (err) { console.log("Captcha script loaded first time"); }
301
302  if (isRegistration && !isCaptchaScriptLoaded) {
303    var recaptchaAPIScript = document.createElement('script');
304    recaptchaAPIScript.setAttribute('type', 'text/javascript');
305    recaptchaAPIScript.setAttribute('src', 'https://www.google.com/recaptcha/api.js?onload=onloadLoginRecaptchaCallback&render=explicit');
306    recaptchaAPIScript.setAttribute('async', true);
307    recaptchaAPIScript.setAttribute('defer', true);
308    document.body.appendChild(recaptchaAPIScript);
309  }
310  else if (isRegistration && isCaptchaScriptLoaded) {
311    grecaptcha.reset();
312  }
313  
314  /*if (isLogin) {
315    doSubmitRegisterLoginForm("");
316  }*/
317  if (isRegistration && window.confirm("A valid payment method is required to access the free trial. Do you wish to continue?")) {
318    doSubmitRegisterLoginForm("");
319  }
320  else if (isLogin) {
321    doSubmitRegisterLoginForm("");
322  }
323
324  return false;  // ajax request will handle subsequent flow
325}
326
327function doSubmitLandingForm(userCaptchaResponse) {
328  $.ajax({
329    type: "POST",  
330    url: hostAndProtocol + "/login_do.jsp?" + landingformDatastring + '&captchaResponse=' + userCaptchaResponse,  
331    data: landingformDatastring,
332    success: function(jsonResponse) {
333      if (typeof(jsonResponse.valid) === "boolean") {
334        if (!jsonResponse.valid) {
335          const existingUserRE = /^User .*? is already taken$/;
336          const badPwdRE = /password/;
337          const badUserRE = /^Invalid email address$/;
338          if (existingUserRE.test(jsonResponse.message) || badUserRE.test(jsonResponse.message)) {
339            $("#landingUserEmail").prev().css("color", "red")
340                                  .next().next().html(jsonResponse.message).css('color', 'red').focus();
341          }
342          else if (badPwdRE.test(jsonResponse.message)) {
343            $("#landingUserPwd").next().html(jsonResponse.message).css('color', 'red').focus();
344          }
345        }
346      }
347      else {
348        const sessionID = getSession();
349        localStorage.setItem("JSESSIONID", sessionID);
350
351        let landing_url = $("#landingGURL").val();
352        let loginParams = "";
353
354        if (landing_url != "") {
355          loginParams += "?landingURL=" + encodeURIComponent(landing_url);
356        }
357
358        if (refCode != "") {
359          if (loginParams != "") {
360            loginParams += "&";
361          }
362          else {
363            loginParams += "?";
364          }
365          loginParams += "refCode=" + refCode;
366        }
367
368        window.location.href = hostAndProtocol + "/main.jsp" + loginParams;
369        //gtagSendEvent(hostAndProtocol + "/main.jsp" + loginParams);
370      }
371      return false;
372    },
373    error: function(err) {
374      console.log("Failed: " + err);
375    },
376    dataType: 'json'
377  });
378}
379
380function doSubmitContactUsForm(userCaptchaResponse) {
381  contactformDatastring += '&captchaResponse=' + userCaptchaResponse;
382  $.ajax({
383    type: "POST",  
384    url: hostAndProtocol + "/contactUs.jsp?" + contactformDatastring,  
385    data: contactformDatastring,
386    success: function(jsonResponse) {
387      $(".contactUs").hide();
388      $("#contactUsResult").html("been sent").parent().addClass("alert-success").removeClass("alert-danger");
389      $(".contactUsResult").show();
390    },
391    error: function() {
392      $(".contactUs").hide();
393      $("#contactUsResult").html("not been sent").parent().addClass("alert-danger").removeClass("alert-success");
394      $(".contactUsResult").show();
395    },
396    dataType: 'json'
397  });
398}
399
400function doSubmitRegisterLoginForm(userCaptchaResponse) {
401  let finalParamList = lrformDatastring;
402  if (isRegistration) {
403    finalParamList += '&captchaResponse=' + userCaptchaResponse;
404  }
405
406  $.ajax({  
407    type: "POST",  
408    url: hostAndProtocol + "/login_do.jsp?" + finalParamList,  
409    data: finalParamList,  
410    success: function(jsonResponse) {
411      if (typeof(jsonResponse.valid) === "boolean") {
412        if (!jsonResponse.valid) {
413          if (navigator.notification) {
414            navigator.notification.alert(
415                jsonResponse.message,
416                function(){},
417                'Login Error',
418                'Close'
419            );
420          }
421          else {
422            var re = /^(User .*? (?:does not exist|is already taken)|Invalid email address)$/;
423            if (re.test(jsonResponse.message)) {
424              if (isLogin) {
425                $("#login-username").next().html(jsonResponse.message).css('color', 'red').focus();
426              }
427              else if (isRegistration) {
428                $("#form24").next().html(jsonResponse.message).css('color', 'red').focus();
429              }
430            }
431            else if (jsonResponse.message == "Incorrect Password") {
432              if (isLogin) {
433                $("#login-password").next().html("Incorrect password. Try again").css('color', 'red').focus();
434              }
435            }
436          }
437        }
438      }
439      else {
440        $("#login-username").next().html("Your email").css('color', '').focus();
441        $("#form24").next().html("Your email").css('color', '').focus();
442        $("#login-password").next().html("Your password").css('color', '').focus();
443
444        const sessionID = getSession();
445        localStorage.setItem("JSESSIONID", sessionID);
446        let loginParams = "";
447
448        if (emailCode != "") {
449          loginParams += "?code=" + emailCode;
450        }
451
452        if (refCode != "") {
453          if (loginParams != "") {
454            loginParams += "&";
455          }
456          else {
457            loginParams += "?";
458          }
459          loginParams += "refCode=" + refCode;
460        }
461
462        /*if (request_type == "register" && window.FirebasePlugin) {
463          FirebasePlugin.logEvent("NewUser_registration", {content_type: "page_view", item_id: "RegisterLandingForm"});
464        }*/
465
466        if (isRegistration) {
467          window.location.href = hostAndProtocol + "/main.jsp" + loginParams;
468          //gtagSendEvent(hostAndProtocol + "/main.jsp" + loginParams);
469        } else {
470          if (window.location.href.indexOf("/price-history") >= 0) {
471            window.location.reload();
472          }
473          else {
474            window.location.href = hostAndProtocol + "/main.jsp" + loginParams;
475          }
476        }
477      }
478      return false;
479    },
480    error: function() {
481      alert((request_type == "login" ? "Login" : "Registration") + " Failed!");
482      $("#login-password").val("");
483      $("#form25").val("");
484      $("#form26").val("");
485      return false;
486    },
487    dataType: 'json'
488  });
489}
490
491// Upon relaunch/bring to foreground, app can query the server with the presistent token.
492// Looks for cookie in browser first, but it not found it's possible app closed,
493// so this also looks in persistent storage
494function getSession() {
495  if (typeof(Storage) !== "undefined") {
496    let sessionID = getCookie("JSESSIONID");
497    if (sessionID && typeof sessionID !== 'undefined' && sessionID != "" && sessionID != "null") {
498      console.log("Found cookie sessionID = " + sessionID);
499      return sessionID;
500    }
501    sessionID = localStorage.getItem("JSESSIONID");
502    if (sessionID && typeof sessionID !== 'undefined' && sessionID != "" && sessionID != "null") {
503      console.log("Found local sessionID = " + sessionID);
504      return sessionID;
505    }
506    console.log("No sessionID found");
507    return "";
508  }
509  else {
510    console.log("No support for window.localStorage");
511  }
512  return "";
513}
514
515function showPrivacyPolicy() {
516  $(".searchAddItem").hide();
517  $(".userSettings").hide();
518  $("#userMsg").hide().parent().parent().hide();
519  $(".userPayments").hide();
520  $(".userPaymentResult").hide();
521  $(".userAccount").hide();
522  $(".userMessages").hide();
523  $(".contactUs").hide();
524  $(".contactUsResult").hide();
525  $(".browseItems").hide();
526  $(".homePageItems").hide();
527  $(".landingSection").hide();
528  $(".termsOfService").hide();
529  $(".FAQs").hide();
530  if (window.location.href.indexOf("installed.jsp") != -1) {
531    $($("main div.container div.row-centered div.col-md-12 div.card")[0]).hide();
532  }
533  else {
534    $("main div.container div.row-centered").hide();
535  }
536  $(".aboutUs").hide();
537  if (window.location.href.indexOf("/price-history") != -1) {
538    window.location.href = "https://glassit.co/#privacyPolicy";
539  }
540  else {
541    $(".privacyPolicy").show();
542    let privacyHTML = $(".privacyPolicy .card-block").html().trim();
543    if (privacyHTML == "") {
544      $.ajax({
545        type: "GET",  
546        url: hostAndProtocol + "/privacy.html",  
547        success: function(htmlResponse) {
548          console.log("Retrieved privacy policy");
549          $(".privacyPolicy .card-block").html(htmlResponse);
550          $(".privacyPolicy").show();
551        },
552        error: function() {
553          console.log("Error fetching privacy policy.");
554        },
555        dataType: 'html'
556      });
557    } else {
558      $(".privacyPolicy").show();
559    }
560  }
561}
562
563function showContactUs(redirect) {
564  $(".searchAddItem").hide();
565  $(".userSettings").hide();
566  $("#userMsg").hide().parent().parent().hide();
567  $(".userPayments").hide();
568  $(".userPaymentResult").hide();
569  $(".userAccount").hide();
570  $(".userMessages").hide();
571  $(".homePageItems").hide();
572  $(".FAQs").hide();
573  if (window.location.href.indexOf("installed.jsp") != -1) {
574    $($("main div.container div.row-centered div.col-md-12 div.card")[0]).hide();
575  }
576  else {
577    $("main div.container div.row-centered").hide();
578  }
579  $(".privacyPolicy").hide();
580  $(".termsOfService").hide();
581  $(".landingSection").hide();
582  $(".aboutUs").hide();
583  $(".contactUsResult").hide();
584  $(".contactUs").show();
585  if (watchedItems.email && watchedItems.email != "") {
586    $("#contactUs_email").val(watchedItems.email);
587    $("#contactUs_email").focus();
588  }
589  if (redirect) {
590    window.location.href = hostAndProtocol + "/#contactUs";
591  }
592}
593
594/*function showAboutUs() {
595  $(".searchAddItem").hide();
596  $(".userSettings").hide();
597  $("#userMsg").hide().parent().parent().hide();
598  $(".userPayments").hide();
599  $(".userPaymentResult").hide();
600  $(".userAccount").hide();
601  $(".userMessages").hide();
602  $(".contactUs").hide();
603  $(".contactUsResult").hide();
604  $(".homePageItems").hide();
605  $("main div.container div.row-centered").hide();
606  $(".privacyPolicy").hide();
607  $(".landingSection").hide();
608  $(".aboutUs").show();
609}*/
610
611function showAboutUs() {
612  $(".searchAddItem").hide();
613  $(".userSettings").hide();
614  $("#userMsg").hide().parent().parent().hide();
615  $(".userPayments").hide();
616  $(".userPaymentResult").hide();
617  $(".userAccount").hide();
618  $(".userMessages").hide();
619  $(".contactUs").hide();
620  $(".contactUsResult").hide();
621  $(".homePageItems").hide();
622  $(".landingSection").hide();
623  $(".browseItems").hide();
624  $(".userDashBoard").hide();
625  $(".termsOfService").hide();
626  $(".FAQs").hide();
627
628  if (window.location.href.indexOf("installed.jsp") != -1) {
629    $($("main div.container div.row-centered div.col-md-12 div.card")[0]).hide();
630  }
631  else {
632    $("main div.container div.row-centered").hide();
633  }
634  $(".privacyPolicy").hide();
635  if (window.location.href.indexOf("/price-history") != -1) {
636    window.location.href = "https://glassit.co/#aboutUs";
637  }
638  else {
639    let aboutUsHTML = $(".theTeam").html().trim();
640    if (aboutUsHTML == "") {
641      $.ajax({
642        type: "GET",  
643        url: hostAndProtocol + "/aboutUs.html?t=01142024",  
644        success: function(htmlResponse) {
645          console.log("Retrieved about us");
646          $(".theTeam").html(htmlResponse);
647          $(".aboutUs").show();
648        },
649        error: function() {
650          console.log("Error fetching about us.");
651        },
652        dataType: 'html'
653      });
654      /*$.ajax({
655        type: "GET",  
656        url: hostAndProtocol + "/faq.html?t=09212023",  
657        success: function(htmlResponse) {
658          console.log("Retrieved FAQ");
659          $(".FAQs").html(htmlResponse);
660          $(".FAQs").show();
661          if (/#faq/.test(window.location.href)) {
662            $([document.documentElement, document.body]).animate({
663                scrollTop: $("h4[name='faq']").offset().top
664            }, 2000);
665          }
666          else if (/#meetTeam/.test(window.location.href)) {
667            $([document.documentElement, document.body]).animate({
668                scrollTop: $("h4[name='meetTeam']").offset().top
669            }, 2000);
670          }
671        },
672        error: function() {
673          console.log("Error fetching about us.");
674        },
675        dataType: 'html'
676      });*/
677    } else {
678      $(".aboutUs").show();
679      if (/#faq/.test(window.location.href)) {
680        $([document.documentElement, document.body]).animate({
681            scrollTop: $("#faq").offset().top
682        }, 750);
683      }
684      else if (/#meetTeam/.test(window.location.href)) {
685        $([document.documentElement, document.body]).animate({
686            scrollTop: $("h4[name='meetTeam']").offset().top
687        }, 750);
688      }
689    }
690  }
691}
692
693function showTOS() {
694  $(".searchAddItem").hide();
695  $(".userSettings").hide();
696  $("#userMsg").hide().parent().parent().hide();
697  $(".userPayments").hide();
698  $(".userPaymentResult").hide();
699  $(".userAccount").hide();
700  $(".userMessages").hide();
701  $(".contactUs").hide();
702  $(".contactUsResult").hide();
703  $(".homePageItems").hide();
704  $(".landingSection").hide();
705  $(".browseItems").hide();
706  $(".userDashBoard").hide();
707  $(".FAQs").hide();
708  if (window.location.href.indexOf("installed.jsp") != -1) {
709    $($("main div.container div.row-centered div.col-md-12 div.card")[0]).hide();
710  }
711  else {
712    $("main div.container div.row-centered").hide();
713  }
714  $(".privacyPolicy").hide();
715  $(".aboutUs").hide();
716  if (/price-history|affiliate-program|pricing|competition-price-tracking|sitemap.jsp|gift-cards/.test(window.location.href)) {
717    window.location.href = "https://glassit.co/#terms-of-service";
718  }
719  else {
720    let tosHTML = $(".glass-it-terms-of-service").html().trim();
721    if (tosHTML == "") {
722      $.ajax({
723        type: "GET",  
724        url: hostAndProtocol + "/terms-of-service.html?t=10092022",  
725        success: function(htmlResponse) {
726          console.log("Retrieved Glass It Terms of Service");
727          $(".glass-it-terms-of-service").html(htmlResponse);
728          $(".termsOfService").show();
729        },
730        error: function() {
731          console.log("Error fetching Glass It Terms of Service.");
732        },
733        dataType: 'html'
734      });
735    } else {
736      $(".termsOfService").show();
737    }
738  }
739}
740
741function showVerifyEmailBtn() {
742  $("#onBoardingModal").modal("hide");
743  skipOnboarding = true;
744  $($(".userSettingsButton")[0]).click();
745  $([document.documentElement, document.body]).animate({
746    scrollTop: $("#resendVerEmail").offset().top
747  }, 750);
748  skipOnboarding = false;
749}
750
751$(document).ready(function(){
752
753  $(".modal-toggle").click(function(e){
754    var tab = e.target.hash; 
755    $('#modalRegisterLoginForm .nav-item a[href="' + tab + '"]').tab("show");
756  });
757
758  $("#registerForm").submit(function(){
759      registerFormSubmit();
760      return false;
761  });
762
763  $("#contact-form").submit(function(){
764      contactFormSubmit();
765      return false;
766  });
767
768  $("#landing-form").submit(function(e){
769    landingFormSubmit();
770    return false;
771  });
772
773  $("#forgotPasswordButton").click(function(){
774    $('#reset-login-username').val( $("#login-username").val() );
775    setTimeout(function() {
776      $("#reset-login-username").click();
777      $("#reset-login-username").focus();
778      return false;
779    }, 0400);
780    return false;
781  });
782
783
784  $("#resetPasswordButton").click(function(e){
785    var currInputEmail = $("#reset-login-username");
786    if (!email_invalid(currInputEmail.val())) {
787      currInputEmail.next().html("Enter your email address").focus().css('color', '');
788      $.ajax({
789        url: hostAndProtocol + '/ajx_reset.jsp?user=' +  currInputEmail.val(),
790        method: 'GET',
791        dataType: 'json',
792        success: function(json) {
793                   var retJSON = eval(json);
794                   if (retJSON.success) {
795                     if (navigator.notification) {
796                       navigator.notification.alert(
797                           "Check your email for the temporary password",
798                           function(){},
799                           'Passwowrd Reset Successfully',
800                           'Close'
801                       );
802                     }
803                     else {
804                       alert("Password reset successfully. Check your email for the temporary password");
805                     }
806                     $("#modalRegisterLoginForm").modal("hide");
807                   }
808                   else if (retJSON.message) {
809                     currInputEmail.next().html("User does not exist").focus().css('color', 'red');
810                   }
811                   else {
812                     currInputEmail.next().html("Enter your email address").focus().css('color', '');
813                   }
814                   return false;
815                 },
816        error: function(json) {
817                 var j = eval(json);
818                 if (j.message) {
819                   if (navigator.notification) {
820                     navigator.notification.alert(
821                         j.message,
822                         function(){},
823                         'Passwowrd Reset Error',
824                         'Close'
825                     );
826                   }
827                   else {
828                     alert("Password Reset Error: " + j.message);
829                   }
830                 }
831                 return false;
832               },
833        async: true
834      });
835    }
836    else {
837      currInputEmail.next().html("Valid email required").focus().css('color', 'red');
838    }
839    return false;
840  });
841
842  // reset user notification on logout. User must be logged in to get notifications about target price matches
843  $("#logoutButton").click(function(e){
844    if (window.confirm("Logout? Push Notifications will be disabled on this device")) {
845      if (pushPermission) {
846        pushPermission = false;
847        updateDeviceSubscriptions(); //unsubscribe from topics, then delete deviceToken
848      }
849
850      $.ajax({
851        url: '/add.jsp?reset=Y&pushClientToken=' + deviceToken,
852        method: 'GET',
853        dataType: 'json',
854        success: function(json) {
855                   if (json.success) {
856                     if (json.userDevices) {
857                       userDevices = eval(json.userDevices);
858                     }
859                     deviceToken = "";
860                     if (window.FirebasePlugin) {
861                       // By default, a new token will be generated as soon as the old one is removed.
862                       // To prevent a new token being generated, by sure to disable autoinit using
863                       // setAutoInitEnabled() before calling unregister().
864                       //FirebasePlugin.unregister();
865                       FirebasePlugin.setAutoInitEnabled(false, function(){
866                         console.log("Auto init has been disabled");
867                         FirebasePlugin.unregister();
868                       });
869                     }
870                     if (window.firebase) {
871                       window.firebase.messaging().deleteToken();
872                     }
873                     localStorage.setItem("firebaseGlassItDeviceID", deviceToken);
874                     console.log("Reset push notifications successfully");
875                     window.location.href = "https://glassit.co/logout.jsp";
876                   }
877                 },
878        error: function(json) {
879                 console.log("Error resetting push notifications: " + json);
880                 // do not allow logout if error reseting push notifications!
881               },
882        async: true,
883        cachce: false
884      });
885
886      return false; // prevent <a> click logout before updating Device/token on server
887    }
888    else {
889      e.preventDefault();
890      return false;
891    }
892  });
893});

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.