PageSourceSearch

https://www.sansa.org.za/wp-content/themes/gardon/assets/js/gardon-theme.js?ver=1790241998

js sansa.org.za collected 2026-09-24 09:27:35 UTC 8,838 bytes, 279 lines download raw bytes

1(function ($) {
2  "use strict";
3
4  if ($(".main-menu__list").length) {
5    let menuElement = $(".main-menu__list");
6    let currentMenuItem = menuElement.find("li.current-menu-item");
7    let currentMenuParent = menuElement.find("li.current-menu-parent");
8    let currentMenuAncestor = menuElement.find("li.current-menu-ancestor");
9    let currentPageItem = menuElement.find("li.current_page_item");
10    currentMenuItem.addClass("current");
11    currentMenuParent.addClass("current");
12    currentMenuAncestor.addClass("current");
13    currentPageItem.addClass("current");
14  }
15
16  if ($(".service-details__category-list").length) {
17    let menuElement = $(".service-details__category-list");
18    let currentMenuItem = menuElement.find("li.current-menu-item");
19    let currentMenuParent = menuElement.find("li.current-menu-parent");
20    let currentMenuAncestor = menuElement.find("li.current-menu-ancestor");
21    let currentPageItem = menuElement.find("li.current_page_item");
22    currentMenuItem.addClass("active");
23    currentMenuParent.addClass("active");
24    currentMenuAncestor.addClass("active");
25    currentPageItem.addClass("active");
26  }
27
28  // Accrodion
29  if ($(".accrodion-grp").length) {
30    var accrodionGrp = $(".accrodion-grp");
31    accrodionGrp.each(function () {
32      var accrodionName = $(this).data("grp-name");
33      var Self = $(this);
34      var accordion = Self.find(".accrodion");
35      Self.addClass(accrodionName);
36      Self.find(".accrodion .accrodion-content").hide();
37      Self.find(".accrodion.active").find(".accrodion-content").show();
38      accordion.each(function () {
39        $(this)
40          .find(".accrodion-title")
41          .on("click", function () {
42            if ($(this).parent().hasClass("active") === false) {
43              $(".accrodion-grp." + accrodionName)
44                .find(".accrodion")
45                .removeClass("active");
46              $(".accrodion-grp." + accrodionName)
47                .find(".accrodion")
48                .find(".accrodion-content")
49                .slideUp();
50              $(this).parent().addClass("active");
51              $(this).parent().find(".accrodion-content").slideDown();
52            }
53          });
54      });
55    });
56  }
57
58  if ($(".scroll-to-target").length) {
59    $(".scroll-to-target").on("click", function () {
60      var target = $(this).attr("data-target");
61      // animate
62      $("html, body").animate(
63        {
64          scrollTop: $(target).offset().top
65        },
66        1000
67      );
68
69      return false;
70    });
71  }
72
73  if ($(".video-popup").length) {
74    $(".video-popup").magnificPopup({
75      type: "iframe",
76      mainClass: "mfp-fade",
77      removalDelay: 160,
78      preloader: true,
79
80      fixedContentPos: false
81    });
82  }
83
84  if ($(".img-popup").length) {
85    var groups = {};
86    $(".img-popup").each(function () {
87      var id = parseInt($(this).attr("data-group"), 10);
88
89      if (!groups[id]) {
90        groups[id] = [];
91      }
92
93      groups[id].push(this);
94    });
95
96    $.each(groups, function () {
97      $(this).magnificPopup({
98        type: "image",
99        closeOnContentClick: true,
100        closeBtnInside: false,
101        gallery: {
102          enabled: true
103        }
104      });
105    });
106  }
107
108  $(document).on("click", ".add", function () {
109    if ($(this).prev().val() < 999) {
110      $(this)
111        .prev()
112        .val(+$(this).prev().val() + 1);
113    }
114    $(this).prev().trigger("change");
115  });
116
117  $(document).on("click", ".sub", function () {
118    if ($(this).next().val() > 0) {
119      if ($(this).next().val() > 0)
120        $(this)
121          .next()
122          .val(+$(this).next().val() - 1);
123    }
124    $(this).next().trigger("change");
125  });
126
127  if ($(".main-menu__list").length && $(".mobile-nav__container").length) {
128    let navContent = document.querySelector(".main-menu__list").outerHTML;
129    let mobileNavContainer = document.querySelector(".mobile-nav__container");
130    mobileNavContainer.innerHTML = navContent;
131  }
132  if ($(".sticky-header__content").length) {
133    let navContent = document.querySelector(".main-menu").innerHTML;
134    let mobileNavContainer = document.querySelector(".sticky-header__content");
135    mobileNavContainer.innerHTML = navContent;
136  }
137
138  if ($(".mobile-nav__container .main-menu__list").length) {
139    let dropdownAnchor = $(
140      ".mobile-nav__container .main-menu__list .menu-item-has-children > a"
141    );
142    dropdownAnchor.each(function () {
143      let self = $(this);
144      let toggleBtn = document.createElement("BUTTON");
145      toggleBtn.setAttribute("aria-label", "dropdown toggler");
146      toggleBtn.innerHTML = "<i class='fa fa-angle-down'></i>";
147      self.append(function () {
148        return toggleBtn;
149      });
150      self.find("button").on("click", function (e) {
151        e.preventDefault();
152        let self = $(this);
153        self.toggleClass("expanded");
154        self.parent().toggleClass("expanded");
155        self.parent().parent().children("ul").slideToggle();
156      });
157    });
158  }
159
160  if ($(".mobile-nav__toggler").length) {
161    $(".mobile-nav__toggler").on("click", function (e) {
162      e.preventDefault();
163      $(".mobile-nav__wrapper").toggleClass("expanded");
164      $("body").toggleClass("locked");
165    });
166  }
167
168  if ($(".search-toggler").length) {
169    $(".search-toggler").on("click", function (e) {
170      e.preventDefault();
171      $(".search-popup").toggleClass("active");
172      $(".mobile-nav__wrapper").removeClass("expanded");
173      $("body").toggleClass("locked");
174    });
175  }
176
177  if ($(".dynamic-year").length) {
178    let date = new Date();
179    $(".dynamic-year").html(date.getFullYear());
180  }
181
182  if ($(".wow").length) {
183    var wow = new WOW({
184      boxClass: "wow", // animated element css class (default is wow)
185      animateClass: "animated", // animation css class (default is animated)
186      mobile: true, // trigger animations on mobile devices (default is true)
187      live: true // act on asynchronously loaded content (default is true)
188    });
189    wow.init();
190  }
191
192  // window load event
193
194  $(window).on("load", function () {
195    if ($(".preloader").length) {
196      $(".preloader").fadeOut();
197    }
198
199    if ($(".product__items ul.products").length) {
200      $(".product__items ul.products").imagesLoaded(function () {
201        $(".product__items ul.products").isotope({
202          layoutMode: "masonry"
203        });
204      });
205    }
206  });
207
208  // window scroll event
209
210  $(window).on("scroll", function () {
211    if ($(".stricked-menu").length) {
212      var headerScrollPos = 130;
213      var stricky = $(".stricked-menu");
214      if ($(window).scrollTop() > headerScrollPos) {
215        stricky.addClass("stricky-fixed");
216      } else if ($(this).scrollTop() <= headerScrollPos) {
217        stricky.removeClass("stricky-fixed");
218      }
219    }
220    if ($(".scroll-to-top").length) {
221      var strickyScrollPos = 100;
222      if ($(window).scrollTop() > strickyScrollPos) {
223        $(".scroll-to-top").fadeIn(500);
224      } else if ($(this).scrollTop() <= strickyScrollPos) {
225        $(".scroll-to-top").fadeOut(500);
226      }
227    }
228  });
229
230  $(document).on("click", ".shop-one__cart.gardon_ajax ", function (e) {
231    $(".gardon-overlay").fadeIn(300);
232  });
233
234  $(document.body).on(
235    "added_to_cart",
236    function (event, fragments, cart_hash, $button) {
237      $(".gardon-overlay").fadeOut(300);
238    }
239  );
240
241  // custom coursor
242  if ($(".custom-cursor").length) {
243    var cursor = document.querySelector(".custom-cursor__cursor");
244    var cursorinner = document.querySelector(".custom-cursor__cursor-two");
245    var a = document.querySelectorAll("a");
246
247    document.addEventListener("mousemove", function (e) {
248      var x = e.clientX;
249      var y = e.clientY;
250      cursor.style.transform = `translate3d(calc(${e.clientX}px - 50%), calc(${e.clientY}px - 50%), 0)`;
251    });
252
253    document.addEventListener("mousemove", function (e) {
254      var x = e.clientX;
255      var y = e.clientY;
256      cursorinner.style.left = x + "px";
257      cursorinner.style.top = y + "px";
258    });
259
260    document.addEventListener("mousedown", function () {
261      cursor.classList.add("click");
262      cursorinner.classList.add("custom-cursor__innerhover");
263    });
264
265    document.addEventListener("mouseup", function () {
266      cursor.classList.remove("click");
267      cursorinner.classList.remove("custom-cursor__innerhover");
268    });
269
270    a.forEach((item) => {
271      item.addEventListener("mouseover", () => {
272        cursor.classList.add("custom-cursor__hover");
273      });
274      item.addEventListener("mouseleave", () => {
275        cursor.classList.remove("custom-cursor__hover");
276      });
277    });
278  }
279})(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.