PageSourceSearch

https://www.zephyrplc.com/wp-content/themes/zephyr/extensions/bir-banners/js/_birbanners.js

js zephyrplc.com collected 2026-10-08 19:01:49 UTC 3,393 bytes, 148 lines download raw bytes

1jQuery(document).ready(function($) {
2
3    var slideWrapper = $(".main-slider"),
4		iframes = slideWrapper.find('.embed-player'),
5		lazyImages = slideWrapper.find('.slide-image'),
6		lazyCounter = 0;
7
8	// POST commands to YouTube or Vimeo API
9	function postMessageToPlayer(player, command){
10	if (player == null || command == null) return;
11	player.contentWindow.postMessage(JSON.stringify(command), "*");
12	}
13
14	// When the slide is changing
15	function playPauseVideo(slick, control){
16	var currentSlide, slideType, startTime, player, video;
17
18	currentSlide = slick.find(".slick-current");
19	slideType = currentSlide.attr("class").split(" ")[1];
20	player = currentSlide.find("iframe").get(0);
21	startTime = currentSlide.data("video-start");
22
23	if (slideType === "vimeo") {
24		switch (control) {
25		case "play":
26			if ((startTime != null && startTime > 0 ) && !currentSlide.hasClass('started')) {
27			currentSlide.addClass('started');
28			postMessageToPlayer(player, {
29				"method": "setCurrentTime",
30				"value" : startTime
31			});
32			}
33			postMessageToPlayer(player, {
34			"method": "play",
35			"value" : 1
36			});
37			break;
38		case "pause":
39			postMessageToPlayer(player, {
40			"method": "pause",
41			"value": 1
42			});
43			break;
44		}
45	} else if (slideType === "youtube") {
46		switch (control) {
47		case "play":
48			postMessageToPlayer(player, {
49			"event": "command",
50			"func": "mute"
51			});
52			postMessageToPlayer(player, {
53			"event": "command",
54			"func": "playVideo"
55			});
56			break;
57		case "pause":
58			postMessageToPlayer(player, {
59			"event": "command",
60			"func": "pauseVideo"
61			});
62			break;
63		}
64	} else if (slideType === "video") {
65		video = currentSlide.children("video").get(0);
66		if (video != null) {
67		if (control === "play"){
68			video.play();
69		} else {
70			video.pause();
71		}
72		}
73	}
74	}
75
76	// Resize player
77	function resizePlayer(iframes, ratio) {
78	if (!iframes[0]) return;
79	var win = $(".main-slider"),
80		width = win.width(),
81		playerWidth,
82		height = win.height(),
83		playerHeight,
84		ratio = ratio || 16/9;
85
86	iframes.each(function(){
87		var current = $(this);
88		if (width / ratio < height) {
89		playerWidth = Math.ceil(height * ratio);
90		current.width(playerWidth).height(height).css({
91			left: (width - playerWidth) / 2,
92			top: 0
93			});
94		} else {
95		playerHeight = Math.ceil(width / ratio);
96		current.width(width).height(playerHeight).css({
97			left: 0,
98			top: (height - playerHeight) / 2
99		});
100		}
101	});
102	}
103
104	// DOM Ready
105	$(function() {
106
107		// Initialize
108		slideWrapper.on("init", function(slick){
109			slick = $(slick.currentTarget);
110			setTimeout(function(){
111			playPauseVideo(slick,"play");
112			}, 1000);
113			resizePlayer(iframes, 16/9);
114		});
115		slideWrapper.on("beforeChange", function(event, slick) {
116			slick = $(slick.$slider);
117			playPauseVideo(slick,"pause");
118		});
119		slideWrapper.on("afterChange", function(event, slick) {
120			slick = $(slick.$slider);
121			playPauseVideo(slick,"play");
122		});
123		slideWrapper.on("lazyLoaded", function(event, slick, image, imageSource) {
124			lazyCounter++;
125			if (lazyCounter === lazyImages.length){
126			lazyImages.addClass('show');
127			// slideWrapper.slick("slickPlay");
128			}
129		});
130
131		//start the slider
132		slideWrapper.slick({
133			dots: false,
134      speed: 1500,
135      fade: true,
136      useCSS: false,
137      arrows:true,
138      infinite: false
139		});
140
141	});
142
143	// Resize event
144	$(window).on("resize.slickVideoPlayer", function(){
145		resizePlayer(iframes, 16/9);
146    });
147
148});

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.