PageSourceSearch

https://groupepiment.fr/wp-content/plugins/divi-plus/divi-5/server…/Modal/assets/script.min.js?ver=2.3.0

js groupepiment.fr collected 2026-10-07 13:39:46 UTC 13,249 bytes, 348 lines download raw bytes

1( function( $ ) {
2	let windowWidth = $(window).width();
3	$.fn.DiviPlusModalRemoveClasses = function( orderClass ) {
4		let $this   = this,
5		$classes    = dipl_modal_get_module_classes();
6
7		$classes.push(orderClass);
8		$this.removeClass( $classes.join(' ') );
9
10		$this.css( {
11			'animation-delay'           : '',
12			'animation-duration'        : '',
13			'animation-timing-function' : '',
14			'opacity'                   : '',
15			'transform'                 : '',
16			'filter'                    : '',
17		} );
18		return this;
19	};
20	
21	$.fn.DiviPlusModalPopup = function( options ) {
22		let defaults = {
23			action: '',
24			delay: '0',
25		};
26		
27		let $modal   = this,
28			$timeOut = 1000,
29			$options = $.extend({}, defaults, options);
30
31		if ( 'undefined' !== typeof( $modal.find('.dipl_modal_inner_wrap').data('animation-duration') ) ) {
32			$timeOut = parseFloat( $modal.find('.dipl_modal_inner_wrap').data('animation-duration') );
33			if ( windowWidth < 981 ) {
34				if ( 'undefined' !== typeof( $modal.find('.dipl_modal_inner_wrap').data('animation-duration-tablet') ) && '' !== $modal.find('.dipl_modal_wrapper').data('animation-duration-tablet') ) {
35					$timeOut = parseFloat( $modal.find('.dipl_modal_inner_wrap').data('animation-duration-tablet') );
36				}
37			} else if ( windowWidth < 768 ) {
38				if ( 'undefined' !== typeof( $modal.find('.dipl_modal_inner_wrap').data('animation-duration-phone') ) && '' !== $modal.find('.dipl_modal_wrapper').data('animation-duration-phone') ) {
39					$timeOut = parseFloat( $modal.find('.dipl_modal_inner_wrap').data('animation-duration-phone') );
40				}
41			}
42		}
43
44		if ( 'open' === $options.action ) {
45			let delay = parseInt($options.delay);
46			setTimeout( function() {
47				$timeOut = $timeOut + 200;
48				$('body').find('.dipl_modal').removeClass('dipl_active_modal');
49				$('body').addClass('dipl_modal_active');
50				$modal.addClass('dipl_active_modal');
51				if ( 'off' === $modal.find('.dipl_modal_wrapper').data('disable-website-scroll') ) {
52					$('body').addClass('dipl_modal_enable_scroll');
53				}
54				setTimeout( function() {
55					$('body').find('.dipl_modal').removeClass('dipl_modal_opened');
56					$modal.addClass('dipl_modal_opened');
57				}, $timeOut );
58				setTimeout( function() {
59					dipl_modal_autoplay_video($modal);
60				}, ( 0.7 * $timeOut ) );
61				
62				// et_animate_element( $modal.find( '.dipl_modal_inner_wrap' ) );
63				if ( typeof et_animate_element === 'function' ) {
64					et_animate_element( $modal.find( '.dipl_modal_inner_wrap' ) );
65				} else {
66					$modal.find( '.dipl_modal_inner_wrap' ).removeClass( 'et_animated' );
67				}
68				$(document).trigger( 'diviPlusPopupOpened' );
69			}, delay );
70		}
71 
72		if ( 'close' === $options.action ) {
73			let modalId     = $modal.prop('id'),
74				triggerType = $modal.find('.dipl_modal_wrapper').data('trigger-type'),
75				reRender    = $modal.find('.dipl_modal_wrapper').data('re-render');
76	
77			if ( 0 !== $timeOut ) {
78				$modal.removeClass('dipl_active_modal');
79				// $modal.find('.dipl_animated').css('opacity', '1'); // removed for animation.
80				// $modal.find('.dipl_animated').css('transform', 'none'); // removed for animation.
81				setTimeout( function() {
82					// $modal.find('.dipl_animated').removeAttr('style'); // removed for animation.
83					$modal.addClass('dipl_animate_reverse');
84				}, 0 );
85				
86				$modal.removeClass('dipl_modal_opened');
87				$('body').removeClass('dipl_modal_enable_scroll');
88				$('body').removeClass('dipl_modal_active');
89				setTimeout( function() {
90					$modal.removeClass('dipl_animate_reverse');
91				}, $timeOut );
92			} else {
93				$modal.removeClass('dipl_active_modal');
94				$modal.removeClass('dipl_modal_opened');
95				$('body').removeClass('dipl_modal_active');
96				$('body').removeClass('dipl_modal_enable_scroll');
97			}
98			
99			dipl_modal_stop_video( $modal );
100			if ( -1 !== $.inArray( triggerType, [ 'exit_intent', 'on_page_load' ] ) ) {
101				let modalStorageKey = modalId + '_' + triggerType + '_hide';
102				if ( ( 'on_page_load' === triggerType && 'off' === reRender ) || 'exit_intent' === triggerType ) {
103					localStorage.setItem( modalStorageKey, 'true' );
104				}
105			}
106
107			$(document).trigger( 'diviPlusPopupClosed' );
108		}
109		return this;
110	};
111} ( jQuery ) );
112
113jQuery( document ).ready( function($) {
114	/* Module: Modal */
115	if ( $('body').find('.dipl_modal').length > 0 ) {
116		$('body').find('.dipl_modal').each( function() {
117			let $this            = $( this ),
118				$modalClass      = $this.prop('class'),
119				$orderClass      = $this.prop('class').match(/(dipl_modal\_[^\s]*)/)[0],
120				$modalId         = $this.find('.dipl_modal_wrapper').data('id'),
121				$modalStorageKey = $modalId + '_' + $this.find('.dipl_modal_wrapper').data('trigger-type') + '_hide',
122				$modal_container = $('<div class="dipl_modal_section et_pb_section entry-content et-l"></div>'),
123				$modal           = $('<div></div>');
124
125			$modal.prop( 'id', $modalId );
126			$modal.prop( 'class', $modalClass );
127			$modal.DiviPlusModalRemoveClasses($orderClass).addClass('dipl_modal_module');
128
129			if ( $this.hasClass( $orderClass + '_tb_header' ) ) {
130				$modal.addClass( $orderClass + '_tb_header_module' );
131			} else if ( $this.hasClass( $orderClass + '_tb_body' ) ) {
132				$modal.addClass( $orderClass + '_tb_body_module' );
133			} else if ( $this.hasClass( $orderClass + '_tb_footer' ) ) {
134				$modal.addClass( $orderClass + '_tb_footer_module' );
135			} else {
136				$modal.addClass( $orderClass + '_module' );
137			}
138
139			$modal.html( $(this).find('.dipl_modal_wrapper').detach() );
140			$modal_container.html($modal);
141
142			if ( $('body').find('#page-container').find('#et-boc').not('.mm-added').length > 0 ) {
143				$('body').find('#page-container').find('#et-boc').not('.mm-added').append( $modal_container );
144			} else if ( $('body').find('#page-container').length > 0 ) {
145				$('body').find('#page-container').append( $modal_container );
146			} else if ( $('body').find('#et_builder_outer_content').length > 0 ) {
147				$('body').find('#et_builder_outer_content').append( $modal_container );
148			} else if ( $('body').find('#et-boc').not('.mm-added').length > 0 ) {
149				$('body').find('#et-boc').not('.mm-added').append( $modal_container );
150			} else {
151				$('body').append( $modal_container );
152			}
153
154			if ( 'none' === $this.css('display') ) {
155				return;
156			}
157
158			if ( 'element' === $modal.find('.dipl_modal_wrapper').data('trigger-type') ) {
159				if ( 'undefined' !== typeof( $modal.find('.dipl_modal_wrapper').data('trigger-element-id') ) && '' !== $modal.find('.dipl_modal_wrapper').data('trigger-element-id') ) {
160					/* Trigger modal on user defined element */
161					let $elem = '#' + $modal.find('.dipl_modal_wrapper').data('trigger-element-id');
162					$('body').on( 'click', $elem, function(e) {
163						e.preventDefault();
164						$modal.DiviPlusModalPopup( {
165							action: 'open',
166						} );
167					} );
168				} else if ( 'undefined' !== typeof( $modal.find('.dipl_modal_wrapper').data('trigger-element-class') ) && '' !== $modal.find('.dipl_modal_wrapper').data('trigger-element-class') ) {
169					/* Trigger modal on user defined element */
170					let $elem = '.' + $modal.find('.dipl_modal_wrapper').data('trigger-element-class');
171					$('body').on( 'click', $elem, function(e) {
172						e.preventDefault();
173						$modal.DiviPlusModalPopup( {
174							action: 'open',
175						} );
176					} );
177				} else if ( $this.find('.dipl_modal_trigger_element').length > 0 ) {
178					/* Trigger modal on modal trigger element */
179					$this.find('.dipl_modal_trigger_element').on( 'click', function(e) {
180						e.preventDefault();
181						$modal.DiviPlusModalPopup( {
182							action: 'open',
183						} );
184					} );
185				}
186			} else if ( 'on_page_load' === $modal.find('.dipl_modal_wrapper').data('trigger-type') ) {
187				/* Trigger modal on page load */
188				let delay    = parseFloat( $modal.find('.dipl_modal_wrapper').data('trigger-delay') ),
189					reRender = $modal.find('.dipl_modal_wrapper').data('re-render');
190				if ( ( 'off' === reRender && 'true' !== localStorage.getItem( $modalStorageKey ) ) || 'on' === reRender ) {
191					$modal.DiviPlusModalPopup( {
192						action: 'open',
193						delay: delay,
194					} );
195				}
196			} else if ( 'exit_intent' === $modal.find('.dipl_modal_wrapper').data('trigger-type') ) {
197				/* Trigger modal on exit intent */
198				$(document).on( 'mouseout', function(e) {
199					if ( ! $modal.hasClass('dipl_modal_opened') ) {
200						if ( e.toElement === null && e.relatedTarget === null && 'true' !== localStorage.getItem( $modalStorageKey ) ) {
201							$modal.DiviPlusModalPopup({
202								action: 'open',
203							} );
204						}
205					}
206				} );
207			}
208		} );
209
210		/* Prevent modal closing before it's fully rendered */
211		$('body').on( 'click', '.dipl_modal_close', function(e) {
212			e.preventDefault();
213		} );
214
215		/* Close modal on outside click */
216		$('body').on( 'click', '.dipl_modal_opened .dipl_modal_wrapper', function(e) {
217			if ( $(e.target).is( $(this) ) ) {
218				let $modal = $(this).parents('.dipl_modal');
219				$modal.DiviPlusModalPopup( {
220					action: 'close',
221				} );
222			}
223		} );
224		
225		/* Close modal on close icon click after its fully rendered */
226		$('body').on( 'click', '.dipl_modal_opened .dipl_modal_close', function(e) {
227			e.preventDefault();
228			let $modal = $(this).parents('.dipl_modal');
229			$modal.DiviPlusModalPopup( {
230				action: 'close',
231			} );
232		} );
233
234		/* Close modal on esc key after its fully rendered */
235		$(document).on( 'keyup', function(e) {
236			if ( e.keyCode === 27 ) {
237				if ( 
238					$('body').hasClass('dipl_modal_active') &&
239					$('body').find('.dipl_modal_opened .dipl_modal_wrapper').hasClass('dipl_modal_close_on_esc') &&
240					$('body').find('.dipl_modal_opened .dipl_modal_wrapper').length > 0
241				) {
242					let $modal = $('body').find('.dipl_modal_opened');
243					$modal.DiviPlusModalPopup( {
244						action: 'close',
245					} );
246				}
247			}
248		} );
249
250		if ( document.onfullscreenchange === null ) {
251			document.onfullscreenchange = diplOnFullScreenChange;
252		} else if ( document.onmsfullscreenchange === null ) {
253			document.onmsfullscreenchange = diplOnFullScreenChange;
254		} else if ( document.onmozfullscreenchange === null ) {
255			document.onmozfullscreenchange = diplOnFullScreenChange;
256		} else if ( document.onwebkitfullscreenchange === null ) {
257			document.onwebkitfullscreenchange = diplOnFullScreenChange;
258		}
259	}
260} );
261
262function diplOnFullScreenChange() {
263	let diplFullScreenElement = document.fullscreenElement || document.msFullscreenElement || 
264								document.mozFullScreenElement || document.webkitFullscreenElement;
265
266	if ( !! diplFullScreenElement ) {
267		jQuery('body').find('.dipl_active_modal .dipl_modal_inner_wrap').addClass('dipl_modal_fullscreen');
268	} else {
269		jQuery('body').find('.dipl_modal_module .dipl_modal_inner_wrap').removeClass('dipl_modal_fullscreen');
270	}
271}
272
273function dipl_modal_stop_video( $modal ) {
274	if ( typeof($modal) === 'undefined' || '' === $modal ) {
275		return false;
276	}
277
278	if ( $modal.find('iframe').length > 0 ) {
279		let src = $modal.find('iframe').attr('src').replace('?autoplay=1&amp;', '?').replace('?autoplay=1&', '?').replace('?autoplay=1', '').replace('&amp;autoplay=1', '').replace('&autoplay=1', '').replace('&mute=1&muted=1', '');
280		$modal.find('iframe').attr('src', src );
281	} else if ( $modal.find('video').length > 0 ) {
282		$modal.find('video').get(0).pause();
283		$modal.find('video').get(0).currentTime = 0;
284	}
285}
286
287function dipl_modal_autoplay_video($modal) {
288	if ( typeof($modal) === 'undefined' || '' === $modal ) {
289		return false;
290	}
291
292	if ( 'on' === $modal.find('.dipl_modal_wrapper').data('autoplay-video') ) {
293		if ( $modal.find('iframe').length > 0 ) {
294			let mute = 'on_page_load' === $modal.find('.dipl_modal_wrapper').data('trigger-type') ? true : false;
295			let src = dipl_modal_add_autoplay_to_url( $modal.find('iframe').attr('src'), mute );
296			$modal.find('iframe').attr('src', src );
297		} else if ( $modal.find('video').length > 0 ) {
298			let promise = $modal.find('video').get(0).play();
299			if ( promise !== undefined ) {
300				promise.then(_ => {
301				}).catch(error => {
302					$modal.find('video').prop('muted', true);
303					$modal.find('video').get(0).play();
304				});
305			}
306		}
307	}
308}
309
310function dipl_modal_add_autoplay_to_url(src, mute) {
311	let uri     = decodeURIComponent( src );
312	let atts    = uri.split('&');
313	if ( 1 === atts.length ) {
314		atts = uri.split('?');
315		if ( 1 !== atts.length ) {
316			uri = uri + '&autoplay=1';
317			if ( mute ) {
318				uri = uri + '&mute=1&muted=1';
319			}
320		} else {
321			uri = uri + '?autoplay=1';
322			if ( mute ) {
323				uri = uri + '&mute=1&muted=1';
324			}
325		}
326	} else {
327		uri = uri + '&autoplay=1';
328		if ( mute ) {
329			uri = uri + '&mute=1&muted=1';
330		}
331	}
332	return uri;
333}
334
335function dipl_modal_get_module_classes() {
336	return [
337		'et_pb_sticky_module', 'et_pb_sticky',
338		'et_pb_sticky--top', 'et_pb_sticky--bottom', 'et_pb_sticky--top_bottom',
339		'et_animated', 'infinite', 'et-waypoint', 'et_had_animation',
340		'fade', 'fadeTop', 'fadeRight', 'fadeBottom', 'fadeLeft',
341		'slide', 'slideTop', 'slideRight', 'slideBottom', 'slideLeft',
342		'bounce', 'bounceTop', 'bounceRight', 'bounceBottom', 'bounceLeft',
343		'zoom', 'zoomTop', 'zoomRight', 'zoomBottom', 'zoomLeft',
344		'flip', 'flipTop', 'flipRight', 'flipBottom', 'flipLeft',
345		'fold', 'foldTop', 'foldRight', 'foldBottom', 'foldLeft',
346		'roll', 'rollTop', 'rollRight', 'rollBottom', 'rollLeft', 'transformAnim',
347	];
348}

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.