PluginProbe
Elementor Website Builder – more than just a page builder / 3.30.0-beta1
Elementor Website Builder – more than just a page builder v3.30.0-beta1
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 / lightbox.74688eb10c7852662847.bundle.js

lightbox.74688eb10c7852662847.bundle.js in Elementor Website Builder – more than just a page builder 3.30.0-beta1, at assets/js/lightbox.74688eb10c7852662847.bundle.js

1,303 lines 48.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*! elementor - v3.30.0 - 10-06-2025 */
2 "use strict";
3 (self["webpackChunkelementorFrontend"] = self["webpackChunkelementorFrontend"] || []).push([["lightbox"],{
4
5 /***/ "../assets/dev/js/frontend/utils/icons/e-icons.js":
6 /*!********************************************************!*\
7 !*** ../assets/dev/js/frontend/utils/icons/e-icons.js ***!
8 \********************************************************/
9 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
10
11
12
13 var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
14 Object.defineProperty(exports, "__esModule", ({
15 value: true
16 }));
17 exports.zoomOutBold = exports.zoomInBold = exports.twitter = exports.shareArrow = exports.pinterest = exports.loading = exports.frameMinimize = exports.frameExpand = exports.facebook = exports.downloadBold = exports.close = exports.chevronRight = exports.chevronLeft = void 0;
18 var _manager = _interopRequireDefault(__webpack_require__(/*! ./manager */ "../assets/dev/js/frontend/utils/icons/manager.js"));
19 // This file is automatically generated, please don't change anything in this file.
20
21 const iconsManager = new _manager.default('eicon');
22 const chevronLeft = exports.chevronLeft = {
23 get element() {
24 const svgData = {
25 path: 'M646 125C629 125 613 133 604 142L308 442C296 454 292 471 292 487 292 504 296 521 308 533L604 854C617 867 629 875 646 875 663 875 679 871 692 858 704 846 713 829 713 812 713 796 708 779 692 767L438 487 692 225C700 217 708 204 708 187 708 171 704 154 692 142 675 129 663 125 646 125Z',
26 width: 1000,
27 height: 1000
28 };
29 return iconsManager.createSvgElement('chevron-left', svgData);
30 }
31 };
32 const chevronRight = exports.chevronRight = {
33 get element() {
34 const svgData = {
35 path: 'M696 533C708 521 713 504 713 487 713 471 708 454 696 446L400 146C388 133 375 125 354 125 338 125 325 129 313 142 300 154 292 171 292 187 292 204 296 221 308 233L563 492 304 771C292 783 288 800 288 817 288 833 296 850 308 863 321 871 338 875 354 875 371 875 388 867 400 854L696 533Z',
36 width: 1000,
37 height: 1000
38 };
39 return iconsManager.createSvgElement('chevron-right', svgData);
40 }
41 };
42 const close = exports.close = {
43 get element() {
44 const svgData = {
45 path: 'M742 167L500 408 258 167C246 154 233 150 217 150 196 150 179 158 167 167 154 179 150 196 150 212 150 229 154 242 171 254L408 500 167 742C138 771 138 800 167 829 196 858 225 858 254 829L496 587 738 829C750 842 767 846 783 846 800 846 817 842 829 829 842 817 846 804 846 783 846 767 842 750 829 737L588 500 833 258C863 229 863 200 833 171 804 137 775 137 742 167Z',
46 width: 1000,
47 height: 1000
48 };
49 return iconsManager.createSvgElement('close', svgData);
50 }
51 };
52 const downloadBold = exports.downloadBold = {
53 get element() {
54 const svgData = {
55 path: 'M572 42H428C405 42 385 61 385 85V385H228C197 385 180 424 203 447L475 719C489 732 511 732 524 719L797 447C819 424 803 385 771 385H614V85C615 61 595 42 572 42ZM958 915V715C958 691 939 672 915 672H653L565 760C529 796 471 796 435 760L347 672H85C61 672 42 691 42 715V915C42 939 61 958 85 958H915C939 958 958 939 958 915ZM736 873C736 853 720 837 700 837 681 837 665 853 665 873 665 892 681 908 700 908 720 908 736 892 736 873ZM815 837C835 837 851 853 851 873 851 892 835 908 815 908 795 908 779 892 779 873 779 853 795 837 815 837Z',
56 width: 1000,
57 height: 1000
58 };
59 return iconsManager.createSvgElement('download-bold', svgData);
60 }
61 };
62 const facebook = exports.facebook = {
63 get element() {
64 const svgData = {
65 path: 'M858 42H142C88 42 42 87 42 142V863C42 913 88 958 142 958H421V646H292V500H421V387C421 258 496 192 613 192 667 192 725 200 725 200V325H663C600 325 579 362 579 404V500H721L700 646H583V958H863C917 958 963 913 963 858V142C958 87 913 42 858 42L858 42Z',
66 width: 1000,
67 height: 1000
68 };
69 return iconsManager.createSvgElement('facebook', svgData);
70 }
71 };
72 const frameExpand = exports.frameExpand = {
73 get element() {
74 const svgData = {
75 path: 'M863 583C890 583 914 605 916 632L917 637V863L916 868C914 893 893 914 868 916L863 917H638L632 916C607 914 586 893 584 868L583 863 584 857C586 832 607 811 632 809L638 808H808V637L809 632C811 605 835 583 863 583ZM138 583C165 583 189 605 191 632L192 637V808H363C390 808 414 830 416 857L417 863C417 890 395 914 368 916L363 917H138C110 917 86 895 84 868L83 863V637C83 607 108 583 138 583ZM863 83C890 83 914 105 916 132L917 137V362C917 392 893 417 863 417 835 417 811 395 809 368L808 362V192H638C610 192 586 170 584 143L583 137C583 110 605 86 632 84L638 83H863ZM363 83L368 84C393 86 414 107 416 132L417 137 416 143C414 168 393 189 368 191L363 192H192V362L191 368C189 395 165 417 138 417S86 395 84 368L83 362V137L84 132C86 107 107 86 132 84L138 83H363Z',
76 width: 1000,
77 height: 1000
78 };
79 return iconsManager.createSvgElement('frame-expand', svgData);
80 }
81 };
82 const frameMinimize = exports.frameMinimize = {
83 get element() {
84 const svgData = {
85 path: 'M363 583C392 583 413 604 417 633L417 637V863C417 892 392 917 363 917 333 917 313 896 308 867L308 863V692H138C108 692 88 671 83 642L83 637C83 608 104 587 133 583L138 583H363ZM638 583C608 583 588 604 583 633L583 637V863C583 892 608 917 638 917 667 917 688 896 692 867L692 863V692H863C892 692 913 671 917 642L917 637C917 608 896 587 867 583L863 583H638ZM363 417C392 417 413 396 417 367L417 362V137C417 108 392 83 363 83 333 83 313 104 308 133L308 137V308H138C108 308 88 329 83 358L83 362C83 392 104 412 133 417L138 417H363ZM638 417C608 417 588 396 583 367L583 362V137C583 108 608 83 638 83 667 83 688 104 692 133L692 137V308H863C892 308 913 329 917 358L917 362C917 392 896 412 867 417L863 417H638Z',
86 width: 1000,
87 height: 1000
88 };
89 return iconsManager.createSvgElement('frame-minimize', svgData);
90 }
91 };
92 const loading = exports.loading = {
93 get element() {
94 const svgData = {
95 path: 'M500 975V858C696 858 858 696 858 500S696 142 500 142 142 304 142 500H25C25 237 238 25 500 25S975 237 975 500 763 975 500 975Z',
96 width: 1000,
97 height: 1000
98 };
99 return iconsManager.createSvgElement('loading', svgData);
100 }
101 };
102 const pinterest = exports.pinterest = {
103 get element() {
104 const svgData = {
105 path: 'M950 496C950 746 746 950 496 950 450 950 404 942 363 929 379 900 408 850 421 808 425 787 450 700 450 700 467 729 508 754 554 754 692 754 792 629 792 471 792 321 671 208 513 208 317 208 213 342 213 483 213 550 250 633 304 658 313 662 317 662 321 654 321 650 329 617 333 604 333 600 333 596 329 592 313 567 296 525 296 487 288 387 367 292 496 292 608 292 688 367 688 475 688 600 625 683 546 683 500 683 467 646 479 600 492 546 517 487 517 450 517 417 500 387 458 387 413 387 375 433 375 496 375 537 388 562 388 562S342 754 333 787C325 825 329 883 333 917 163 854 42 687 42 496 42 246 246 42 496 42S950 246 950 496Z',
106 width: 1000,
107 height: 1000
108 };
109 return iconsManager.createSvgElement('pinterest', svgData);
110 }
111 };
112 const shareArrow = exports.shareArrow = {
113 get element() {
114 const svgData = {
115 path: 'M946 383L667 133C642 112 604 129 604 162V292C238 296 71 637 42 812 238 587 363 521 604 517V658C604 692 642 708 667 687L946 442C963 425 963 400 946 383Z',
116 width: 1000,
117 height: 1000
118 };
119 return iconsManager.createSvgElement('share-arrow', svgData);
120 }
121 };
122 const twitter = exports.twitter = {
123 get element() {
124 const svgData = {
125 path: 'M863 312C863 321 863 329 863 337 863 587 675 871 329 871 221 871 125 842 42 787 58 787 71 792 88 792 175 792 254 762 321 712 238 712 171 658 146 583 158 583 171 587 183 587 200 587 217 583 233 579 146 562 83 487 83 396V387C108 400 138 408 167 412 117 379 83 321 83 254 83 221 92 187 108 158 200 271 342 346 496 354 492 342 492 325 492 312 492 208 575 125 679 125 733 125 783 146 817 183 858 175 900 158 938 137 925 179 896 217 854 242 892 237 929 229 963 212 933 250 900 283 863 312Z',
126 width: 1000,
127 height: 1000
128 };
129 return iconsManager.createSvgElement('twitter', svgData);
130 }
131 };
132 const zoomInBold = exports.zoomInBold = {
133 get element() {
134 const svgData = {
135 path: 'M388 383V312C388 283 413 258 442 258 471 258 496 283 496 312V383H567C596 383 621 408 621 437S596 492 567 492H496V562C496 592 471 617 442 617 413 617 388 592 388 562V492H317C288 492 263 467 263 437S288 383 317 383H388ZM654 733C592 779 517 804 438 804 233 804 71 642 71 437S233 71 438 71 804 233 804 437C804 521 779 596 733 654L896 817C917 837 917 871 896 892 875 913 842 913 821 892L654 733ZM438 696C579 696 696 579 696 437S579 179 438 179 179 296 179 437 296 696 438 696Z',
136 width: 1000,
137 height: 1000
138 };
139 return iconsManager.createSvgElement('zoom-in-bold', svgData);
140 }
141 };
142 const zoomOutBold = exports.zoomOutBold = {
143 get element() {
144 const svgData = {
145 path: 'M750 683L946 879C963 896 963 929 946 946 929 963 896 967 879 946L683 750C617 804 533 833 438 833 221 833 42 654 42 437S221 42 438 42 833 221 833 437C833 529 800 612 750 683ZM296 392H575C600 392 621 412 621 442 621 467 600 487 575 487H296C271 487 250 467 250 442 250 412 271 392 296 392ZM438 737C604 737 738 604 738 437S604 137 438 137 138 271 138 437 271 737 438 737Z',
146 width: 1000,
147 height: 1000
148 };
149 return iconsManager.createSvgElement('zoom-out-bold', svgData);
150 }
151 };
152
153 /***/ }),
154
155 /***/ "../assets/dev/js/frontend/utils/icons/manager.js":
156 /*!********************************************************!*\
157 !*** ../assets/dev/js/frontend/utils/icons/manager.js ***!
158 \********************************************************/
159 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
160
161
162
163 Object.defineProperty(exports, "__esModule", ({
164 value: true
165 }));
166 exports["default"] = void 0;
167 __webpack_require__(/*! core-js/modules/es.array.includes.js */ "../node_modules/core-js/modules/es.array.includes.js");
168 __webpack_require__(/*! core-js/modules/es.array.push.js */ "../node_modules/core-js/modules/es.array.push.js");
169 __webpack_require__(/*! core-js/modules/esnext.iterator.map.js */ "../node_modules/core-js/modules/esnext.iterator.map.js");
170 class IconsManager {
171 static symbolsContainer;
172 static iconsUsageList = [];
173 constructor(elementsPrefix) {
174 this.prefix = `${elementsPrefix}-`;
175 this.createSvgSymbolsContainer();
176 }
177 createSvgElement(name, _ref) {
178 let {
179 path,
180 width,
181 height
182 } = _ref;
183 const iconName = this.prefix + name,
184 iconSelector = '#' + this.prefix + name;
185
186 // Create symbol if not exist yet.
187 if (!IconsManager.iconsUsageList.includes(iconName)) {
188 if (!IconsManager.symbolsContainer.querySelector(iconSelector)) {
189 const symbol = this.createSymbolElement({
190 id: iconName,
191 path,
192 width,
193 height
194 });
195 IconsManager.symbolsContainer.appendChild(symbol);
196 }
197 IconsManager.iconsUsageList.push(iconName);
198 }
199 return this.createSvgIconElement({
200 iconName,
201 iconSelector
202 });
203 }
204 createSvgNode(tag, _ref2) {
205 let {
206 props = {},
207 attrs = {}
208 } = _ref2;
209 const node = document.createElementNS('http://www.w3.org/2000/svg', tag);
210 Object.keys(props).map(key => node[key] = props[key]);
211 Object.keys(attrs).map(key => node.setAttributeNS(null, key, attrs[key]));
212 return node;
213 }
214 createSvgIconElement(_ref3) {
215 let {
216 iconName,
217 iconSelector
218 } = _ref3;
219 return this.createSvgNode('svg', {
220 props: {
221 innerHTML: '<use xlink:href="' + iconSelector + '" />'
222 },
223 attrs: {
224 class: 'e-font-icon-svg e-' + iconName
225 }
226 });
227 }
228 createSvgSymbolsContainer() {
229 if (!IconsManager.symbolsContainer) {
230 const symbolsContainerId = 'e-font-icon-svg-symbols';
231 IconsManager.symbolsContainer = document.getElementById(symbolsContainerId);
232 if (!IconsManager.symbolsContainer) {
233 IconsManager.symbolsContainer = this.createSvgNode('svg', {
234 attrs: {
235 style: 'display: none;',
236 class: symbolsContainerId
237 }
238 });
239 document.body.appendChild(IconsManager.symbolsContainer);
240 }
241 }
242 }
243 createSymbolElement(_ref4) {
244 let {
245 id,
246 path,
247 width,
248 height
249 } = _ref4;
250 return this.createSvgNode('symbol', {
251 props: {
252 innerHTML: '<path d="' + path + '"></path>',
253 id
254 },
255 attrs: {
256 viewBox: '0 0 ' + width + ' ' + height
257 }
258 });
259 }
260 }
261 exports["default"] = IconsManager;
262
263 /***/ }),
264
265 /***/ "../assets/dev/js/frontend/utils/lightbox/lightbox.js":
266 /*!************************************************************!*\
267 !*** ../assets/dev/js/frontend/utils/lightbox/lightbox.js ***!
268 \************************************************************/
269 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
270
271
272
273 var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
274 __webpack_require__(/*! core-js/modules/es.array.push.js */ "../node_modules/core-js/modules/es.array.push.js");
275 __webpack_require__(/*! core-js/modules/esnext.iterator.constructor.js */ "../node_modules/core-js/modules/esnext.iterator.constructor.js");
276 __webpack_require__(/*! core-js/modules/esnext.iterator.filter.js */ "../node_modules/core-js/modules/esnext.iterator.filter.js");
277 __webpack_require__(/*! core-js/modules/esnext.iterator.find.js */ "../node_modules/core-js/modules/esnext.iterator.find.js");
278 __webpack_require__(/*! core-js/modules/esnext.iterator.for-each.js */ "../node_modules/core-js/modules/esnext.iterator.for-each.js");
279 var _screenfull = _interopRequireDefault(__webpack_require__(/*! ./screenfull */ "../assets/dev/js/frontend/utils/lightbox/screenfull.js"));
280 var _eIcons = __webpack_require__(/*! @elementor/e-icons */ "../assets/dev/js/frontend/utils/icons/e-icons.js");
281 module.exports = elementorModules.ViewModule.extend({
282 oldAnimation: null,
283 swiper: null,
284 player: null,
285 isFontIconSvgExperiment: elementorFrontend.config.experimentalFeatures.e_font_icon_svg,
286 getDefaultSettings() {
287 return {
288 classes: {
289 item: 'elementor-lightbox-item',
290 image: 'elementor-lightbox-image',
291 videoContainer: 'elementor-video-container',
292 videoWrapper: 'elementor-video-wrapper',
293 playButton: 'elementor-custom-embed-play',
294 playButtonIcon: 'fa',
295 playing: 'elementor-playing',
296 hidden: 'elementor-hidden',
297 invisible: 'elementor-invisible',
298 preventClose: 'elementor-lightbox-prevent-close',
299 slideshow: {
300 container: 'swiper',
301 slidesWrapper: 'swiper-wrapper',
302 prevButton: 'elementor-swiper-button elementor-swiper-button-prev',
303 nextButton: 'elementor-swiper-button elementor-swiper-button-next',
304 prevButtonIcon: 'eicon-chevron-left',
305 nextButtonIcon: 'eicon-chevron-right',
306 slide: 'swiper-slide',
307 header: 'elementor-slideshow__header',
308 footer: 'elementor-slideshow__footer',
309 title: 'elementor-slideshow__title',
310 description: 'elementor-slideshow__description',
311 counter: 'elementor-slideshow__counter',
312 iconExpand: 'eicon-frame-expand',
313 iconShrink: 'eicon-frame-minimize',
314 iconZoomIn: 'eicon-zoom-in-bold',
315 iconZoomOut: 'eicon-zoom-out-bold',
316 iconShare: 'eicon-share-arrow',
317 shareMenu: 'elementor-slideshow__share-menu',
318 shareLinks: 'elementor-slideshow__share-links',
319 hideUiVisibility: 'elementor-slideshow--ui-hidden',
320 shareMode: 'elementor-slideshow--share-mode',
321 fullscreenMode: 'elementor-slideshow--fullscreen-mode',
322 zoomMode: 'elementor-slideshow--zoom-mode'
323 }
324 },
325 selectors: {
326 image: '.elementor-lightbox-image',
327 links: 'a, [data-elementor-lightbox]',
328 slideshow: {
329 activeSlide: '.swiper-slide-active',
330 prevSlide: '.swiper-slide-prev',
331 nextSlide: '.swiper-slide-next'
332 }
333 },
334 modalOptions: {
335 id: 'elementor-lightbox',
336 entranceAnimation: 'zoomIn',
337 videoAspectRatio: 169,
338 position: {
339 enable: false
340 }
341 }
342 };
343 },
344 getModal() {
345 if (!module.exports.modal) {
346 this.initModal();
347 }
348 return module.exports.modal;
349 },
350 initModal() {
351 const closeIcon = {};
352
353 // If the experiment is active the closeIcon should be an entire SVG element otherwise it should pass the eicon class name.
354 if (this.isFontIconSvgExperiment) {
355 closeIcon.iconElement = _eIcons.close.element;
356 } else {
357 closeIcon.iconClass = 'eicon-close';
358 }
359 const modal = module.exports.modal = elementorFrontend.getDialogsManager().createWidget('lightbox', {
360 className: 'elementor-lightbox',
361 closeButton: true,
362 closeButtonOptions: {
363 ...closeIcon,
364 attributes: {
365 role: 'button',
366 tabindex: 0,
367 'aria-label': elementorFrontend.config.i18n.close + ' (Esc)'
368 }
369 },
370 selectors: {
371 preventClose: '.' + this.getSettings('classes.preventClose')
372 },
373 hide: {
374 onClick: true
375 }
376 });
377 modal.on('hide', function () {
378 modal.setMessage('');
379 });
380 },
381 showModal(options) {
382 if (options.url && !options.url.startsWith('http')) {
383 return;
384 }
385 this.elements.$closeButton = this.getModal().getElements('closeButton');
386 this.$buttons = this.elements.$closeButton;
387 this.focusedButton = null;
388 const self = this,
389 defaultOptions = self.getDefaultSettings().modalOptions;
390 self.id = options.id;
391 self.setSettings('modalOptions', jQuery.extend(defaultOptions, options.modalOptions));
392 const modal = self.getModal();
393 modal.setID(self.getSettings('modalOptions.id'));
394 modal.onShow = function () {
395 DialogsManager.getWidgetType('lightbox').prototype.onShow.apply(modal, arguments);
396 self.setEntranceAnimation();
397 };
398 modal.onHide = function () {
399 DialogsManager.getWidgetType('lightbox').prototype.onHide.apply(modal, arguments);
400 modal.getElements('message').removeClass('animated');
401 if (_screenfull.default.isFullscreen) {
402 self.deactivateFullscreen();
403 }
404 self.unbindHotKeys();
405 };
406 switch (options.type) {
407 case 'video':
408 self.setVideoContent(options);
409 break;
410 case 'image':
411 {
412 const slides = [{
413 image: options.url,
414 index: 0,
415 title: options.title,
416 description: options.description,
417 hash: options.hash
418 }];
419 options.slideshow = {
420 slides,
421 swiper: {
422 loop: false,
423 pagination: false
424 }
425 };
426 self.setSlideshowContent(options.slideshow);
427 break;
428 }
429 case 'slideshow':
430 self.setSlideshowContent(options.slideshow);
431 break;
432 default:
433 self.setHTMLContent(options.html);
434 }
435 modal.show();
436 },
437 createLightbox(element) {
438 let lightboxData = {};
439 if (element.dataset.elementorLightbox) {
440 lightboxData = JSON.parse(element.dataset.elementorLightbox);
441 }
442 if (lightboxData.type && 'slideshow' !== lightboxData.type) {
443 this.showModal(lightboxData);
444 return;
445 }
446 if (!element.dataset.elementorLightboxSlideshow) {
447 const slideshowID = 'single-img';
448 this.showModal({
449 type: 'image',
450 id: slideshowID,
451 url: element.href,
452 hash: element.getAttribute('data-e-action-hash'),
453 title: element.dataset.elementorLightboxTitle,
454 description: element.dataset.elementorLightboxDescription,
455 modalOptions: {
456 id: 'elementor-lightbox-slideshow-' + slideshowID
457 }
458 });
459 return;
460 }
461 const initialSlideURL = element.dataset.elementorLightboxVideo || element.href;
462 this.openSlideshow(element.dataset.elementorLightboxSlideshow, initialSlideURL);
463 },
464 setHTMLContent(html) {
465 if (window.elementorCommon) {
466 elementorDevTools.deprecation.deprecated('elementorFrontend.utils.lightbox.setHTMLContent()', '3.1.4');
467 }
468 this.getModal().setMessage(html);
469 },
470 setVideoContent(options) {
471 const $ = jQuery;
472 let $videoElement;
473 if ('hosted' === options.videoType) {
474 const videoParams = $.extend({
475 src: options.url,
476 autoplay: ''
477 }, options.videoParams);
478 $videoElement = $('<video>', videoParams);
479 } else {
480 let apiProvider;
481 if (-1 !== options.url.indexOf('vimeo.com')) {
482 apiProvider = elementorFrontend.utils.vimeo;
483 } else if (options.url.match(/^(?:https?:\/\/)?(?:www\.)?(?:m\.)?(?:youtu\.be\/|youtube\.com|youtube-nocookie\.com)/)) {
484 apiProvider = elementorFrontend.utils.youtube;
485 } else {
486 return;
487 }
488 $videoElement = $('<iframe>', {
489 allowfullscreen: 1
490 });
491 if ('yes' === options.autoplay) {
492 $videoElement.attr('allow', 'autoplay');
493 $videoElement.attr('src', apiProvider.getAutoplayURL(options.url));
494 } else {
495 $videoElement.attr('src', options.url);
496 }
497 }
498 const classes = this.getSettings('classes'),
499 aspectRatio = this.getRatioDictionry(this.getSettings('modalOptions.videoAspectRatio')),
500 $videoContainer = $('<div>', {
501 class: `${classes.videoContainer} ${classes.preventClose}`
502 }),
503 $videoWrapper = $('<div>', {
504 class: `${classes.videoWrapper} elementor-video-${this.getRatioType(aspectRatio)}`,
505 style: '--video-aspect-ratio: ' + aspectRatio
506 });
507 $videoWrapper.append($videoElement);
508 $videoContainer.append($videoWrapper);
509 const modal = this.getModal();
510 modal.setMessage($videoContainer);
511 const onHideMethod = modal.onHide;
512 modal.onHide = function () {
513 onHideMethod();
514 this.$buttons = jQuery();
515 this.focusedButton = null;
516 modal.getElements('message').removeClass('elementor-video-wrapper');
517 };
518 },
519 getRatioDictionry(ratio) {
520 const aspectRatiosDictionary = {
521 219: 2.33333,
522 // 21/9
523 169: 1.77777,
524 // 16/9
525 43: 1.33333,
526 // 4/3
527 32: 1.5,
528 // 3/2
529 11: 1,
530 // 1/1
531 916: 0.5625 // 9/16
532 };
533 return aspectRatiosDictionary[ratio] || ratio;
534 },
535 getRatioType(ratio) {
536 let type = '';
537 if (1 === ratio) {
538 type = 'square';
539 } else {
540 type = ratio < 1 ? 'portrait' : 'landscape';
541 }
542 return type;
543 },
544 getShareLinks() {
545 const {
546 i18n
547 } = elementorFrontend.config,
548 socialNetworks = {
549 facebook: {
550 label: i18n.shareOnFacebook,
551 iconElement: _eIcons.facebook
552 },
553 twitter: {
554 label: i18n.shareOnTwitter,
555 iconElement: _eIcons.twitter
556 },
557 pinterest: {
558 label: i18n.pinIt,
559 iconElement: _eIcons.pinterest
560 }
561 },
562 $ = jQuery,
563 classes = this.getSettings('classes'),
564 selectors = this.getSettings('selectors'),
565 $linkList = $('<div>', {
566 class: classes.slideshow.shareLinks
567 }),
568 $activeSlide = this.getSlide('active'),
569 $image = $activeSlide.find(selectors.image),
570 videoUrl = $activeSlide.data('elementor-slideshow-video');
571 let itemUrl;
572 if (videoUrl) {
573 itemUrl = videoUrl;
574 } else {
575 itemUrl = $image.attr('src');
576 }
577 $.each(socialNetworks, (key, data) => {
578 const networkLabel = data.label,
579 $link = $('<a>', {
580 href: this.createShareLink(key, itemUrl, $activeSlide.attr('data-e-action-hash')),
581 target: '_blank'
582 }).text(networkLabel),
583 $socialNetworkIconElement = this.isFontIconSvgExperiment ? $(data.iconElement.element) : $('<i>', {
584 class: 'eicon-' + key,
585 'aria-hidden': 'true'
586 });
587 $link.prepend($socialNetworkIconElement);
588 $linkList.append($link);
589 });
590 if (!videoUrl) {
591 const $downloadIcon = this.isFontIconSvgExperiment ? $(_eIcons.downloadBold.element) : $('<i>', {
592 class: 'eicon-download-bold'
593 });
594 $downloadIcon.attr('aria-label', i18n.download);
595 $linkList.append($('<a>', {
596 href: itemUrl,
597 download: ''
598 }).text(i18n.downloadImage).prepend($downloadIcon));
599 }
600 return $linkList;
601 },
602 createShareLink(networkName, itemUrl) {
603 let hash = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
604 const options = {};
605 if ('pinterest' === networkName) {
606 options.image = encodeURIComponent(itemUrl);
607 } else {
608 options.url = encodeURIComponent(location.href.replace(/#.*/, '') + hash);
609 }
610 return ShareLink.getNetworkLink(networkName, options);
611 },
612 getSlideshowHeader() {
613 const {
614 i18n
615 } = elementorFrontend.config,
616 $ = jQuery,
617 showCounter = 'yes' === elementorFrontend.getKitSettings('lightbox_enable_counter'),
618 showFullscreen = 'yes' === elementorFrontend.getKitSettings('lightbox_enable_fullscreen'),
619 showZoom = 'yes' === elementorFrontend.getKitSettings('lightbox_enable_zoom'),
620 showShare = 'yes' === elementorFrontend.getKitSettings('lightbox_enable_share'),
621 classes = this.getSettings('classes'),
622 slideshowClasses = classes.slideshow,
623 elements = this.elements;
624 if (!(showCounter || showFullscreen || showZoom || showShare)) {
625 return;
626 }
627 elements.$header = $('<header>', {
628 class: slideshowClasses.header + ' ' + classes.preventClose
629 });
630 if (showShare) {
631 const iconElement = this.isFontIconSvgExperiment ? _eIcons.shareArrow.element : '<i>';
632 elements.$iconShare = $(iconElement, {
633 class: slideshowClasses.iconShare,
634 role: 'button',
635 tabindex: 0,
636 'aria-label': i18n.share,
637 'aria-expanded': false
638 }).append($('<span>'));
639 const $shareLinks = $('<div>');
640 $shareLinks.on('click', e => {
641 e.stopPropagation();
642 });
643 elements.$shareMenu = $('<div>', {
644 class: slideshowClasses.shareMenu
645 }).append($shareLinks);
646 elements.$iconShare.add(elements.$shareMenu).on('click', this.toggleShareMenu);
647 elements.$header.append(elements.$iconShare, elements.$shareMenu);
648 this.$buttons = this.$buttons.add(elements.$iconShare);
649 }
650 if (showZoom) {
651 const iconElement = this.isFontIconSvgExperiment ? _eIcons.zoomInBold.element : '<i>',
652 showZoomElements = [],
653 showZoomAttrs = {
654 role: 'switch',
655 tabindex: 0,
656 'aria-checked': false,
657 'aria-label': i18n.zoom
658 },
659 zoomAttrs = {
660 ...showZoomAttrs
661 };
662 if (!this.isFontIconSvgExperiment) {
663 zoomAttrs.class = slideshowClasses.iconZoomIn;
664 }
665 elements.$iconZoom = $(iconElement).attr(zoomAttrs).on('click', this.toggleZoomMode);
666 showZoomElements.push(elements.$iconZoom);
667 if (this.isFontIconSvgExperiment) {
668 elements.$iconZoomOut = $(_eIcons.zoomOutBold.element).attr(showZoomAttrs).addClass(classes.hidden).on('click', this.toggleZoomMode);
669 showZoomElements.push(elements.$iconZoomOut);
670 }
671 elements.$header.append(showZoomElements);
672 this.$buttons = this.$buttons.add(showZoomElements);
673 }
674 if (showFullscreen) {
675 const iconElement = this.isFontIconSvgExperiment ? _eIcons.frameExpand.element : '<i>',
676 fullScreenElements = [],
677 fullScreenAttrs = {
678 role: 'switch',
679 tabindex: 0,
680 'aria-checked': false,
681 'aria-label': i18n.fullscreen
682 },
683 expandAttrs = {
684 ...fullScreenAttrs
685 };
686
687 // Only if the experiment is not active, we use the class-name in order to render the icon.
688 if (!this.isFontIconSvgExperiment) {
689 expandAttrs.class = slideshowClasses.iconExpand;
690 }
691 elements.$iconExpand = $(iconElement).append($('<span>'), $('<span>')).attr(expandAttrs).on('click', this.toggleFullscreen);
692 fullScreenElements.push(elements.$iconExpand);
693 if (this.isFontIconSvgExperiment) {
694 elements.$iconMinimize = $(_eIcons.frameMinimize.element).attr(fullScreenAttrs).addClass(classes.hidden).on('click', this.toggleFullscreen);
695 fullScreenElements.push(elements.$iconMinimize);
696 }
697 elements.$header.append(fullScreenElements);
698 this.$buttons = this.$buttons.add(fullScreenElements);
699 }
700 if (showCounter) {
701 elements.$counter = $('<span>', {
702 class: slideshowClasses.counter
703 });
704 elements.$header.append(elements.$counter);
705 }
706 return elements.$header;
707 },
708 toggleFullscreen() {
709 if (_screenfull.default.isFullscreen) {
710 this.deactivateFullscreen();
711 } else if (_screenfull.default.isEnabled) {
712 this.activateFullscreen();
713 }
714 },
715 toggleZoomMode() {
716 if (1 !== this.swiper.zoom.scale) {
717 this.deactivateZoom();
718 } else {
719 this.activateZoom();
720 }
721 },
722 toggleShareMenu() {
723 if (this.shareMode) {
724 this.deactivateShareMode();
725 } else {
726 this.elements.$shareMenu.html(this.getShareLinks());
727 this.activateShareMode();
728 }
729 },
730 activateShareMode() {
731 const classes = this.getSettings('classes');
732 this.elements.$container.addClass(classes.slideshow.shareMode);
733 this.elements.$iconShare.attr('aria-expanded', true);
734
735 // Prevent swiper interactions while in share mode
736 this.swiper.detachEvents();
737
738 // Temporarily replace tabbable buttons with share-menu items
739 this.$originalButtons = this.$buttons;
740 this.$buttons = this.elements.$iconShare.add(this.elements.$shareMenu.find('a'));
741 this.shareMode = true;
742 },
743 deactivateShareMode() {
744 const classes = this.getSettings('classes');
745 this.elements.$container.removeClass(classes.slideshow.shareMode);
746 this.elements.$iconShare.attr('aria-expanded', false);
747 this.swiper.attachEvents();
748 this.$buttons = this.$originalButtons;
749 this.shareMode = false;
750 },
751 activateFullscreen() {
752 const classes = this.getSettings('classes');
753 _screenfull.default.request(this.elements.$container.parents('.dialog-widget')[0]);
754 if (this.isFontIconSvgExperiment) {
755 this.elements.$iconExpand.addClass(classes.hidden).attr('aria-checked', 'false');
756 this.elements.$iconMinimize.removeClass(classes.hidden).attr('aria-checked', 'true');
757 } else {
758 this.elements.$iconExpand.removeClass(classes.slideshow.iconExpand).addClass(classes.slideshow.iconShrink).attr('aria-checked', 'true');
759 }
760 this.elements.$container.addClass(classes.slideshow.fullscreenMode);
761 },
762 deactivateFullscreen() {
763 const classes = this.getSettings('classes');
764 _screenfull.default.exit();
765 if (this.isFontIconSvgExperiment) {
766 this.elements.$iconExpand.removeClass(classes.hidden).attr('aria-checked', 'true');
767 this.elements.$iconMinimize.addClass(classes.hidden).attr('aria-checked', 'false');
768 } else {
769 this.elements.$iconExpand.removeClass(classes.slideshow.iconShrink).addClass(classes.slideshow.iconExpand).attr('aria-checked', 'false');
770 }
771 this.elements.$container.removeClass(classes.slideshow.fullscreenMode);
772 },
773 activateZoom() {
774 const swiper = this.swiper,
775 elements = this.elements,
776 classes = this.getSettings('classes');
777 swiper.zoom.in();
778 swiper.allowSlideNext = false;
779 swiper.allowSlidePrev = false;
780 swiper.allowTouchMove = false;
781 elements.$container.addClass(classes.slideshow.zoomMode);
782 if (this.isFontIconSvgExperiment) {
783 elements.$iconZoom.addClass(classes.hidden).attr('aria-checked', 'false');
784 elements.$iconZoomOut.removeClass(classes.hidden).attr('aria-checked', 'true');
785 } else {
786 elements.$iconZoom.removeClass(classes.slideshow.iconZoomIn).addClass(classes.slideshow.iconZoomOut);
787 }
788 },
789 deactivateZoom() {
790 const swiper = this.swiper,
791 elements = this.elements,
792 classes = this.getSettings('classes');
793 swiper.zoom.out();
794 swiper.allowSlideNext = true;
795 swiper.allowSlidePrev = true;
796 swiper.allowTouchMove = true;
797 elements.$container.removeClass(classes.slideshow.zoomMode);
798 if (this.isFontIconSvgExperiment) {
799 elements.$iconZoom.removeClass(classes.hidden).attr('aria-checked', 'true');
800 elements.$iconZoomOut.addClass(classes.hidden).attr('aria-checked', 'false');
801 } else {
802 elements.$iconZoom.removeClass(classes.slideshow.iconZoomOut).addClass(classes.slideshow.iconZoomIn);
803 }
804 },
805 getSlideshowFooter() {
806 const $ = jQuery,
807 classes = this.getSettings('classes'),
808 $footer = $('<footer>', {
809 class: classes.slideshow.footer + ' ' + classes.preventClose
810 }),
811 $title = $('<div>', {
812 class: classes.slideshow.title
813 }),
814 $description = $('<div>', {
815 class: classes.slideshow.description
816 });
817 $footer.append($title, $description);
818 return $footer;
819 },
820 setSlideshowContent(options) {
821 const {
822 i18n
823 } = elementorFrontend.config,
824 $ = jQuery,
825 isSingleSlide = 1 === options.slides.length,
826 hasTitle = '' !== elementorFrontend.getKitSettings('lightbox_title_src'),
827 hasDescription = '' !== elementorFrontend.getKitSettings('lightbox_description_src'),
828 showFooter = hasTitle || hasDescription,
829 classes = this.getSettings('classes'),
830 slideshowClasses = classes.slideshow,
831 $container = $('<div>', {
832 class: slideshowClasses.container
833 }),
834 $slidesWrapper = $('<div>', {
835 class: slideshowClasses.slidesWrapper
836 });
837 let $prevButton, $nextButton;
838 options.slides.forEach(slide => {
839 let slideClass = slideshowClasses.slide + ' ' + classes.item;
840 if (slide.video) {
841 slideClass += ' ' + classes.video;
842 }
843 const $slide = $('<div>', {
844 class: slideClass
845 });
846 if (slide.video) {
847 $slide.attr('data-elementor-slideshow-video', slide.video);
848 const playVideoLoadingElement = this.isFontIconSvgExperiment ? _eIcons.loading.element : '<i>',
849 $playIcon = $('<div>', {
850 class: classes.playButton
851 }).html($(playVideoLoadingElement).attr('aria-label', i18n.playVideo).addClass(classes.playButtonIcon));
852 $slide.append($playIcon);
853 } else {
854 const $zoomContainer = $('<div>', {
855 class: 'swiper-zoom-container'
856 }),
857 $slidePlaceholder = $('<div class="swiper-lazy-preloader"></div>'),
858 imageAttributes = {
859 'data-src': slide.image,
860 class: classes.image + ' ' + classes.preventClose + ' swiper-lazy'
861 };
862 if (slide.title) {
863 imageAttributes['data-title'] = slide.title;
864 imageAttributes.alt = slide.title;
865 }
866 if (slide.description) {
867 imageAttributes['data-description'] = slide.description;
868 imageAttributes.alt += ' - ' + slide.description;
869 }
870 const $slideImage = $('<img>', imageAttributes);
871 $zoomContainer.append([$slideImage, $slidePlaceholder]);
872 $slide.append($zoomContainer);
873 }
874 if (slide.hash) {
875 $slide.attr('data-e-action-hash', slide.hash);
876 }
877 $slidesWrapper.append($slide);
878 });
879 this.elements.$container = $container;
880 this.elements.$header = this.getSlideshowHeader();
881 $container.prepend(this.elements.$header).append($slidesWrapper);
882 if (!isSingleSlide) {
883 const $prevButtonIcon = this.isFontIconSvgExperiment ? $(_eIcons.chevronLeft.element) : $('<i>', {
884 class: slideshowClasses.prevButtonIcon,
885 'aria-hidden': 'true'
886 }),
887 $nextButtonIcon = this.isFontIconSvgExperiment ? $(_eIcons.chevronRight.element) : $('<i>', {
888 class: slideshowClasses.nextButtonIcon,
889 'aria-hidden': 'true'
890 }),
891 $prevButtonLabel = $('<span>', {
892 class: 'screen-reader-text'
893 }).html(i18n.previous),
894 $nextButtonLabel = $('<span>', {
895 class: 'screen-reader-text'
896 }).html(i18n.next);
897 $prevButton = $('<div>', {
898 class: slideshowClasses.prevButton + ' ' + classes.preventClose
899 }).append($prevButtonIcon, $prevButtonLabel);
900 $nextButton = $('<div>', {
901 class: slideshowClasses.nextButton + ' ' + classes.preventClose
902 }).append($nextButtonIcon, $nextButtonLabel);
903 $container.append($nextButton, $prevButton);
904 this.$buttons = this.$buttons.add($nextButton).add($prevButton);
905 }
906 if (showFooter) {
907 this.elements.$footer = this.getSlideshowFooter();
908 $container.append(this.elements.$footer);
909 }
910 this.setSettings('hideUiTimeout', '');
911 $container.on('click mousemove keypress', this.showLightboxUi);
912 const modal = this.getModal();
913 modal.setMessage($container);
914 const onShowMethod = modal.onShow;
915 modal.onShow = async () => {
916 onShowMethod();
917 const swiperOptions = {
918 pagination: {
919 el: '.' + slideshowClasses.counter,
920 type: 'fraction'
921 },
922 on: {
923 slideChangeTransitionEnd: this.onSlideChange
924 },
925 lazy: {
926 loadPrevNext: true
927 },
928 zoom: true,
929 spaceBetween: 100,
930 grabCursor: true,
931 runCallbacksOnInit: false,
932 loop: true,
933 keyboard: true,
934 handleElementorBreakpoints: true
935 };
936 if (!isSingleSlide) {
937 swiperOptions.navigation = {
938 prevEl: $prevButton[0],
939 nextEl: $nextButton[0]
940 };
941 }
942 if (options.swiper) {
943 $.extend(swiperOptions, options.swiper);
944 }
945 const Swiper = elementorFrontend.utils.swiper;
946 this.swiper = await new Swiper($container, swiperOptions);
947
948 // Expose the swiper instance in the frontend
949 $container.data('swiper', this.swiper);
950 this.playSlideVideo();
951 if (showFooter) {
952 this.updateFooterText();
953 }
954 this.bindHotKeys();
955 this.makeButtonsAccessible();
956 };
957 },
958 makeButtonsAccessible() {
959 this.$buttons.attr('tabindex', 0).on('keypress', event => {
960 const ENTER_KEY = 13,
961 SPACE_KEY = 32;
962 if (ENTER_KEY === event.which || SPACE_KEY === event.which) {
963 jQuery(event.currentTarget).trigger('click');
964 }
965 });
966 },
967 showLightboxUi() {
968 const slideshowClasses = this.getSettings('classes').slideshow;
969 this.elements.$container.removeClass(slideshowClasses.hideUiVisibility);
970 clearTimeout(this.getSettings('hideUiTimeout'));
971 this.setSettings('hideUiTimeout', setTimeout(() => {
972 if (!this.shareMode) {
973 this.elements.$container.addClass(slideshowClasses.hideUiVisibility);
974 }
975 }, 3500));
976 },
977 bindHotKeys() {
978 this.getModal().getElements('window').on('keydown', this.activeKeyDown);
979 },
980 unbindHotKeys() {
981 this.getModal().getElements('window').off('keydown', this.activeKeyDown);
982 },
983 activeKeyDown(event) {
984 this.showLightboxUi();
985 const TAB_KEY = 9;
986 if (event.which === TAB_KEY) {
987 const $buttons = this.$buttons;
988 let focusedButton,
989 isFirst = false,
990 isLast = false;
991 $buttons.each(index => {
992 const item = $buttons[index];
993 if (jQuery(item).is(':focus')) {
994 focusedButton = item;
995 isFirst = 0 === index;
996 isLast = $buttons.length - 1 === index;
997 return false;
998 }
999 });
1000 if (event.shiftKey) {
1001 if (isFirst) {
1002 event.preventDefault();
1003 $buttons.last().trigger('focus');
1004 }
1005 } else if (isLast || !focusedButton) {
1006 event.preventDefault();
1007 $buttons.first().trigger('focus');
1008 }
1009 }
1010 },
1011 getSlide(slideState) {
1012 return jQuery(this.swiper.slides).filter(this.getSettings('selectors.slideshow.' + slideState + 'Slide'));
1013 },
1014 updateFooterText() {
1015 if (!this.elements.$footer) {
1016 return;
1017 }
1018 const classes = this.getSettings('classes'),
1019 $activeSlide = this.getSlide('active'),
1020 $image = $activeSlide.find('.elementor-lightbox-image'),
1021 titleText = $image.data('title'),
1022 descriptionText = $image.data('description'),
1023 $title = this.elements.$footer.find('.' + classes.slideshow.title),
1024 $description = this.elements.$footer.find('.' + classes.slideshow.description);
1025 $title.text(titleText || '');
1026 $description.text(descriptionText || '');
1027 },
1028 playSlideVideo() {
1029 const $activeSlide = this.getSlide('active'),
1030 videoURL = $activeSlide.data('elementor-slideshow-video');
1031 if (!videoURL) {
1032 return;
1033 }
1034 const classes = this.getSettings('classes'),
1035 aspectRatio = this.getRatioDictionry(this.getSettings('modalOptions.videoAspectRatio')),
1036 $videoContainer = jQuery('<div>', {
1037 class: classes.videoContainer + ' ' + classes.invisible
1038 }),
1039 $videoWrapper = jQuery('<div>', {
1040 class: `${classes.videoWrapper} elementor-video-${this.getRatioType(aspectRatio)}`,
1041 style: '--video-aspect-ratio: ' + aspectRatio
1042 }),
1043 $playIcon = $activeSlide.children('.' + classes.playButton);
1044 let videoType, apiProvider;
1045 $videoContainer.append($videoWrapper);
1046 $activeSlide.append($videoContainer);
1047 if (-1 !== videoURL.indexOf('vimeo.com')) {
1048 videoType = 'vimeo';
1049 apiProvider = elementorFrontend.utils.vimeo;
1050 } else if (videoURL.match(/^(?:https?:\/\/)?(?:www\.)?(?:m\.)?(?:youtu\.be\/|youtube\.com)/)) {
1051 videoType = 'youtube';
1052 apiProvider = elementorFrontend.utils.youtube;
1053 }
1054 const videoID = apiProvider.getVideoIDFromURL(videoURL);
1055 apiProvider.onApiReady(apiObject => {
1056 if ('youtube' === videoType) {
1057 this.prepareYTVideo(apiObject, videoID, $videoContainer, $videoWrapper, $playIcon);
1058 } else if ('vimeo' === videoType) {
1059 this.prepareVimeoVideo(apiObject, videoURL, $videoContainer, $videoWrapper, $playIcon);
1060 }
1061 });
1062 $playIcon.addClass(classes.playing).removeClass(classes.hidden);
1063 },
1064 prepareYTVideo(YT, videoID, $videoContainer, $videoWrapper, $playIcon) {
1065 const classes = this.getSettings('classes'),
1066 $videoPlaceholderElement = jQuery('<div>');
1067 let startStateCode = YT.PlayerState.PLAYING;
1068 $videoWrapper.append($videoPlaceholderElement);
1069
1070 // Since version 67, Chrome doesn't fire the `PLAYING` state at start time
1071 if (window.chrome) {
1072 startStateCode = YT.PlayerState.UNSTARTED;
1073 }
1074 $videoContainer.addClass('elementor-loading' + ' ' + classes.invisible);
1075 this.player = new YT.Player($videoPlaceholderElement[0], {
1076 videoId: videoID,
1077 events: {
1078 onReady: () => {
1079 $playIcon.addClass(classes.hidden);
1080 $videoContainer.removeClass(classes.invisible);
1081 this.player.playVideo();
1082 },
1083 onStateChange: event => {
1084 if (event.data === startStateCode) {
1085 $videoContainer.removeClass('elementor-loading' + ' ' + classes.invisible);
1086 }
1087 }
1088 },
1089 playerVars: {
1090 controls: 0,
1091 rel: 0
1092 }
1093 });
1094 },
1095 prepareVimeoVideo(Vimeo, videoURL, $videoContainer, $videoWrapper, $playIcon) {
1096 const classes = this.getSettings('classes'),
1097 vimeoOptions = {
1098 url: videoURL,
1099 autoplay: true,
1100 transparent: false,
1101 playsinline: false,
1102 cc_load_policy: false
1103 };
1104 this.player = new Vimeo.Player($videoWrapper, vimeoOptions);
1105 this.player.ready().then(() => {
1106 $playIcon.addClass(classes.hidden);
1107 $videoContainer.removeClass(classes.invisible);
1108 });
1109 },
1110 setEntranceAnimation(animation) {
1111 animation = animation || elementorFrontend.getCurrentDeviceSetting(this.getSettings('modalOptions'), 'entranceAnimation');
1112 const $widgetMessage = this.getModal().getElements('message');
1113 if (this.oldAnimation) {
1114 $widgetMessage.removeClass(this.oldAnimation);
1115 }
1116 this.oldAnimation = animation;
1117 if (animation) {
1118 $widgetMessage.addClass('animated ' + animation);
1119 }
1120 },
1121 openSlideshow(slideshowID, initialSlideURL) {
1122 const $allSlideshowLinks = jQuery(this.getSettings('selectors.links')).filter((index, element) => {
1123 const $element = jQuery(element);
1124 return slideshowID === element.dataset.elementorLightboxSlideshow && !$element.parent('.swiper-slide-duplicate').length && !$element.parents('.slick-cloned').length;
1125 });
1126 const slides = [];
1127 let initialSlideIndex = 0;
1128 $allSlideshowLinks.each(function () {
1129 const slideVideo = this.dataset.elementorLightboxVideo;
1130 let slideIndex = this.dataset.elementorLightboxIndex;
1131 if (undefined === slideIndex) {
1132 slideIndex = $allSlideshowLinks.index(this);
1133 }
1134 if (initialSlideURL === this.href || slideVideo && initialSlideURL === slideVideo) {
1135 initialSlideIndex = slideIndex;
1136 }
1137 const slideData = {
1138 image: this.href,
1139 index: slideIndex,
1140 title: this.dataset.elementorLightboxTitle,
1141 description: this.dataset.elementorLightboxDescription,
1142 hash: this.getAttribute('data-e-action-hash')
1143 };
1144 if (slideVideo) {
1145 slideData.video = slideVideo;
1146 }
1147 slides.push(slideData);
1148 });
1149 slides.sort((a, b) => a.index - b.index);
1150 this.showModal({
1151 type: 'slideshow',
1152 id: slideshowID,
1153 modalOptions: {
1154 id: 'elementor-lightbox-slideshow-' + slideshowID
1155 },
1156 slideshow: {
1157 slides,
1158 swiper: {
1159 initialSlide: +initialSlideIndex
1160 }
1161 }
1162 });
1163 },
1164 onSlideChange() {
1165 this.getSlide('prev').add(this.getSlide('next')).add(this.getSlide('active')).find('.' + this.getSettings('classes.videoWrapper')).remove();
1166 this.playSlideVideo();
1167 this.updateFooterText();
1168 }
1169 });
1170
1171 /***/ }),
1172
1173 /***/ "../assets/dev/js/frontend/utils/lightbox/screenfull.js":
1174 /*!**************************************************************!*\
1175 !*** ../assets/dev/js/frontend/utils/lightbox/screenfull.js ***!
1176 \**************************************************************/
1177 /***/ ((module) => {
1178
1179
1180
1181 (function () {
1182 'use strict';
1183
1184 var document = typeof window !== 'undefined' && typeof window.document !== 'undefined' ? window.document : {};
1185 var isCommonjs = true && module.exports;
1186 var fn = function () {
1187 var val;
1188 var fnMap = [['requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror'],
1189 // New WebKit
1190 ['webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitFullscreenElement', 'webkitFullscreenEnabled', 'webkitfullscreenchange', 'webkitfullscreenerror'],
1191 // Old WebKit
1192 ['webkitRequestFullScreen', 'webkitCancelFullScreen', 'webkitCurrentFullScreenElement', 'webkitCancelFullScreen', 'webkitfullscreenchange', 'webkitfullscreenerror'], ['mozRequestFullScreen', 'mozCancelFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'mozfullscreenchange', 'mozfullscreenerror'], ['msRequestFullscreen', 'msExitFullscreen', 'msFullscreenElement', 'msFullscreenEnabled', 'MSFullscreenChange', 'MSFullscreenError']];
1193 var i = 0;
1194 var l = fnMap.length;
1195 var ret = {};
1196 for (; i < l; i++) {
1197 val = fnMap[i];
1198 if (val && val[1] in document) {
1199 var valLength = val.length;
1200 for (i = 0; i < valLength; i++) {
1201 ret[fnMap[0][i]] = val[i];
1202 }
1203 return ret;
1204 }
1205 }
1206 return false;
1207 }();
1208 var eventNameMap = {
1209 change: fn.fullscreenchange,
1210 error: fn.fullscreenerror
1211 };
1212 var screenfull = {
1213 request(element) {
1214 return new Promise(function (resolve, reject) {
1215 var onFullScreenEntered = function () {
1216 this.off('change', onFullScreenEntered);
1217 resolve();
1218 }.bind(this);
1219 this.on('change', onFullScreenEntered);
1220 element = element || document.documentElement;
1221 Promise.resolve(element[fn.requestFullscreen]()).catch(reject);
1222 }.bind(this));
1223 },
1224 exit() {
1225 return new Promise(function (resolve, reject) {
1226 if (!this.isFullscreen) {
1227 resolve();
1228 return;
1229 }
1230 var onFullScreenExit = function () {
1231 this.off('change', onFullScreenExit);
1232 resolve();
1233 }.bind(this);
1234 this.on('change', onFullScreenExit);
1235 Promise.resolve(document[fn.exitFullscreen]()).catch(reject);
1236 }.bind(this));
1237 },
1238 toggle(element) {
1239 return this.isFullscreen ? this.exit() : this.request(element);
1240 },
1241 onchange(callback) {
1242 this.on('change', callback);
1243 },
1244 onerror(callback) {
1245 this.on('error', callback);
1246 },
1247 on(event, callback) {
1248 var eventName = eventNameMap[event];
1249 if (eventName) {
1250 document.addEventListener(eventName, callback, false);
1251 }
1252 },
1253 off(event, callback) {
1254 var eventName = eventNameMap[event];
1255 if (eventName) {
1256 document.removeEventListener(eventName, callback, false);
1257 }
1258 },
1259 raw: fn
1260 };
1261 if (!fn) {
1262 if (isCommonjs) {
1263 module.exports = {
1264 isEnabled: false
1265 };
1266 } else {
1267 window.screenfull = {
1268 isEnabled: false
1269 };
1270 }
1271 return;
1272 }
1273 Object.defineProperties(screenfull, {
1274 isFullscreen: {
1275 get() {
1276 return Boolean(document[fn.fullscreenElement]);
1277 }
1278 },
1279 element: {
1280 enumerable: true,
1281 get() {
1282 return document[fn.fullscreenElement];
1283 }
1284 },
1285 isEnabled: {
1286 enumerable: true,
1287 get() {
1288 // Coerce to boolean in case of old WebKit
1289 return Boolean(document[fn.fullscreenEnabled]);
1290 }
1291 }
1292 });
1293 if (isCommonjs) {
1294 module.exports = screenfull;
1295 } else {
1296 window.screenfull = screenfull;
1297 }
1298 })();
1299
1300 /***/ })
1301
1302 }]);
1303 //# sourceMappingURL=lightbox.74688eb10c7852662847.bundle.js.map