PageSourceSearch

https://www.spacejam.com/js/video.js

js spacejam.com collected 2026-10-02 02:19:42 UTC 12,578 bytes, 415 lines download raw bytes

1var flag1 = 0;
2var noThumbs = false;
3//console.log(video_mode)
4
5function onYouTubeIframeAPIReady() {
6
7	utilsController.youtubeReady(), vidController.initVid(ytID)
8}
9
10function onPlayerReady(e) {
11	isLoaded = true;
12}
13
14function onPlayerStateChange(e) {
15	0 === e.data && (_winFocus = false)
16}
17
18function stopVideo() {
19	if (mp4Player == 'false') {
20		trailerVidPlayer.stopVideo()
21	}
22}
23
24function pauseVideo() {
25	if (mp4Player == 'false') {
26		trailerVidPlayer.pauseVideo()
27	} else {
28		videoPlayerHtml.pause();
29	}
30}
31
32function playVideo() {
33	if (mp4Player == 'false') {
34		trailerVidPlayer.playVideo()
35	}
36}
37var trailerVidPlayer, globalController = {},
38	vidController, isLoaded = false,
39	ytID = "",
40	_navInit = false;
41
42
43var utilsController = (function () {
44	var _obj = {};
45	var apiReady = false;
46	var title, description, siteUrl;
47
48	function _init() {
49		//console.log('utils init');
50
51		//    window.addEventListener("blur", function() {
52		//     //console.log('onblur');
53		//     //if(isLoaded && _winFocus) 
54		//     try {
55		//         pauseVideo();
56		//         pauseHomeVideo();
57		//     } catch (err) {}
58
59		// });
60		// Set the name of the hidden property and the change event for visibility
61		var hidden, visibilityChange;
62		if (typeof document.hidden !== "undefined") { // Opera 12.10 and Firefox 18 and later support 
63			hidden = "hidden";
64			visibilityChange = "visibilitychange";
65		} else if (typeof document.msHidden !== "undefined") {
66			hidden = "msHidden";
67			visibilityChange = "msvisibilitychange";
68		} else if (typeof document.webkitHidden !== "undefined") {
69			hidden = "webkitHidden";
70			visibilityChange = "webkitvisibilitychange";
71		}
72
73
74		// If the page is hidden, pause the video;
75		// if the page is shown, play the video
76		function handleVisibilityChange() {
77			if (document[hidden]) {
78				try {
79					pauseVideo();
80				} catch (err) { }
81
82
83			} else { }
84		}
85
86		// Warn if the browser doesn't support addEventListener or the Page Visibility API
87		if (typeof document.addEventListener === "undefined" || typeof document.hidden === "undefined") {
88			console.log("This demo requires a browser, such as Google Chrome or Firefox, that supports the Page Visibility API.");
89		} else {
90			// Handle page visibility change   
91			document.addEventListener(visibilityChange, handleVisibilityChange, false);
92		}
93		window.onfocus = function () {
94			//console.log('onfocus');
95			$('a').blur();
96			// $('.mouse-over').blur();
97			//if(isLoaded && _winFocus) playVideo();
98		}
99
100	}
101
102
103
104	function _youtubeReady() {
105		apiReady = true;
106	}
107
108	function _checkYouTube() {
109		return apiReady;
110	}
111
112
113	_obj.init = _init;
114	_obj.youtubeReady = _youtubeReady;
115	_obj.checkYouTube = _checkYouTube;
116
117
118
119	return _obj;
120
121}());
122
123
124
125
126
127vidController = function () {
128	function _init() {
129		_vidInit = true;
130		/**/
131		_win = $(window);
132		_trailer = $("#trailer");
133		_trailerVid = $("#trailerVid");
134		_trailerWrap = _trailer.find('.trailer-wrap');
135		_trailerNav = $('#trailerNav');
136		_trailerToggle = _trailer.find('.trailer-toggle');
137		_trailerLinks = _trailerNav.find('.trailer-link');
138
139		//$("#in-depth-trailer");
140		//$("#reg-trailer");
141		_trailerLinks.on("mouseenter", function () { /*to mahe hover effect*/
142			$(this).find(".trailer-title").css("opacity", 1)
143		});
144		_trailerLinks.on("mouseleave", function () {
145			$(this).find(".trailer-title").css("opacity", 0)
146		});
147		_trailerLinks.on("click", function () {
148			_trailerLinks.removeClass("active");
149			$(this).addClass("active");
150			_initVid($(this).attr("vid-id"), '140');
151		});
152		if (flag1 == 0) {
153			ytID = $(".trailer-link:first-child").attr("vid-id");
154			_initVid(ytID);
155
156		}
157		flag1 = 1;
158		/*alert($(".trailer-link:first-child").attr("vid-id"));*/
159
160
161		_trailerToggle.on("click", function () {
162
163			$(this).toggleClass('open');
164			$(this).toggleClass('closed');
165
166			_trailerNav.toggleClass('hide');
167			$("#trailer #trailer-buttons").toggleClass('hide');
168
169			if (video_mode == 'carousel') {
170				video_mode = "fullscreen";
171
172			} else if (video_mode = "fullscreen") {
173				video_mode = 'carousel';
174
175			}
176			//resize();
177
178			if (video_mode == 'carousel') {
179				var openHeight = _win.height() - (_trailerNav.height() + $('.header').height() + $('.footer-centered').outerHeight() + _trailerToggle.height());
180				_trailerWrap.css('height', (openHeight - 25));
181
182			} else {
183				var openHeight = _win.height() - ($('.header').height() + $('.footer-centered').outerHeight() + _trailerToggle.height());
184				_trailerWrap.css('height', (openHeight - 25));
185
186
187			}
188
189
190		});
191
192		var openHeight = _win.height() - _trailerNav.height();
193		_trailerWrap.css('height', (openHeight - 90));
194
195		$(window).resize(function () {
196
197			resize();
198
199		});
200		/*_vidInit = true;*/
201	}
202
203	function checkApiNow() {
204		apiReady = utilsController.checkYouTube();
205		if (apiReady) {
206			_initVid(ytID);
207			clearInterval(checkApi);
208		}
209	}
210
211	var videoYTSection = _x('trailerVid');
212	var videoMp4Section = _x('trailerVidDefault');
213
214	function _initVid(vidId) {
215
216		if (mp4Player == 'false') {
217
218			trailerVidPlayer && trailerVidPlayer.loadVideoById ? trailerVidPlayer.loadVideoById(vidId) :
219				window.YT.ready(function () {
220				var youtubehost = '';
221				//var val = OnetrustActiveGroups;
222				//if ( (val.indexOf(",tpv,") > -1)) {
223					//youtubehost = 'https://www.youtube.com';
224				//}
225				//else {
226					//youtubehost = 'https://www.youtube-nocookie.com';
227				//}
228					trailerVidPlayer = new window.YT.Player("trailerVid", {
229						height: "100%",
230						width: "100%",
231						videoId: vidId,
232						host: 'https://www.youtube-nocookie.com',
233						playerVars: {
234							html5: 1,
235							rel: 0,
236							playsinline: 1,
237							controls: 1,
238							enablejsapi: 1,
239							showinfo: 0,
240							suggestedQuality: "hd720",
241							wmode: "transparent",
242							autoplay: 0
243						},
244						events: {
245							onReady: onPlayerReady,
246							onStateChange: onPlayerStateChange
247						}
248					})
249				});
250
251		} else {
252			videoYTSection.style.display = 'none';
253			videoMp4Section.style.display = 'block';
254			var vidPlayer = videoMp4Section.getElementsByTagName('video')[0];
255			vidPlayer.src = vidId;
256
257		}
258
259	} // End of Init Vid
260
261	function resize() {
262
263		getVideoHeight();
264	}
265
266	function getVideoHeight() {
267
268		if (video_mode == 'carousel') {
269
270			setTimeout(function () {
271				var openHeight = _win.height() - (_trailerNav.height() + $('.header').height() + $('.footer-centered').outerHeight() + _trailerToggle.height());
272				_trailerWrap.css('height', (openHeight - 21));
273			}, 1500);
274
275
276		} else {
277			var openHeight = _win.height() - ($('.header').height() + $('.footer-centered').outerHeight() + _trailerToggle.height());
278
279			/*_trailerWrap.css('height', (openHeight - 100));*/
280			/*if(isMobile){
281				_trailerWrap.css('height', '92%');
282				}else{*/
283			/*_trailerWrap.css('height', '95%');*/
284			_trailerWrap.css('height', (openHeight - 25));
285			//}
286
287		}
288	}
289
290	function checkApiNow() {
291
292		apiReady = utilsController.checkYouTube();
293		if (apiReady) {
294
295			_initVid(ytID);
296			clearInterval(checkApi);
297		}
298	}
299	var _obj = {};
300	var _win, _trailer, _trailerVid, _trailerWrap, _trailerNav, _trailerLinks, _trailerToggle;
301	var _vidInit = false,
302		checkApi;
303
304	_obj.init = _init;
305	_obj.setVideo = function (id, i) {
306		setTimeout(function () {
307			var ytID = $("#" + id);
308			_trailerNav.find(".trailer-link").removeClass("active"), _trailer.addClass("active"), _initVid(_trailer.attr("vid-id")), globalController.checkVisible(i)
309		}, 10);
310	};
311
312	_obj.setVid = function (id, autoplay, youtube) {
313		console.log('_setVid', id);
314		console.log("autoplay", autoplay);
315		ytID = id;
316		_youtube = youtube;
317		autoPlay = autoplay;
318		var apiReady = utilsController.checkYouTube();
319		if (apiReady) {
320
321			_initVid(ytID);
322
323		} else {
324			checkApi = setInterval(checkApiNow, 1000);
325		}
326
327	};
328	_obj.showVid = function () {
329
330
331		if (_vidInit || _init(), _winFocus = true, isLoaded) {
332
333			if ($("body").hasClass("outdated")) return; /*to make change for ie*/
334			playVideo();
335			_winFocus = true;
336		}
337		resize();
338	};
339	_obj.hideVid = function () {
340		_winFocus = false, isLoaded && stopVideo()
341	};
342	/*setTimeout(function(){
343		_obj.initVid = _initVid;
344		console.log("In....")
345	},150);*/
346	var myVar = checkStatusMp4Value();
347
348	if (myVar == 'false' || myVar == 'true') {
349
350		_obj.initVid = _initVid;
351
352	}
353
354	return _obj;
355
356
357}();
358
359function checkStatusMp4Value() {
360
361	if (typeof mp4Player !== "undefined") {
362		return mp4Player;
363	} else {
364		setTimeout(function () {
365			checkStatusMp4Value()
366		}, 2000)
367	}
368
369}
370thumbController = function () {
371	var e, o, i, t, _obj = {};
372
373	function _init() {
374		return true, $(window), _currentIndex = 0, _movement = 0, _max_moves = 0, _last_move = 0, _moves = 0, _position = 0, _window_width = 0, _videos = $("#trailerNav").find(".trailer-link"), $("#trailerVid"), _videoThumbs = {
375			numSlides: _videos.length,
376			movement: 0,
377			max_moves: 0,
378			position: 0,
379			last_move: 0
380		}, _videos.eq(0).addClass("active"), _configVideoThumbs = function () {
381			var e = window.innerWidth;
382			_window_width = e;
383			var o = e > 1024 ? 336 : 146; /*need too bechange*/
384			if (_videoThumbs.moves = 0, _videoThumbs.position = 0, $("#trailerNav").css("transform", "translateX(0)"), _videoThumbs.numSlides * o <= e) $("#trailerNav").removeClass("carousel"), $("#trailer-back").css("opacity", 0), $("#trailer-back").css("pointer-events", "none"), $("#trailer-forward").css("opacity", 0), $("#trailer-forward").css("pointer-events", "none");
385			else {
386				$("#trailerNav").addClass("carousel"), $("#trailer-forward").css("opacity", 1), $("#trailer-forward").css("pointer-events", "auto"), $("#trailer-back").css("opacity", 0), $("#trailer-back").css("pointer-events", "none");
387				var i = Math.floor(e / o),
388					t = _videoThumbs.numSlides * o;
389				_videoThumbs.movement = i * o, _videoThumbs.max_moves = Math.ceil(t / _videoThumbs.movement) - 1, _videoThumbs.last_move = t - _videoThumbs.max_moves * _videoThumbs.movement - (e - _videoThumbs.movement)
390			}
391		}, _checkVisible = function (e) {
392			var o = window.innerWidth;
393			_window_width = o;
394			var i = o >= 700 ? 306 : 186;
395			moves = Math.ceil(i * e / _videoThumbs.movement) - 1, moves > _videoThumbs.max_moves && (moves = _videoThumbs.max_moves), moves >= 1 && (_videoThumbs.moves = moves, _videoThumbs.moves >= 1 && ($("#trailer-back").css("opacity", 1), $("#trailer-back").css("pointer-events", "auto")), _videoThumbs.moves === _videoThumbs.max_moves ? (_videoThumbs.position = _videoThumbs.movement * (moves - 1) + _videoThumbs.last_move, $("#trailer-forward").css("opacity", 0), $("#trailer-forward").css("pointer-events", "none")) : _videoThumbs.position = _videoThumbs.movement * moves, $("#trailerNav").css("transform", "translateX(-" + _videoThumbs.position + "px)"))
396		}, $("#trailer-back").on("click", function () {
397			_videoThumbs.moves > 0 && (_videoThumbs.moves--, _videoThumbs.moves === _videoThumbs.max_moves - 1 ? ($("#trailer-forward").css("opacity", 1), $("#trailer-forward").css("pointer-events", "auto"), _videoThumbs.position = _videoThumbs.position - _videoThumbs.last_move) : _videoThumbs.position = _videoThumbs.position - _videoThumbs.movement, 0 === _videoThumbs.moves && ($("#trailer-back").css("opacity", 0), $("#trailer-back").css("pointer-events", "none")), $("#trailerNav").css("transform", "translateX(-" + _videoThumbs.position + "px)"))
398		}), $("#trailer-forward").on("click", function () {
399			_videoThumbs.moves < _videoThumbs.max_moves && (_videoThumbs.moves++, 1 === _videoThumbs.moves && ($("#trailer-back").css("opacity", 1), $("#trailer-back").css("pointer-events", "auto")), _videoThumbs.moves === _videoThumbs.max_moves ? (_videoThumbs.position = _videoThumbs.position + _videoThumbs.last_move, $("#trailer-forward").css("opacity", 0), $("#trailer-forward").css("pointer-events", "none")) : _videoThumbs.position = _videoThumbs.position + _videoThumbs.movement, $("#trailerNav").css("transform", "translateX(-" + _videoThumbs.position + "px)"))
400		}), setTimeout(function () {
401			_configVideoThumbs()
402		}, 50), $(window).resize(function () {
403			setTimeout(function () {
404				window.innerWidth !== _window_width && (_configVideoThumbs())
405			}, 10)
406		}), {
407			configVideoThumbs: _configVideoThumbs,
408			checkVisible: _checkVisible
409		};
410	}
411	_obj.init = _init;
412
413	return _obj;
414
415}();

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.