PageSourceSearch

https://centreforfacdev.ca/core/modules/3baeed1bff/public/assets/js/public.js?20170424&rnd=64259

js centreforfacdev.ca collected 2026-10-04 05:21:36 UTC 5,120 bytes, 195 lines download raw bytes

1(function ( $ ) {
2	"use strict";
3	
4	var uriRegion;
5
6	$(function () {
7
8		// Place your public-facing JavaScript here
9		var showText = objectL10n.showmoredates;
10                
11		if ($('.arlo-show-more').length == 1 && $('.arlo-show-more[data-show-text]').attr('data-show-text') != null) {
12			showText = $('.arlo-show-more').attr('data-show-text');        
13		}
14
15		if ($('.arlo-show-more-hidden').children().length > 0) {
16			$('.arlo-show-more-hidden').before('<div class="arlo-show-more-link-container"><a href="#" class="arlo-show-more-link">' + showText + '</a></div>');
17		}
18
19		$(document).on('click touch', '.arlo-show-more-link', function(e) {
20
21			$(".arlo-show-more-link-container").remove();
22
23			$('.arlo-show-more-hidden').show();
24
25			e.preventDefault();
26
27		} );
28		
29        $('.arlo-timezone > select').change(function() {
30            $('.arlo-timezone').submit();
31        });	
32
33        $('.arlo-event-filters > select').change(function() {
34			var page = $('#arlo-page').val();
35
36        	if (page[page.length-1] != '/') {
37        		page = page + '/';
38        	}
39
40			if ($('#arlo-filter-region').length > 0) {
41				page += 'region-' + $('#arlo-filter-region').val() + '/';
42			}
43
44			if ($(this).val() != "") {
45				page += 'location-' + $(this).val() + '/';
46			}
47
48            document.location = page;
49        });				
50                
51        $('.arlo-filters > select').change(function() {
52        	var filters = {
53        		'search': 'arlo-filter-search',
54        		'cat': 'arlo-filter-category',
55        		'month': 'arlo-filter-month',
56        		'location': 'arlo-filter-location',
57        		'delivery': 'arlo-filter-delivery',
58        		'eventtag': 'arlo-filter-eventtag',
59        		'templatetag': 'arlo-filter-templatetag',
60	    		'oatag': 'arlo-filter-oatag',
61        		'presenter': 'arlo-filter-presenter',
62        		'state': 'arlo-filter-state'
63        	};
64        	
65        	var page = $('#arlo-page').val();
66        	
67        	if (page[page.length-1] != '/') {
68        		page = page + '/';
69        	}
70
71			if ($('#arlo-filter-region').length > 0) {
72				page += 'region-' + $('#arlo-filter-region').val() + '/';
73			}
74
75        	var url = page;
76			var urlParams = [];
77
78			for (var i in filters) {
79        		if (filters.hasOwnProperty(i) && $('#' + filters[i]).length == 1) {
80					var content = $('#' + filters[i]).val().trim();
81					if (content != '') {
82						if (content.indexOf('/') === -1 || content.indexOf('\\') === -1) {
83							if (i == 'search') {
84								url += 'search/' + encodeURIComponent(content) + '/'; 
85							} else {
86								url += i + '-' + encodeURIComponent(content) + '/'; 
87							}
88						} else {
89							//default url structure does not work with slashes
90							if (i == 'cat') {
91								urlParams.push('arlo-category=' + encodeURIComponent(content));
92							} else {
93								urlParams.push('arlo-' + i + '=' + encodeURIComponent(content));
94							}
95						}
96					}
97        		} 
98			}
99
100			if (urlParams.length > 0) {
101				url += '?' + urlParams.join('&');
102			}
103
104        	document.location = url;
105        });
106        
107   		//if boxed (grid) layout, make the boxes' height even
108		if ($('.arlo-boxed').length) {
109
110	        $(".arlo-boxed .events.arlo-show-more-hidden").show();
111
112			var boxedMaxHeight = 0;
113			$('.arlo-boxed .arlo-list li.arlo-cf:not(.arlo-group-divider)').each(function() {
114				if ($(this).height() > boxedMaxHeight) {
115					boxedMaxHeight = $(this).height()
116				}
117			});
118
119	        $(".arlo-boxed .events.arlo-show-more-hidden").hide();
120
121			$('.arlo-boxed .arlo-list li.arlo-cf:not(.arlo-group-divider)').height(boxedMaxHeight);
122		}
123		
124		//tooltip init
125		$('.arlo-tooltip-button').darkTooltip({
126			gravity: 'north'
127		});
128
129
130		//modal init
131		$('.arlo-sessions-popup-trigger').each(function(i, el) {
132			var modal = new tingle.modal({
133				footer: true,
134				cssClass: ['arlo'],
135			    closeMethods: ['overlay', 'button', 'escape']
136			});
137
138			var popupContent = $($(el).data('target')).html();
139
140			modal.setContent(popupContent);
141
142			modal.addFooterBtn('Close', 'arlo-close-btn button btn btn-primary', function() {
143			    modal.close();
144			});
145
146			$(el).click(function(e) {
147				e.preventDefault();
148				modal.open()
149			});
150		});
151	});
152	
153	function getUriRegion() {
154		try {
155			
156			var patt = new RegExp("region-([^/]*)");
157			var region = patt.exec(window.location.href);
158			
159			if (region[1] != null) {
160				return region[1];
161			} else {
162				return null;
163			}
164			
165		}
166		catch (e) {
167		    return null;
168		}
169	}        
170    
171	function initRegionChanger() {
172		uriRegion = getUriRegion();
173		
174		$(".arlo-filter-region").bind("change", function () {
175			changeRegion(uriRegion, $(this).val());
176		});		
177	}        
178    
179    function changeRegion(uriRegion, newRegion) {
180
181	    //Manually set cookie
182    	Cookies.set("arlo-region", newRegion, { path: "/", domain: window.location.hostname });
183
184    	if (uriRegion) {
185		    window.location.href = window.location.href.replace("/region-" + uriRegion + "/", "/region-" + newRegion + "/").replace(/location-\w+(%\d+)?\w*/g,"");
186    	} else {
187    		window.location.reload();
188    	}
189	}	
190	
191	$(document).ready(function() {
192		initRegionChanger();
193	});
194
195}(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.