PageSourceSearch

https://cesarkaikarate.com/wp-content/plugins/market-muscles-llc-w…/js/mm-form.js?ver=202610051002

js cesarkaikarate.com collected 2026-10-05 10:30:26 UTC 13,401 bytes, 457 lines download raw bytes

1function submitForm(data, success, error) {
2  try {
3    if (sessionStorage.getItem("mmcrm_original_referrer")) {
4      data["mmcrm_original_referrer"] = sessionStorage.getItem(
5        "mmcrm_original_referrer"
6      );
7    }
8  } catch (error) {
9    console.log("Error injecting Original Referrer property", error);
10  }
11
12  // Capture original landing page
13  try {
14    if (sessionStorage.getItem("mmcrm_original_landing_page")) {
15      data["mmcrm_original_landing_page"] = sessionStorage.getItem(
16        "mmcrm_original_landing_page"
17      );
18    }
19  } catch (error) {
20    console.log("Error injecting Original Landing Page property", error);
21  }
22
23  grecaptcha.enterprise.ready(async () => {
24    const formData = data;
25    const grctoken = await grecaptcha.enterprise.execute(
26      "6LfX_CAqAAAAAOjWa8Xax3f5C_ki9X_O_gFhZLFh",
27      {
28        action: "submit",
29      }
30    );
31
32    formData.grctoken = grctoken;
33
34    jQuery.ajax({
35      dataType: "json",
36      type: "POST",
37      url: frontend_ajax_object.ajaxurl,
38      data: formData,
39      success: success,
40      error: error,
41    });
42  });
43}
44
45jQuery(document).ready(function () {
46  let params = new URLSearchParams(document.location.search);
47
48  // Capture referrer
49  try {
50    if (
51      !sessionStorage.getItem("mmcrm_original_referrer") &&
52      document.referrer !== ""
53    ) {
54      sessionStorage.setItem("mmcrm_original_referrer", document.referrer);
55    }
56  } catch (error) {
57    console.log("Error capturing referrer", error);
58  }
59
60  try {
61    if (!sessionStorage.getItem("mmcrm_original_landing_page")) {
62      sessionStorage.setItem("mmcrm_original_landing_page", document.URL);
63    }
64  } catch (error) {
65    console.log("Error capturing original landing page", error);
66  }
67
68  // Capture UTM Parameters
69  const utmParameterNames = [
70    "utm_source",
71    "utm_medium",
72    "utm_campaign",
73    "utm_term",
74    "utm_content",
75  ];
76
77  jQuery(document).on("submit", "form.mm-custom-form-home", function (e) {
78    e.preventDefault();
79    var $form = jQuery(this);
80
81    // Check if the form is busy
82    if ($form.data("busy")) {
83      return;
84    }
85
86    var full_name = $form.find('input[name="full_name"]').val();
87    var email = $form.find('input[name="email"]').val();
88    var phone = $form.find('input[name="phone"]').val();
89    var program_id_select = $form.find(".mm-programs option:selected");
90
91    if (program_id_select.length) {
92      var program_id = program_id_select.val();
93    } else {
94      var program_id = $form.find('input[name="program"]').val();
95    }
96
97    var pain_point = $form.find('input[name="pain_point"]').val();
98    var location = $form
99      .find('.mm-location option:selected, input[name="location"]')
100      .val();
101    var contact_by_phone = $form
102      .find('input[name="contact_me_by_phone"]:checked')
103      .val();
104    var $fieldset = $form.find("fieldset");
105    var instance_id = $form.data("instance");
106    var tags = $form.find('input[name="tags"]').val();
107    var contact_method_el = $form.find(".mm-contact option:selected");
108    var contact_method = "";
109
110    if (contact_method_el.length) {
111      contact_method = contact_method_el.val();
112    }
113
114    // Set the form as busy
115    $form.data("busy", true);
116    $fieldset.attr("disabled", "disabled");
117    $message = jQuery("#mm-form-submission-message-home" + instance_id + "");
118
119    let formData = {
120      full_name: full_name,
121      email: email,
122      phone: phone,
123      program_id: program_id,
124      pain_point: pain_point,
125      location: location,
126      tags: tags,
127      contact_method: contact_method,
128      contact_by_phone: contact_by_phone,
129      action: "mm_custom_form_home_submit",
130    };
131
132    try {
133      utmParameterNames.forEach((name) => {
134        let value = params.get(name);
135
136        if (value && value.length > 0) {
137          formData[name] = value;
138        }
139      });
140    } catch (error) {
141      console.log("Error capturing UTM values", error);
142    }
143
144    submitForm(
145      formData,
146      function (res) {
147        if (res.status == 1) {
148          if (res.data.type == "text") {
149            $message.html(res.data.text).hide();
150            tb_show(
151              "",
152              "#TB_inline?&width=370&height=200&inlineId=mm-form-submission-message-home" +
153                instance_id +
154                ""
155            );
156
157            // Free up the form
158            $form.data("busy", false);
159            $fieldset.removeAttr("disabled");
160          } else if (res.data.type == "url") {
161            // Redirect visitor
162            window.location = res.data.url;
163          } else {
164            console.log(
165              "Form Submitted. But form setting not found for selected program"
166            );
167          }
168        } else if (res.status == 0) {
169          $message.html("<span>" + res.message + "</span>").show();
170          $message.find("span").delay(15000).fadeOut(1000, "linear");
171
172          // Free up the form
173          $form.data("busy", false);
174          $fieldset.removeAttr("disabled");
175        }
176      },
177      function (e, res) {
178        console.log(
179          "Oops something wrong happened during form submission!",
180          e,
181          res
182        );
183      }
184    );
185  });
186
187  jQuery(document).on("submit", "form.mm-custom-form-program", function (e) {
188    e.preventDefault();
189    var $form = jQuery(this);
190
191    // Check if the form is busy
192    if ($form.data("busy")) {
193      return;
194    }
195
196    var full_name = $form.find('input[name="full_name"]').val();
197    var email = $form.find('input[name="email"]').val();
198    var phone = $form.find('input[name="phone"]').val();
199    var program_id = $form.find('input[name="program_id"]').val();
200    var pain_point = $form.find('input[name="pain_point"]').val();
201    var contact_by_phone = $form
202      .find('input[name="contact_me_by_phone"]:checked')
203      .val();
204    var location = $form
205      .find('.mm-location option:selected, input[name="location"]')
206      .val();
207    var $fieldset = $form.find("fieldset");
208    var tags = $form.find('input[name="tags"]').val();
209    var source = $form.find('input[name="source"]').val();
210
211    var contact_method_el = $form.find(".mm-contact option:selected");
212    var contact_method = "";
213
214    if (contact_method_el.length) {
215      contact_method = contact_method_el.val();
216    }
217
218    var instance_id = $form.data("instance");
219
220    var $message = jQuery("#mm-form-submission-message-program" + instance_id);
221
222    // Set the form as busy
223    $form.data("busy", true);
224    $fieldset.attr("disabled", "disabled");
225
226    submitForm(
227      {
228        full_name: full_name,
229        email: email,
230        phone: phone,
231        program_id: program_id,
232        pain_point: pain_point,
233        location: location,
234        tags: tags,
235        source: source,
236        contact_method: contact_method,
237        contact_by_phone: contact_by_phone,
238        action: "mm_custom_form_program_submit",
239      },
240      function (res) {
241        if (res.status == 1) {
242          if (res.data.type == "text") {
243            $message.html("<p>" + res.data.text + "</p>").hide();
244            tb_show(
245              "",
246              "#TB_inline?&width=370&height=200&inlineId=mm-form-submission-message-program" +
247                instance_id
248            );
249
250            // Free up the form
251            $form.data("busy", false);
252            $fieldset.removeAttr("disabled");
253          } else if (res.data.type == "url") {
254            var redirect_url = res.data.url;
255
256            // Check if notifications have already been handled by the system
257            if (!res.data.hasOwnProperty("handled") || !res.data.handled) {
258              window.location = redirect_url;
259            } else {
260              // Redirect visitor
261              window.location = res.data.url;
262            }
263          } else {
264            console.log(
265              "Form Submitted. But form setting not found for selected program"
266            );
267
268            // Free up the form
269            $form.data("busy", false);
270            $fieldset.removeAttr("disabled");
271          }
272        } else if (res.status == 0) {
273          $message.html("<span>" + res.message + "</span>").show();
274          $message.find("span").delay(15000).fadeOut(1000, "linear");
275
276          // Free up the form
277          $form.data("busy", false);
278          $fieldset.removeAttr("disabled");
279        }
280      },
281      function (e, res) {
282        console.log(
283          "Oops something wrong happened during form submission!",
284          e,
285          res
286        );
287      }
288    );
289  });
290
291  jQuery(document).on("change", ".mm-programs", function (e) {
292    var program_id = jQuery(this)
293      .closest("form")
294      .find(".mm-programs option:selected")
295      .val();
296
297    var $this = jQuery(this);
298
299    // Clear the location
300    $this.closest("form").find(".mm-location").val(null);
301
302    submitForm(
303      {
304        program_id: program_id,
305        action: "get_locations_for_program",
306      },
307      function (res) {
308        var location_options = '<option value="">Select Location*</option>';
309        if (res && res.status == 1) {
310          jQuery(res.locations).each(function (key, value) {
311            location_options +=
312              '<option value="' +
313              value.post_name +
314              '">' +
315              value.post_title +
316              "</option>";
317          });
318
319          $locationField = $this.closest("form").find(".mm-location");
320
321          $locationField.html(location_options);
322          $locationField.val(null);
323        }
324      },
325      function () {
326        console.log("Oops something wrong happened!");
327      }
328    );
329  });
330
331  jQuery(document).on("submit", "form.mm-form-module", function (e) {
332    e.preventDefault();
333    var $form = jQuery(this);
334
335    // Check if the form is busy
336    if ($form.data("busy")) {
337      return;
338    }
339
340    var full_name = $form.find('input[name="full_name"]').val();
341    var email = $form.find('input[name="email"]').val();
342    var phone = $form.find('input[name="phone"]').val();
343    var program_id = $form.find('[name="program_id"]').val();
344    var pain_point = $form.find('input[name="pain_point"]').val();
345    var contact_by_phone = $form
346      .find('input[name="contact_me_by_phone"]:checked')
347      .val();
348    var location = $form
349      .find('.mm-location option:selected, input[name="location"]')
350      .val();
351    var $fieldset = $form.find("fieldset");
352    var tags = $form.find('input[name="tags"]').val();
353    var source = $form.find('input[name="source"]').val();
354
355    var contact_method_el = $form.find(".mm-contact option:selected");
356    var contact_method = "";
357
358    if (contact_method_el.length) {
359      contact_method = contact_method_el.val();
360    }
361
362    var instance_id = $form.data("instance");
363
364    var redirectUrl = $form.data("redirect");
365
366    var $message = jQuery("#mm-form-submission-message-module" + instance_id);
367
368    // Set the form as busy
369    $form.data("busy", true);
370    $fieldset.attr("disabled", "disabled");
371
372    submitForm(
373      {
374        full_name: full_name,
375        email: email,
376        phone: phone,
377        program_id: program_id,
378        pain_point: pain_point,
379        location: location,
380        tags: tags,
381        source: source,
382        contact_method: contact_method,
383        contact_by_phone: contact_by_phone,
384        action: "mm_custom_form_program_submit",
385      },
386      function (res) {
387        if (res.status == 1) {
388          if (redirectUrl && redirectUrl.length > 0) {
389            window.location = redirectUrl;
390            return;
391          }
392
393          if (res.data.type == "text") {
394            $message.html("<p>" + res.data.text + "</p>").hide();
395            tb_show(
396              "",
397              "#TB_inline?&width=370&height=200&inlineId=mm-form-submission-message-program" +
398                instance_id
399            );
400
401            // Free up the form
402            $form.data("busy", false);
403            $fieldset.removeAttr("disabled");
404          } else if (res.data.type == "url") {
405            var redirect_url = res.data.url;
406
407            // Check if notifications have already been handled by the system
408            if (!res.data.hasOwnProperty("handled") || !res.data.handled) {
409              window.location = redirect_url;
410            } else {
411              // Redirect visitor
412              window.location = res.data.url;
413            }
414          } else {
415            console.log(
416              "Form Submitted. But form setting not found for selected program"
417            );
418
419            // Free up the form
420            $form.data("busy", false);
421            $fieldset.removeAttr("disabled");
422          }
423        } else if (res.status == 0) {
424          $message.html("<span>" + res.message + "</span>").show();
425          $message.find("span").delay(15000).fadeOut(1000, "linear");
426
427          // Free up the form
428          $form.data("busy", false);
429          $fieldset.removeAttr("disabled");
430        }
431      },
432      function (e, res) {
433        console.log(
434          "Oops something wrong happened during form submission!",
435          e,
436          res
437        );
438      }
439    );
440  });
441});
442
443jQuery(document).ready(async function () {
444  try {
445    const response = await fetch(
446      "https://crm.marketmuscles.com/api/form/settings"
447    );
448    if (!response.ok) {
449      throw new Error(`Response status: ${response.status}`);
450    }
451
452    const json = await response.json();
453    console.log(json);
454  } catch (error) {
455    console.error(error.message);
456  }
457});

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.