PageSourceSearch

https://www.maxkravmaga.com/wp-content/plugins/memberpress/js/signup.js?ver=4.9.28

js maxkravmaga.com collected 2026-10-02 13:37:31 UTC 5,563 bytes, 161 lines download raw bytes

1(function($) {
2  $(document).ready(function() {
3    var meprValidateInput = function (obj) {
4      $(obj).removeClass('invalid');
5
6      var form = $(obj).closest('.mepr-signup-form');
7
8      if ($(obj).attr('required') !== undefined) {
9        var notBlank = true;
10        if ($(obj).is('input') || $(obj).is('select') || $(obj).is('textarea')) {
11          notBlank = mpValidateNotBlank($(obj).val());
12        }
13        else if ($(obj).hasClass('mepr-checkbox-field')) {
14          notBlank = $(obj).find('input').is(':checked');
15        }
16        else if ($(obj).hasClass('mepr-radios-field') || $(obj).hasClass('mepr-checkboxes-field')) {
17          var input_vals = [];
18          $.each($(obj).find('input'), function (i, obj) {
19            if($(obj).is(':checked')) {
20              input_vals.push(true);
21            }
22          });
23
24          notBlank = mpValidateNotBlank(input_vals);
25        }
26
27        mpToggleFieldValidation($(obj), notBlank);
28      }
29
30      // Validate actual email only if it's not empty otherwise let the required/un-required logic hold
31      if ($(obj).attr('type')==='email' && $(obj).val().length > 0) {
32        var validEmail = mpValidateEmail($(obj).val());
33        mpToggleFieldValidation($(obj), validEmail);
34      }
35
36      // Validate the URL by using the browser validation functions
37      if ($(obj).attr('type')==='url' && $(obj).val().length > 0) {
38        var validURL = $(obj).is(':valid');
39        mpToggleFieldValidation($(obj), validURL);
40      }
41
42      if ($(obj).hasClass('mepr-password-confirm')) {
43        var confirmMatch = $(obj).val() === form.find('.mepr-password').val();
44        mpToggleFieldValidation($(obj), confirmMatch);
45      }
46
47      if ($(obj).hasClass('mepr-coupon-code') && $(obj).val().match(/(\s|\S)/)) {
48        $(obj).prev('.mp-form-label').find('.mepr-coupon-loader').fadeIn();
49
50        var data = {
51          action: 'mepr_validate_coupon',
52          code: $(obj).val(),
53          prd_id: $(obj).attr("data-prd-id"),
54          coupon_nonce: MeprSignup.coupon_nonce
55        };
56
57        $.post(MeprI18n.ajaxurl, data, function(res) {
58          $(obj).prev('.mp-form-label').find('.mepr-coupon-loader').hide();
59          res = res.trim();
60          mpToggleFieldValidation($(obj), (res.toString() == 'true'));
61
62          if(res.toString() == 'true') {
63            var data_two = {
64              action: 'mepr_update_price_string_with_coupon',
65              code: $(obj).val(),
66              prd_id: $(obj).attr("data-prd-id"),
67              coupon_nonce: MeprSignup.coupon_nonce
68            };
69
70            $.post(MeprI18n.ajaxurl, data_two, function(res_two) {
71              res_two = res_two.trim();
72              if(res_two.toString() != 'false') {
73                form.find('div.mepr_price_cell').text(res_two);
74                $('body').animate( {
75                  scrollTop: form.find('div.mepr_price_cell').offset().top
76                }, 200, function() {
77                  form.find('div.mepr_price_cell').parent().hide();
78                  form.find('div.mepr_price_cell').parent().fadeIn(1000);
79                });
80              }
81            });
82          }
83        });
84      }
85
86      $(obj).trigger('mepr-validate-input');
87    };
88
89    $('body').on('focus', '.mepr-form .mepr-form-input', function (e) {
90      $(this).prev('.mp-form-label').find('.cc-error').hide();
91      $(this).removeClass('invalid');
92    });
93
94    $('body').on('blur', '.mepr-form .mepr-form-input', function (e) {
95      //Don't validate date fields here, wait til the push the submit button
96      if(!$(this).hasClass('mepr-date-picker')) {
97        meprValidateInput(this);
98      }
99    });
100
101    // Specific to validating with the datepicker ui text field
102    $('body').on('mepr-date-picker-closed', '.mepr-form .mepr-form-input.mepr-date-picker', function (e, date, inst) {
103      meprValidateInput(this);
104    });
105
106    $('body').on('click', '.mepr-signup-form .mepr-submit', function (e) {
107      // We want to control if/when the form is submitted
108      e.preventDefault();
109
110      var form = $(this).closest('.mepr-signup-form');
111      var button = $(this);
112
113      $.each(form.find('.mepr-form-input'), function(i,obj) {
114        meprValidateInput(obj);
115      });
116
117      if (0 < form.find('.invalid').length) {
118        form.find('.validation').addClass('failed');
119      }
120      else {
121        form.find('.validation').addClass('passed');
122        this.disabled = true;
123        $('.mepr-loading-gif').show();
124        $(this).trigger('mepr-register-submit');
125        form.submit();
126      }
127    });
128
129    $('body').on('click', '.mepr-signup-form .mepr_payment_method input.mepr-form-radio', function (e) {
130      var form = $(this).closest('.mepr-signup-form');
131
132      var pmid = '#mp-pm-desc-' + $(this).val();
133      var pmid_exists = (form.find(pmid).length > 0);
134
135      form.find('.mepr-payment-method-desc-text').addClass('mepr-close');
136
137      if(pmid_exists) {
138        form.find(pmid).removeClass('mepr-close');
139      }
140
141      //If nothing has the mepr-close class, we still need to show this one's description
142      var mepr_close_exists = (form.find('.mepr-payment-method-desc-text.mepr-close').length > 0);
143
144      if(mepr_close_exists) {
145        form.find('.mepr-payment-method-desc-text.mepr-close').slideUp({
146          duration: 200,
147          complete: function() {
148            if(pmid_exists) {
149              form.find(pmid).slideDown(200);
150            }
151          }
152        });
153      } else {
154        if(pmid_exists) {
155          form.find(pmid).slideDown(200);
156        }
157      }
158    });
159  });
160})(jQuery);
161

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.