PluginProbe
Elementor Website Builder – more than just a page builder / 3.26.1
Elementor Website Builder – more than just a page builder v3.26.1
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 All 457 releases
elementor / assets / js / video.602349dafcafaba0fcb2.bundle.js

video.602349dafcafaba0fcb2.bundle.js in Elementor Website Builder – more than just a page builder 3.26.1, at assets/js/video.602349dafcafaba0fcb2.bundle.js

184 lines 6.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*! elementor - v3.26.0 - 19-12-2024 */
2 "use strict";
3 (self["webpackChunkelementor"] = self["webpackChunkelementor"] || []).push([["video"],{
4
5 /***/ "../assets/dev/js/frontend/handlers/video.js":
6 /*!***************************************************!*\
7 !*** ../assets/dev/js/frontend/handlers/video.js ***!
8 \***************************************************/
9 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
10
11
12
13 Object.defineProperty(exports, "__esModule", ({
14 value: true
15 }));
16 exports["default"] = void 0;
17 __webpack_require__(/*! core-js/modules/es.array.includes.js */ "../node_modules/core-js/modules/es.array.includes.js");
18 class Video extends elementorModules.frontend.handlers.Base {
19 getDefaultSettings() {
20 return {
21 selectors: {
22 imageOverlay: '.elementor-custom-embed-image-overlay',
23 video: '.elementor-video',
24 videoIframe: '.elementor-video-iframe',
25 playIcon: '.elementor-custom-embed-play'
26 }
27 };
28 }
29 getDefaultElements() {
30 const selectors = this.getSettings('selectors');
31 return {
32 $imageOverlay: this.$element.find(selectors.imageOverlay),
33 $video: this.$element.find(selectors.video),
34 $videoIframe: this.$element.find(selectors.videoIframe),
35 $playIcon: this.$element.find(selectors.playIcon)
36 };
37 }
38 handleVideo() {
39 if (this.getElementSettings('lightbox')) {
40 return;
41 }
42 if ('youtube' === this.getElementSettings('video_type')) {
43 this.apiProvider.onApiReady(apiObject => {
44 this.elements.$imageOverlay.remove();
45 this.prepareYTVideo(apiObject, true);
46 });
47 } else {
48 this.elements.$imageOverlay.remove();
49 this.playVideo();
50 }
51 }
52 playVideo() {
53 if (this.elements.$video.length) {
54 // This.youtubePlayer exists only for YouTube videos, and its play function is different.
55 if (this.youtubePlayer) {
56 this.youtubePlayer.playVideo();
57 } else {
58 this.elements.$video[0].play();
59 }
60 return;
61 }
62 const $videoIframe = this.elements.$videoIframe,
63 lazyLoad = $videoIframe.data('lazy-load');
64 if (lazyLoad) {
65 $videoIframe.attr('src', lazyLoad);
66 }
67 if (this.getElementSettings('autoplay')) {
68 $videoIframe.attr('allow', 'autoplay');
69 $videoIframe[0].src = this.apiProvider.getAutoplayURL($videoIframe[0].src);
70 }
71 }
72 async animateVideo() {
73 const lightbox = await elementorFrontend.utils.lightbox;
74 lightbox.setEntranceAnimation(this.getCurrentDeviceSetting('lightbox_content_animation'));
75 }
76 async hideLightbox() {
77 const lightbox = await elementorFrontend.utils.lightbox;
78 lightbox.getModal().hide();
79 }
80 prepareYTVideo(YT, onOverlayClick) {
81 const elementSettings = this.getElementSettings(),
82 playerOptions = {
83 videoId: this.videoID,
84 events: {
85 onReady: () => {
86 if (elementSettings.mute) {
87 this.youtubePlayer.mute();
88 }
89 if (elementSettings.autoplay || onOverlayClick) {
90 this.youtubePlayer.playVideo();
91 }
92 },
93 onStateChange: event => {
94 if (event.data === YT.PlayerState.ENDED && elementSettings.loop) {
95 this.youtubePlayer.seekTo(elementSettings.start || 0);
96 }
97 }
98 },
99 playerVars: {
100 controls: elementSettings.controls ? 1 : 0,
101 rel: elementSettings.rel ? 1 : 0,
102 playsinline: elementSettings.play_on_mobile ? 1 : 0,
103 modestbranding: elementSettings.modestbranding ? 1 : 0,
104 autoplay: elementSettings.autoplay ? 1 : 0,
105 start: elementSettings.start,
106 end: elementSettings.end
107 }
108 };
109
110 // To handle CORS issues, when the default host is changed, the origin parameter has to be set.
111 if (elementSettings.yt_privacy) {
112 playerOptions.host = 'https://www.youtube-nocookie.com';
113 playerOptions.origin = window.location.hostname;
114 }
115 this.youtubePlayer = new YT.Player(this.elements.$video[0], playerOptions);
116 }
117 bindEvents() {
118 this.elements.$imageOverlay.on('click', this.handleVideo.bind(this));
119 this.elements.$playIcon.on('keydown', event => {
120 const playKeys = [13,
121 // Enter key.
122 32 // Space bar key.
123 ];
124 if (playKeys.includes(event.keyCode)) {
125 this.handleVideo();
126 }
127 });
128 }
129 onInit() {
130 super.onInit();
131 const elementSettings = this.getElementSettings();
132 if (elementorFrontend.utils[elementSettings.video_type]) {
133 this.apiProvider = elementorFrontend.utils[elementSettings.video_type];
134 } else {
135 this.apiProvider = elementorFrontend.utils.baseVideoLoader;
136 }
137 if ('youtube' !== elementSettings.video_type) {
138 // Currently the only API integration in the Video widget is for the YT API
139 return;
140 }
141 this.videoID = this.apiProvider.getVideoIDFromURL(elementSettings.youtube_url);
142
143 // If there is an image overlay, the YouTube video prep method will be triggered on click
144 if (!this.videoID) {
145 return;
146 }
147
148 // If the user is using an image overlay, loading the API happens on overlay click instead of on init.
149 if (elementSettings.show_image_overlay && elementSettings.image_overlay.url) {
150 return;
151 }
152 if (elementSettings.lazy_load) {
153 this.intersectionObserver = elementorModules.utils.Scroll.scrollObserver({
154 callback: event => {
155 if (event.isInViewport) {
156 this.intersectionObserver.unobserve(this.elements.$video.parent()[0]);
157 this.apiProvider.onApiReady(apiObject => this.prepareYTVideo(apiObject));
158 }
159 }
160 });
161
162 // We observe the parent, since the video container has a height of 0.
163 this.intersectionObserver.observe(this.elements.$video.parent()[0]);
164 return;
165 }
166 this.apiProvider.onApiReady(apiObject => this.prepareYTVideo(apiObject));
167 }
168 onElementChange(propertyName) {
169 if (0 === propertyName.indexOf('lightbox_content_animation')) {
170 this.animateVideo();
171 return;
172 }
173 const isLightBoxEnabled = this.getElementSettings('lightbox');
174 if ('lightbox' === propertyName && !isLightBoxEnabled) {
175 this.hideLightbox();
176 }
177 }
178 }
179 exports["default"] = Video;
180
181 /***/ })
182
183 }]);
184 //# sourceMappingURL=video.602349dafcafaba0fcb2.bundle.js.map