PageSourceSearch

https://www.visitdoncaster.com/js/script-v2.js

js visitdoncaster.com collected 2026-10-02 12:27:36 UTC 5,734 bytes, 205 lines download raw bytes

1$(document).ready(function(){
2
3  $(".nav-toggle").click(function(){
4    $(".full-menu").fadeToggle("fast");
5  });
6	
7	$(".nav-toggle").click(function(){
8    $("body").toggleClass("menu-open");
9  });
10
11});
12
13
14
15// MOVE NAV UP
16$(window).on("scroll", function() {
17    if($(window).scrollTop() > 25) {
18        $("header").addClass("nav-down");
19    } else {
20       $("header").removeClass("nav-down");
21    }
22});
23
24
25
26//READ MORE
27$('#hider').hide();
28$('#shower').hide();
29
30$('.intro-description').each(function() {
31
32   if ($(this).children('.intro-description p').length > 1) {
33      $('.intro-description p:not(:first-child)').wrapAll('<div class="description-extended hidden"></div>');
34      $('#shower').show();
35   }
36});
37
38
39$( '#hider').click(function() {
40    $('.intro-description p').not(':first').hide();
41    $('#hider').hide();
42    $('#shower').show();
43});
44
45$( '#shower').click(function() {
46	$('.intro-description p').show();
47    $('#shower').hide();
48    $('#hider').show();
49});
50
51$('.intro-description p').not(':first').hide();
52
53
54 //SCROLL
55$(document).on('click', 'a[href^="#"]', function(e) {
56    var id = $(this).attr('href');
57    var $id = $(id);
58    if ($id.length === 0) {
59        return;
60    }
61    e.preventDefault();
62    var pos = $id.offset().top-80;
63    $('body, html').animate({scrollTop: pos});
64});
65
66//MATCH
67$(function() {
68	$('.match').matchHeight();
69});
70
71//SLIDER
72$('.slider').slick({
73  dots: false,
74  infinite: true,
75  speed: 300,
76  slidesToShow: 4,
77  slidesToScroll: 1,
78  autoplaySpeed: 3000,
79  prevArrow: '<button type="button" class="slick-prev slider-button" aria-label="Previous"><svg viewBox="0 0 148.8 283.5"><path d="M140.8 2c1.8 0 3.6.7 4.9 2 2.7 2.7 2.7 7.2 0 9.9L17.9 141.8l127.8 127.8c2.7 2.7 2.7 7.2 0 9.9s-7.2 2.7-9.9 0L3.1 146.7c-1.3-1.3-2.1-3.1-2.1-4.9s.7-3.6 2.1-4.9L135.8 4.1c1.4-1.4 3.2-2 4.9-2Z"/></svg></button>',
80  nextArrow: '<button type="button" class="slick-next slider-button" aria-label="Next"><svg viewBox="0 0 148.8 283.5"><path d="M8 281.5c-1.8 0-3.6-.7-4.9-2-2.7-2.7-2.7-7.2 0-9.9l127.8-127.8L3.1 14C.3 11.2.3 6.8 3.1 4.1c2.7-2.7 7.2-2.7 9.9 0l132.8 132.8c1.3 1.3 2.1 3.1 2.1 4.9s-.7 3.6-2.1 4.9L13 279.5c-1.4 1.4-3.2 2-4.9 2Z"/></svg></button>',
81  responsive: [
82	{
83      breakpoint: 1200,
84      settings: {
85        slidesToShow: 3,
86      }
87    },
88	{
89      breakpoint: 992,
90      settings: {
91        slidesToShow: 2,
92      }
93    },
94	{
95      breakpoint: 650,
96      settings: {
97        slidesToShow: 1,
98      }
99    }
100  ]
101});
102
103
104
105
106
107
108//HIDE CAROUSEL CONTROLS
109$('.carousel-inner').each(function() {
110
111    if ($(this).children('div').length === 1) $(this).siblings('.carousel-control-wrap, .carousel-indicators, .carousel-control-prev, .carousel-control-next').hide();
112
113});
114
115//ACCORDION
116var acc = document.getElementsByClassName("accordion");
117var i;
118
119for (i = 0; i < acc.length; i++) {
120  acc[i].addEventListener("click", function() {
121    this.classList.toggle("active");
122    var panel = this.nextElementSibling;
123    if (panel.style.maxHeight) {
124      panel.style.maxHeight = null;
125    } else {
126      panel.style.maxHeight = panel.scrollHeight + "px";
127    }
128  });
129}
130
131//VIDEO SOUND
132$(".modal.fade").on('hidden.bs.modal', function (e) {
133    $(".modal.fade iframe").attr("src", $(".modal.fade iframe").attr("src"));
134});
135
136
137
138$(function() {
139	
140	$('input.datepicker').datepicker({
141		dateFormat: 'dd/mm/yy'
142    });
143    
144    $('#any-date').on('change', function() {
145		if ($(this).is(':checked')) {
146			$('#start-date').val('');
147			$('#end-date').val('');
148		}
149    });
150    
151	$('form.search-bar').on('submit', function(e) {
152		e.preventDefault();
153		var url = $(this).find('select').val();
154		if ($(this).find('input.datepicker').length && $('#start-date').val().length) url += moment($('#start-date').val(), 'DD/MM/YYYY').format('YYYY-MM-DD')+'/'+(($('#end-date').val().length) ? moment($('#end-date').val(), 'DD/MM/YYYY').format('YYYY-MM-DD'):moment($('#start-date').val(), 'DD/MM/YYYY').add(1, 'y').format('YYYY-MM-DD'));
155		if ($(this).find('input[name=locality]:checked').length) url += '?'+$(this).find('input[name=locality]:checked').attr('name')+'='+$(this).find('input[name=locality]:checked').val();			
156		window.location = url;
157	});
158	
159});
160
161//SPLIT P
162$(document).ready(function() {
163    $('#introp').append($('.splitp p:first'));
164});
165
166
167//SPLIT UL
168// Function to split the <ul> after the 4th item and add classes to the divs
169function splitUlAndAddClasses() {
170    const ul = document.getElementById('full-list');
171    const items = Array.from(ul.children); // Get all <li> elements
172
173    // Split the list after the 4th item
174    const splitIndex = 4; 
175    const firstHalfItems = items.slice(0, splitIndex); // First 4 items
176    const secondHalfItems = items.slice(splitIndex); // Items after the 4th
177
178    // Create the two new <ul> elements
179    const firstUl = document.createElement('ul');
180    const secondUl = document.createElement('ul');
181
182    // Append the items to their respective <ul>
183    firstHalfItems.forEach(item => firstUl.appendChild(item));
184    secondHalfItems.forEach(item => secondUl.appendChild(item));
185
186    // Create the two <div> elements with classes
187    const firstDiv = document.createElement('div');
188    const secondDiv = document.createElement('div');
189
190    firstDiv.classList.add('first-list-container');  // Add a class to the first div
191    secondDiv.classList.add('second-list-container'); // Add a class to the second div
192
193    // Append each <ul> to a <div>
194    firstDiv.appendChild(firstUl);
195    secondDiv.appendChild(secondUl);
196
197    // Replace the original <ul> with the two new <div>s
198    ul.parentNode.replaceChild(firstDiv, ul);
199    firstDiv.parentNode.insertBefore(secondDiv, firstDiv.nextSibling);
200}
201
202// Call the function to perform the split and add classes
203splitUlAndAddClasses();
204
205

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.