PageSourceSearch

https://uniongeneralhealthsystem.com/wp-content/plugins/responsive…/assets/js/wp-video-popup.js?ver=2.10.4

js uniongeneralhealthsystem.com collected 2026-10-02 11:37:35 UTC 2,949 bytes, 117 lines download raw bytes

1/**
2 * NodeList.forEach polyfill for IE
3 * 
4 * @see https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach
5 */
6if (window.NodeList && !NodeList.prototype.forEach) {
7	NodeList.prototype.forEach = Array.prototype.forEach;
8}
9
10/**
11 * Custom Event polyfill for >= IE9
12 *
13 * @see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
14 */
15(function () {
16	if (typeof window.CustomEvent === "function") return false;
17
18	function CustomEvent(event, params) {
19		params = params || { bubbles: false, cancelable: false, detail: null };
20		var evt = document.createEvent('CustomEvent');
21		evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
22		return evt;
23	}
24
25	window.CustomEvent = CustomEvent;
26})();
27
28(function ($) {
29	// Free version only support 1 video per page/ post.
30	var popup;
31	var speed = 200;
32
33	function init() {
34		popup = document.querySelector('.wp-video-popup-wrapper');
35		if (!popup) return;
36		setupOpenActions();
37		setupVideoHeight();
38		setupCloseActions();
39	}
40
41	function setupOpenActions() {
42		// Setup trigger for single popup.
43		setupOpenTriggers('.wp-video-popup');
44
45		// Setup trigger for single popup (backward compatibility support).
46		setupOpenTriggers('.ryv-popup');
47	}
48
49	function setupOpenTriggers(triggerSelector) {
50		var triggers = document.querySelectorAll(triggerSelector);
51		if (!triggers) return;
52
53		triggers.forEach(function (trigger) {
54			trigger.addEventListener('click', function (e) {
55				e.preventDefault();
56				openPopup();
57			});
58		});
59	}
60
61	function setupCloseActions() {
62		// Close on click.
63		popup.addEventListener('click', function (e) {
64			if (e.target == this || e.target.classList.contains('wp-video-popup-close')) closePopup();
65		});
66
67		// Close on escape.
68		document.addEventListener('keyup', function (e) {
69			if (e.key !== 'Escape' && e.key !== 'Esc' && e.keyCode !== 27) return;
70			if ($(popup).is(':visible')) closePopup();
71		});
72	}
73
74	function setupVideoHeight() {
75		window.addEventListener('resize', function () {
76			var video = document.querySelector('.wp-video-popup-video.is-resizable');
77			if (video) $(video).height($(video).width() * 0.5625);
78		});
79	}
80
81	function openPopup() {
82		var video = popup.querySelector('.wp-video-popup-video');
83
84		document.body.insertBefore(popup, document.body.firstChild);
85
86		$(popup).css({ display: 'flex' }).stop().animate({
87			opacity: 1
88		}, speed);
89
90		$(video).stop().fadeIn(speed);
91
92		var videoUrl = video.getAttribute('data-wp-video-popup-url');
93		if (videoUrl) {
94			video.setAttribute('src', videoUrl);
95		}
96
97		window.dispatchEvent(new Event('resize'));
98	}
99
100	function closePopup() {
101		var video = popup.querySelector('.wp-video-popup-video');
102
103		$(popup).stop().animate({
104			opacity: 0
105		}, speed, function () {
106			$(popup).css({ display: 'none' });
107		});
108
109		$(video).stop().fadeOut(speed, function () {
110			video.setAttribute('src', '');
111		});
112	}
113
114	$(document).ready(function () {
115		init();
116	});
117})(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.