PageSourceSearch

https://www.stemsave.com/Assets/js/main.js

js stemsave.com collected 2026-10-02 19:56:15 UTC 23,340 bytes, 643 lines download raw bytes

1
2// set header country drop down
3var setHeaderCountryDropDown = function () {
4    var country = localStorage.getItem("headerCountryValue");
5    if (country == "" || country == null) {
6        country = localStorage.setItem("headerCountryValue", "US");
7    }
8    if (country != "##") {
9        $("#header-country").val(country);
10    } else {
11        $("#header-country").val("US");
12    }
13};
14var getServiceCountryList = function () {
15    $.ajax({
16        url: "/api/commonapi/GetServiceCountry",
17        contentType: 'application/json',
18        type: 'GET',
19        success: function (data) {
20            setServiceCountryDropDown(data.servicecountrylist);
21            localStorage.setItem("token", data.token);
22            setHeaderCountryDropDown();
23        },
24        error: function (xhr) {
25            alert(xhr.responseText);
26        }
27    });
28};
29
30
31$(document).on("click", "#Btn_SubscribeNewsLetter", function (event) {
32    if (($("#txt_username").val() != null && $("#txt_username").val() != "")) {
33        if ($("#txt_firstName").val() != null && $("#txt_firstName").val() != "") {
34            if ($('#dd_persona2 option:selected').val() != 0) {
35                SubscribeForNewsletter();
36            }
37        }
38    }
39    if ($("#txt_username").val() != "" && $("#txt_firstName").val() != "" && $('#dd_persona2 option:selected').val() != "0") {
40        if ($("#txt_username").val() != null && $("#txt_username").val() != "") {
41            $("#usernameRequired1").css("display", "block");
42            $("#usernameRequired2").css("display", "none");
43            if (($("#txt_firstName").val() != null && ($("#txt_firstName").val() != ""))) {
44                $("#firstNameRequired1").css("display", "block");
45                $("#firstNameRequired2").css("display", "none");
46                if ($('#dd_persona2 option:selected').val() != 0) {
47                    $("#personaRequired1").css("display", "block");
48                    $("#personaRequired2").css("display", "none");
49                    localStorage.setItem("SaveUser", "true");
50                    localStorage.setItem("IsThanks", "true");
51                    if (localStorage.getItem("SaveUser") == "true") {
52                        if (localStorage.getItem("IsThanks") == "true") {
53                            $("#myModalLabel").css("display", "none");
54                            $("#myModalLabel2").css("display", "block");
55                            $("#subscribedThankYou").css("display", "block");                            
56                            localStorage.setItem("IsThanks", "False");
57                        } else {
58                            $("#myModalLabel").css("display", "block");
59                            $("#myModalLabel2").css("display", "none");
60                            $("#subscribedThankYou").css("display", "none");                            
61                            localStorage.setItem("IsThanks", "False");
62                        }
63                    }
64                }
65            }
66        }
67    }
68    else {
69        if (($("#txt_username").val() == null || $("#txt_username").val() == "") || ($("#txt_firstName").val() == null || $("#txt_firstName").val() == "") || ($('#dd_persona2 option:selected').val() == 0)) {
70            if (($("#txt_username").val() == null || ($("#txt_username").val() == ""))) {
71                $("#usernameRequired1").css("display", "none");
72                $("#usernameRequired2").css("display", "block");
73                $("#SubscribeForm").css("display", "block");
74                $("#subscribeRegister").css("display", "block");
75                $("#Btn_SubscribeNewsLetter").css("display", "block");
76            }
77            else {
78                $("#usernameRequired1").css("display", "block");
79                $("#usernameRequired2").css("display", "none");
80            }
81
82            if (($("#txt_firstName").val() == null || ($("#txt_firstName").val() == ""))) {
83                $("#firstNameRequired1").css("display", "none");
84                $("#firstNameRequired2").css("display", "block");
85                $("#SubscribeForm").css("display", "block");
86                $("#subscribeRegister").css("display", "block");
87                $("#Btn_SubscribeNewsLetter").css("display", "block");
88            }
89            else {
90                $("#firstNameRequired1").css("display", "block");
91                $("#firstNameRequired2").css("display", "none");
92            }
93            if ($('#dd_persona2 option:selected').val() == 0) {
94                $("#personaRequired1").css("display", "none");
95                $("#personaRequired2").css("display", "block");
96                $("#SubscribeForm").css("display", "block");
97                $("#subscribeRegister").css("display", "block");
98                $("#Btn_SubscribeNewsLetter").css("display", "block");
99            }
100            else {
101                $("#personaRequired1").css("display", "block");
102                $("#personaRequired2").css("display", "none");
103            }
104        }
105        else {
106            $("#SubscribeForm").css("display", "block");
107            $("#subscribeRegister").css("display", "block");
108            $("#Btn_SubscribeNewsLetter").css("display", "block");
109        }
110    }
111
112});
113
114$(document).on("click", "#subscribeFormnow", function (event) {
115    $("#subscribeInfo").css("display", "none");
116    $("#subscribeFormnow").css("display", "none");
117    $("#SubscribeForm").css("display", "block");
118    $("#subscribeRegister").css("display", "block");
119    $("#Btn_SubscribeNewsLetter").css("display", "block");
120});
121
122$(document).on("click", "#subscribeFormnow2", function (event) {
123    $("#subscribeInfo").css("display", "none");
124    $("#subscribeFormnow").css("display", "none");
125    //$("#SubscribeForm").css("display", "block");
126    //$("#subscribeRegister").css("display", "block");
127    //$("#Btn_SubscribeNewsLetter").css("display", "block");
128});
129
130var SubscribeForNewsletter = function () {
131    var detail = {
132        username: $('#txt_username').val(),
133        firstName: $('#txt_firstName').val(),
134        persona:$('#dd_persona2 option:selected').val()
135    }
136    $.ajax({
137        url: "/api/commonapi/SubscribeNewsletter",
138        contentType: 'application/json',
139        type: 'POST',
140        data: JSON.stringify(detail),
141        success: function (data) {
142            localStorage.setItem("SaveUser", "true");
143            localStorage.setItem("IsThanks", "true");
144            if (localStorage.getItem("SaveUser") == "true") {
145                if (localStorage.getItem("IsThanks") == "true") {
146                    $("#myModalLabel").css("display", "none");
147                    $("#myModalLabel2").css("display", "block");
148                    $("#subscribedThankYou").css("display", "block");
149                    localStorage.setItem("IsThanks", "False");                    
150                } else {
151                    $("#myModalLabel").css("display", "block");
152                    $("#myModalLabel2").css("display", "none");
153                    $("#subscribedThankYou").css("display", "none");
154                    localStorage.setItem("IsThanks", "False");                    
155                }
156                $("#SubscribeForm").css("display", "none");
157                $("#Btn_SubscribeNewsLetter").css("display", "none");
158                $("#subscribeInfo").css("display", "none");
159                $("#closeSubscribeModal").css("display", "none");
160                $("#subscribeRegister").css("display", "none");
161            }
162        },
163        error: function (xhr) {
164            alert(xhr.responseText);
165        }
166    });
167};
168
169$(document).on("click", "#closeSubscribeModal", function (event) {
170    $("#myModal1").css("display", "none");
171    $("#subscribeInfo").css("display", "none");
172    $("#SubscribeForm").css("display", "none");
173    $("#subscribeRegister").css("display", "none");
174    $("#Btn_SubscribeNewsLetter").css("display", "none");
175    localStorage.setItem("IsThanks", "false");
176    localStorage.setItem("SaveUser", "false");
177});
178
179$(document).on("click", ".close", function (event) {
180    localStorage.setItem("headerCountryValue", "US");
181    var modalClose = document.getElementById('myModal');
182    modalClose.style.display = "none";
183});
184function openAlertModal() {
185    var modal = document.getElementById('myModal');
186    modal.style.display = "block";
187}
188$(document).on("click", "#okbutton", function (event) {
189    localStorage.setItem("headerCountryValue", "US");
190    var modalClose = document.getElementById('myModal');
191    modalClose.style.display = "none";
192
193});
194
195function HidePopup(){
196    $("#myModal1").css("display", "none");
197    $("#subscribeInfo").css("display", "none");
198    $("#SubscribeForm").css("display", "none");
199    $("#subscribeRegister").css("display", "none");
200    $("#Btn_SubscribeNewsLetter").css("display", "none");
201    localStorage.setItem("IsThanks", "false");
202    localStorage.setItem("SaveUser", "false");
203}
204
205var setServiceCountryDropDown = function (data) {
206    $.each(data, function (val, obj) {
207        $("#header-country").append(
208            $('<option></option>').val(obj.serviceCountryAbbr).html(obj.serviceCountryName)
209        );
210    });
211};
212
213jQuery(document).ready(function ($) {
214
215    getServiceCountryList();
216    setHeaderCountryDropDown();
217    
218   
219    if (localStorage.getItem("SaveUser") == "true") {
220        if (localStorage.getItem("IsThanks") == "true") {
221            $("#subscribedThankYou").css("display", "block");
222            localStorage.setItem("IsThanks", "False");
223        }
224        else {
225            $("#subscribedThankYou").css("display", "none");
226            localStorage.setItem("IsThanks", "False");
227        }
228    }
229
230    if (localStorage.getItem("SaveUser") == "" || localStorage.getItem("SaveUser") == null) {
231        setTimeout(function () {
232            $("#myModal1").css("display", "block");
233        }, 600);
234        $("#subscribeInfo").css("display", "block");
235        $("#subscribeFormnow").css("display", "block");        
236        
237    }
238    else {
239        $("#myModal1").css("display", "none");
240        $("#subscribeInfo").css("display", "none");
241        $("#subscribeFormnow").css("display", "none");        
242    }
243   
244    // Back to top button
245    $(window).scroll(function () {
246        if ($(this).scrollTop() > 100) {
247            $('.back-to-top').fadeIn('slow');
248            $('.enroll-now-footer-btn').fadeIn('slow');
249        } else {
250            $('.back-to-top').fadeOut('slow');
251            $('.enroll-now-footer-btn').fadeOut('slow');
252        }
253    });
254    $('.back-to-top').click(function () {
255        $('html, body').animate({
256            scrollTop: 0
257        }, 1500, 'easeInOutExpo');
258        return false;
259    });
260
261    // Stick the header at top on scroll
262    $("#header").sticky({
263        topSpacing: 0,
264        zIndex: '50'
265    });
266
267    // Intro background carousel
268    $("#intro-carousel").owlCarousel({
269        autoplay: true,
270        dots: false,
271        loop: true,
272        animateOut: 'fadeOut',
273        items: 1
274    });
275
276    // Initiate the wowjs animation library
277    new WOW().init();
278
279    // Initiate superfish on nav menu
280    $('.nav-menu').superfish({
281        animation: {
282            opacity: 'show'
283        },
284        speed: 400
285    });
286
287    // Mobile Navigation
288    if ($('#nav-menu-container').length) {
289        var $mobile_nav = $('#nav-menu-container').clone().prop({
290            id: 'mobile-nav'
291        });
292        $mobile_nav.find('> ul').attr({
293            'class': '',
294            'id': ''
295        });
296        $('body').append($mobile_nav);
297        $('body').prepend('<button type="button" id="mobile-nav-toggle"><i class="fa fa-bars"></i></button>');
298        $('body').append('<div id="mobile-body-overly"></div>');
299        $('#mobile-nav').find('.menu-has-children').prepend('<i class="fa fa-chevron-down"></i>');
300
301        $(document).on('click', '.menu-has-children i', function (e) {
302            $(this).next().toggleClass('menu-item-active');
303            $(this).nextAll('ul').eq(0).slideToggle();
304            $(this).toggleClass("fa-chevron-up fa-chevron-down");
305        });
306
307        $(document).on('click', '#mobile-nav-toggle', function (e) {
308            $('body').toggleClass('mobile-nav-active');
309            $('#mobile-nav-toggle i').toggleClass('fa-times fa-bars');
310            $('#mobile-body-overly').toggle();
311        });
312
313        $(document).click(function (e) {
314            var container = $("#mobile-nav, #mobile-nav-toggle");
315            if (!container.is(e.target) && container.has(e.target).length === 0) {
316                if ($('body').hasClass('mobile-nav-active')) {
317                    $('body').removeClass('mobile-nav-active');
318                    $('#mobile-nav-toggle i').toggleClass('fa-times fa-bars');
319                    $('#mobile-body-overly').fadeOut();
320                }
321            }
322        });
323    } else if ($("#mobile-nav, #mobile-nav-toggle").length) {
324        $("#mobile-nav, #mobile-nav-toggle").hide();
325    }
326
327    // Smooth scroll for the menu and links with .scrollto classes
328    $('.nav-menu a, #mobile-nav a, .scrollto').on('click', function () {
329        if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
330            var target = $(this.hash);
331            if (target.length) {
332                var top_space = 0;
333
334                if ($('#header').length) {
335                    top_space = $('#header').outerHeight();
336
337                    if (!$('#header').hasClass('header-fixed')) {
338                        top_space = top_space - 20;
339                    }
340                }
341
342                $('html, body').animate({
343                    scrollTop: target.offset().top - top_space
344                }, 1500, 'easeInOutExpo');
345
346                if ($(this).parents('.nav-menu').length) {
347                    $('.nav-menu .menu-active').removeClass('menu-active');
348                    $(this).closest('li').addClass('menu-active');
349                }
350
351                if ($('body').hasClass('mobile-nav-active')) {
352                    $('body').removeClass('mobile-nav-active');
353                    $('#mobile-nav-toggle i').toggleClass('fa-times fa-bars');
354                    $('#mobile-body-overly').fadeOut();
355                }
356                return false;
357            }
358        }
359    });
360
361
362    // Porfolio - uses the magnific popup jQuery plugin
363    $('.portfolio-popup').magnificPopup({
364        type: 'image',
365        removalDelay: 300,
366        mainClass: 'mfp-fade',
367        gallery: {
368            enabled: true
369        },
370        zoom: {
371            enabled: true,
372            duration: 300,
373            easing: 'ease-in-out',
374            opener: function (openerElement) {
375                return openerElement.is('img') ? openerElement : openerElement.find('img');
376            }
377        }
378    });
379
380    // Testimonials carousel (uses the Owl Carousel library)
381    $(".testimonials-carousel").owlCarousel({
382        autoplay: true,
383        dots: true,
384        loop: true,
385        responsive: {
386            0: {
387                items: 1
388            },
389            768: {
390                items: 2
391            },
392            900: {
393                items: 3
394            }
395        }
396    });
397
398    // Clients carousel (uses the Owl Carousel library)
399    $(".clients-carousel").owlCarousel({
400        autoplay: true,
401        dots: true,
402        loop: true,
403        responsive: {
404            0: {
405                items: 2
406            },
407            768: {
408                items: 4
409            },
410            900: {
411                items: 6
412            }
413        }
414    });
415
416    // form apply flow
417
418    $('.owl-carousel').owlCarousel({
419        items: 4,
420        nav: false,
421        dots: false,
422        mouseDrag: false,
423        touchDrag: false,
424        responsiveClass: true,
425        responsive: {
426            0: {
427                items: 1
428            },
429            360: {
430                items: 2
431            },
432            560: {
433                items: 3
434            }
435        }
436    });
437
438    var steppos;
439
440    $("#smartwizard").on("showStep", function (e, anchorObject, stepNumber, stepDirection, stepPosition) {
441        steppos = stepPosition;
442        if (steppos === "first") {
443            $("#prev-btn").addClass('disabled');
444        }
445        if (steppos === "middle") {
446            $("#prev-btn").removeClass('disabled');
447            $("#next-btn").removeClass('disabled');
448        }
449        if (steppos === "final") {
450            $("#next-btn").addClass('disabled');
451        }
452    });
453
454    // External Button Events
455    var owl = $('.owl-carousel');
456    owl.owlCarousel();
457
458    $("#prev-btn").on("click", function () {
459        // Navigate previous
460        $('#smartwizard').smartWizard("prev");
461        owl.trigger('prev.owl.carousel');
462
463        $('html,body').animate({
464            scrollTop: $(".member-apply").offset().top - 100
465        }, 'slow');
466
467        if ($("ul.step-anchor li.login").hasClass("active")) {
468            $(".info-block").addClass('item');
469        } else {
470            $(".info-block").removeClass('item');
471        }
472
473        return true;
474    });
475
476    if (!$("ul.step-anchor li.login").hasClass("active")) {
477        $(".info-block").addClass('item');
478    } else {
479        $(".info-block").removeClass('item');
480    }
481
482    $("#next-btn").on("click", function () {
483        // Navigate next
484        $('#smartwizard').smartWizard("next");
485        if (!steperror) {
486            owl.trigger('next.owl.carousel');
487        }
488
489        if ($("ul.step-anchor li.login").hasClass("active")) {
490            $(".info-block").addClass('item');
491        } else {
492            $(".info-block").removeClass('item');
493        }
494
495        return true;
496    });
497
498    $('#accordion').collapse({
499
500    })
501
502    // Toolbar extra buttons
503    var btnFinish = $('<button></button>').text('Finish')
504      .addClass('btn btn-info')
505      .on('click', function () {
506          if (!$(this).hasClass('disabled')) {
507              var elmForm = $("#myForm");
508              if (elmForm) {
509                  elmForm.validator('validate');
510                  var elmErr = elmForm.find('.has-error');
511                  if (elmErr && elmErr.length > 0) {
512                      alert('Oops we still have error in the form');
513                      return false;
514                  } else {
515                      alert('Great! we are ready to submit form');
516                      elmForm.submit();
517                      return false;
518                  }
519              }
520          }
521      });
522    var btnCancel = $('<button></button>').text('Cancel')
523      .addClass('btn btn-danger')
524      .on('click', function () {
525          $('#smartwizard').smartWizard("reset");
526          $('#myForm').find("input, textarea").val("");
527      });
528
529    $('.my-account-section .side-links h5 i').on("click", function () {
530        if (!$(".my-account-section .side-links").hasClass("active") && $(window).width() < 768) {
531            $(".my-account-section .side-links").addClass('active');
532            $("#mobile-body-overly").show();
533            $(".mobile-remove").fadeIn();
534        } else {
535            $(".my-account-section .side-links").removeClass('active');
536            $("#mobile-body-overly").fadeOut();
537        }
538    });
539
540    $('.mobile-remove').on("click", function () {
541        $(".my-account-section .side-links").removeClass('active');
542        $("#mobile-body-overly").hide();
543        $(".mobile-remove").fadeOut();
544    });
545
546    $("#header-country").change(function () {
547        if ($(this).val() == "##") {
548            openAlertModal();
549            return false;
550        }
551        else {
552            localStorage.setItem("headerCountryValue", $(this).val());
553        }
554    });
555
556
557    $(window).resize(function () {
558
559        if ($(window).width() > 767) {
560            $(".my-account-section .side-links").removeClass('active');
561            $("#mobile-body-overly").hide();
562            $(".mobile-remove").fadeOut();
563        }
564    });
565
566    // Smart Wizard
567    $('#smartwizard').smartWizard({
568        selected: 0,
569        theme: 'dots',
570        transitionEffect: 'fade',
571        toolbarSettings: {
572            toolbarPosition: 'bottom',
573            showNextButton: false,
574            showPreviousButton: false
575            // toolbarExtraButtons: [btnFinish, btnCancel]
576        },
577        anchorSettings: {
578            markDoneStep: true, // add done css
579            markAllPreviousStepsAsDone: true, // When a step selected by url hash, all previous steps are marked done
580            removeDoneStepOnNavigateBack: true, // While navigate back done step after active step will be cleared
581            enableAnchorOnDoneStep: true // Enable/Disable the done steps navigation
582        }
583    });
584
585    var steperror = false;
586
587    $("#smartwizard").on("leaveStep", function (e, anchorObject, stepNumber, stepDirection) {
588        var elmForm = $("#form-step-" + stepNumber);
589        // stepDirection === 'forward' :- this condition allows to do the form validation
590        // only on forward navigation, that makes easy navigation on backwards still do the validation when going next
591        if (stepDirection === 'forward' && elmForm) {
592            elmForm.validator('validate');
593            var elmErr = elmForm.children('.has-error');
594            if (elmErr && elmErr.length > 0) {
595                // Form validation failed
596                steperror = true;
597                return false;
598            }
599        }
600        steperror = false
601        return true;
602    });
603
604    $("#smartwizard").on("showStep", function (e, anchorObject, stepNumber, stepDirection) {
605        // Enable finish button only on last step
606        if (stepNumber == 6) {
607            $('.btn-finish').removeClass('disabled');
608        } else {
609            $('.btn-finish').addClass('disabled');
610        }
611    });
612
613
614    //$("#my-account-header-btn").on("click tap",function() {
615    //    var userType = !!$("#logged-user-type").val() ? $("#logged-user-type").val().toLowerCase() : "";
616
617    //    if (userType == "member" ) {
618    //        window.location.href = "/member-account-details";
619    //    }
620    //    else if (userType == "prof") {
621    //        window.location.href = "/professional-account-details";
622    //    }
623    //});
624
625
626    $("#MyAccountRedirection").on('click', function () {
627
628        var UserType = (!!$("#CurrentLoggedUser").val() ? $("#CurrentLoggedUser").val().toLowerCase() : "");
629        if (UserType == "member" || UserType == "gifter") {
630            window.location.href = "/member-account-details";
631        }
632        else if (UserType == "prof") {
633            window.location.href = "/professional-account-details";
634        }
635    })
636
637    $('li').on('click', function () {
638        $('li').removeClass('active');
639        $('li').toggleClass('active');
640    })
641});
642
643

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.