PageSourceSearch

https://www.hirondelle.org/wp-content/themes/hirondelle/assets/js/videosplash.js?ver=1790282961

js hirondelle.org collected 2026-09-24 20:49:59 UTC 3,808 bytes, 116 lines download raw bytes

1jQuery(function(){
2
3	var splashvideos = document.querySelectorAll('.splash');
4	for(var z = 0; z < splashvideos.length; z++) {
5		var splashvideoElement = splashvideos[z];   
6		splashvideoElement.onclick = function() {
7			
8			var videoParentElement = splashvideoElement.closest('.videoListItem-splash');
9			// videoParentElement.classList.add('video-is-displayed');
10			var videoTarget = splashvideoElement.getAttribute('data-target');
11			
12			splashvideoElement.classList.add('d-none');
13			document.querySelector(videoTarget).classList.remove('d-none');
14
15			// 
16			// splashvideoElement
17			// jQuery(this).fadeOut('fast', function() {
18			  // jQuery(videoTarget).fadeIn('fast');
19			// });
20			
21			return false;
22		};
23	}
24});
25
26var player = {};
27
28// Creating the player and feeding it its source
29function onYouTubeIframeAPIReady() {
30	
31	var videoListItems = document.querySelectorAll('.videoListItem-splash');
32	for (var index = 0; index < videoListItems.length; index++) {
33		var videoListItem = videoListItems[index];
34		
35		// console.log('videoListItem', videoListItem);
36		
37		var loop = index,
38        source = videoListItem.querySelector('.videoWrap').getAttribute('data-source'),
39        videoLanguage = videoListItem.querySelector('.videoWrap').getAttribute('data-language'),
40        videoId = videoListItem.querySelector('.videoWrap').getAttribute('id');
41		
42		var playerVars = {
43			modestbranding: 1,
44			rel: 0, 
45			showInfo: 0,
46			vq: "hd1080"
47		};
48		
49		if (videoLanguage !== '' && videoLanguage !== shortSiteLanguage)
50		{
51			console.log('on essaye de mettre les soustitres en ' + shortSiteLanguage);
52			playerVars.hl = shortSiteLanguage;
53			playerVars.cc_lang_pref = shortSiteLanguage;
54			playerVars.cc_load_policy = 1;
55		}
56		
57		var playerParameters = {
58			height: '430',
59			width: '764',
60			videoId: source,
61			playerVars: playerVars,
62			events: {
63				// call this function when player is ready to use
64				'onReady': onPlayerReady
65			}
66		};
67		
68		console.log('video ID ' + videoId + ' player parameters', playerParameters);
69			
70		// Create the player using YT API
71		player[videoId] = new YT.Player(videoId, playerParameters);
72	}
73	
74	console.log('player aaa', player);
75}
76
77// When API and player are both set, clicking on splash screen makes the video play
78function onPlayerReady(event) {
79	// Again, looping on the wrapping element
80	console.log('player bbb', player);
81  
82	var videoListItems = document.querySelectorAll('.videoListItem-splash');
83	for (var index = 0; index < videoListItems.length; index++) {
84		var videoListItem = videoListItems[index];
85		var videoId = videoListItem.querySelector('.videoWrap').getAttribute('id');
86		
87		// Saving up that element's splashscreen
88		var playButton = videoListItem.querySelector('.splash');
89		
90		// Entering its object to set the eventListener to it
91		playButton.addEventListener("click", function() {
92			// Since the splashscreen and its target are on the same index in the loop, I can play the related video thus: 
93			player[videoId].playVideo();
94		});
95	}
96  
97  /*
98  jQuery('.videoListItem-splash').each(function(index){
99    // Saving up that element's splashscreen
100    var playButton = jQuery(this).find('.splash');
101    
102    // Entering its object to set the eventListener to it
103    playButton[0].addEventListener("click", function() {
104      // Since the splashscreen and its target are on the same index in the loop, I can play the related video thus: 
105      player[index].playVideo();
106    });
107  });
108  */
109
110}
111
112// Injecting API into DOM
113var tag = document.createElement('script');
114tag.src = "https://www.youtube.com/iframe_api";
115var firstScriptTag = document.getElementsByTagName('script')[0];
116firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

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.