PageSourceSearch

https://www.winnipeg.ca/themes/custom/confluence/js/scripts.js?tltipi

js winnipeg.ca collected 2026-09-24 08:42:21 UTC 28,318 bytes, 812 lines download raw bytes

1/* TABLE OF CONTENTS
21. Global functions
32. Menu
43. Components
5	3.1 Tabs
6	3.2 ScrollTop
7	3.3 Mobile search
8	3.4 Tiny Slider
9	3.5 Footer Links
10	3.6 Skip Links
11	3.7 Accordions
12	3.8 I want to
13	3.9 Results summary/view all
14	3.10 Feedback auto submit
15	3.11 WPS
16	3.12 Document Content Type Section Nav
17	3.13 Footnotes Backup Link
18	3.14 Facility/Parks - Other Facility View Placement
19	3.15 Translate file size indicators
20	3.16 Translate days & times
21	3.17 Card detect click description
22	3.18 A11y Disrupton Breadcrumbs & <title>
23	3.19 Header login
244. Window resize
25	4.1 Cookie Consent banner
26	4.2 I want to
27	4.3 Tiny Slider
28	4.4 Alerts padding for controls
295. Storage
30	5.1 Categorized tiles
316. Ajax
32	6.1 Datepicker
33	6.2 Results summary/view all
34	6.3 Filters summary fr translation
35*/
36
37(function ($) {
38
39	/* [ 1. Global functions ] ----------*/
40
41	function delayAdd(elem,className,transition) {
42		setTimeout(
43			function removeAddFunc() {
44				elem.addClass(className);
45			},
46		transition);
47	}
48	function delayRemove(elem,className,transition) {
49		setTimeout(
50			function removeDelayFunc() {
51				elem.removeClass(className);
52			},
53		transition);
54	}
55
56	/* [ 2. Menu ] ----------*/
57	if($('.sidenav-btn').length){
58		$('.sidenav-btn').each(function(){
59			var btnID = $(this).attr('data-target').split('#')[1];
60			$(this).parent().siblings('.m-menu').attr('id',btnID);
61		});
62	}
63	$('.sidenav-btn').on('click',function(){
64		$(this).attr('aria-expanded',function(index,attr){
65			return attr == "true" ? "false" : "true";
66		}).attr('aria-label',function(index,attr){
67			if($(this).attr('aria-expanded') == true) {
68				return attr.replace('Expand the','Collapse the');
69			} else {
70				return attr.replace('Collapse the','Expand the');
71			}
72		}).parent().siblings('.m-menu').slideToggle();
73		$(this).children('.far').toggleClass('fa-chevron-up fa-chevron-down');
74	});
75
76	/* [ 3. Components ] ----------*/
77
78	/* [ 3.1 Tabs ] ----------*/
79	$('a[data-toggle="tab"]').on('click',function(e){
80		e.preventDefault();
81  		$(this).tab('show');
82	});
83	if(window.location.href.indexOf('#tab-') > -1) {
84		var tab_id = decodeURIComponent(window.location.href.split('#tab-')[1]);
85		if ($("#"+tab_id).length && $("#"+tab_id).closest('.tab-pane').length){
86			tab_id = "#" + $("#"+tab_id).closest('.tab-pane').attr("aria-labelledby");
87		}else{
88			tab_id = "#tab-" + tab_id;
89		}
90		$('.nav-link').removeClass('active')
91		$(tab_id).attr('aria-selected', true).addClass('active');
92		$('.tab-pane').removeClass('active').removeClass('show');
93		$(tab_id + '-panel').addClass('active').addClass('show');
94	}
95
96	/* [ 3.2 ScrollTop ] ----------*/
97	if ($('body').hasClass('global') || $('body').hasClass('vertical-layout')) {
98
99    //only invoke this code if it's within the new designsystem look and feel
100
101    $(window).scroll(function () {
102      if ($(this).scrollTop() > 300) {
103        $('.scrolltop:hidden').fadeIn('slow');
104      } else {
105        $('.scrolltop').fadeOut('slow');
106      }
107    });
108
109		$('.scrolltop').on('click',function(e){
110			e.preventDefault();
111			$("html,body").animate({scrollTop: $("#thetop").offset().top }, "1000");
112		})
113  }
114
115	/* [ 3.3 Mobile search ] ----------*/
116	function openSearch(){
117		$('html').scrollTop( 0 );
118    $('.headerGradient').fadeIn(200);
119    $('.global-header .search-group-container').addClass('in');
120    $('.global-header .search-group-container input').focus();
121    $('body').css({'position':'fixed','left':0,'right':0, 'top':0});
122  }
123
124  function closeSearch(){
125		$('.headerGradient').fadeOut(200);
126    $('.global-header .search-group-container').removeClass('in');
127    $('body').css({'position':'initial','left':'auto','right':'auto','top':'auto'});
128  }
129
130  $('.searchBtn').on('click',function() {
131    openSearch();
132  });
133
134  // Close search and menu on gradient click
135  $('.headerGradient, .headerCloseBtn').on('click',function() {
136    closeSearch();
137  });
138
139	/* [ 3.4 Tiny Slider ] ----------*/
140	if($('.view-global-alerts .views-row').length > 1) {
141		$('.view-global-alerts .views-row').each(function(){
142			$('.view-global-alerts .alerts__nav').append('<li class="alerts__nav-item"><button class="alerts__nav-item-button"></button></li>');
143			setTimeout(function(){
144				$('.alerts__nav-item').each(function(){
145					alertNavIndex = $(this).index() + 1;
146					let thisObj = this;
147					$(once('.alerts__nav-item-button', thisObj)).each(function(alertNavIndex) {
148						$(thisObj).append('<span class="visually-hidden">' + alertNavIndex + '</span>')
149					});
150                });
151			});
152		});
153		$('.view-global-alerts .alerts__controls').removeClass('alerts__controls--hidden');
154		var alerts_carousel = tns({
155			container:'.view-global-alerts .view-content',
156			nav: true,
157			navContainer: '.view-global-alerts .alerts__nav',
158			controls: true,
159			prevButton: '.view-global-alerts .alerts__control--previous',
160			nextButton: '.view-global-alerts .alerts__control--next',
161			autoHeight:true,
162			mode: 'gallery'
163		});
164		var alertsControlsWidth = $('.alerts__controls').width();
165		$('.view-global-alerts .field-content').css('padding-right', 'calc(' + alertsControlsWidth + 'px + 32px)');
166	}
167
168	if($('.wps-slides > .wps-slide').length > 1) {
169		var wps_carousel = tns({
170			container:'.wps-slides',
171			nav: false,
172			controls: true,
173			nextButton: '.wps-slides__nav .wps-slides__nav--next',
174			prevButton: '.wps-slides__nav .wps-slides__nav--prev',
175			autoHeight:true,
176			mode: 'gallery'
177		});
178		var wps_carousel_info = wps_carousel.getInfo();
179		var wps_carousel_current = wps_carousel_info.displayIndex;
180		$('.wps-slides__nav-current').text(wps_carousel_current);
181		$('.wps-slides__nav').appendTo('.tns-slide-active .wps-slide__content')
182		$('.wps-slides__nav--next, .wps-slides__nav--prev').removeAttr('tabindex');
183		setTimeout(function() {
184			$('.wps-slide:not(.tns-slide-active)').find('a').attr('tabindex', '-1');
185		}, 150)
186		wps_carousel.events.on('indexChanged',function(){
187			$('.wps-slides__nav--next, .wps-slides__nav--prev').removeAttr('tabindex');
188			var wps_carousel_info = wps_carousel.getInfo();
189			var wps_carousel_current = wps_carousel_info.displayIndex;
190			$('.wps-slides__nav-current').text(wps_carousel_current);
191			$('.wps-slides__nav').appendTo('.tns-slide-active .wps-slide__content')
192			setTimeout(function() {
193				$('.wps-slide:not(.tns-slide-active)').find('a').attr('tabindex', '-1');
194				$('.wps-slide.tns-slide-active').find('a').removeAttr('tabindex');
195			}, 300);
196		});
197		$('.wps-slides__nav--next, .wps-slides__nav--prev').on('click', function(){
198			$(this).focus();
199		});
200	}
201
202	/* [ 3.5 Footer Links ] ----------*/
203	setTimeout(function(){
204		$('#block-footerlinks .no-inline-links a').removeAttr('title');
205	});
206
207	/* [ 3.6 Skip Links ] ----------*/
208	setTimeout(function(){
209		$('.user-logged-in .a-skip-link').removeAttr('tabindex');
210	},500);
211
212	/* [ 3.7 Accordions ] ----------*/
213	if(window.location.href.indexOf('#accordion') > -1) {
214		var accordion_id = decodeURIComponent('#accordion' + window.location.href.split('#accordion')[1]);
215		$(accordion_id).attr('aria-expanded', true).removeClass('collapsed');
216		$(accordion_id + '-target').addClass('show');
217	}
218	$('a[href^="#accordion-"]').on('click', function(){
219		var accordion_id = $(this).attr('href');
220		$(accordion_id).attr('aria-expanded', true).removeClass('collapsed');
221		$(accordion_id + '-target').addClass('show');
222	});
223
224	/* [ 3.8 I want to ] ----------*/
225	$('.i-want-to__trigger').on('click', function(){
226		var activeSectionHeight = 0;
227		setTimeout(function(){
228			$('.i-want-to__section.is-active > *').each(function(){
229				activeSectionHeight += $(this).outerHeight() + 4;
230			});
231			$('.i-want-to').css('min-height',activeSectionHeight + 16);
232		});
233	});
234	if($('.i-want-to').length) {
235		var activeSectionHeight = 0;
236		setTimeout(function(){
237			$('.i-want-to__section.is-active > *').each(function(){
238				activeSectionHeight += $(this).outerHeight() + 4;
239			});
240			$('.i-want-to').css('min-height',activeSectionHeight + 16);
241		});
242	}
243
244	/* [ Results summary / view all ] ----------*/
245	if($('.view .results-summary').length) {
246		$('.view .results-summary').each(function(){
247			var resultsSummary = $(this);
248			var viewFilters = resultsSummary.parent().siblings('.view-filters').find('.form--inline');
249			if(viewFilters.length) {
250				resultsSummary.insertAfter(viewFilters);
251			}
252		});
253	}
254	if($('.view .views-filters-summary').length) {
255		$('.view .views-filters-summary').each(function(){
256			var filtersSummary = $(this);
257			var viewFilters = filtersSummary.parent().siblings('.view-filters').find('.form--inline');
258			if(viewFilters.length) {
259				filtersSummary.insertAfter(viewFilters);
260			}
261		});
262	}
263	if($('.view-header .reset-btn').length) {
264		$('.view-header .reset-btn').each(function(){
265			var viewAll = $(this);
266			var viewContent = viewAll.parent().siblings('.view-content');
267			viewAll.insertBefore(viewContent);
268		});
269	}
270
271	/* [ 3.10 Feedback auto submit ] ----------*/
272	$('.webform-submission-feedback-form label[for=edit-selection-yes]').click(function(){
273		$('input#edit-selection-yes').attr('checked', true);
274		$('form.webform-submission-feedback-form').submit();
275	});
276
277	/* [ 3.11 WPS ] ----------*/
278	if($('.region-wps-translate').length) {
279		var gtranslateCheck = setInterval(changeGtranslateDefault, 500);
280		function changeGtranslateDefault() {
281			if($('.gt_selector').length) {
282
283				clearInterval(gtranslateCheck);
284
285				$('.gt_selector option:first').val('en|en');
286				$('.gt_selector option:contains("English")').remove();
287
288				var selectedValue = $('.gt_selector').val();
289				var firstOption = $('.gt_selector').find('option:first');
290				var firstOptionValue = 'en|en';
291
292				if (selectedValue != firstOptionValue) {
293					firstOption.text('Disable Translation');
294				} else {
295					$('.gt_selector').val('en|en');
296				}
297
298				$('.gt_selector').on('change', function() {
299					var selectedValue = $(this).val();
300
301					if (selectedValue != firstOptionValue) {
302						firstOption.text('Disable Translation');
303					} else {
304						firstOption.text('More Languages');
305					}
306				});
307
308			}
309		}
310	}
311
312	/* [ 3.12 Document Content Type Section Nav ] ----------*/
313	if ( ( $('.page-node-type-document').length ) && ( $('.node__content h2').length ) ) {
314		var headings = [];
315		var idCounts = {};
316
317		// Build Array of H2, H3, H4 elements 
318		$('.node__content h2, .node__content h3, .node__content h4').each(function() {
319			var $heading = $(this);
320			var title = '';
321
322			// If inside a card, get the .card-title text (if it exists)
323			if ($heading.closest('.card').length) {
324				title = $heading.closest('.card').find('.card-title').first().text().trim();
325			}
326			// Else if it has a button, use the button's text
327			else if ($heading.find('button').length) {
328				title = $heading.find('button').first().text().trim();
329			}
330			// Otherwise use the heading text itself
331			else {
332				title = $heading.text().trim();
333			}
334
335			// If no title found, skip this heading
336			if (!title) return;
337
338			var baseId = title
339				.replace(/[^a-z0-9\s]/gi, '')
340				.replace(/[_\s]/g, '-')
341				.toLowerCase();
342
343			// Ensure unique ID
344			if (!idCounts[baseId]) {
345				idCounts[baseId] = 1;
346			} else {
347				idCounts[baseId]++;
348			}
349			var id = baseId + (idCounts[baseId] > 1 ? '-' + idCounts[baseId] : '');
350			$heading.attr('id', id);
351
352			var link = '';
353			if ($heading.is("h2")) {
354				link = '<li class="anchor__menu-item anchor__menu-item--level-1"><a class="sidenav-item" href="#' + id + '">' + title + '</a></li>';
355			}
356			if ($heading.is("h3") && !$heading.hasClass("card-title")) {
357				link = '<li class="anchor__menu-item anchor__menu-item--level-2"><a class="sidenav-item" href="#' + id + '">' + title + '</a></li>';
358			}
359			if ($heading.is("h4")) {
360				link = '<li class="anchor__menu-item anchor__menu-item--level-3"><a class="sidenav-item" href="#' + id + '">' + title + '</a></li>';
361			}
362
363			if (link) headings.push(link);
364		});
365
366		// Append array values to section nav
367		$.each(headings, function(index, value) {
368			$('.anchor__menu').append(value);
369		});
370
371		// Creates .anchor__menu--level-3 menu container, moves markup for level 3 items into level 2
372		$('.anchor__menu > .anchor__menu-item--level-3').each(function(){
373			if ( $(this).prev().hasClass('anchor__menu-item--level-2') ) {
374				$(this).before("<ul class='anchor__menu--level-3'>");
375			}
376		});
377		$('.anchor__menu--level-3').each(function(){
378			$(this).nextUntil('.anchor__menu-item--level-2, .anchor__menu-item--level-1').detach().appendTo($(this));
379			if ($(this).prev().hasClass('anchor__menu-item--level-2')) {
380				var previous = $(this).prev();
381				$(this).detach().appendTo( previous );
382			}
383		});
384
385		// Creates .anchor__menu--level-2 menu container, moves markup for level 2 items
386		$('.anchor__menu > .anchor__menu-item--level-2').each(function(){
387			if ( $(this).prev().hasClass('anchor__menu-item--level-1') ) {
388				$(this).before("<ul class='anchor__menu--level-2'>");
389			}
390		});
391		$('.anchor__menu--level-2').each(function(){
392			$(this).nextUntil('.anchor__menu-item--level-1').detach().appendTo($(this));
393			if ($(this).prev().hasClass('anchor__menu-item--level-1')) {
394				var previous = $(this).prev();
395				$(this).detach().appendTo( previous );
396			}
397		});
398
399		// Submenu Trigger
400		if ($('.anchor__menu-item > ul').length) {
401			$('.anchor__menu-item > ul').each(function(){
402				var title = $(this).prev().html();
403				var triggerAriaControls = $(this).prev().html().replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '-') + '-menu';
404				var triggerAriaLabel = 'Expand the ' + title + ' menu';
405				$(this).attr('id', triggerAriaControls);
406				$(this).prev().wrap('<div class="anchor__menu-item--link-wrapper">');
407				$(this).prev().append('<button aria-controls="'+triggerAriaControls+'" aria-label="'+triggerAriaLabel+'" aria-expanded="false"><i class="far fa-chevron-down"></i></button>');
408			});
409		}
410		$('.anchor__nav button').click(function(){
411			$(this).attr('aria-expanded',function(index,attr){
412				return attr == "true" ? "false" : "true";
413			}).attr('aria-label',function(index,attr){
414				if($(this).attr('aria-expanded') == true) {
415					return attr.replace('Expand the','Collapse the');
416				} else {
417					return attr.replace('Collapse the','Expand the');
418				}
419			}).parent().siblings().slideToggle();
420			$(this).children('.far').toggleClass('fa-chevron-up fa-chevron-down');
421		});
422
423	} else {
424		$('.anchor__nav').hide();
425	}
426
427	/* [ 3.13 Footnotes Backup Link ] ----------*/
428	if ($('.footnote-link-rf').length) {
429		$('.footnote-link-rf').click(function(){
430			var footnoteId = $(this).attr('id');
431			$('.footnote-link-rf').removeClass('clicked-footnote');
432			$(this).addClass('clicked-footnote');
433			$('div.footnote').find('a[href="#'+footnoteId+'"]').parent().prepend('<button class="footnote-return" aria-label="Return to last clicked footnote"></button>');
434			$('.footnote-return').click(function(event){
435				$(window).scrollTop( $('.clicked-footnote').offset().top );
436				$('.clicked-footnote').focus();
437				$(this).detach();
438			})
439		})
440	}
441
442	/* [ 3.14 Facility/Parks - Other Facility View Placement ] ----------*/
443	if ( ($('.other-facilities-view').length) && ($('.other-facilities-view-container').length) ) {
444		$('.other-facilities-view').detach().appendTo( $('.other-facilities-view-container') );
445	}
446
447	if($('.page-node-type-page-police, .page-node-type-wps-homepage, .page-node-type-event-police').length) {
448		if($('#block-confluence-breadcrumbs').length) {
449			$('#block-confluence-breadcrumbs a[href="/"]:contains("Home")').attr('href', '/police');
450		}
451	}
452
453	if($('.page-node-type-wps-homepage').length) {
454		function equalizeHeights(selector1, selector2) {
455			$(selector1 + ', ' + selector2).css('height', '');
456			var height1 = $(selector1).outerHeight();
457			var height2 = $(selector2).outerHeight();
458			var maxHeight = Math.max(height1, height2);
459			if ($(window).width() > 767) {
460				$(selector1 + ', ' + selector2).css('height', maxHeight);
461			}
462		}
463		function adjustViewsOnResize() {
464			equalizeHeights('.view-media-releases', '.view-police-homepage-events');
465		}
466		adjustViewsOnResize();
467		$(window).resize(adjustViewsOnResize);
468	}
469
470	$('#crime-form').submit(function(e) {
471		e.preventDefault();
472		var crimeOption = $('#crime-select').val();
473		window.location.href = crimeOption;
474	});
475
476	$('.view-events-police input[id*="edit-reset"]').on('click', function(e){
477		e.preventDefault();
478		window.location = window.location.href.split('?')[0]
479	});
480
481  $('.wps#globalSearchBtn').click(function() {
482		var searchText = $('#globalSearchInput').val().trim();
483		var url = 'https://legacy.winnipeg.ca/search/default.stm?q=' + encodeURIComponent(searchText);
484		window.location.href = url;
485	});
486
487	$('.wps#globalSearchInput').on('input', function() {
488		var searchText = $(this).val().trim();
489		if (searchText.length > 0) {
490			$('.wps.search-group').addClass('has-value');
491		} else {
492			$('.wps.search-group').removeClass('has-value');
493		}
494	});
495
496	/* [ 3.15 Translate file size indicators ] ----------*/
497	if ($('body.lang-fr a[data-entity-type="media"]').length) {
498		$('a[data-entity-type="media"]').each(function(){
499			var originalText = $(this).text();
500			var newText = originalText.replace('KB)', 'Ko)').replace('MB)', 'Mo)');
501			$(this).text(newText);
502		})
503	}
504
505	/* [ 3.16 Translate days & times ] ----------*/
506
507	// Translate Manage Display Label for Hours
508	if ($('.lang-fr .hours-label').length) {
509		$('.hours-label').html('Heures');
510	}
511
512  // Translate Days
513  if ($('.lang-fr .office-hours__item-label').length) {
514    function translateDayRange(dayRange) {
515      // Regular expression to match the day range format
516      var dayRangeRegex = /([A-Za-zÀ-ÿ]+)\s*-\s*([A-Za-zÀ-ÿ]+)/;
517      var match = dayRange.match(dayRangeRegex);
518
519      if (match) {
520          // Extract start and end days, convert to lowercase for consistency
521          var startDay = match[1].toLowerCase();
522          var endDay = match[2].toLowerCase();
523          
524          // Convert to French range format
525          var frenchDayRange = `Du ${startDay} au ${endDay}`;
526        return frenchDayRange + ': ';
527      } else {
528        return dayRange;
529      }
530      
531  }
532    $('.office-hours__item-label').each(function(){
533      var dayRange = $(this).text().toLowerCase();
534      var frenchDayRange = translateDayRange(dayRange);
535      $(this).text(frenchDayRange);
536    })
537  } 
538
539	// Translate Times
540	if ($('.lang-fr .office-hours__item-slots').length) {
541		function translateTimeToFrench(englishTime) {
542			// Replace "Noon" and "Midnight" with specific French words
543			englishTime = englishTime.replace("Noon", "12:00 p.m.").replace("noon", "12:00 p.m.").replace("Midnight", "12:00 a.m.").replace("midnight", "12:00 a.m.");
544			
545			var timeRegex = /(\d{1,2}):?(\d{2})?\s*(a\.m\.|p\.m\.)\s*-\s*(\d{1,2}):?(\d{2})?\s*(a\.m\.|p\.m\.)/i;
546			var match = englishTime.match(timeRegex);
547	
548			if (match) {
549				var startHour = parseInt(match[1]);
550				var startMinute = match[2] ? match[2] : '00';
551				var startPeriod = match[3];
552				var endHour = parseInt(match[4]);
553				var endMinute = match[5] ? match[5] : '00';
554				var endPeriod = match[6];
555
556				// Convert start hour
557				if (startPeriod.toLowerCase() === 'p.m.' && startHour !== 12) {
558						startHour += 12;
559				} else if (startPeriod.toLowerCase() === 'a.m.' && startHour === 12) {
560						startHour = 0;
561				}
562
563				// Convert end hour
564				if (endPeriod.toLowerCase() === 'p.m.' && endHour !== 12) {
565						endHour += 12;
566				} else if (endPeriod.toLowerCase() === 'a.m.' && endHour === 12) {
567						endHour = 0;
568				}
569
570				// Translate time range to French
571				var frenchTime = `de ${startHour} h ${startMinute} à ${endHour} h ${endMinute}`;
572				
573				// Replace "h 00" with "h" (as in French, "h" alone is used when the minutes are 00)
574				frenchTime = frenchTime.replaceAll('h 00', 'h');
575
576				// Handle special case for "Noon" and "Midnight"
577				if (startHour === 0 && startMinute === '00') {
578					frenchTime = frenchTime.replace("de 00 h", "à minuit");
579				} else if (startHour === 12 && startMinute === '00') {
580					frenchTime = frenchTime.replace("de 12 h", "à midi");
581				}
582
583				if (endHour === 0 && endMinute === '00') {
584					frenchTime = frenchTime.replace("à 00 h", "à minuit");
585					frenchTime = frenchTime.replace("à 0 h", "à minuit");
586				} else if (endHour === 12 && endMinute === '00') {
587					frenchTime = frenchTime.replace("à 12 h", "à midi");
588				}
589
590				return frenchTime;
591			}
592		}
593		$('.office-hours__item-slots').each(function(){
594			var englishTime = $(this).text();
595			frenchTime = translateTimeToFrench(englishTime);
596			$(this).text(frenchTime);
597		})
598	}
599
600	// Fix colon spacing for french label
601	if ($('.lang-fr .office-hours__item-label').length) {
602		$('.lang-fr .office-hours__item-label').each(function(){
603			var currentText = $(this).text();
604			$(this).text(currentText.replace(':',' : '));
605		})
606	}
607
608  /* [ 3.17 Card detect click description ] ----------*/
609	var isDragging = false;
610	$('.card .field--name-field-card-body')
611	.hover(function() {
612        if($(this).siblings('.card-title').children('a').length){ 
613			$(this).siblings('.card-title').children('a').css('box-shadow','inset 0 -3px 0 0 #ACBAD5');
614		}
615	})
616	.mousedown(function() {
617		$(window).mousemove(function() {
618				isDragging = true;
619				$(window).unbind("mousemove");
620		});
621	})
622	.mouseup(function() {
623		var wasDragging = isDragging;
624		isDragging = false;
625		$(window).unbind("mousemove");
626		if (!wasDragging) {
627			$(this).siblings('.card-title').children('a')[0].click();
628		}
629	});
630
631	/* [ 3.18 A11y Disruption Breadcrumbs & <title> ] ----------*/
632	if ( ($('.page-node-type-accessibility-disruption').length) ) {
633		var title = $('.view-accessibility-disruptions-details h1').text();
634		$('title').html(title);
635		$('.breadcrumb > .breadcrumb-item:last-of-type()').html(title);
636	}
637	if ( ($('.page-node-type-accessibility-disruption-api').length) ) {
638		var title = $('.view-accessibility-disruptions-api-detail h1').text();
639		$('title').html(title);
640		$('.breadcrumb > .breadcrumb-item:last-of-type()').html(title);
641	} 
642	/* [ 3.19 Header login ] ----------*/
643	$('.mseie-menu-trigger').click(function(){		
644		 const isHidingMenu = $(this).attr('aria-expanded') === 'true';
645		 $(this).attr({
646			'aria-expanded': !isHidingMenu,
647			'aria-label': isHidingMenu ? 'Show account menu' : 'Hide account menu'
648		});
649		$('.mseie-menu-trigger+ul').attr('aria-hidden', isHidingMenu);
650	});
651
652	/* [ 4. Window resize ] ----------*/
653
654	var resizeTimer;
655	function resizeFunction() {
656		/* [ 4.1 Cookie Consent banner ] ----------*/
657		if($('.cc_banner-wrapper').length) {
658			$('body').css('padding-bottom',$('.cc_banner-wrapper').outerHeight());
659		}
660		$('.cc_btn_accept_all').on('click', function(){
661			$('body').css('padding-bottom',0);
662		});
663		/* [ 4.2 I want to ] ----------*/
664		if($('.i-want-to').length) {
665			var activeSectionHeight = 0;
666			setTimeout(function(){
667				$('.i-want-to__section.is-active > *').each(function(){
668					activeSectionHeight += $(this).outerHeight() + 4;
669				});
670				$('.i-want-to').css('min-height',activeSectionHeight + 16);
671			});
672		}
673		/* [ 4.3 Tiny Slider ] ----------*/
674		if($('.view-global-alerts .views-row').length > 1) {
675			var pageWidth = $(window).width();
676			var containerWidth = $('.views-row .container').width();
677			var right = (pageWidth - containerWidth) / 2;
678			if($(window).width() > 992) {
679				$('.alerts__controls').css({
680					'right': right + 'px',
681					'left': 'auto'
682				});
683			} else {
684				$('.alerts__controls').css({
685					'left': right + 'px',
686					'right': 'auto'
687				});
688			}
689		}
690
691		if($('.wps-slides').length) {
692			var pageWidth = $(window).width();
693			var containerWidth = $('.page-node-type-wps-homepage .global-header > * > .container').width();
694			var right = (pageWidth - containerWidth) / 2;
695			if($(window).width() > 1200) {
696				$('.wps-slide__content').css({
697					'right': right + 'px',
698				});
699			} else {
700				$('.wps-slide__content').css({
701					'right': 'auto'
702				});
703			}
704		}
705
706		/* [4.4 Alerts padding for controls ] -----------*/
707		var alertsControlsWidth = $('.alerts__controls').width();
708		$('.view-global-alerts .field-content').css('padding-right', 'calc(' + alertsControlsWidth + 'px + 32px)');
709
710		if($('.view-events-police').length) {
711			if($(window).width() > 800) {
712				if(!$('.fc-dayGridMonth-button.fc-button-active').length) {
713					$('.fc-dayGridMonth-button').click();
714				}
715			} else {
716				if(!$('.fc-listMonth-button.fc-button-active').length) {
717					$('.fc-listMonth-button').click();
718				}
719			}
720		}
721	};
722	$(window).on('load resize',function() {
723		clearTimeout(resizeTimer);
724		resizeTimer = setTimeout(resizeFunction, 250);
725	});
726	resizeFunction();
727
728	/* [ 5. Storage ] ----------*/
729
730	if ('sessionStorage' in window && typeof sessionStorage == 'object') {
731		$(document).ready(function() {
732			if($('.category-list__button').length) {
733				if(sessionStorage[$('html').attr('lang') + 'categorized links'] == null || sessionStorage[$('html').attr('lang') + 'categorized links'] == '') {
734					sessionStorage[$('html').attr('lang') + 'categorized links'] = $('.category-list__item:first > .category-list__button').attr('data-category');
735				}
736				$('.category-list__button[data-category="'+sessionStorage[$('html').attr('lang') + 'categorized links']+'"]').addClass('category-list__button--selected');
737				$('.categorized-links__section[data-category="'+sessionStorage[$('html').attr('lang') + 'categorized links']+'"]').addClass('categorized-links__section--active').siblings().css('opacity', '0');
738			}
739			$('.category-list__button').on('click',function(){
740				sessionStorage[$('html').attr('lang') + 'categorized links'] = $(this).attr('data-category');
741				$(this).addClass('category-list__button--selected').parent().siblings().find('.category-list__button').removeClass('category-list__button--selected');
742				$('.categorized-links__section[data-category="'+sessionStorage[$('html').attr('lang') + 'categorized links']+'"]').siblings().removeClass('categorized-links__section--active').css('opacity', '0');
743        $('.categorized-links__section[data-category="'+sessionStorage[$('html').attr('lang') + 'categorized links']+'"]').addClass('categorized-links__section--active');
744        setTimeout(function(){
745          $('.categorized-links__section[data-category="'+sessionStorage[$('html').attr('lang') + 'categorized links']+'"]').css('opacity', '1');
746        });
747			});
748		});
749	};
750
751})(jQuery);
752/* [ 6. Ajax ] ----------*/
753jQuery(document).ready(function ($) {
754	$(document).ajaxComplete(function () {
755		/* [ 6.1 Datepicker ] ----------*/
756		$('input.datepicker-years-filter').each(function () {
757			$(this).datepicker('destroy');
758			$(this).datepicker({
759				disableTouchKeyboard: true,
760				dateFormat: 'yy',
761				minViewMode: 'years',
762				direction: "down",
763			});
764		});
765		$('.view-media-releases fieldset[id*="edit-date-wrapper"] .fieldset-wrapper > * > input').each(function () {
766			$(this).datepicker('destroy');
767			$(this).datepicker({
768				format: 'mm/dd/yyyy',
769			});
770		});
771		/* [ 6.2 Results summary / view all ] ----------*/
772		if($('.view .results-summary').length) {
773			$('.view .results-summary').each(function(){
774				var resultsSummary = $(this);
775				var viewFilters = resultsSummary.parent().siblings('.view-filters').find('.form--inline');
776				if(viewFilters.length) {
777					resultsSummary.insertAfter(viewFilters);
778				}
779			});
780		}
781		if($('.view .views-filters-summary').length) {
782			$('.view .views-filters-summary').each(function(){
783				var filtersSummary = $(this);
784				var viewFilters = filtersSummary.parent().siblings('.view-filters').find('.form--inline');
785				if(viewFilters.length) {
786					filtersSummary.insertAfter(viewFilters);
787				}
788			});
789		}
790		if($('.view-header .reset-btn').length) {
791			$('.view-header .reset-btn').each(function(){
792				var viewAll = $(this);
793				var viewContent = viewAll.parent().siblings('.view-content');
794				viewAll.insertBefore(viewContent);
795			});
796		}
797		/* [ 6.3 Filters summary fr translation ] ----------*/
798		if($('body.lang-fr .remove-filter').length) {
799			$('.remove-filter').each(function(){
800				var activeFilter = $(this).attr('data-remove-selector').split(':');
801				var tid = activeFilter[1];
802				var filterName = activeFilter[0];
803				var filter = $('.view-filters *[name=' + filterName + ']');
804				var filterType = filter.prop('nodeName');
805				if(filterType == 'SELECT') {
806					var filterValue = $('.view-filters *[name=' + filterName + ']').find('option[value="' + tid + '"]');
807					$(this).parent('.item').find('.value').text(filterValue.text());
808				}
809			});
810		}
811	});
812});

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.