PageSourceSearch

https://www.shrewsburyprison.com/wp-content/themes/shrewsburyprison/assets/js/custom.min.js?ver=1.5.7

js shrewsburyprison.com collected 2026-10-04 13:24:21 UTC 12,061 bytes, 377 lines download raw bytes

1(function ($) {
2  /* ------------------------------------------------------------------------- */
3  /*  Mobile Sub-menu Toggle
4  /* ------------------------------------------------------------------------- */
5  $("ul.mobile-menu > li.menu-item-has-children").append(
6    '<span class="sub-menu-toggle"><i class="fal fa-chevron-right"></i></span>'
7  );
8
9  $("ul.mobile-menu > li.menu-item-has-children").each(function () {
10    $(this)
11      .find("> ul.sub-menu")
12      .prepend(
13        '<span class="close-sub-menu"><i class="fal fa-chevron-left"></i> <span>' +
14          $(this).find("a").html() +
15          "</span></span>"
16      );
17  });
18  $(document).on("click", ".mobile-menu .sub-menu-toggle", function (e) {
19    e.preventDefault();
20    $(this).closest(".menu-item").toggleClass("expanded");
21    $(this).closest(".menu-item").parent().toggleClass("hide-parent-menu");
22    $(this).closest(".menu-item").parent().toggleClass("with-overflow");
23  });
24
25  // Close sub-nav
26  $(".close-sub-menu").on("click", function () {
27    $(this).closest(".mobile-menu").removeClass("hide-parent-menu");
28    var closeSubMenu = $(this).parent().parent();
29    setTimeout(function () {
30      closeSubMenu.removeClass("expanded");
31      $("ul.mobile-menu").removeClass("with-overflow");
32    }, 500);
33  });
34
35  $(".current_page_ancestor")
36    .closest("li.menu-item-has-children")
37    .addClass("expanded");
38  $(".current_page_ancestor")
39    .closest("ul.mobile-menu")
40    .addClass("hide-parent-menu");
41  $(".current_page_ancestor")
42    .closest("ul.mobile-menu")
43    .addClass("with-overflow");
44
45  /* ------------------------------------------------------------------------- */
46  /*  Menu Toggle Actions
47  /* ------------------------------------------------------------------------- */
48  var sub_nav = ".header__navigation > ul > li.menu-item-has-children";
49  var full_width_nav = "li.full-width";
50
51  $(sub_nav).mouseenter(function () {
52    $("body").addClass("content-overlay");
53  });
54  $(sub_nav).mouseleave(function () {
55    $("body").removeClass("content-overlay");
56  });
57
58  // Remove pos relative on full-width hover
59  $(full_width_nav).mouseenter(function () {
60    $(".header__navigation > ul:not(.mobile-menu):first-of-type").css(
61      "position",
62      "static"
63    );
64  });
65  $(full_width_nav).mouseleave(function () {
66    $(".header__navigation > ul:not(.mobile-menu):first-of-type").css(
67      "position",
68      "relative"
69    );
70  });
71
72  /* ------------------------------------------------------------------------- */
73  /*  Banner Video Full Screen
74  /* ------------------------------------------------------------------------- */
75  $(document).on("click", "a.show-full-video", function (e) {
76    e.preventDefault();
77    $("#bgvid").get(0).pause();
78  });
79
80  $('[data-fancybox="video"]').fancybox({
81    afterClose: function () {
82      $("#bgvid").get(0).play();
83    },
84  });
85
86  $(document).on("scroll", function () {
87    if ($("#bgvid").length > 0) {
88      checkVideoInView();
89    }
90  });
91
92  function checkVideoInView() {
93    $("#bgvid").each(function () {
94      var top_of_element = $(this).offset().top;
95      var bottom_of_element = $(this).offset().top + $(this).outerHeight();
96      var bottom_of_screen = $(window).scrollTop() + $(window).innerHeight();
97      var top_of_screen = $(window).scrollTop();
98
99      if (
100        bottom_of_screen > top_of_element &&
101        top_of_screen < bottom_of_element
102      ) {
103        $(this)[0].play();
104      } else {
105        $(this)[0].pause();
106      }
107    });
108  }
109
110  /* ------------------------------------------------------------------------- */
111  /*  Booking Widget
112  /* ------------------------------------------------------------------------- */
113  $(document).on("click", "a.booking-cta", function (evt) {
114    var id = $(this).data("id");
115    var type = $(this).data("type");
116
117    // Gift Vouchers
118    if (type == "shop-items") {
119      try {
120        OpenTrekksoftBookingWidget("shop-items", id);
121        evt.preventDefault();
122        return false;
123      } catch (error) {
124        // open normal booking window
125        return true;
126      }
127    }
128
129    // Tickets
130    if (!id) return true;
131    try {
132      OpenTrekksoftBookingWidget("activity-booking", id);
133      evt.preventDefault();
134      return false;
135    } catch (error) {
136      // open normal booking window
137      return true;
138    }
139  });
140
141  /* ------------------------------------------------------------------------- */
142  /*  Search
143  /* ------------------------------------------------------------------------- */
144
145  $(document).on("click", ".header__search i", function (e) {
146    if ($(this).hasClass("fa-search")) {
147      $(this).removeClass("fa-search");
148      $(this).addClass("fa-times");
149      $(".header__search_form").addClass("active");
150      $(".header__search_form input").focus();
151    } else {
152      $(this).removeClass("fa-times");
153      $(this).addClass("fa-search");
154      $(".header__search_form").removeClass("active");
155    }
156  });
157
158  $(document).on(
159    "click",
160    ".header__search_form .quick-search-form i",
161    function (e) {
162      e.preventDefault();
163      $(this).closest("form").submit();
164    }
165  );
166
167  $(document).on(
168    "click",
169    ".newsletter-form-wrapper .gform_body .ginput_container + .gfield_description",
170    function (e) {
171      console.log("test");
172      console.log($(this).closest("form").find("#gform_submit_button_1"));
173      $(this).closest("form").find("#gform_submit_button_1").click();
174    }
175  );
176
177  /* ------------------------------------------------------------------------- */
178  /*  Back to Top
179  /* ------------------------------------------------------------------------- */
180  $(document).on("click", ".cta-backtotop", function () {
181    $("html, body").animate({ scrollTop: 0 }, 1000);
182  });
183
184  /* ------------------------------------------------------------------------- */
185  /*  Gallery Filters
186  /* ------------------------------------------------------------------------- */
187  $('.gallery-filters input[type="checkbox"]').on("change", function () {
188    console.log(this.value);
189    $form = $(this).closest("form");
190    if ($(this).val() == "all") {
191      $form.find('input[type="checkbox"]').prop("checked", false);
192      $(this).prop("checked", true);
193    } else {
194      $form.find('input[value="all"]').prop("checked", false);
195    }
196
197    $form.submit();
198  });
199
200  /* ------------------------------------------------------------------------- */
201  /*  FAQ Accordian
202  /* ------------------------------------------------------------------------- */
203  $(document).on("click", ".faqs .faq .question", function (e) {
204    var $faq = $(this).closest(".faq");
205    $faq.toggleClass("expanded");
206    if ($faq.hasClass("expanded")) {
207      $faq.find(".answer").slideDown();
208    } else {
209      $faq.find(".answer").slideUp();
210    }
211  });
212
213  /* ------------------------------------------------------------------------- */
214  /*  Mobile Nav
215  /* ------------------------------------------------------------------------- */
216  $(document).on("click", ".nav-toggle", function (e) {
217    e.preventDefault();
218    $icon = $(this).find("i");
219    $(this).toggleClass("active");
220
221    $(this).closest("html").toggleClass("menu-open");
222
223    if ($("html").hasClass("menu-open")) {
224      $icon.removeClass("fa-bars");
225      $icon.addClass("fa-times");
226    } else {
227      $icon.addClass("fa-bars");
228      $icon.removeClass("fa-times");
229    }
230  });
231
232  $(document).on("click", ".form-wrapper .form-submit", function (e) {
233    e.preventDefault();
234
235    $(this).closest(".form-wrapper").find("form").submit();
236  });
237
238  /* ------------------------------------------------------------------------- */
239  /*  TripAdvisor
240  /* ------------------------------------------------------------------------- */
241
242  // Select the node that will be observed for mutations
243  var targetNode = document.getElementById("tripadvisor-reviews");
244
245  // Options for the observer (which mutations to observe)
246  var config = { attributes: true, childList: true, subtree: true };
247
248  // Callback function to execute when mutations are observed
249  function callback(mutationsList, observer) {
250    mutationsList.forEach(mutation);
251  }
252
253  function mutation(item) {
254    if (item.type === "childList") {
255      n_elements = $("#tripadvisor-reviews .widSSPBullet li").length;
256      var random = Math.floor(Math.random() * n_elements);
257      $("#tripadvisor-reviews .widSSPBullet li").eq(random).addClass("show");
258      // $('#tripadvisor-reviews #writereview').attr('onclick', "return false;")
259      $("#tripadvisor-reviews #writereview").attr("onclick", "");
260      $("#tripadvisor-reviews #writereview").attr("href", "/reviews/");
261      $("#tripadvisor-reviews #writereview").attr("onclick", "");
262      $("#tripadvisor-reviews #writereview").attr("href", "/reviews/");
263    }
264  }
265  // Create an observer instance linked to the callback function
266  const observer = new MutationObserver(callback);
267
268  // Start observing the target node for configured mutations
269  if (targetNode) {
270    observer.observe(targetNode, config);
271  }
272
273  // Later, you can stop observing
274  // observer.disconnect();
275
276  // $(document).on('click', '#tripadvisor-reviews #writereview', function(e){
277  //   e.preventDefault();
278
279  //   $('.trip-advisor-review-popup').fadeIn();
280  //   $('.trip-advisor-review-popup-bg').fadeIn();
281  // });
282  // $(document).on('click', '.trip-advisor-review-popup-bg, .trip-advisor-review-popup .close-popup', function(e){
283  //   e.preventDefault();
284
285  //   $('.trip-advisor-review-popup').fadeOut();
286  //   $('.trip-advisor-review-popup-bg').fadeOut();
287  // });
288
289  jQuery(document).ready(function ($) {
290    $("#input_6_8").datepicker({ minDate: "+1d" });
291  });
292
293  // gform.addFilter('gform_datepicker_options_pre_init', function (optionsObj, formId, fieldId) {
294  //   // Apply to field 2 only
295  //   if (formId == 6 && fieldId == 8) {
296  //     optionsObj.minDate = 0;
297  //   }
298  //   return optionsObj;
299  // });
300
301  $(document).on(
302    "change",
303    '.tickets-selection__filters input[name="filter"]',
304    function () {
305      let val = $(this).val();
306      if (val == "all") {
307        $(".activity-card").show();
308      } else {
309        $(".activity-card").hide();
310        $(".activity-card." + val).show();
311      }
312    }
313  );
314
315  $(document).on("click", "#site-notice .close", function (e) {
316    e.preventDefault();
317    $("#site-notice").addClass("closed");
318
319    const d = new Date();
320    d.setTime(d.getTime() + 7 * 24 * 60 * 60 * 1000); //7 Days duration
321    let expires = "expires=" + d.toUTCString();
322    document.cookie = "siteNoticeClosed=1; expires=" + expires + "; path=/";
323  });
324
325  //Gravity form submissions
326  $(document).on("submit", ".gform_wrapper form", function (event) {
327    let formId = $(this).attr("id");
328    if (formId.length > 0) {
329      let formWrapper = "#gform_wrapper_" + formId.replace("gform_", "");
330      let formTitle = $(formWrapper).find(".gform_title").text();
331      dataLayer.push({
332        event: "gravity-form-submission",
333        formId: formId,
334        formName: formTitle,
335      });
336    }
337  });
338
339  $(document).ready(function() {
340    var $selects = $('select.gfield_select');
341    
342    $selects.each(function() {
343        // Check initial state
344        updateSelectClass($(this));
345        
346        // Update on change
347        $(this).on('change', function() {
348            updateSelectClass($(this));
349        });
350    });
351    
352    function updateSelectClass($select) {
353        var selectedOption = $select.find('option:selected');
354        if (selectedOption.hasClass('gf_placeholder')) {
355            $select.addClass('placeholder-selected');
356        } else {
357            $select.removeClass('placeholder-selected');
358        }
359    }
360  });
361
362  $(".banner-slider .slider-wrapper").slick({
363    draggable: false,
364    infinite: true,
365    slidesToShow: 1,
366    slidesToScroll: 1,
367    autoplay: true,
368    autoplaySpeed: 10000,
369    arrows: true,
370    prevArrow: $(".prev-slide.fal.fa-arrow-circle-left"),
371    nextArrow: $(".next-slide.fal.fa-arrow-circle-right"),
372    dots: true,
373    fade: true,
374    speed: 250,
375    adaptiveHeight: true,
376  });
377})(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.