PageSourceSearch

https://www.manchestercityofliterature.com/app/themes/mcol/assets/js/main.js?ver=c16d1bcd7

js manchestercityofliterature.com collected 2026-10-02 06:53:53 UTC 5,563 bytes, 237 lines download raw bytes

1jQuery(function () {
2		initInlineGallery();
3		initFancybox();
4		initDatepicker();
5		initFiltering();
6		initMobileNav();
7		initDropDownClasses();
8		initCustomHover();
9		initAccordion();
10		initHTMLClone();
11		initOpenClose();
12		initCustomForms();
13		initSameHeight();
14		initLightbox();
15		NewsLoadMore();
16});
17
18// align blocks height
19function initSameHeight() {
20	jQuery('.info-post-section').sameHeight({
21		elements: '.text-holder',
22		flexible: true,
23		multiLine: true,
24		biggestHeight: false,
25	});
26}
27
28function initFiltering(){
29	jQuery('.filter-form select, #hidden-date').change(function(){
30		jQuery('.filter-form').submit();
31		})
32	}
33
34// initialize custom form elements
35function initCustomForms() {
36	jcf.setOptions('Select', {
37		wrapNative: false,
38		wrapNativeOnMobile: false,
39		fakeDropInBody: false,
40	});
41	jcf.replaceAll();
42
43	// Now add subtle shadows when scrollable
44	const observer = new MutationObserver((mutations) => {
45		for (const mutation of mutations) {
46			mutation.addedNodes.forEach(node => {
47				if (
48					node.nodeType === 1 &&
49					node.classList.contains('jcf-list-content')
50				) {
51					attachScrollHandler(node);
52				} else if (node.nodeType === 1) {
53					// In case .jcf-list-content is nested deeper
54					node.querySelectorAll('.jcf-list-content').forEach(attachScrollHandler);
55				}
56			});
57		}
58	});
59
60	// Start observing document (or a narrower container if possible)
61	observer.observe(document.body, {
62		childList: true,
63		subtree: true,
64	});
65
66	// Attach handler to existing ones at start
67	document.querySelectorAll('.jcf-list-content').forEach(attachScrollHandler);
68
69	function attachScrollHandler(scrollBox) {
70		const wrapper = scrollBox.closest('.jcf-scroll-active');
71		if (!wrapper) return;
72
73		function updateShadow() {
74			const atBottom = scrollBox.scrollTop + scrollBox.clientHeight >= scrollBox.scrollHeight - 1;
75			wrapper.classList.toggle('has-more', !atBottom);
76		}
77
78		// Prevent multiple listeners
79		if (!scrollBox._shadowListenerAttached) {
80			scrollBox.addEventListener('scroll', updateShadow);
81			window.addEventListener('resize', updateShadow);
82			updateShadow();
83			scrollBox._shadowListenerAttached = true;
84		}
85	}
86}
87
88// accordion menu init
89function initAccordion() {
90	ResponsiveHelper.addRange({
91		"..1023": {
92			on: function () {
93				jQuery(".navigation").slideAccordion({
94					opener: ">.mobile-opener",
95					slider: ">.dropdown-menu",
96					animSpeed: 300,
97					activeClass: "drop-active",
98				});
99			},
100			off: function () {
101				jQuery(".navigation").slideAccordion("destroy");
102			},
103		},
104	});
105
106	jQuery(".accordion").slideAccordion({
107		opener: ".opener",
108		slider: ".slide",
109		animSpeed: 300,
110	});
111}
112
113function initCustomHover() {
114	ResponsiveHelper.addRange({
115		'1024..': {
116			on: function () {
117				jQuery('navigation>li>a').touchHover();
118			},
119		},
120	});
121}
122
123function initDatepicker() {
124	jQuery('[data-datepicker_1]').uiDatepicker({
125		dateFormat: 'yy-mm-dd',
126		firstDay: 1,
127		showOtherMonths: true,
128		selectOtherMonths: true,
129		onSelect: function(dateText){
130			jQuery('#hidden-date_1').val(dateText);
131		}
132	});
133
134	jQuery('[data-datepicker_2]').uiDatepicker({
135		dateFormat: 'yy-mm-dd',
136		firstDay: 1,
137		showOtherMonths: true,
138		selectOtherMonths: true,
139		onSelect: function(dateText){
140			jQuery('#hidden-date_2').val(dateText);
141		}
142	});
143
144	jQuery('#submit-dates').click(function(){
145		jQuery('.filter-form').submit()
146	})
147}
148
149function initDropDownClasses() {
150	jQuery('.navigation li').each(function () {
151		var item = jQuery(this);
152		var drop = item.find('ul');
153		var link = item.find('a').eq(0);
154		if (drop.length) {
155			item.addClass('has-drop-down');
156			if (link.length) link.addClass('has-drop-down-a');
157		}
158	});
159}
160
161// lightbox init
162function initFancybox() {
163	jQuery("a.lightbox, [data-fancybox]").fancybox({
164		parentEl: "body",
165		margin: [50, 0],
166		loop: false,
167		infobar: false,
168		slideShow: false,
169		fullScreen: false,
170		thumbs: false,
171		toolbarCloseBtn: false,
172	});
173}
174
175// mobile menu init
176function initMobileNav() {
177	jQuery('body').mobileNav({
178		menuActiveClass: 'nav-active',
179		menuOpener: '.nav-opener',
180		hideOnClickOutside: false,
181		menuDrop: '.nav-drop',
182	});
183}
184
185function initHTMLClone() {
186	jQuery('.navigation').each(function () {
187		jQuery(this).clone().appendTo('.navigation-clone');
188	});
189
190	 jQuery('.header-holder').each(function () {
191		 jQuery(this).clone().appendTo('.header-holder-clone');
192	 });
193}
194
195function initOpenClose() {
196	jQuery('.open-close').openClose({
197		activeClass: 'active',
198		opener: '.opener',
199		slider: '.slide',
200		animSpeed: 400,
201		effect: 'slide',
202	});
203}
204
205function initLightbox() {
206	let popupLink = jQuery('.bloxPopup');
207
208	popupLink.lightboxController();
209	popupLink.click(function(e) {
210		e.preventDefault();
211	});
212}
213
214function NewsLoadMore() {
215	let hidden = jQuery('.post-list div:nth-child(n+6)');
216	let loadMore = jQuery('.load-more-wrapper');
217	hidden.hide();
218	loadMore.hide();
219	loadMore.slideDown();
220
221	jQuery('.load-more').click(function(e) {
222		e.preventDefault();
223		hidden.slideDown();
224		jQuery('.load-more-wrapper').hide();
225	});
226}
227
228function initInlineGallery() {
229	let item = jQuery('.text-block .gallery .gallery-item');
230	item.each(function(){
231		jQuery(this).find('a').attr('data-fancybox', 'gallery');
232		let caption = jQuery(this).find('.wp-caption-text').html();
233		if (caption !== 'undefined') {
234			jQuery(this).find('a').attr('data-caption', caption);
235		}
236	})
237}

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.