PageSourceSearch

https://visionforsoft.com/wp-content/plugins/sendquicker-4/assets/…dquicker-checkout-capture.js?ver=1790865468

js visionforsoft.com collected 2026-10-01 14:38:23 UTC 3,536 bytes, 102 lines download raw bytes

1jQuery(function ($) {
2  var $form = $('form.checkout');
3  if (!$form.length) return;
4
5  // --- Helpers ------------------------------------------------------------
6  function ensureMirrors() {
7    var names = ['billing_phone', 'billing_email', 'billing_country'];
8    names.forEach(function (n) {
9      var sel = 'input[type="hidden"][name="sendquicker_' + n + '"]';
10      if ($form.find(sel).length === 0) {
11        $('<input>', { type: 'hidden', name: 'sendquicker_' + n }).appendTo($form);
12      }
13    });
14  }
15
16  function syncMirrors() {
17    ensureMirrors();
18    var getVal = function (name) {
19      var $el = $form.find('[name="' + name + '"]');
20      return ($el.val() || '').trim();
21    };
22
23    var phone   = getVal('billing_phone');
24    var email   = getVal('billing_email');
25    var country = getVal('billing_country');
26
27    $form.find('[name="sendquicker_billing_phone"]').val(phone);
28    $form.find('[name="sendquicker_billing_email"]').val(email);
29    $form.find('[name="sendquicker_billing_country"]').val(country);
30
31    try {
32      localStorage.setItem('sq_billing_phone', phone);
33      localStorage.setItem('sq_billing_email', email);
34      localStorage.setItem('sq_billing_country', country);
35    } catch (e) {}
36  }
37
38  // Debounced background ping to server
39  var pingTimer = null;
40  function debouncedPing(delay) {
41    clearTimeout(pingTimer);
42    pingTimer = setTimeout(sendPing, delay || 400);
43  }
44
45  function sendPing() {
46    ensureMirrors();
47    var data = {
48      action: 'sendquicker_capture_checkout',
49      nonce:  (window.sendquicker_front_vars && sendquicker_front_vars.nonce) || '',
50      phone:   $form.find('[name="sendquicker_billing_phone"]').val() || '',
51      email:   $form.find('[name="sendquicker_billing_email"]').val() || '',
52      country: $form.find('[name="sendquicker_billing_country"]').val() || '',
53      fname:   $form.find('[name="billing_first_name"]').val() || '',
54      lname:   $form.find('[name="billing_last_name"]').val() || ''
55    };
56    $.post(
57      (window.sendquicker_front_vars && sendquicker_front_vars.ajaxurl) || '',
58      data
59    );
60  }
61
62  // --- Wire events --------------------------------------------------------
63  // While typing/changing
64  $(document).on(
65    'input change keyup',
66    '#billing_phone, #billing_email, #billing_country, [name="billing_first_name"], [name="billing_last_name"]',
67    function () { syncMirrors(); debouncedPing(400); }
68  );
69
70  // On blur (instant capture when user leaves a field)
71  $(document).on(
72    'blur',
73    '#billing_phone, #billing_email, #billing_country, [name="billing_first_name"], [name="billing_last_name"]',
74    function () { syncMirrors(); sendPing(); }
75  );
76
77  // After WooCommerce refreshes checkout fragments (tax/shipping recalcs)
78  $(document.body).on('updated_checkout', function () {
79    // The DOM was replaced—reacquire form and re-inject mirrors
80    $form = $('form.checkout');
81    syncMirrors();
82    debouncedPing(200);
83  });
84
85  // Safety: if blocks/other scripts replace the form root, watch and re-sync
86  var mo;
87  try {
88    mo = new MutationObserver(function () {
89      var now = $('form.checkout');
90      if (now.length && (!$form.length || now.get(0) !== $form.get(0))) {
91        $form = now;
92        syncMirrors();
93        debouncedPing(200);
94      }
95    });
96    mo.observe(document.body, { childList: true, subtree: true });
97  } catch (e) {}
98
99  // Initial
100  syncMirrors();
101  debouncedPing(200);
102});

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.