PageSourceSearch

https://nextsteprealtymd.com/app/plugins/aios-optin/resources/js/optin.min.js?nocache

js nextsteprealtymd.com collected 2026-09-29 00:49:19 UTC 5,273 bytes, 129 lines download raw bytes

1(function() {
2  function bindMutex(root) {
3    root = root || document;
4    root.querySelectorAll(".aios-cf7-consent-consent-wrap.aios-cf7-consent-both").forEach(function(wrap) {
5      var checkboxes = wrap.querySelectorAll('input[type="checkbox"]');
6      checkboxes.forEach(function(cb) {
7        if (cb["__aios-cf7-consent_bound"]) return;
8        cb["__aios-cf7-consent_bound"] = true;
9        cb.addEventListener("change", function() {
10          if (cb.checked) {
11            checkboxes.forEach(function(other) {
12              if (other !== cb) other.checked = false;
13            });
14          }
15        });
16      });
17    });
18  }
19  bindMutex(document);
20  bindOptionClick(document);
21  document.addEventListener("wpcf7mailsent", function() {
22    bindMutex(document);
23    bindOptionClick(document);
24  });
25  function bindOptionClick(root) {
26    root = root || document;
27    root.querySelectorAll(".aios-cf7-consent-option").forEach(function(wrap) {
28      if (wrap["__aios-cf7-consent_clickbound"]) return;
29      wrap["__aios-cf7-consent_clickbound"] = true;
30      wrap.addEventListener("click", function(e) {
31        if (e.target.closest("a, input, label")) {
32          return;
33        }
34        var cb = wrap.querySelector('input[type="checkbox"], input[type="radio"]');
35        if (cb) {
36          cb.checked = !cb.checked;
37          var evt = document.createEvent("HTMLEvents");
38          evt.initEvent("change", true, false);
39          cb.dispatchEvent(evt);
40        }
41      });
42    });
43  }
44  var config = typeof window["aios-cf7-consentConfig"] !== "undefined" ? window["aios-cf7-consentConfig"] : null;
45  if (!config || !config.forms) return;
46  var modal = null;
47  function buildModal() {
48    if (modal) return;
49    modal = document.createElement("div");
50    modal.className = "aios-cf7-consent-modal-overlay aios-cf7-consent-modal-hidden";
51    modal.innerHTML = '<div class="aios-cf7-consent-modal" role="dialog" aria-modal="true"><p class="aios-cf7-consent-modal-text"></p><div class="aios-cf7-consent-modal-actions"><button type="button" class="aios-cf7-consent-btn aios-cf7-consent-btn-optin"></button><button type="button" class="aios-cf7-consent-btn aios-cf7-consent-btn-optout"></button></div></div>';
52    document.body.appendChild(modal);
53  }
54  function showModal(formConfig, onChoice) {
55    buildModal();
56    modal.querySelector(".aios-cf7-consent-modal-text").innerHTML = formConfig.disclosure;
57    modal.querySelector(".aios-cf7-consent-btn-optin").textContent = formConfig.optin_btn;
58    modal.querySelector(".aios-cf7-consent-btn-optout").textContent = formConfig.optout_btn;
59    modal.classList.remove("aios-cf7-consent-modal-hidden");
60    function finish(choice) {
61      modal.classList.add("aios-cf7-consent-modal-hidden");
62      modal.querySelector(".aios-cf7-consent-btn-optin").onclick = null;
63      modal.querySelector(".aios-cf7-consent-btn-optout").onclick = null;
64      onChoice(choice);
65    }
66    modal.querySelector(".aios-cf7-consent-btn-optin").onclick = function() {
67      finish("agreed");
68    };
69    modal.querySelector(".aios-cf7-consent-btn-optout").onclick = function() {
70      finish("declined");
71    };
72  }
73  function bindModalForm(formEl, formConfig) {
74    function interceptSubmit(e) {
75      if (formEl.dataset.aiosCf7ConsentConsented) return;
76      e.preventDefault();
77      e.stopImmediatePropagation();
78      showModal(formConfig, function(choice) {
79        var hiddenField = formEl.querySelector('input[name="consent_submit"]');
80        if (!hiddenField) {
81          hiddenField = document.createElement("input");
82          hiddenField.type = "hidden";
83          hiddenField.name = "consent_submit";
84          formEl.appendChild(hiddenField);
85        }
86        if (hiddenField) hiddenField.value = choice;
87        formEl.dataset.aiosCf7ConsentConsented = "1";
88        var submitBtn2 = formEl.querySelector('input[type="submit"], button[type="submit"]');
89        if (submitBtn2) {
90          submitBtn2.click();
91        } else {
92          formEl.submit();
93        }
94      });
95    }
96    formEl.addEventListener("submit", interceptSubmit, true);
97    var submitBtn = formEl.querySelector('input[type="submit"], button[type="submit"]');
98    if (submitBtn) {
99      submitBtn.addEventListener("click", function(e) {
100        interceptSubmit(e);
101      }, true);
102    }
103  }
104  function initModals() {
105    document.querySelectorAll(".wpcf7[id]").forEach(function(wrapper) {
106      var match = wrapper.id.match(/wpcf7-f(\d+)-/);
107      if (!match) return;
108      var formId = match[1];
109      if (!config.forms[formId]) return;
110      var formEl = wrapper.querySelector("form.wpcf7-form");
111      if (formEl) bindModalForm(formEl, config.forms[formId]);
112    });
113  }
114  if (document.readyState === "loading") {
115    document.addEventListener("DOMContentLoaded", initModals);
116  } else {
117    initModals();
118  }
119  document.addEventListener("wpcf7mailsent", function(e) {
120    var detail = e.detail || {};
121    var fid = detail.contactFormId || detail.apiResponse && detail.apiResponse.contact_form_id;
122    if (!fid) return;
123    var wrapper = document.querySelector('.wpcf7[id*="wpcf7-f' + fid + '-"]');
124    if (wrapper) {
125      var formEl = wrapper.querySelector("form");
126      if (formEl) delete formEl.dataset.aiosCf7ConsentConsented;
127    }
128  });
129})();

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.