PageSourceSearch

https://www.instaproofs.com/home/assets/js/scripts.js?v=.95

js instaproofs.com collected 2026-10-03 20:14:24 UTC 16,404 bytes, 507 lines download raw bytes

1'use strict';
2/*********************************\
3  PAGE SCROLLING AND NAVIGATION
4\*********************************/
5$(document).on("scroll", function () {
6  var pageTop = $(document).scrollTop();
7  var pageBottom = pageTop + $(window).height();
8  var tags = $("section");
9
10  for (var i = 0; i < tags.length; i++) {
11    var tag = tags[i];
12
13    if ($(tag).position().top < pageBottom) {
14      $(tag).addClass("visible");
15    } else {  
16      $(tag).removeClass("visible");
17    }
18  }
19});
20
21$(document).ready(function() {
22  $(document).scroll();
23  
24  // anchor
25  $(".go-to").on('click',function(e){
26
27    e.preventDefault();
28
29    var anchor = $(this).attr("href");
30
31    if ($(anchor).length) {
32      var run = $(anchor).offset().top;
33      $('body,html').stop().animate({scrollTop: run}, 1500);
34    } else {
35      console.warn("Couldn't find the ID.")
36    }
37  });
38
39  // back top button
40  var backtotop = $('.main-footer .mouse');
41  backtotop.on('click', function(e) {
42      e.preventDefault();
43      $('html, body').animate({scrollTop:0}, '1500');
44  });
45
46  $(".mobile-menu").on("click", function(){
47    $(this).toggleClass("active");
48    $(".main-header .main-menu").stop().slideToggle( "slow", function(){
49      if ($(this).css('display') === 'none'){
50        $(this).removeAttr('style');
51      }
52    });
53  });
54
55  $.fn.forceNumbericOnly = function () {
56    return this.each(function () {
57      $(this).keydown(function (e) {
58        var key = e.charCode || e.keyCode || 0;
59        return (key == 8 || key == 9 || key == 46 || (key >= 37 && key <= 40) || (key >=
60          48 && key <= 57) || (key >= 96 && key <= 105) || key == 107 || key ==
61          109 || key == 173 || key == 61);
62      });
63    });
64  };
65
66  $('input[type=tel]').forceNumbericOnly();
67
68  /*********************\
69    ACCORDIAN CONTROLS
70  \*********************/
71  var Accordion = function(el, multiple,link='.link') {
72    this.el = el || {};
73    this.multiple = multiple || false;
74    this.link = link;
75
76    // Variables privadas
77    var links = this.el.find(this.link);
78    // Evento
79    links.on('click', {el: this.el, multiple: this.multiple}, this.dropdown)
80  }
81
82  Accordion.prototype.dropdown = function(e) {
83    var $el = e.data.el,
84        $this = $(this),
85        $next = $this.next();
86
87    $next.stop().slideToggle();
88    $this.parent().toggleClass('open');
89
90    if (!e.data.multiple) {
91      $el.find('.submenu').not($next).slideUp().parent().removeClass('open');
92    };
93  }
94  var accordion = new Accordion($('#accordion'), false);
95  
96  /******************\
97    SLIDER CONTROLS
98  \******************/
99  $('.slider-galery').slick({
100    slidesToShow: 1,
101    slidesToScroll: 1,
102    appendArrows: '.slider-galery-arrow',
103    autoplay: true,
104    autoplaySpeed: 3000,
105    infinite: true,
106  });
107
108  var slider = $('.slider-photograph');
109
110  slider.slick({
111    slidesToShow: 1,
112    slidesToScroll: 1,
113    arrows: false,
114    autoplay: true,
115    autoplaySpeed: 6000,
116  });
117
118  $('.slider-btn-prev').on('click', function() {
119    $(slider).slick('slickPrev');
120  });
121  $('.slider-btn-next').on('click', function() {
122    $(slider).slick('slickNext');
123  });
124
125  $('.slider-blog').slick({
126    slidesToShow: 2,
127    slidesToScroll: 1,
128    autoplay: true,
129    autoplaySpeed: 3000,
130    infinite: false
131  });
132  var accordion = new Accordion($('#accordion__two'), false,'.link__click');
133
134  var sliderTestimonial = $('.slider-text');
135  sliderTestimonial.slick({
136    slidesToShow: 1,
137    slidesToScroll: 1,
138    arrows: false,
139    fade: true,
140    asNavFor: '.slider-photographer',
141    autoplay: true,
142    autoplaySpeed: 7000,
143    infinite: true
144  });
145  $('.slider-text-btn-prev').on('click', function () {
146    $(sliderTestimonial).slick('slickPrev');
147  });
148  $('.slider-text-btn-next').on('click', function () {
149    $(sliderTestimonial).slick('slickNext');
150  });
151  $('.slider-photographer').slick({
152    slidesToShow: 3,
153    slidesToScroll: 1,
154    asNavFor: '.slider-text',
155    centerMode: true,
156    centerPadding: '30px',
157    focusOnSelect: true,
158    autoplay: true,
159    autoplaySpeed: 7000,
160    infinite: true,
161    responsive: [
162      {
163        breakpoint: 900,
164        settings: {
165         slidesToShow: 3,
166         slidesToScroll: 1
167        }
168      },
169      {
170          breakpoint: 770,
171          settings: {
172              slidesToShow: 2,
173              slidesToScroll: 1,
174              autoplay: false,
175          }
176      }
177    ]
178  });
179
180  jQuery(window).on("load resize", function () {
181    var viewportWidth = jQuery(window).width();
182    if (viewportWidth < 884) {
183      $(".pagegalleries-slider").slick("unslick");
184      $(".pagegalleries-slider-text").slick("unslick");
185    } else {
186      $(".pagegalleries-slider").slick({
187        slidesToShow: 4,
188        slidesToScroll: 1,
189        asNavFor: ".pagegalleries-slider-text",
190        centerMode: true,
191        centerPadding: "30px",
192        focusOnSelect: true,
193        // autoplay: true,
194        // autoplaySpeed: 3000,
195        infinite: true,
196      });
197
198      $(".pagegalleries-slider-text").slick({
199        slidesToShow: 1,
200        slidesToScroll: 1,
201        arrows: false,
202        fade: true,
203        asNavFor: ".pagegalleries-slider",
204        infinite: true,
205      });
206    }
207  });
208
209  $(document).on("click", ".pagegalleries-slider .item", function () {
210    $(".pagegalleries-slider .item").removeClass("is-active");
211    $(this).addClass("is-active");
212    let itemID = $(this).data("id");
213    let color = $(this).data("color");
214    $(".pagegalleries-slider-text .item").removeClass("is-active");
215    $(".pagegalleries-slider-text .item[data-content=" + itemID + "]").addClass("is-active");
216    $(".galleries .main-testimonials .slider-bg").css('background-color', color);
217  });
218
219  $('.tab-btn').on('click', function() {
220    let id = $(this).attr('data-id')
221
222    $('.tab-btn').removeClass('active')
223    $(this).addClass('active')
224    $('.price__tr').removeClass('active')
225    $('.'+id).addClass('active')
226  });
227
228  var accordion = new Accordion($('#accordion__faq'), false,'.link__faq');
229
230
231  /***************\
232    SIGN-UP FORM
233  \***************/
234  var emailPattern = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,6})+$/;
235
236  // Get the state list when a country is selected
237  $('.sign__up #countrySelect').on('change', function () {
238      // Get a list of the states available for this country
239      let countryInput = $(this);
240      if($(countryInput).val()) {
241        $.get( "https://www.instaproofs.com/home/scripts/getStates.php?country="+$(countryInput).val(), function( data ) {
242            //Empty the state droplist
243            $('.sign__up #stateSelect').empty();
244            
245            //Fill in the state list with states from the selected country
246            $('.sign__up #stateSelect').append($('<option></option>').val('').html('Select State/Province'));
247            $.each(data, function (index, item) {
248                $('.sign__up #stateSelect').append($('<option></option>').val(item['id']).html(item['name']));
249            });
250
251            $(countryInput).closest('.form-group').removeClass('error');
252            $(countryInput).closest('.form-group').find('.error-message').remove();
253        }, "json" );
254      } else {
255        //Remove the selection from the state droplist
256        $('.sign__up #stateSelect').empty();        
257        $('.sign__up #stateSelect').append($('<option></option>').val('').html('Select State/Province'));
258        $('.sign__up #stateSelect').val('');
259        $('.sign__up #stateSelect').change();
260      }
261  });
262
263  // Get rid of the error message when a state has been selected
264  $('.sign__up #stateSelect').on('change', function () {
265      // Get a list of the states available for this country
266      let stateInput = $(this);
267      if($(stateInput).val()) {
268        $(stateInput).closest('.form-group').removeClass('error');
269        $(stateInput).closest('.form-group').find('.error-message').remove();
270      }
271  });
272
273  // Verify that the email address doesn't already exist in our system
274  $('.sign__up #sign-form input[type=email]').on('blur', function () {
275      validateTheEmail($(this), true);
276  });
277
278  function validateTheEmail(emailInput, checkForUnique)
279  {
280    $(emailInput).closest('.form-group').find('.error-message').remove();
281    if(!$(emailInput).val()) {
282      $(emailInput).closest('.form-group').addClass('error');
283      $(emailInput).closest('.form-group').append('<p class="error-message">field can not be empty</p>');
284    } else if(!emailPattern.test($(emailInput).val())) {
285      $(emailInput).closest('.form-group').addClass('error');
286      $(emailInput).closest('.form-group').append('<p class="error-message">valid email required</p>');
287    } else if(checkForUnique) {
288      $.ajax({
289          type: 'GET',
290          url: 'https://www.instaproofs.com/home/scripts/checkEmail.php',
291          data: {email: $(emailInput).val()},
292          dataType: 'json',
293          success: function (data) {
294              $(emailInput).closest('.form-group').removeClass('error');
295              
296              if (data.response === true) {
297                $(emailInput).closest('.form-group').addClass('error');
298                $(emailInput).closest('.form-group').append('<p class="error-message">email already exists</p>');
299              }
300          }
301      });
302    }
303  }
304
305  // Verify that the provided store url doesn't already exist in our system
306  $('.sign__up #sign-form #signup_url').on('keyup', function () {
307      //Remove any non alphanumeric characters
308      if ($(this).val().match(/[^a-zA-Z0-9]/g)) {
309        $(this).val($(this).val().replace(/[^a-zA-Z0-9]/g, ''));
310      }
311
312      //Update the url under the input box
313      let storeInput = $(this);
314      let tempValue = (storeInput.val().length) ? storeInput.val() : "custom_url";
315      $('.example-url').html('<span style="color: #A52A2A;">' + tempValue + '</span>.instaproofs.com');
316
317      //Validate the URL
318      if (storeInput.val().length > 0) {
319          // Make a call to check if the storefront url exists
320          $.ajax({
321              type: 'GET',
322              url: 'https://www.instaproofs.com/home/scripts/checkStorefrontURL.php',
323              data: {url: $(this).val()},
324              dataType: 'json',
325              success: function (data) {
326                  if (data.response === true) {
327                      $(storeInput).closest('.form-group').addClass('error');
328                      $(storeInput).closest('.form-group').append('<p class="error-message">url already exists</p>');
329                      $(storeInput).focus();
330                  } else {
331                      $(storeInput).closest('.form-group').removeClass('error');
332                      $(storeInput).closest('.form-group').find('.error-message').remove();
333                  }
334              }
335          });
336      }
337  });
338  
339  function validateTheElement(element)
340  {
341    let minLength = ($(element).data('minlength')) ? $(element).data('minlength') : 2;
342    let elementType = $(element).attr('type');
343    //console.log('minlength', minLength);
344    //console.log('type', $(element).attr('type'));
345
346    if(elementType != "email") {
347      $(element).closest('.form-group').removeClass('error');
348      $(element).closest('.form-group').find('.error-message').remove();
349    }
350
351    if($(element).val() == "") {
352      $(element).closest('.form-group').addClass('error');
353      $(element).closest('.form-group').find('.error-message').remove();
354      $(element).closest('.form-group').append('<p class="error-message">field can not be empty</p>')
355    } else if(elementType == "email") {
356      validateTheEmail($(element), false);
357    } else if ($(element).val().length > 0 && $(element).val().length < minLength){
358      $(element).closest('.form-group').addClass('error');
359      $(element).closest('.form-group').append('<p class="error-message">requires '+minLength+' or more characters.</p>')
360    } else {
361      $(element).closest('.form-group').removeClass('error');
362      $(element).closest('.form-group').find('.error-message').remove();
363    }
364  }
365
366  // Basic validation
367  function validateTheForm()
368  {
369    $('.step-one .required').each(function(){
370      validateTheElement($(this));
371    });
372  }
373
374  // Submit the form
375  $(document).on('click', '.validateJs .form-btn', function(e) {
376    e.preventDefault();
377
378    // Check for errors on the first page of the form
379    validateTheForm();
380    
381    if(!$('.step-one .error').length){
382      // No validation errors – run reCAPTCHA v3
383      const $btn = $(this);
384      $btn.prop('disabled', true);
385      $btn.text('Wait...');
386
387      grecaptcha.ready(function () {
388        grecaptcha.execute('6LcV8RsrAAAAACDvqt2k50mzv1uQx8vQn8fbl-GA', { action: 'signup' }).then(function (token) {
389          // Add the token to a hidden input (create it if it doesn’t already exist)
390          let $form = $('#sign-form');
391          let $existingInput = $form.find('input[name="recaptcha_token"]');
392
393          if ($existingInput.length === 0) {
394            $('<input>').attr({
395              type: 'hidden',
396              name: 'recaptcha_token',
397              value: token
398            }).appendTo($form);
399          } else {
400            $existingInput.val(token);
401          }
402
403          // Submit the form
404          $.post("scripts/processSignup.php", $form.serialize(), function (data) {
405            try {
406              var result = JSON.parse(data);
407              // console.log(result);
408          
409              if (result.response === true) {
410                $form.attr('action', 'sign-up-complete.html');
411                $form.attr('method', 'post');
412                $form.submit();
413                // $form[0].reset();
414                // location.href = 'sign-up-complete.html';
415              } else {
416                var errorMessage = result.error || 'There was a problem creating your account. Please try again.';
417                alert(errorMessage);
418                console.log("signup results: ", result);
419                $btn.prop('disabled', false);
420                $btn.text('Submit');
421              }
422            } catch (err) {
423              alert("Unexpected error. Please try again.");
424              console.error("Invalid JSON response:", data);
425              $btn.prop('disabled', false);
426              $btn.text('Submit');
427            }
428          });
429        });
430      });
431
432      return false; // prevent default submit behavior
433    }
434  });
435
436
437  /********************\
438    CONTACT US FORM
439  \********************/
440  $('#contactus-form .btn-link').click(function(e) {
441    e.preventDefault();
442    let formError = false;
443    $('#contactus-form .required').each(function(){
444      // Submit the contact request if all of the required items are filled in
445      let thisType = $(this).attr('type');
446      
447      if($(this).val() == "") {
448        if(!formError)
449          $(this).focus();
450        formError = true;
451        $(this).css('background-color','pink');
452      } else if(thisType == "email" && !emailPattern.test($(this).val())) {
453        if(!formError)
454          $(this).focus();
455        formError = true;
456        $(this).css('background-color','pink');
457      } else {
458        $(this).css('background-color','unset');
459      }
460    });
461
462    if(!formError) {
463      $.post("scripts/processContact.php", $("#contactus-form").serialize(), function(data) {
464          //Thank them and then close the contact form
465          $('#contactus-form .contact-details').hide('slow');
466          $('#contactus-form .contact-results').show('slow');
467          $("#contactus-form")[0].reset();
468          setTimeout(function () {
469              $('#contactus-form .contact-results').hide('slow');
470              $('#contactus-form .contact-details').show('slow');
471          }, 6000);
472      });
473      return false;
474    }
475  });
476
477
478  /***************\
479    SIGN-IN FORM
480  \***************/
481  $('#login-form .form-btn.logInJs').on('click', function(e) {
482    e.preventDefault();
483    $(this).prop('disabled', true);
484    $(this).text('Wait...');
485    window.setTimeout(function(){$('#login-form').submit();},500);
486    return false;
487  });
488});
489
490/******************\
491  MODAL OPEN/CLOSE
492\******************/
493function openModal(modalID, pageURL) {
494  $('#'+modalID).fadeIn();
495  $('body').addClass('modal-open');
496  
497  if(pageURL)
498    $('#'+modalID+' .modal-body').load(pageURL);
499}
500function closeModal(modalID) {
501 $('#'+modalID).fadeOut();
502 
503 window.setTimeout(function(){
504  if(!$('.custom-modal:visible').length)
505    $('body').removeClass('modal-open');
506  },700);
507}

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.