PageSourceSearch

https://www.seafordtowncouncil.gov.uk/wp-content/themes/seaford-town-council/js/main.js?ver=7.1

js seafordtowncouncil.gov.uk collected 2026-10-02 08:19:24 UTC 10,113 bytes, 328 lines download raw bytes

1try{Typekit.load({ async: true });}catch(e){}
2
3jQuery(function($) {
4	/**
5	 *	Isolate a window resize on x or y axis.
6	 *	jQuery objects now have resizeY and resizeX triggers.
7	 */
8	(function(){
9		var $w = $(window);
10		var windowWidth = $w.width();
11		var windowHeight = $w.height();
12		$w.on('resize',function(){
13			if($w.width() != windowWidth){
14				$w.trigger('resizeX');
15				windowWidth = $w.width();
16			}
17			if($w.height() != windowHeight){
18				$w.trigger('resizeY');
19				windowHeight = $w.height();
20			}
21		});
22	})();
23
24	/**
25	 *	Trigger an event when resize on x axis ends
26	 *	jQuery objects now have resizeXend triggers.
27	 */
28	(function(){
29		var $w = $(window);
30		var resizeTimer;
31		$w.on('resizeX', function(){
32			if (resizeTimer) clearTimeout(resizeTimer);   // clear any previous pending timer
33			resizeTimer = setTimeout(function(){$w.trigger('resizeXend')}, 200);
34		});
35	})();
36
37	/**
38	 *	Trigger an event when resize on y axis ends
39	 *	jQuery objects now have resizeYend triggers.
40	 */
41	(function(){
42		var $w = $(window);
43		var resizeTimer;
44		$w.on('resizeY', function(){
45			if (resizeTimer) clearTimeout(resizeTimer);   // clear any previous pending timer
46			resizeTimer = setTimeout(function(){$w.trigger('resizeYend')}, 200);
47		});
48	})();
49
50
51//-- VARS
52   var $body = $('body');
53
54	// Vars for menu
55	var $menuToggle = $('#menu-toggle');
56   var $dropDownMenu = $('#drawer');
57	var menuOpen = 'menu-open';
58
59	// Vars for popup
60	var $popup = $('.popup');
61	var popupOpen = 'popup-open';
62
63	// Vars for custom drop downs
64	var open = 'open';
65	var customDropDownOpen = 'custom-drop-down-open';
66
67
68//-- FUNCTIONS
69	// Make gloablly available
70   screenSize = function() {
71      if ( window.getComputedStyle ) {
72         var style = getComputedStyle( document.body, ':before' );
73         if ( style ) {
74            return parseInt(style.content.replace(/\'|\"/g, ''));
75         }
76      }
77      return 4;
78   }
79
80	// Open the menu
81   var openMenu = function() {
82      $body.add($menuToggle).addClass(menuOpen);
83		$dropDownMenu.stop().slideDown(300);
84   }
85
86	// Close the menu
87   var closeMenu = function() {
88      $body.add($menuToggle).removeClass(menuOpen);
89		$dropDownMenu.stop().slideUp(200);
90   }
91
92	// Open sub menus
93	var openSubMenus = function($menu, opengranddSub) {
94		if(opengranddSub) {
95			$menu.find('.grand-sub-menu').show();
96		}
97		$menu.addClass(menuOpen).stop().slideDown(200);
98	}
99
100	// Close sub menus
101	var closeSubMenus = function($menu, closegranddSub) {
102		if(closegranddSub) {
103			$menu.find('.grand-sub-menu').hide();
104		}
105		$menu.removeClass(menuOpen).stop().slideUp(200);
106	}
107
108	// Hide the cookie policy and set cookie to not show it again
109	var hideCookiePolicy = function() {
110		var d = new Date();
111		var expiryDate = d.setTime(d.getTime() + (1000*60*60*24*365));
112		document.cookie = 'hide_cookie_policy=true; expires='+expiryDate+'; path=/';
113		$('#cookie-policy').slideUp();
114	}
115
116	// Open the popup
117	var openPopup = function($popup) {
118		$popup.add($body).addClass(popupOpen).end().fadeIn();
119	}
120
121	// Close the popup
122	var closePopup = function() {
123		$popup.add($body).removeClass(popupOpen).end().fadeOut();
124
125		if( $popup.find('iframe').length > 0 ) {
126			var src = $popup.find('iframe').attr('src');
127			$popup.find('iframe').attr('src','').attr('src', src);
128		}
129	}
130
131	// Toggle accordions
132	var toggleAccordion = function($accordion) {
133		var defaultHeight = $accordion.attr('data-default-height');
134		var cutHeight = $accordion.attr('data-cut-height');
135		if( $accordion.hasClass('closed') ) {
136			$accordion.removeClass('closed').children('.table-container').css('height', defaultHeight);
137		} else {
138			$accordion.addClass('closed').children('.table-container').css('height', cutHeight);
139		}
140	}
141
142	// Determine whether a meeting table should be cut or not
143	var setupMeetingsTables = function() {
144		$('.meeting-table.expandable').each(function() {
145			$(this).attr('data-default-height', $(this).find('table').height());
146			var heightTotals = $(this).find('thead').height();
147			for(var i = 1; i <= 10; i++) {
148				heightTotals += $(this).find('.meeting-' + i).height();
149			}
150			$(this).attr('data-cut-height', heightTotals).addClass('closed').children('.table-container').css('height', heightTotals);
151		});
152	}
153
154	// Custom drop downs
155	var openCustomDropDown = function($dd) {
156		// Open the custom drop down
157		var delay = ($('body').hasClass(customDropDownOpen)) ? 310 : 0;
158		setTimeout(function() {
159			$dd.addClass(open + ' arrow-change').children('.custom-drop-down-options').stop().slideDown(300);
160			$body.addClass(customDropDownOpen);
161		},delay);
162	}
163
164	var closeCustomDropDown = function(ev) {
165		// Close the custom drop down
166		var $ev = $(ev.target);
167		var $dd = $('.custom-drop-down.open');
168		$dd.removeClass('arrow-change').children('.custom-drop-down-options').stop().slideUp(300, function() {
169			$(this).parents('.custom-drop-down').removeClass(open).addClass('just-closed');
170			$body.removeClass(customDropDownOpen);
171		});
172
173		// We add and remove this class to stop a slight flash in the border bottom. Small and tiny, but it makes it not look slightly odd
174		setTimeout(function() {
175			$dd.removeClass('just-closed');
176		},350);
177	}
178
179	var updateCustomDropDown = function($option) {
180		// Update the hidden select list and trigger the change, then update the custom select list
181		$option.parents('.custom-drop-down-container').children('select').val($option.attr('data-value')).trigger('change').siblings('.custom-drop-down').children('.custom-drop-down-selected').text($option.text());
182	}
183
184	var updateCustomDropDownSelected = function($select) {
185		// Set the custom drop down selected item to use the <select> selected value
186		$select.siblings('.custom-drop-down').children('.custom-drop-down-selected').text($select.children('option:selected').text());
187	}
188
189	var hackGfDropDowns = function() {
190		$('.gform_wrapper').each(function() {
191			$('select', this).each(function() {
192				if($(this).parents('.custom-drop-down-container').length > 0) {return true;}
193				var options = [];
194				var optionsHTML = '';
195
196				$(this).wrap('<div class="custom-drop-down-container"></div>').children('option').each(function() {
197					options.push([$(this).attr('value'), $(this).text()]);
198				});
199
200				for(i = 0; i < options.length; i++) {
201					optionsHTML += '<li class="custom-drop-down-option option" data-value="'+options[i][0]+'">'+options[i][1]+'</li>';
202				}
203
204				$(this).parents('.custom-drop-down-container').append('<div class="custom-drop-down"><p class="custom-drop-down-selected">'+options[0][1]+'</p><ul class="custom-drop-down-options options-container">'+optionsHTML+'</ul></div>');
205			});
206		});
207	}
208	// End custom drop downs
209
210
211//-- MAIN
212	// Menus
213	$(window).on('resizeXend', function() {
214		if( $body.hasClass(menuOpen) ) {
215			closeMenu();
216		}
217	});
218
219   $menuToggle.on('click', function() {
220      $body.hasClass(menuOpen) ? closeMenu() : openMenu();
221   });
222
223   $body.on('keydown', function( e ) {
224      if( e.keyCode == 27 && $body.hasClass(menuOpen)) {
225         closeMenu();
226      }
227
228		if( e.keyCode == 27 && $body.hasClass(popupOpen)) {
229         closePopup();
230      }
231   });
232
233	$('#site-header .menu-item-has-children').on('mouseenter', function() {
234		openSubMenus($(this).children('.sub-menu, .grand-sub-menu'), false);
235	}).on('mouseleave', function() {
236		closeSubMenus($(this).children('.sub-menu, .grand-sub-menu'), false);
237	});
238
239	$('#drawer .fa-angle-down, #sidebar .fa-angle-down').on('click', function() {
240		$(this).hide().siblings('.fa-angle-up').show();
241		openSubMenus($(this).siblings('.sub-menu, .grand-sub-menu'), false);
242	});
243
244	$('#drawer .fa-angle-up, #sidebar .fa-angle-up').on('click', function() {
245		$(this).hide().siblings('.fa-angle-down').show();
246		closeSubMenus($(this).siblings('.sub-menu, .grand-sub-menu'), false);
247	});
248
249	$('.menu-items .expand').on('.click', function() {
250		if($(this).siblings('.sub-menu').hasClass(menuOpen)) {
251			closeSubMenus($(this).children('.sub-menu, .grand-sub-menu'));
252		} else {
253			openSubMenus($(this).siblings('.sub-menu, .grand-sub-menu'));
254		}
255	});
256
257	var $headerLoginContainer = $('#site-header .login-container');
258	$('#site-header button[name="account-dropdown"]').on( 'click', function() {
259		$headerLoginContainer.slideToggle();
260	} );
261	// End menus
262
263	// Match heights
264	$('.link-blocks-dark').matchHeights(['.post-title'], 1);
265	$('body:not(.home) .posts-container, body.home .latest-posts').matchHeights(['.post-title', '.excerpt'], 1);
266	$('.home.in-mourning .mourning-pages').matchHeights(['p'], 1);
267	// End match heights
268
269	// Cookie policy
270	$('#cookie-policy .close').on('click', hideCookiePolicy);
271	// End cookie policy
272
273	// Popups
274	$('.popup-trigger.e-news > a').on('click', function() {
275		openPopup($('#popup-e-news'));
276	});
277	$('.popup-trigger.contact-form').on('click', function() {
278		openPopup($('#popup-form'));
279	});
280
281	$popup.on('click', function(e) {
282		if($(e.target).hasClass(popupOpen)) {closePopup();}
283	}).find('.close').on('click', closePopup);
284	// End popups
285
286	// Galleries
287	$('.gallery-images').each(function() {
288		$(this).popupGallery();
289	});
290	// End galleries
291
292	// Slideshow
293	$('.page-section.slideshow-section').slideshow();
294	// End slideshow
295
296	// Meeting accordion
297	if( $body.is('.tax-meeting-year') ) {
298		$(window).on('load resizeXend', function() {
299			setupMeetingsTables();
300		});
301	}
302
303	$('.toggle-accordion').on('click', function() {
304		toggleAccordion($(this).parent());
305	});
306	// End meeting accordion
307
308	// Custom drop downs
309	$(document).on('click', 'body.custom-drop-down-open', function(ev) {
310		// Close custom drop down menus
311		closeCustomDropDown(ev);
312	}).on('click', '.custom-drop-down:not(.open)', function() {
313		if( $(this).children('.custom-drop-down-options').length )
314		{
315			// Open custom drop down menus
316			openCustomDropDown($(this));
317		}
318	}).on('click', '.custom-drop-down-option', function() {
319		// Update custom drop down menus
320		updateCustomDropDown($(this));
321	}).on('change', '.custom-drop-down-container select', function() {
322		updateCustomDropDownSelected($(this));
323	});
324
325	// Re-changes the Gravity Forms submit button after a form submit
326	$(document).on('gform_post_render', hackGfDropDowns);
327	// End custom drop downs
328});

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.