PageSourceSearch

https://www.bgcgh.ca/wp-content/themes/innermost-multisite-sme-bs4/js/common.js?ver=2026w41

js bgcgh.ca collected 2026-10-06 18:38:19 UTC 8,290 bytes, 239 lines download raw bytes

1jQuery(document).ready(function ($) {
2  // Add a class for styles if is the wp activation page
3  if ($(".wp-activate-container")[0]) {
4    $("body").addClass("activation-page");
5  }
6
7  $(window).on("load", function () {
8    var window_top_scroll = $(window).scrollTop();
9    var siteHeader = $("#site-header:not(.sticky)");
10    var siteHeaderHeight = siteHeader.outerHeight();
11    var wpBarHeight = $("#wpadminbar").outerHeight();
12
13    //sticky Header
14    function setStickyHeader(scrollpos, ele) {
15      if (scrollpos > ele) {
16        siteHeader.addClass("sticky");
17      } else {
18        siteHeader.removeClass("sticky");
19      }
20    }
21
22    if ($("#site-header").hasClass("site-header-sticky")) {
23      if (wpBarHeight) {
24        $("#site-header").css("top", wpBarHeight);
25      }
26      setStickyHeader(window_top_scroll, siteHeaderHeight);
27
28      $(window).scroll(function () {
29        window_top_scroll = $(window).scrollTop();
30        setStickyHeader(window_top_scroll, siteHeaderHeight);
31      });
32
33      $(window).resize(function () {
34        siteHeaderHeight = siteHeader.outerHeight();
35        wpBarHeight = $("#wpadminbar").outerHeight();
36        $("#site-header").css("top", wpBarHeight);
37        setStickyHeader(window_top_scroll, siteHeaderHeight);
38      });
39    }
40
41    // Custom show / hide back to top button
42    // Added by: DT
43    if ($("#back-to-top").hasClass("btn")) {
44      $(window).scroll(function () {
45        var window_top_scroll = $(window).scrollTop();
46        if (window_top_scroll > 150) {
47          $("#back-to-top").addClass("visible");
48        } else {
49          $("#back-to-top").removeClass("visible");
50        }
51      });
52    }
53
54    function checkTableWidth(table) {
55      if (table.outerWidth() > table.parent().outerWidth()) {
56        table.data("scrollWrapper").addClass("has-scroll");
57      } else if (table.data("scrollWrapper")) {
58        table.data("scrollWrapper").removeClass("has-scroll");
59      }
60    }
61
62    // responsive tables
63    function responsiveTables() {
64      $("table").each(function () {
65        var element = $(this).filter(":visible");
66        if (element.css("display") !== "none" || typeof element.css("display") !== undefined) {
67          if (!$(this).data("scrollWrapper")) {
68            // Create the wrapper element
69            var scrollWrapper = $("<div />", {
70              class: "scrollable",
71              html: "<div />", // The inner div is needed for styling
72            }).insertBefore(element);
73
74            // Store a reference to the wrapper element
75            element.data("scrollWrapper", scrollWrapper);
76
77            // Move the scrollable element inside the wrapper element
78            element.appendTo(scrollWrapper.find("div"));
79
80            // Check if the element is wider than its parent and thus needs to be scrollable
81            checkTableWidth(element);
82
83            // When the viewport size is changed, check again if the element needs to be scrollable
84            $(window).on("resize orientationchange", function () {
85              checkTableWidth(element);
86            });
87          }
88        }
89      });
90    }
91    responsiveTables();
92    // run responsive tables after accordion is displayed
93    $(document).on("afterShow.vc.accordion", responsiveTables);
94
95    $(".vc_toggle").on("click touchstart", responsiveTables);
96  });
97
98  // site search modal global popup
99  $(".site-nav-search").click(function () {
100    $("#searchModal").modal("show");
101  });
102
103  // tooltip
104  $('[data-toggle="tooltip"]').tooltip();
105
106  function focus_input(current_modal) {
107    if (current_modal) {
108      $(current_modal).find("input").focus();
109    } else {
110      $("#searchModal").find("input").focus();
111    }
112  }
113
114  $("#searchModal").on("shown.bs.modal", function () {
115    focus_input(this);
116  });
117
118  // dropdown-toggle click event handle to enable href redirect if href attr is valid
119  $("a.dropdown-toggle").click(function (e) {
120    e.preventDefault();
121    if (e.originalEvent !== undefined) {
122      // get url
123      var link_url = $(this).attr("href");
124      if (typeof link_url !== undefined && link_url !== false) {
125        location.href = link_url;
126      }
127    }
128  });
129
130  var shiftPressed = false;
131  // check focusout event from li link under class navbar-nav
132  $(".navbar-nav li a").focusout(function () {
133    // force to display submenu
134    if ($(this).siblings("ul").hasClass("dropdown-menu") && shiftPressed === false) {
135      $(this).siblings("ul").css("display", "block");
136    }
137    // hide dropdown-menu
138    if ($(this).parent("li").parent("ul").hasClass("dropdown-menu") && $(this).parent("li").is("li:last-child") && shiftPressed === false) {
139      if (!$(this).siblings().hasClass("dropdown-menu")) {
140        $(this).parent("li").parent("ul").removeAttr("style");
141
142        if ($(this).parent("li").parent("ul").parent("li").parent("ul").hasClass("dropdown-menu") && $(this).parent("li").parent("ul").parent("li").is("li:last-child")) {
143          $(this).parent("li").parent("ul").parent("li").parent("ul").removeAttr("style");
144        }
145      }
146    }
147
148    if ($(this).siblings("ul").hasClass("dropdown-menu") && shiftPressed === true) {
149      $(this).siblings("ul").removeAttr("style");
150    }
151  });
152
153  $(".navbar-nav li a").on("keyup, keydown", function (e) {
154    shiftPressed = e.shiftKey;
155  });
156
157  // show modal on enter keypress
158  $('#nav-search[data-target="#searchModal"]').on("keyup, keydown", function (e) {
159    var key = e.which || e.keyCode;
160    if (key === 13) {
161      $("#searchModal").modal("show");
162    }
163  });
164
165  // get rid of extra dropdown-menu style if clicking outside of .navbar-nav
166  $(document).mouseup(function (e) {
167    var menuItem = $(".navbar-nav");
168
169    // if the target of the click isn't the container nor a descendant of the container
170    if (!menuItem.is(e.target) && menuItem.has(e.target).length === 0) {
171      $(".navbar-nav").siblings("ul").removeAttr("style");
172    }
173  });
174
175  // mobile menu btn toggle
176  $(".header__main-mobile").on("click touchstart", function (e) {
177    e.preventDefault();
178    const btn = $(this);
179    btn.toggleClass("is-active");
180    $("body").toggleClass("mm-open");
181    $("#mobile-menu").toggleClass("mm-open");
182  });
183
184  // mobile submenu dropdown toggle
185  $(".mobile-menu").on("click touchstart", ".ddm-toggle", function (e) {
186    e.preventDefault();
187    const dropdownToggle = $(this);
188    dropdownToggle.toggleClass("ddm-open");
189    dropdownToggle.parent().next(".dropdown-menu").toggleClass("ddm-open");
190  });
191
192  // mobile menu close button
193  $(".mm-close").on("click touchstart", function (e) {
194    e.preventDefault();
195    const closeBtn = $(this);
196    $("body").removeClass("mm-open");
197    closeBtn.closest(".mm-open").removeClass("mm-open");
198  });
199
200  //social share sidebar
201  //facebook
202  $("div#social_share").on("click", "a.facebook-link", function (e) {
203    e.preventDefault();
204    FB.ui(
205      {
206        display: "popup",
207        method: "share",
208        hashtag: String.format("#{0}", social_share_object.shareTag),
209        quote: social_share_object.share,
210        href: window.location.href,
211      },
212      function (response) {}
213    );
214  });
215  //twitter
216  $("div#social_share").on("click", "a.twitter-link", function (e) {
217    e.preventDefault();
218    let _href = String.format(social_share_object.twitterURL, window.location.href, encodeURIComponent(social_share_object.share), social_share_object.shareTag, "", "");
219    window.open(_href);
220  });
221  //linkedin
222  $("div#social_share").on("click", "a.linkedin-link", function (e) {
223    e.preventDefault();
224    let _href = String.format(social_share_object.linkedinURL, window.location.href);
225    window.open(_href);
226  });
227  //email
228  $("div#social_share a.sharetoemail-link").attr("href", String.format(social_share_object.mailto, encodeURIComponent($("title").text()), encodeURI(window.location.href)));
229});
230
231String.format = function () {
232  var s = arguments[0];
233  var n = arguments.length - 1;
234  for (var i = 0; i < n; i++) {
235    var reg = new RegExp("\\{" + i + "\\}", "gm");
236    s = s.replace(reg, arguments[i + 1]);
237  }
238  return s;
239};

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.