PageSourceSearch

https://www.proinspire.org/wp-content/themes/proinspire/js/card-filter.js?ver=7.0.2

js proinspire.org collected 2026-10-03 20:52:14 UTC 11,832 bytes, 386 lines download raw bytes

1(function ($) {
2  $(document).ready(function () {
3    if (window.location.href.indexOf("tfa_next") !== -1) {
4      $(".checkout-container").addClass("hidden");
5      $(".success-message").addClass("active");
6    }
7
8    let hasFilter = false;
9    $(".filter-clear-block").addClass("d-none").removeClass("d-inline-block");
10    $(".filter-clear-block").on("click", function (e) {
11      hasFilter = false;
12
13      $(".filter-clear-block").addClass("d-none").removeClass("d-inline-block");
14
15      $(".section-cards__categories-item").removeClass("active");
16      $(".section-cards__sub-cat-item").removeClass("active");
17      product_ajax("");
18    });
19    $(".section-cards__categories-item").on("click", function (e) {
20      hasFilter = true;
21      e.preventDefault();
22
23      let slug = [];
24
25      $(this).addClass("active");
26
27      $(".section-cards__categories-item.active").each(function () {
28        slug.push($(this).attr("data-id"));
29        console.log(slug);
30      });
31      product_ajax(slug, true);
32    });
33
34    $(".card-item__flip .enlarger").on("click", function (e) {
35      e.preventDefault();
36      e.stopPropagation();
37
38      console.log($(this).parent().find("img"));
39
40      $(".zoomed-view .img-container img").attr(
41        "src",
42        $(this).parent().find("img.enlarge").attr("src")
43      );
44
45      $(".zoomed-view").addClass("active");
46    });
47
48    $(".zoomed-view .enlarger").on("click", function (e) {
49      e.preventDefault();
50      e.stopPropagation();
51
52      $(".zoomed-view").removeClass("active");
53    });
54
55    $(".view-tutorial").on("click", function (e) {
56      e.preventDefault();
57      e.stopPropagation();
58
59      $(".tutorial-view").addClass("active");
60      $("body").addClass("fixed");
61      jQuery(".slick-mobile").slick({
62        dots: false,
63        arrows: false,
64        infinite: true,
65        speed: 300,
66        autoplaySpeed: 5000,
67        slidesToShow: 1,
68        autoplay: true,
69        initialSlide: 2,
70      });
71    });
72
73    $(".zoomed-view .enlarger").on("click", function (e) {
74      e.preventDefault();
75      e.stopPropagation();
76
77      $(".zoomed-view").removeClass("active");
78    });
79
80    $("body").on("click", ".section-cards__sub-cat-item", function (e) {
81      e.preventDefault();
82
83      if ($(this).hasClass("active")) {
84        $(".card-item").removeClass("d-none");
85        $(this).removeClass("active");
86      } else {
87        $(this).addClass("active");
88        let slugs = [];
89
90        $(".section-cards__sub-cat-item.active").each(function () {
91          slugs.push($(this).attr("data-id"));
92        });
93
94        $(".card-item").addClass("d-none");
95        $(".card-item").each(function () {
96          let cats = $(this).attr("data-type");
97          let catArray = cats.split(" ");
98          if (slugs.some((slug) => catArray.includes(slug))) {
99            $(this).removeClass("d-none");
100          }
101        });
102
103        $(".filter-clear-block")
104          .removeClass("d-none")
105          .addClass("d-inline-block");
106      }
107    });
108
109    $("body").on("click", ".card-item__flip", function (e) {
110      e.preventDefault();
111      if ($(this).hasClass("active")) {
112        $(".card-item__flip").removeClass("active");
113      } else {
114        $(".card-item__flip").removeClass("active");
115        $(this).toggleClass("active");
116      }
117    });
118
119    function product_ajax(slug = "", $reset = false) {
120      let action = "filter_cards";
121      if (hasFilter) {
122        action = "filter_cards";
123      } else {
124        action = "reset_cards";
125      }
126      $.ajax({
127        type: "POST",
128        url: "/wp-admin/admin-ajax.php",
129        cache: true,
130        data: {
131          action: action,
132          category: slug,
133        },
134        beforeSend: function () {
135          $("#svg-spinner").removeClass("d-none");
136        },
137        success: function (res) {
138          $("#svg-spinner").addClass("d-none");
139          $("#result").html(res);
140          $(".card-item__flip .enlarger").on("click", function (e) {
141            e.preventDefault();
142            e.stopPropagation();
143
144            console.log($(this).parent().find("img"));
145
146            $(".zoomed-view .img-container img").attr(
147              "src",
148              $(this).parent().find("img.enlarge").attr("src")
149            );
150
151            $(".zoomed-view").addClass("active");
152          });
153
154          $(".zoomed-view .enlarger").on("click", function (e) {
155            e.preventDefault();
156            e.stopPropagation();
157
158            $(".zoomed-view").removeClass("active");
159          });
160          if ($reset == true) {
161            $(".filter-clear-block")
162              .removeClass("d-none")
163              .addClass("d-inline-block");
164          }
165        },
166      });
167    }
168
169    // password protect page
170    $("#password-form").on("submit", function (e) {
171      e.preventDefault();
172      var password = $("#pw-field").val();
173
174      $.ajax({
175        url: "/wp-admin/admin-ajax.php",
176        method: "POST",
177        data: {
178          action: "check_password",
179          password: password,
180        },
181        success: function (response) {
182          if (response == "match") {
183            console.log(response);
184            sessionStorage.setItem("gatedAccess", "true");
185            window.location.href = "/here2listen-flipcards-kfljf8102jfbzz99081";
186          } else {
187            $("#pw-field").addClass("error");
188            $(".error-message").addClass("active");
189            console.log(response);
190          }
191        },
192        error: function (respose) {
193          $("#pw-field").addClass("error");
194          $(".error-message").addClass("active");
195          console.log(response);
196        },
197      });
198    });
199
200    if (window.location.pathname == "/here2listen-register/") {
201      jQuery("#purchase-form").on("submit", function (e) {
202        e.preventDefault();
203
204        grantAccess();
205      });
206
207      let grantAccess = () => {
208        var password = Math.random().toString(36).substring(2, 9).toUpperCase();
209
210        var data = {
211          firstName: $("#inputFirstName").val(),
212          lastName: $("#inputLastName").val(),
213          foundation: $("#inputOrganization").val(),
214          foundationType: $("#foundtationType").val(),
215          title: $("#inputTitle").val(),
216          email: $("#inputEmail").val(),
217          password: password,
218        };
219
220        console.log(data);
221
222        data = { ...data };
223
224        $.ajax({
225          url: "/wp-admin/admin-ajax.php",
226          type: "POST",
227          data: {
228            action: "purchase_action",
229            data: data,
230          },
231          success: function (response) {
232            var emailData = {
233              action: "send_email",
234              email: data["email"],
235              password: password,
236              firstName: data["firstName"],
237              lastName: data["lastName"],
238            };
239
240            $.ajax({
241              url: "/wp-admin/admin-ajax.php",
242              type: "POST",
243              data: {
244                action: "send_email",
245                data: emailData,
246              },
247              success: function (response) {
248                $("#submit_button").click();
249                sessionStorage.setItem("gatedAccess", "true");
250                // Handle the response if needed
251              },
252              error: function (xhr, status, error) {
253                console.error(
254                  "An error occurred while sending the email:",
255                  error
256                );
257                // Handle the error if needed
258              },
259            });
260          },
261          error: function (xhr, status, error) {
262            console.error("An error occurred while saving to db:", error);
263            // Handle the error if needed
264          },
265        });
266      };
267
268      var currentURL = window.location.href;
269    }
270
271    const fieldMapping = {
272      inputFirstName: "tfa_2",
273      inputLastName: "tfa_3",
274      inputOrganization: "tfa_103",
275      foundtationType: "tfa_106",
276      inputTitle: "tfa_105",
277      inputEmail: "tfa_5",
278      inputCity: "tfa_100",
279    };
280
281    // Attach event listener to each field in the first form
282    $.each(fieldMapping, function (sourceFieldId, targetFieldId) {
283      $("#" + sourceFieldId).on("input", function () {
284        const newValue = $(this).val();
285        $("#" + targetFieldId).val(newValue);
286      });
287    });
288  });
289
290  $(document).ready(function () {
291    setTimeout(() => {
292      $(".flipcards-hero__images img").each(function (index) {
293        $(this).addClass("animate-" + (index + 1));
294      });
295    }, 300);
296  });
297})(jQuery);
298
299document.addEventListener("DOMContentLoaded", function () {
300  function positionPointers() {
301    // Example: Positioning the pointer for the first step
302    var targetElement = document.querySelector(
303      ".section-cards:not(.tutorial-view) .section-cards__categories"
304    ); // replace with your target element's selector
305    if (targetElement == null) {
306      return;
307    }
308    var pointer = document.querySelector(".pp-1");
309    var rect = targetElement.getBoundingClientRect();
310
311    pointer.style.left = rect.left + "px";
312    pointer.style.top = rect.top + "px";
313    pointer.style.width = rect.width + "px";
314
315    var targetElement = document.querySelector(
316      ".section-cards:not(.tutorial-view) .section-cards__sub-categories"
317    ); // replace with your target element's selector
318    var pointer = document.querySelector(".pp-2");
319    var rect = targetElement.getBoundingClientRect();
320
321    pointer.style.left = rect.left + "px";
322    pointer.style.top = rect.top + "px";
323    pointer.style.width = rect.width + "px";
324
325    var targetElement = document.querySelector(
326      ".section-cards:not(.tutorial-view) #result"
327    ); // replace with your target element's selector
328    var pointer = document.querySelector(".pp-3");
329    var rect = targetElement.getBoundingClientRect();
330
331    pointer.style.left = rect.left + "px";
332    pointer.style.top = rect.top + "px";
333    pointer.style.width = rect.width + "px";
334
335    var targetElement = document.querySelector(
336      ".section-cards:not(.tutorial-view) #result .card-item:nth-child(1)"
337    ); // replace with your target element's selector
338    var pointer = document.querySelector(".pp-enlarge");
339    var rect = targetElement.getBoundingClientRect();
340
341    pointer.style.left = rect.left + "px";
342    pointer.style.top = rect.top + "px";
343    pointer.style.width = rect.width + "px";
344
345    var targetElement = document.querySelector(
346      ".section-cards:not(.tutorial-view) .filter-clear"
347    ); // replace with your target element's selector
348    var pointer = document.querySelector(".pp-4");
349    var rect = targetElement.getBoundingClientRect();
350
351    pointer.style.left = rect.left + "px";
352    pointer.style.top = rect.top + "px";
353
354    var targetElement = document.querySelector(
355      ".section-cards:not(.tutorial-view) .tutorial-content"
356    ); // replace with your target element's selector
357    var pointer = document.querySelector(".pp-tut");
358    var rect = targetElement.getBoundingClientRect();
359
360    pointer.style.left = rect.left + "px";
361    pointer.style.top = rect.top + "px";
362
363    var targetElement = document.querySelector(
364      ".section-cards:not(.tutorial-view) #result"
365    ); // replace with your target element's selector
366    var pointer = document.querySelector(".pp-5");
367    var rect = targetElement.getBoundingClientRect();
368
369    pointer.style.left = rect.left + "px";
370    pointer.style.top = rect.top + "px";
371    pointer.style.width = rect.width + "px";
372  }
373
374  jQuery(".close-tutorial").on("click", function (e) {
375    e.preventDefault();
376
377    jQuery(".tutorial-view").removeClass("active");
378    jQuery("body").removeClass("fixed");
379  });
380
381  // Call this function once when the page loads
382  positionPointers();
383
384  // Call this function when the page is resized to reposition the pointers
385  window.addEventListener("resize", positionPointers);
386});

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.