PageSourceSearch

https://canada-culture.org/wp-content/themes/ccc_21/effects.js?ver=1

js canada-culture.org collected 2026-10-02 08:02:00 UTC 6,295 bytes, 248 lines download raw bytes

1// MOSNE FUNCTIONS
2$(function () {
3	/* nav */
4	var navigation = responsiveNav('.nav-collapse');
5
6	/*	Foundation */
7
8	$(document).foundation();
9
10	$('.address').each(function () {
11		addr = $(this).find('p').eq(0).text();
12		log(addr);
13		link = 'http://maps.google.com/maps?q=' + encodeURIComponent(addr);
14		log(link);
15		$(this).find('a').eq(0).attr({ href: link });
16	});
17	
18	var $gg = $('.gallery');
19	var totgg = $gg.length;
20	
21	$gg.each(function (index) {
22    	var current = index + 1;
23    	var desc = $(this).attr("data-modaal-desc");
24    	$(this).attr("data-modaal-desc", current +"/"+totgg+" "+desc );
25	});
26	
27
28	$gg.modaal({
29		type: 'image',
30		background: '#000',
31		outer_controls: true,
32		overlay_opacity: '0.95',
33	});
34
35	$('a.embedvideo').each(function () {
36		url = $(this).attr('href');
37		i_src = testUrlForMedia(url);
38		$(this).attr({ href: i_src });
39	});
40
41	$('.embedvideo').modaal({
42		type: 'video',
43		background: '#000',
44		overlay_opacity: '0.95',
45	});
46
47	$('#morepics').on('click', function () {
48		$('.trigger-modal').eq(0).find('a').eq(0).trigger('click');
49	});
50
51	const showChar = 50;
52	let showWords = 50;
53
54	if ($('body').hasClass('single-event')) {
55		showWords = 80;
56	}
57
58	let readMore = 'Read More';
59	let readLess = 'Close';
60
61	if ($('html').attr('lang') === 'fr-FR') {
62		readMore = 'Lire la suite';
63		readLess = 'Fermer';
64	}
65
66	var ellipsestext = '...';
67	
68	function fixHtml(html){
69        var div = document.createElement('div');
70         div.innerHTML=html
71        return (div.innerHTML);
72    }
73
74function readmoreTruncate(str, nowords) {
75		return fixHtml(str.split(' ').splice(0, nowords).join(' '));
76	}
77	
78	
79	
80	$('.truncate').each(function () {
81		var content = $(this).html();
82		if (content.length > showChar) {
83			var c = readmoreTruncate(content, showWords);
84			var h = content;
85			var html = `
86				<div class="truncate-text" style="display:block">${c}<span class="moreellipses">${ellipsestext}</span>
87					<p><a href="#" role="button" class="button outilne small moreless more">${readMore}</a></p>
88				</div>
89				<div class="truncate-text" style="display:none">
90					${h}<p><a href="#" role="button" class="button outilne small moreless less">${readLess}</a></p>
91				</div>`;
92
93			$(this).html(html);
94		}
95	});
96
97	$('.moreless').click(function (e) {
98		e.preventDefault();
99		var thisEl = $(this);
100		var cT = thisEl.closest('.truncate-text');
101		var tX = '.truncate-text';
102
103		if (thisEl.hasClass('less')) {
104			cT.prev(tX).toggle();
105			cT.toggle();
106		} else {
107			cT.toggle();
108			cT.next(tX).toggle();
109		}
110		return false;
111	});
112}); //scope
113
114function testUrlForMedia(pastedData) {
115	var success = false;
116	if (pastedData.match('://(www.)?youtube|youtu.be')) {
117		if (pastedData.match('embed')) {
118			youtube_id = pastedData.split(/embed\//)[1].split('"')[0];
119		} else {
120			youtube_id = pastedData
121				.split(/v\/|v=|youtu\.be\//)[1]
122				.split(/[?&]/)[0];
123		}
124		v_list ='';
125		if (pastedData.match('list')) {
126    		v_list = pastedData.split(/list=/)[1].split('"')[0].split(/[?&]/)[0];
127		}
128		v_id = youtube_id;
129		i_src =
130			'//www.youtube.com/embed/' +
131			v_id +
132			'?controls=1&color=white&showinfo=0&autoplay=true&hd=1&fs=1&rel=0' +
133			v_list;
134		success = true;
135	} else if (pastedData.match('://(player.)?vimeo.com')) {
136		vimeo_Reg = /https?:\/\/(?:www\.)?vimeo.com\/(?:channels\/|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|)(\d+)(?:$|\/|\?)/;
137		match = pastedData.match(vimeo_Reg);
138		v_id = match[3];
139		i_src =
140			'//player.vimeo.com/video/' +
141			v_id +
142			'?title=0&byline=0&portrait=0&color=ffffff&autoplay=1&loop=1';
143		success = true;
144	} else if (pastedData.match('://(www.)?dailymotion.com')) {
145		m = url.match(
146			/^.+dailymotion.com\/((video|hub)\/([^_]+))?[^#]*(#video=([^_&]+))?/
147		);
148		v_id = m ? m[5] || m[3] : null;
149		i_src =
150			'//www.dailymotion.com/embed/video/' +
151			v_id +
152			'?autoplay=true&background=000000&foreground=ffffff&highlight=ffffff';
153		success = true;
154	}
155	if (success) {
156		return i_src;
157	}
158}
159
160function mosne_init_vimeo() {}
161
162function mosne_init_youtube() {
163	/* youtube api */
164
165	if ($('#youtube').length > 0) {
166		var channelIdValue = 'UCM1A7Ka-D5phzSgDSrJWzDg';
167		var m_playlist = $('#youtube').attr('data-feed');
168		var apiKeyValue = 'AIzaSyBw7aAI-PpgheRrtzLvM1KyNrAz_0TjLxQ';
169		var maxResultsVideo = 4;
170		var gridPreRowList = 'columns small-6 medium-6 large-3 item youtube';
171
172		youtubeChannelVedioApiCallPlayListId();
173
174		// Get  Playlist
175		function youtubeChannelVedioApiCallPlayListId() {
176			$.get(
177				'https://www.googleapis.com/youtube/v3/channels',
178				{
179					part: 'contentDetails',
180					id: channelIdValue,
181					key: apiKeyValue,
182				},
183				function (data) {
184					$.each(data.items, function (i, item) {
185						//log(item);
186						//var playListId = item.contentDetails.relatedPlaylists.uploads;
187						var playListId = m_playlist;
188						youtubeChannelVedioApiCall(playListId);
189					});
190				}
191			);
192		}
193
194		function youtubeChannelVedioApiCall(playListId) {
195			$.ajax({
196				cache: false,
197				data: $.extend(
198					{
199						key: apiKeyValue,
200						part: 'snippet',
201						playlistId: playListId,
202					},
203					{
204						maxResults: maxResultsVideo,
205						order: 'date',
206						type: 'video',
207						pageToken: $('#pageToken').val(),
208					}
209				),
210				dataType: 'json',
211				type: 'GET',
212				timeout: 5000,
213				url: 'https://www.googleapis.com/youtube/v3/playlistItems',
214			}).done(function (channelData) {
215				var items = channelData.items;
216				grid_video_list = 0;
217				videoList = '';
218				$.each(items, function (index, e) {
219					videoList =
220						videoList +
221						'<article class="' +
222						gridPreRowList +
223						'"><a target="_blank" href="https://www.youtube.com/watch?v=' +
224						e.snippet.resourceId.videoId +
225						'&list=' +
226						m_playlist +
227						'"><div class="avideo"><img class="lazyload" src="' +
228						e.snippet.thumbnails.default.url +
229						'"data-sizes="auto" data-srcset="' +
230						e.snippet.thumbnails.default.url +
231						' 120w,' +
232						e.snippet.thumbnails.medium.url +
233						' 320w,' +
234						e.snippet.thumbnails.high.url +
235						' 480w,' +
236						e.snippet.thumbnails.standard.url +
237						' 640w" alt="' +
238						e.snippet.title +
239						'"/></div><div class="shortinfos show-for-medium"><h2 class="title">' +
240						e.snippet.title +
241						'</h2></div></a></article>';
242				});
243				$('#youtube').html(videoList);
244				videoList = '';
245			});
246		}
247	}
248}

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.