PageSourceSearch

https://www.enmu.edu/templates/edulif/js/main.js

js enmu.edu collected 2026-09-25 09:05:19 UTC 7,761 bytes, 277 lines download raw bytes

1/**
2 * @package Helix Ultimate Framework
3 * @author JoomShaper https://www.joomshaper.com
4 * @copyright Copyright (c) 2010 - 2021 JoomShaper
5 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
6 */
7
8jQuery(function ($) {
9  // Stikcy function
10  if ($("body").hasClass("sticky-header")) {
11    let header = $("#sp-header");
12    header.before('<div class="nav-placeholder"></div>');
13    if ($("#sp-header").length) {
14      let headerHeight = header.outerHeight();
15      let stickyHeaderTop = header.offset().top;
16      let stickyHeader = function () {
17        let scrollTop = $(window).scrollTop();
18        if (scrollTop > stickyHeaderTop) {
19          header.addClass("header-sticky");
20          $(".nav-placeholder").height(headerHeight);
21        } else {
22          if (header.hasClass("header-sticky")) {
23            header.removeClass("header-sticky");
24            $(".nav-placeholder").height("inherit");
25          }
26        }
27      };
28      stickyHeader();
29      $(window).scroll(function () {
30        stickyHeader();
31      });
32    }
33
34    if ($("body").hasClass("layout-boxed")) {
35      let windowWidth = header.parent().outerWidth();
36      header.css({ "max-width": windowWidth, left: "auto" });
37    }
38  }
39  if ($(".custom-sticky-nav").length > 0) {
40    let nav = $(".nav-area");
41    if ($(".nav-area").length) {
42      let stickynavTop = nav.offset().top - 90;
43      let stickynav = function () {
44        let scrollTop = $(window).scrollTop();
45        if (scrollTop > stickynavTop) {
46          nav.addClass("nav-sticky");
47        } else {
48          if (nav.hasClass("nav-sticky")) {
49            nav.removeClass("nav-sticky");
50          }
51        }
52      };
53      stickynav();
54      $(window).scroll(function () {
55        stickynav();
56      });
57    }
58  }
59
60  // go to top
61  $(window).scroll(function () {
62    if ($(this).scrollTop() > 100) {
63      $(".sp-scroll-up").fadeIn();
64    } else {
65      $(".sp-scroll-up").fadeOut(400);
66    }
67  });
68
69  $(".sp-scroll-up").click(function () {
70    $("html, body").animate(
71      {
72        scrollTop: 0,
73      },
74      600
75    );
76    return false;
77  });
78
79  // Preloader
80  $(window).on("load", function () {
81    $(".sp-preloader").fadeOut(500, function () {
82      $(this).remove();
83    });
84  });
85
86  //mega menu
87  $(".sp-megamenu-wrapper")
88    .parent()
89    .parent()
90    .css("position", "static")
91    .parent()
92    .css("position", "relative");
93  $(".sp-menu-full").each(function () {
94    $(this).parent().addClass("menu-justify");
95  });
96
97  // Offcanvs
98  $("#offcanvas-toggler").on("click", function (event) {
99    event.preventDefault();
100    $(".offcanvas-init").addClass("offcanvas-active");
101  });
102
103  $(".close-offcanvas, .offcanvas-overlay").on("click", function (event) {
104    event.preventDefault();
105    $(".offcanvas-init").removeClass("offcanvas-active");
106  });
107
108  $(document).on("click", ".offcanvas-inner .menu-toggler", function (event) {
109    event.preventDefault();
110    $(this)
111      .closest(".menu-parent")
112      .toggleClass("menu-parent-open")
113      .find(">.menu-child")
114      .slideToggle(400);
115  });
116
117  // Tooltip
118  var tooltipTriggerList = [].slice.call(
119    document.querySelectorAll('[data-bs-toggle="tooltip"], .hasTooltip')
120  );
121  var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
122    return new bootstrap.Tooltip(tooltipTriggerEl, {
123      html: true,
124    });
125  });
126
127  // Popover
128  var popoverTriggerList = [].slice.call(
129    document.querySelectorAll('[data-bs-toggle="popover"]')
130  );
131  var popoverList = popoverTriggerList.map(function (popoverTriggerEl) {
132    return new bootstrap.Popover(popoverTriggerEl);
133  });
134
135  // Article Ajax voting
136  $(".article-ratings .rating-star").on("click", function (event) {
137    event.preventDefault();
138    var $parent = $(this).closest(".article-ratings");
139
140    var request = {
141      option: "com_ajax",
142      template: template,
143      action: "rating",
144      rating: $(this).data("number"),
145      article_id: $parent.data("id"),
146      format: "json",
147    };
148
149    $.ajax({
150      type: "POST",
151      data: request,
152      beforeSend: function () {
153        $parent.find(".fa-spinner").show();
154      },
155      success: function (response) {
156        var data = $.parseJSON(response);
157        $parent.find(".ratings-count").text(data.message);
158        $parent.find(".fa-spinner").hide();
159
160        if (data.status) {
161          $parent.find(".rating-symbol").html(data.ratings);
162        }
163
164        setTimeout(function () {
165          $parent.find(".ratings-count").text("(" + data.rating_count + ")");
166        }, 3000);
167      },
168    });
169  });
170
171  //  Cookie consent
172  $(".sp-cookie-allow").on("click", function (event) {
173    event.preventDefault();
174
175    var date = new Date();
176    date.setTime(date.getTime() + 30 * 24 * 60 * 60 * 1000);
177    var expires = "; expires=" + date.toGMTString();
178    document.cookie = "spcookie_status=ok" + expires + "; path=/";
179
180    $(this).closest(".sp-cookie-consent").fadeOut();
181  });
182
183  $(".btn-group label:not(.active)").click(function () {
184    var label = $(this);
185    var input = $("#" + label.attr("for"));
186
187    if (!input.prop("checked")) {
188      label
189        .closest(".btn-group")
190        .find("label")
191        .removeClass("active btn-success btn-danger btn-primary");
192      if (input.val() === "") {
193        label.addClass("active btn-primary");
194      } else if (input.val() == 0) {
195        label.addClass("active btn-danger");
196      } else {
197        label.addClass("active btn-success");
198      }
199      input.prop("checked", true);
200      input.trigger("change");
201    }
202    var parent = $(this).parents("#attrib-helix_ultimate_blog_options");
203    if (parent) {
204      showCategoryItems(parent, input.val());
205    }
206  });
207  $(".btn-group input[checked=checked]").each(function () {
208    if ($(this).val() == "") {
209      $("label[for=" + $(this).attr("id") + "]").addClass(
210        "active btn btn-primary"
211      );
212    } else if ($(this).val() == 0) {
213      $("label[for=" + $(this).attr("id") + "]").addClass(
214        "active btn btn-danger"
215      );
216    } else {
217      $("label[for=" + $(this).attr("id") + "]").addClass(
218        "active btn btn-success"
219      );
220    }
221    var parent = $(this).parents("#attrib-helix_ultimate_blog_options");
222    if (parent) {
223      parent.find("*[data-showon]").each(function () {
224        $(this).hide();
225      });
226    }
227  });
228
229  function showCategoryItems(parent, value) {
230    var controlGroup = parent.find("*[data-showon]");
231    controlGroup.each(function () {
232      var data = $(this).attr("data-showon");
233      data = typeof data !== "undefined" ? JSON.parse(data) : [];
234      if (data.length > 0) {
235        if (
236          typeof data[0].values !== "undefined" &&
237          data[0].values.includes(value)
238        ) {
239          $(this).slideDown();
240        } else {
241          $(this).hide();
242        }
243      }
244    });
245  }
246
247  $(window).on("scroll", function () {
248    var scrollBar = $(".sp-reading-progress-bar");
249    if (scrollBar.length > 0) {
250      var s = $(window).scrollTop(),
251        d = $(document).height(),
252        c = $(window).height();
253      var scrollPercent = (s / (d - c)) * 100;
254      const postition = scrollBar.data("position");
255      if (postition === "top") {
256        // var sticky = $('.header-sticky');
257        // if( sticky.length > 0 ){
258        //     sticky.css({ top: scrollBar.height() })
259        // }else{
260        //     sticky.css({ top: 0 })
261        // }
262      }
263      scrollBar.css({ width: `${scrollPercent}%` });
264    }
265  });
266
267  // template related JS
268  if ($(".custom-sticky-nav").length > 0) {
269    //one page nav with smoth scroll and active nav
270    $(".custom-sticky-nav .nav-area").onePageNav({
271      currentClass: "active",
272      changeHash: false,
273      scrollSpeed: 900,
274      scrollThreshold: 0.5,
275    });
276  }
277});

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.