PageSourceSearch

https://avis-plaquedecuisson.com/wp-content/themes/enjoynow-1629230793-via-wpmarmite/script.js

js avis-plaquedecuisson.com collected 2026-10-02 22:46:58 UTC 11,628 bytes, 248 lines download raw bytes

1/** 
2 * Fonctions JS du site
3 *
4 * @author : Thomas
5 * Dernières modifications : 26/06/22
6 /2021
7 */
8 
9
10(function($) {
11	/**
12	 * Effet de transition sur le header
13	 */
14	$(window).scroll(function() {
15		if ($(this).scrollTop() > 400) {
16			$('#masthead').css({'margin-top': '-115px',  'transition' : 'all 0.2s ease 0s'});
17			$('#search-2').css({'margin-top': '-100px',  'transition' : 'all 0.2s ease 0s'});
18			$('#custom_html-2').css({'margin-top': '0',  'transition' : 'all 0.2s ease 0s'});
19		} else {
20			$('#masthead').css({'margin-top': '0', 'transition' : 'all 0.2s ease 0s'});
21			$('#search-2').css({'margin-top': '0',  'transition' : 'all 0.2s ease 0s'});
22			$('#custom_html-2').css({'margin-top': '0',  'transition' : 'all 0.2s ease 0s'});
23		}
24	});	
25	
26	/**
27	 * Effet de transition sur le scroll des liens ancres
28	 * avec positionnement correct
29	 */
30	$("a[href*='#']:not([href='#'])").click(function() {
31		if (window.location.href.split('https://avis-plaquedecuisson.com/tests-et-avis-de-plaques-de-cuisson/').length == 2) {
32			if (location.hostname == this.hostname && this.pathname.replace(/^\//,"") == location.pathname.replace(/^\//,"")) {
33				var anchor = $(this.hash);
34				anchor = anchor.length ? anchor : $("[name=" + this.hash.slice(1) +"]");
35				if (anchor.length) {
36					var topValue = 175;
37					$("html, body").animate( { scrollTop: anchor.offset().top - topValue}, 1000);
38				}
39			}
40		}
41	});	
42	$(document).ready(function() {
43		if (window.location.href.split('https://avis-plaquedecuisson.com/tests-et-avis-de-plaques-de-cuisson/').length == 2) {
44			if (window.location.hash) {
45				$('html, body').animate({scrollTop: $(window.location.hash).offset().top - 300}, 500);
46			}
47		}
48	});
49	
50	// Active/Désactive le focus sur le conteneur du formulaire de la page "Séance Consulting Offerte"
51	$('.page-id-345').click(function(event) {
52		$('.headerSearch_overlay').css('opacity', '1');
53		$('#lp_form_content').css({'z-index' : '999999999', 'border' : 'none'});
54		// Si l'utilisateur clique en dehors du conteneur du formulaire
55 		if (event.target.id != 'lp_form_content' && $(event.target).parents('#lp_form_content').length == 0) {
56			$('.headerSearch_overlay').css('opacity', '0');
57			$('#lp_form_content').css({'z-index' : '1', 'border' : '3px dashed #731D24'});
58		}
59	});
60	
61	/**
62	 * Fonctions pour me formulaire de capture (popup)
63	 */
64	var leave = false;
65	$(document).on('scroll', function(e) {
66		if (!Cookies.get('popup_form_capture')) {
67			heightToDisplay = document.documentElement.scrollHeight * 0.20; // Scroll à 20% de page courante
68			if ($(document).scrollTop() > heightToDisplay && !$('#popup_form_capture')[0]) {
69				var headline = { 0 : '<p><span>Inscrivez-vous maintenant au</span> "<em>Club Cuisine<span class="jade">&</span>Astuces</em>"</p><p>🎁 100% Gratuit. 5 minutes ⌛ d\'astuces & bons plans alléchants dans votre boîte mail ✨ 3700+ membres en profitent déjà 👍🙂 :</p>' };
70				var nbHeadlines = Object.keys(headline).length;
71				var popupFormCapture = '<div id="popup_form_capture"><span type="button" class="close" aria-label="Close"><span aria-hidden="true">×</span></span><div class="container">';
72				popupFormCapture += '<div class="row"><div class="col-md-5">';
73				popupFormCapture += '<img src="/wp-content/uploads/21-accessoires-secrets-cover.png" alt="21 Accessoires Secrets" />';
74				popupFormCapture += '</div>';
75				popupFormCapture += '<div class="col-md-7">';
76				popupFormCapture += '<p><span class="large">- Dossier Gratuit -</span><span class="small">🎁 Dossier GRATUIT à télécharger <u>aujourd\'hui</u> :</span></p>';
77				popupFormCapture += '<p>"21 Accessoires <span class="orange">Secrets</span> <span class="last">Pour Votre Cuisine"</span></p>';
78				popupFormCapture += '<form method="post">';
79				popupFormCapture += '<input type="email" id="popup_capture_form_email" placeholder="Entrez votre email" required />';
80				popupFormCapture += '<button type="submit">Recevoir en 1 clic »</button>';
81				popupFormCapture += '</form>';
82				popupFormCapture += '<p class="secure"><img src="/wp-content/uploads/lock.svg" alt="lock">Gratuit et 100% sécurisé.</p>';
83				popupFormCapture += '<p>En entrant votre adresse email, vous recevrez ponctuellement les conseils et astuces du Club Cuisine&Astuces. Vous pourrez vous désinscrire à tout moment.</p>';
84				popupFormCapture += '</div></div></div></div>';
85				// $('#page').after(popupFormCapture);
86				// $('#page').before('<div id="popup_overlay"></div>');
87				// $('body').css('overflow', 'hidden');
88				leave = true;
89				
90				/**
91				 * Inscription au formulaire de capture (bottom bar)
92				 */
93				$('#popup_form_capture button').click(function() {
94					var origine = 'Avis Plaque de cuisson';
95					var type = 'Popup 21 accessoires secrets';
96					$('#popup_capture_form_email').css('border', 'none');
97					$('#popup_form_capture .error_message').remove();
98					if (($('#popup_capture_form_email').val() != '') && (/^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]{2,}\.[a-zA-Z]{2,4}$/.test($('#popup_capture_form_email').val()))) {
99						$.ajax({
100							url : 'https://automation.chazallet.com/?action=addContact&email='+$('#popup_capture_form_email').val()+'&origine='+origine+'&url='+window.location.href+'&type='+type+'&resolution='+screen.width,
101							type : 'GET',
102							dataType : 'html',
103							beforeSend: function() {
104								$('#popup_form_capture .container').css('display', 'none');
105								$('#popup_form_capture .container').after('<div class="on-load"><div class="spinner"></div></div>');
106								$('#popup_form_capture .on-load').after('<p class="confirm">En cours...</p>');
107							},
108							success : function(data, statut) {
109								$('#popup_form_capture .on-load').css('display', 'none');
110								$('#popup_form_capture .confirm').html('✅️ Votre inscription a bien été prise en compte.<br />Vous allez recevoir votre dossier gratuit <u>dans votre boîte mail d\'ici 5 minutes</u>.<br /><em>(Pensez à vérifier vos spams)</em>');
111								createCookie('popup_form_capture', 'hidden', 365);
112								setTimeout(function(){ closePopup(); }, 4000);
113							}
114						});
115					} else {
116						$('#popup_capture_form_email').css('border', '2px solid #C71B2F');
117						$('#popup_capture_form_email').after('<span class="error_message">
117Merci de saisir une adresse mail valide.</span>');
118					}
119					return false;
120				});
121			}
122		}
123	});
124
125	/**
126	 * Ferme la popup au clic sur "x"
127	 */
128	$(document).on('click', '#popup_form_capture .close', function() {		
129		closePopup();
130		createCookie('popup_form_capture', 'hidden', 2);
131	});
132	
133	/**
134	 * Ferme la popup
135	 */
136	function closePopup() {
137		$('#popup_form_capture').css('display', 'none');
138		$('#popup_overlay').remove();
139		$('body').css('overflow', 'auto');		
140	}
141
142	/**
143	 * Fonctions pour me formulaire de capture (Slide-ins)
144	 */
145	$(document).on('scroll', function(e) {
146		heightToDisplay = document.documentElement.scrollHeight * 0.10; // Scroll à 10% de page courante
147		if ($(document).scrollTop() > heightToDisplay && !$('#bottom_capture_form')[0]) {
148			/**
149			 * Affiche le formulaire de capture (bottom bar)
150			 * si aucun cookie n'existe
151			 */
152			if (!Cookies.get('bottom_capture_form')) {					
153				var headline = { 0 : '<p><span>Inscrivez-vous maintenant au</span> "<em>Club Cuisine<span class="jade">&</span>Astuces</em>"</p><p>🎁 100% Gratuit. 5 minutes ⌛ d\'astuces & bons plans alléchants dans votre boîte mail ✨ 3700+ membres en profitent déjà 👍🙂 :</p>' };
154				var nbHeadlines = Object.keys(headline).length;
155				var bottomFormCapture = '<div id="bottom_capture_form"><span type="button" class="close" aria-label="Close"><span aria-hidden="true">×</span></span><div class="container">';
156				bottomFormCapture += headline[Math.floor(Math.random() * nbHeadlines)];
157				bottomFormCapture += '<form method="post">';
158				bottomFormCapture += '<input type="email" id="capture_form_email" placeholder="Entrez votre email" required />';
159				bottomFormCapture += '<form method="post"><input type="hidden" id="capture_form_email" placeholder="Entrez votre email" required />';
160				bottomFormCapture += '<button type="submit">S\'inscrire</button>';
161				bottomFormCapture += '</form></div></div>';
162				// $('#page').after(bottomFormCapture);
163			}	
164			
165			/**
166			 * Quand une personne saisie son mail sur le formulaire de capture (bottom bar)
167			 */
168			$('#bottom_capture_form input').keypress(function() {
169				$(this).css({'font-style': 'normal', 'font-weight' : '600'});
170			});
171			
172			/**
173			 * Inscription au formulaire de capture (bottom bar)
174			 */
175			$('#bottom_capture_form button').click(function() {
176				var origine = 'Avis Plaque de cuisson';
177				var type = 'Slide-ins';
178				$('#capture_form_email').css('border', 'none');
179				$('#bottom_capture_form .error_message').remove();
180				if (($('#capture_form_email').val() != '') && (/^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]{2,}\.[a-zA-Z]{2,4}$/.test($('#capture_form_email').val()))) {
181					$.ajax({
182						url : 'https://automation.chazallet.com/?action=addContact&email='+$('#capture_form_email').val()+'&origine='+origine+'&url='+window.location.href+'&type='+type+'&resolution='+screen.width,
183						type : 'GET',
184						dataType : 'html',
185						beforeSend: function() {
186							$('#bottom_capture_form .container').css('display', 'none');
187							$('#bottom_capture_form .container').after('<div class="on-load"><div class="spinner"></div></div>');
188							$('#bottom_capture_form .on-load').after('<p class="confirm">En cours...</p>');
189						},
190						success : function(data, statut) {
191 							$('#bottom_capture_form .on-load').css('display', 'none');
192							$('#bottom_capture_form .confirm').html('✔️ Votre inscription a bien été prise en compte.');
193							createCookie('bottom_capture_form', 'hidden', 365);
194							setTimeout(function(){ $('#bottom_capture_form').css('transform', 'translate(0, 160px)') }, 4000);
195						}
196					});
197				} else {
198					$('#capture_form_email').css('border', '2px solid #C71B2F');
199					$('#bottom_capture_form form').after('<span class="error_message">
199Merci de saisir une adresse mail valide.</span>');
200				}
201				return false;
202			});
203
204			/**
205			 * Masque le formulaire de capture (bottom bar)
206			 */
207			$('#bottom_capture_form .close').click(function() {
208				$('#bottom_capture_form').css('display', 'none');
209				createCookie('bottom_capture_form', 'hidden', 1);		
210			});	
211		}
212	});
213	
214	/**
215	 * Création d'un cookie
216	 *
217	 * @param <string> Nom du cookie
218	 * @param <string> Valeur du cookie
219	 * @param <integer> Nombre de jours d'existence du cookie
220	 */ 
221	function createCookie(cookieName, value = null, duration = 365) {
222		var date = new Date();
223		if (value == null) {
224			var cookieDate = '';
225			cookieDate = date.getDate() + '/'+parseInt(date.getMonth() + 1)+'/'+date.getFullYear();	
226			Cookies.set(cookieName, { date : cookieDate }, { expires: duration });			
227		} else {
228			Cookies.set(cookieName, value, { expires: duration });	
229		}
230	}
231	
232	/**
233	 * Affiche la cookie bar
234	 * si elle n'a pas encore été validée
235	 */
236	if (!Cookies.get('avisplaquedecuisson_global_cookie')) {
237		$('footer').after('<div id="cookie_bar"><div class="container"><p>Souhaitez-vous <a href="https://avis-plaquedecuisson.com/go/cookies" target="_blank"><span>manger les cookies</span></a> de ce site ? <a class="button" href="https://avis-plaquedecuisson.com/go/cookies" target="_blank">Accepter</a></p></div></div>');
238	}
239	 
240	/**
241	 * Création d'un cookie lors de
242	 * la validation de la cookie bar
243	 */
244	$('#cookie_bar .button').click(function() {
245		createCookie('avisplaquedecuisson_global_cookie');
246		$('#cookie_bar').css('transform', 'translate(0, 80px)');
247	});
248})(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.