Profitez du service de soins simplifié MedEx : 10 % de réduction sur votre premier rendez-vous avec le code promo « TRYMEDEX » lors du paiement. ///////////////////////////////////// Tarifs généraux : Consultation : 750 THB | Frais de service de prélèvement à domicile : 750 THB (GRATUIT pour les commandes supérieures à 5 000 THB)
`; $('#subtotal').parent().after(iconContainer); const self = this; // Associer l'événement d'impression (le CSS masquera sur mobile) $('#print-cart-btn').on('click', function() { self.printCart.call(self); }); $('#copy-cart-btn').on('click', function() { self.copyCartAsBulletList.call(self); }); }; LabDOSApp.originalRenderCart = LabDOSApp.renderCart; LabDOSApp.renderCart = function(highlightItemName = null) { this.originalRenderCart.call(this, highlightItemName); this.addCartIcons.call(this); }; $(document).ready(function() { setTimeout(function() { if (LabDOSApp && typeof LabDOSApp.addCartIcons === 'function') { LabDOSApp.addCartIcons.call(LabDOSApp); } }, 1000); // Fresh: Toggle labdos-inview class and handle sticky search box (function(){ var rootEl = document.getElementById('lab-dos'); if (!rootEl) return; function setInView(inView){ document.body.classList.toggle('labdos-inview', !!inView); console.log('labdos-inview:', inView); // Debug } function recompute() { var rect = rootEl.getBoundingClientRect(); var vpH = window.innerHeight || document.documentElement.clientHeight; // Consider in view if significant part of #lab-dos is visible var inView = rect.bottom > vpH * 0.2 && rect.top < vpH * 0.8; setInView(inView); } if ('IntersectionObserver' in window) { try { var io = new IntersectionObserver(function(entries){ entries.forEach(function(entry){ setInView(entry.isIntersecting); }); }, { threshold: [0, 0.01], rootMargin: '0px 0px -30% 0px' }); io.observe(rootEl); } catch(e) { /* fallback to scroll checks */ } } $(window).on('scroll.labdos resize.labdos orientationchange.labdos', recompute); setTimeout(recompute, 100); })(); // Force sticky search box on mobile with aggressive approach (function(){ console.log('Initializing sticky search box'); // Debug var $searchBox = $('#lab-dos .search-box'); var $searchWrapper = $('#lab-dos .search-wrapper'); console.log('Éléments trouvés :', $searchBox.length, $searchWrapper.length); // Débogage if (!$searchBox.length || !$searchWrapper.length) return; var stickyClone = null; var isStuck = false; function handleSticky() { var isMobile = window.innerWidth <= 991; if (!isMobile) { if (isStuck) unstickSearchBox(); return; } if (!document.body.classList.contains('labdos-inview')) { if (isStuck) unstickSearchBox(); return; } var searchRect = $searchBox[0].getBoundingClientRect(); var shouldStick = searchRect.top <= 60; console.log('Collé check:', { shouldStick, searchTop: searchRect.top, isStuck }); // Débogage si (shouldStick && !isStuck) { stickSearchBox(); } else if (!shouldStick && isStuck) { unstickSearchBox(); } } function stickSearchBox() { if (isStuck) return; isStuck = true; console.log('ACTIVATION de la zone de recherche fixe'); // Débogage // Créer une simple zone de recherche fixe de type ancre stickyClone = $(''); stickyClone.html(`
Appuyez pour rechercher des analyses de laboratoire...
`); stickyClone.css({ position: 'fixed', top: '60px', left: '15px', right: '15px', height: '50px', zIndex: '99999', backgroundColor: 'rgba(255, 255, 255, 0.95)', backdropFilter: 'blur(15px)', webkitBackdropFilter: 'blur(15px)', border: '1px solid rgba(255, 76, 136, 0.2)', boxShadow: '0 8px 32px rgba(255, 76, 136, 0.15)', borderRadius: '16px', cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#6a297a', fontSize: '16px', fontWeight: '500' }); // Au clic, faire défiler jusqu'à la recherche d'origine et mettre le focus sur stickyClone.on('click', function(){ $('html, body').animate({ scrollTop: Math.max(0, $searchBox.offset().top - 100) }, 400, function(){ $searchBox.find('#searchBox').focus(); }); }); $('body').append(stickyClone); // Ajouter un espaceur $searchWrapper.css('paddingTop', '70px'); } function unstickSearchBox() { if (!isStuck) return; isStuck = false; console.log('DÉSACTIVATION de la zone de recherche fixe'); // Débogage if (stickyClone) { stickyClone.remove(); stickyClone = null; } $searchWrapper.css('paddingTop', ''); } $(window).on('scroll.sticky resize.sticky orientationchange.sticky', handleSticky); setTimeout(handleSticky, 500); })(); // Initialiser la visibilité du bouton Effacer (×) au chargement de la page var $sb = $('#searchBox'); $sb.closest('.search-box').toggleClass('has-value', ($sb.val() || '').trim().length > 0); // Après 10 secondes, déplacer le formulaire Gravity Form (id=3) dans l'espace réservé et l'afficher. setTimeout(function() { var $placeholder = $('#gravityform-placeholder'); if (!$placeholder.length) return; var $gf = $('#gform_wrapper_3'); if (!$gf.length) { $gf = $('#gform_3').closest('.gform_wrapper'); } if (!$gf.length) { $gf = $('.gform_wrapper').filter(function(){ return $(this).find('#gform_3').length > 0; }).first(); } if ($gf.length) { $gf.hide(); $placeholder.append($gf); $gf.fadeIn(300); } }, 10000); // Chargement différé de l'API Google Maps uniquement lorsque l'utilisateur interagit avec le formulaire/la section (function(){ var mapsSrc = null; var mapsInjected = false; function captureAndRemoveMapsScript() { if (window.google && window.google.maps) { mapsInjected = true; // Déjà chargé return; } var $scripts = $('script[src*="maps.googleapis.com/maps/api/js"]'); if ($scripts.length) { mapsSrc = $scripts.eq(0).attr('src'); // Suppression de tous les scripts correspondants pour empêcher un chargement immédiat $scripts.remove(); } } function injectMapsScriptOnce() { if (mapsInjected) return; mapsInjected = true; if (!mapsSrc) return; var s = document.createElement('script'); s.src = mapsSrc; s.async = true; s.defer = true; document.head.appendChild(s); } // Tentative de capture des balises script dès que possible captureAndRemoveMapsScript(); // Chargement lors de l'interaction avec la section de paiement ou tout champ du formulaire var interactionEvents = 'click focus touchstart change'; $(document).on(interactionEvents, '#checkout-section, #gform_wrapper_3, #gform_3, #gravityform-placeholder', function(){ injectMapsScriptOnce(); }); // Chargement lorsque la section est proche de la fenêtre d'affichage if ('IntersectionObserver' in window) { var observer = new IntersectionObserver(function(entries){ entries.forEach(function(entry){ if (entry.isIntersecting) { injectMapsScriptOnce(); observer.disconnect(); } }); }, { rootMargin: '200px' }); var el = document.getElementById('checkout-section'); if (el) observer.observe(el); } })(); }); })(jQuery);