PageSourceSearch

https://www.sansa.org.za/wp-content/plugins/gardon-addon/assets/js/gardon-addon.js?ver=1689101352

js sansa.org.za collected 2026-10-01 11:37:50 UTC 15,342 bytes, 494 lines download raw bytes

1(function ($) {
2  "use strict";
3
4  var WidgetDefaultHandler = function ($scope) {
5    if ($scope.find(".odometer").length) {
6      var odo = $(".odometer");
7      odo.each(function () {
8        $(this).appear(function () {
9          var countNumber = $(this).attr("data-count");
10          $(this).html(countNumber);
11        });
12      });
13    }
14
15    if ($scope.find("#datepicker").length) {
16      $("#datepicker").datepicker();
17    }
18
19    if ($scope.find("#datepicker2").length) {
20      $("#datepicker2").datepicker();
21    }
22
23    if ($scope.find("#datepicker-inline").length) {
24      $scope.find("#datepicker-inline").datepicker();
25    }
26
27
28    if ($scope.find(".before-after-twentytwenty").length) {
29      $scope.find(".before-after-twentytwenty").each(function () {
30        var Self = $(this);
31        var objName = Self.attr("id");
32        $scope.find("#" + objName).twentytwenty();
33        $(document).imagesLoaded(function () {
34          var twentyTwentyContainer = "#" + objName;
35          var twentyTwentyHeight = $scope.find(twentyTwentyContainer).height();
36          if (0 === twentyTwentyHeight) {
37            $scope.find(twentyTwentyContainer).trigger("resize");
38          }
39        });
40      });
41    }
42
43
44    if ($scope.find(".masonary-layout").length) {
45      let masonaryElm = $scope.find(".masonary-layout");
46      masonaryElm.imagesLoaded(function () {
47        masonaryElm.isotope({
48          layoutMode: "masonry"
49        });
50      });
51    }
52
53    if ($scope.find(".post-filter").length) {
54      $scope
55        .find(".post-filter li")
56        .children(".filter-text")
57        .on("click", function () {
58          var Self = $(this);
59          var selector = Self.parent().attr("data-filter");
60          $(".post-filter li").removeClass("active");
61          Self.parent().addClass("active");
62          $(".filter-layout").isotope({
63            filter: selector,
64            animationOptions: {
65              duration: 500,
66              easing: "linear",
67              queue: false
68            }
69          });
70          return false;
71        });
72    }
73
74    if ($scope.find(".tabs-box").length) {
75      $scope.find(".tabs-box .tab-buttons .tab-btn").on("click", function (e) {
76        e.preventDefault();
77        var target = $($(this).attr("data-tab"));
78
79        if ($(target).is(":visible")) {
80          return false;
81        } else {
82          target
83            .parents(".tabs-box")
84            .find(".tab-buttons")
85            .find(".tab-btn")
86            .removeClass("active-btn");
87          $(this).addClass("active-btn");
88          target
89            .parents(".tabs-box")
90            .find(".tabs-content")
91            .find(".tab")
92            .fadeOut(0);
93          target
94            .parents(".tabs-box")
95            .find(".tabs-content")
96            .find(".tab")
97            .removeClass("active-tab");
98          $(target).fadeIn(300);
99          $(target).addClass("active-tab");
100        }
101      });
102    }
103
104    if ($scope.find(".neighborhoods__faq").length) {
105      $scope
106        .find(".neighborhoods__faq")
107        .find(".accrodion")
108        .each(function () {
109          $(this).on("click", function () {
110            let tabName = $(this).data("name");
111            $(".neighborhoods__img-box")
112              .find(".neighborhoods__location-1")
113              .removeClass("active");
114            $(".neighborhoods__img-box")
115              .find(".neighborhoods__location-1." + tabName)
116              .addClass("active");
117          });
118        });
119    }
120
121    // Accrodion
122    if ($scope.find(".accrodion-grp").length) {
123      var accrodionGrp = $(".accrodion-grp");
124      accrodionGrp.each(function () {
125        var accrodionName = $(this).data("grp-name");
126        var Self = $(this);
127        var accordion = Self.find(".accrodion");
128        Self.addClass(accrodionName);
129        Self.find(".accrodion .accrodion-content").hide();
130        Self.find(".accrodion.active").find(".accrodion-content").show();
131        accordion.each(function () {
132          $(this)
133            .find(".accrodion-title")
134            .on("click", function () {
135              if ($(this).parent().hasClass("active") === false) {
136                $(".accrodion-grp." + accrodionName)
137                  .find(".accrodion")
138                  .removeClass("active");
139                $(".accrodion-grp." + accrodionName)
140                  .find(".accrodion")
141                  .find(".accrodion-content")
142                  .slideUp();
143                $(this).parent().addClass("active");
144                $(this).parent().find(".accrodion-content").slideDown();
145              }
146            });
147        });
148      });
149    }
150
151    // Popular Causes Progress Bar
152    if ($scope.find(".count-bar").length) {
153      $(".count-bar").appear(
154        function () {
155          var el = $(this);
156          var percent = el.data("percent");
157          $(el).css("width", percent).addClass("counted");
158        }, {
159          accY: -50
160        }
161      );
162    }
163
164    // Popular Causes Progress Bar
165    if ($scope.find(".circle-progress").length) {
166      $(".circle-progress").appear(function () {
167        let circleProgress = $(".circle-progress");
168        circleProgress.each(function () {
169          let progress = $(this);
170          let progressOptions = progress.data("options");
171          progress.circleProgress(progressOptions);
172        });
173      });
174    }
175
176    //Fact Counter + Text Count
177    if ($scope.find(".count-box").length) {
178      $(".count-box").appear(
179        function () {
180          var $t = $(this),
181            n = $t.find(".count-text").attr("data-stop"),
182            r = parseInt($t.find(".count-text").attr("data-speed"), 10);
183
184          if (!$t.hasClass("counted")) {
185            $t.addClass("counted");
186            $({
187              countNum: $t.find(".count-text").text()
188            }).animate({
189              countNum: n
190            }, {
191              duration: r,
192              easing: "linear",
193              step: function () {
194                $t.find(".count-text").text(Math.floor(this.countNum));
195              },
196              complete: function () {
197                $t.find(".count-text").text(this.countNum);
198              }
199            });
200          }
201        }, {
202          accY: 0
203        }
204      );
205    }
206
207    let thmSwiperSliders = $scope.find(".thm-swiper__slider");
208    if (thmSwiperSliders.length) {
209      thmSwiperSliders.each(function () {
210        let elm = $(this);
211        let options = elm.data("swiper-options");
212        let thmSwiperSlider = new Swiper(
213          elm,
214          "object" === typeof options ? options : JSON.parse(options)
215        );
216      });
217    }
218
219    let thmOwlCarousels = $scope.find(".thm-owl__carousel");
220    if (thmOwlCarousels.length) {
221      thmOwlCarousels.each(function () {
222        let elm = $(this);
223        let options = elm.data("owl-options");
224        let thmOwlCarousel = elm.owlCarousel(
225          "object" === typeof options ? options : JSON.parse(options)
226        );
227      });
228    }
229
230    let thmOwlNavCarousels = $scope.find(".thm-owl__carousel--custom-nav");
231    if (thmOwlNavCarousels.length) {
232      thmOwlNavCarousels.each(function () {
233        let elm = $(this);
234        let owlNavPrev = elm.data("owl-nav-prev");
235        let owlNavNext = elm.data("owl-nav-next");
236        $(owlNavPrev).on("click", function (e) {
237          elm.trigger("prev.owl.carousel");
238          e.preventDefault();
239        });
240
241        $(owlNavNext).on("click", function (e) {
242          elm.trigger("next.owl.carousel");
243          e.preventDefault();
244        });
245      });
246    }
247
248    if ($scope.find("#testimonials-two__thumb").length) {
249      let testimonialsThumb = new Swiper("#testimonials-two__thumb", {
250        slidesPerView: 3,
251        spaceBetween: 0,
252        speed: 1400,
253        watchSlidesVisibility: true,
254        watchSlidesProgress: true,
255        loop: true,
256        autoplay: {
257          delay: 5000
258        }
259      });
260
261      let testimonialsCarousel = new Swiper("#testimonials-two__carousel", {
262        observer: true,
263        observeParents: true,
264        speed: 1400,
265        mousewheel: false,
266        slidesPerView: 1,
267        autoplay: {
268          delay: 5000
269        },
270        thumbs: {
271          swiper: testimonialsThumb
272        },
273        pagination: {
274          el: "#testimonials-one__carousel-pagination",
275          type: "bullets",
276          clickable: true
277        }
278      });
279    }
280    if ($scope.find(".post-filter").length) {
281      var postFilterList = $(".post-filter li");
282      // for first init
283      $(".filter-layout").isotope({
284        filter: ".filter-item",
285        animationOptions: {
286          duration: 500,
287          easing: "linear",
288          queue: false
289        }
290      });
291      // on click filter links
292      postFilterList.on("click", function () {
293        var Self = $(this);
294        var selector = Self.attr("data-filter");
295        postFilterList.removeClass("active");
296        Self.addClass("active");
297
298        $(".filter-layout").isotope({
299          filter: selector,
300          animationOptions: {
301            duration: 500,
302            easing: "linear",
303            queue: false
304          }
305        });
306        return false;
307      });
308    }
309  };
310
311  var WidgetFaqHandler = function ($scope) {
312    if ($scope.find(".accrodion-grp").length) {
313      var accrodionGrp = $(".accrodion-grp");
314      accrodionGrp.each(function () {
315        var accrodionName = $(this).data("grp-name");
316        var Self = $(this);
317        var accordion = Self.find(".accrodion");
318        Self.addClass(accrodionName);
319        Self.find(".accrodion .accrodion-content").hide();
320        Self.find(".accrodion.active").find(".accrodion-content").show();
321        accordion.each(function () {
322          $(this)
323            .find(".accrodion-title")
324            .on("click", function () {
325              if ($(this).parent().hasClass("active") === false) {
326                $(".accrodion-grp." + accrodionName)
327                  .find(".accrodion")
328                  .removeClass("active");
329                $(".accrodion-grp." + accrodionName)
330                  .find(".accrodion")
331                  .find(".accrodion-content")
332                  .slideUp();
333                $(this).parent().addClass("active");
334                $(this).parent().find(".accrodion-content").slideDown();
335              }
336            });
337        });
338      });
339    }
340  };
341
342  if ($("#history-one__thumb").length) {
343    let testimonialsThumb = new Swiper("#history-one__thumb", {
344      slidesPerView: 5,
345      spaceBetween: 0,
346      speed: 1400,
347      watchSlidesVisibility: true,
348      watchSlidesProgress: true,
349      loop: true,
350      autoplay: {
351        delay: 5000
352      }
353    });
354
355    let testimonialsCarousel = new Swiper("#history-one__carousel", {
356      observer: true,
357      observeParents: true,
358      loop: true,
359      speed: 1400,
360      mousewheel: false,
361      slidesPerView: 1,
362      spaceBetween: 72,
363      autoplay: {
364        delay: 5000
365      },
366      thumbs: {
367        swiper: testimonialsThumb
368      },
369      pagination: {
370        el: "#testimonials-one__carousel-pagination",
371        type: "bullets",
372        clickable: true
373      },
374
375      navigation: {
376        nextEl: "#history-one__swiper-button-next",
377        prevEl: "#history-one__swiper-button-prev"
378      }
379    });
380  }
381
382  var WidgetFooterSubscribeHandler = function ($scope) {
383    // mailchimp form
384    if ($scope.find(".mc-form").length) {
385      $(".mc-form").each(function () {
386        var Self = $(this);
387        var mcURL = Self.data("url");
388        var mcResp = Self.parent().find(".mc-form__response");
389
390        Self.ajaxChimp({
391          url: mcURL,
392          callback: function (resp) {
393            // appending response
394            mcResp.append(function () {
395              return '<p class="mc-message">' + resp.msg + "</p>";
396            });
397            // making things based on response
398            if (resp.result === "success") {
399              // Do stuff
400              Self.removeClass("errored").addClass("successed");
401              mcResp.removeClass("errored").addClass("successed");
402              Self.find("input").val("");
403
404              mcResp.find("p").fadeOut(10000);
405            }
406            if (resp.result === "error") {
407              Self.removeClass("successed").addClass("errored");
408              mcResp.removeClass("successed").addClass("errored");
409              Self.find("input").val("");
410
411              mcResp.find("p").fadeOut(10000);
412            }
413          }
414        });
415      });
416    }
417  };
418
419  //elementor front start
420  $(window).on("elementor/frontend/init", function () {
421    elementorFrontend.hooks.addAction(
422      "frontend/element_ready/widget",
423      WidgetDefaultHandler
424    );
425
426    elementorFrontend.hooks.addAction(
427      "frontend/element_ready/gardon-faq.default",
428      WidgetFaqHandler
429    );
430
431    elementorFrontend.hooks.addAction(
432      "frontend/element_ready/footer-subscribe.default",
433      WidgetFooterSubscribeHandler
434    );
435  });
436
437  // login 
438  $("#gardon-login").submit(function (event) {
439
440    event.preventDefault();
441
442    var login = 'action=signup_paragon&param=login&' + $(this).serialize();
443    $.ajax({
444      type: "POST",
445      url: gardon_login_object.ajaxurl,
446      data: login,
447      beforeSend: function () {
448        // setting a timeout
449        $(".login-result").addClass('loading');
450      },
451      success: function (data) {
452        $(".login-result").removeClass('loading');
453        if (data.status == 2) {
454          $(".login-result").removeClass('alert alert-warning');
455          $(".login-result").html(data.message).addClass('alert alert-success');
456          window.location.href = gardon_login_object.login_redirect_url;
457        } else if (data.status == 1) {
458          $(".login-result").html(data.message).addClass('alert alert-warning');
459        } else {
460          $(".login-result").html(gardon_login_object.message).addClass('alert alert-warning');
461        }
462      }
463    });
464  }); //end login
465
466
467  // register 
468  $("#gardon-registration").submit(function (event) {
469
470    event.preventDefault();
471
472    var signupForm = 'action=signup_paragon&param=register&' + $(this).serialize();
473    $.ajax({
474      type: "POST",
475      url: gardon_login_object.ajaxurl,
476      data: signupForm,
477      beforeSend: function () {
478        // setting a timeout
479        $(".registration-result").addClass('loading');
480      },
481      success: function (data) {
482        $(".registration-result").removeClass('loading');
483        if (data.status == 2) {
484          $(".registration-result").removeClass('alert alert-warning');
485          $(".registration-result").html(data.message).addClass('alert alert-success');
486          window.location.href = gardon_login_object.registration_redirect_url;
487        } else {
488          $(".registration-result").html(data.message).addClass('alert alert-warning');
489        }
490      }
491    });
492  }); //end register
493
494})(jQuery);

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.