PageSourceSearch

https://lovenspa.fr/cdn/shop/t/129/assets/loven-collection-mobile.js?v=84758100147599986231790099332

js lovenspa.fr collected 2026-10-06 10:27:00 UTC 9,454 bytes, 2 lines download raw bytes

1(function(){"use strict";var SNAP={COLLAPSED:0,DEFAULT:1,EXPANDED:2},currentSnap=SNAP.DEFAULT,sheetDragging=!1,sheetDragMoved=!1,sheetDragState=null;function clearMobileGridViewportFilter(){typeof window.LovenClearMapViewportGridFilter=="function"&&window.LovenClearMapViewportGridFilter()}function invalidateMap(){var m=window.__lovenCollectionLeafletMap;if(typeof window.LovenInvalidateCollectionMapLayout=="function"){window.LovenInvalidateCollectionMapLayout(m);return}if(m&&typeof m.invalidateSize=="function")try{m.invalidateSize({animate:!1})}catch(e){}}function scheduleMapFix(){clearMobileGridViewportFilter(),invalidateMap(),setTimeout(function(){clearMobileGridViewportFilter(),invalidateMap()},120),setTimeout(function(){clearMobileGridViewportFilter(),invalidateMap()},400)}function isMapMobile(){var root=document.getElementById("CollectionAjaxResult");try{return root&&root.classList.contains("loven-collection-map-mobile")&&window.matchMedia("(max-width: 768px)").matches}catch(e){return!1}}function getRoot(){return document.getElementById("CollectionAjaxResult")}function readMapTopPx(){var root=getRoot();if(!root)return 120;var v=parseInt(getComputedStyle(root).getPropertyValue("--loven-mobile-map-top")||"120",10);return isNaN(v)?120:v}function getAvailableHeight(){var vh=window.visualViewport&&window.visualViewport.height||window.innerHeight||600;return Math.max(160,vh-readMapTopPx())}function measurePeekHeight(){var chrome=document.getElementById("loven-rooms-sheet-chrome");
1if(!chrome)return 96;var h=Math.ceil(chrome.getBoundingClientRect().height);return h>48?h:96}function getSnapHeights(){var avail=getAvailableHeight(),peek=measurePeekHeight();return{collapsed:peek,default:Math.round(Math.max(peek+80,avail*.42)),expanded:Math.round(Math.max(peek+120,avail*.92))}}function readCurrentSheetHeight(){var root=getRoot();if(!root)return getSnapHeights().default;var raw=getComputedStyle(root).getPropertyValue("--loven-rooms-sheet-height"),n=parseInt(String(raw).replace("px",""),10);return!isNaN(n)&&n>0?n:getSnapHeights().default}function setSheetHeightPx(h,withTransition){var root=getRoot(),sheet=document.getElementById("loven-rooms-sheet-root");if(!(!root||!sheet)){var avail=getAvailableHeight(),peek=measurePeekHeight(),maxH=Math.round(avail*.95);h=Math.max(peek,Math.min(maxH,Math.round(h)));var overlap=20,mapH=Math.max(120,avail-h+overlap);root.style.setProperty("--loven-rooms-sheet-height",h+"px"),root.style.setProperty("--loven-mobile-map-height",mapH+"px"),sheet.style.height=h+"px",withTransition===!1&&(root.classList.add("loven-rooms-sheet--no-transition"),requestAnimationFrame(function(){root.classList.remove("loven-rooms-sheet--no-transition")})),scheduleMapFix()}}var sheetSnapBeforePreview=null;window.LovenRoomsSheetCollapseForMapPreview=function(){if(isMapMobile()){sheetSnapBeforePreview=currentSnap,applySnapState(SNAP.COLLAPSED,!0);var root=getRoot();root&&root.classList.add("loven-map-pin-preview-open")}},window.LovenRoomsSheetRestoreAfterMapPreview=function(){if(isMapMobile()){var root=getRoot();root&&root.classList.remove("loven-map-pin-preview-open"),applySnapState(sheetSnapBeforePreview!=null?sheetSnapBeforePreview:SNAP.DEFAULT,!0),sheetSnapBeforePreview=null}};function applySnapState(snap,withTransition){if(isMapMobile()){var root=getRoot();if(root){var heights=getSnapHeights(),h=snap===SNAP.COLLAPSED?heights.collapsed:snap===SNAP.EXPANDED?heights.expanded:heights.default;currentSnap=snap,root.classList.remove("loven-rooms-sheet--collapsed","loven-rooms-sheet--default","loven-rooms-sheet--expanded"),snap===SNAP.COLLAPSED?root.classList.add("loven-rooms-sheet--collapsed"):snap===SNAP.EXPANDED?root.classList.add("loven-rooms-sheet--expanded"):root.classList.add("loven-rooms-sheet--default");var btn=document.getElementById("loven-rooms-sheet-scroll-cta");btn&&btn.setAttribute("aria-expanded",snap===SNAP.EXPANDED?"true":"false"),clearMobileGridViewportFilter(),setSheetHeightPx(h,withTransition)}}}function snapFromHeight(h){var s=getSnapHeights(),d1=Math.abs(h-s.collapsed),d2=Math.abs(h-s.default),d3=Math.abs(h-s.expanded);return d1<=d2&&d1<=d3?SNAP.COLLAPSED:d3<d2?SNAP.EXPANDED:SNAP.DEFAULT}function teardownRoomsSheet(){var root=getRoot(),chrome=document.getElementById("loven-rooms-sheet-chrome");
1if(chrome&&chrome.removeAttribute("data-loven-sheet-init"),!!root){root.classList.remove("loven-rooms-sheet--interactive","loven-rooms-sheet--collapsed","loven-rooms-sheet--default","loven-rooms-sheet--expanded","loven-rooms-sheet--dragging","loven-rooms-sheet--no-transition"),root.style.removeProperty("--loven-rooms-sheet-height");var sheet=document.getElementById("loven-rooms-sheet-root");sheet&&sheet.style.removeProperty("height"),setMobileMapHeight()}}function canStartSheetDrag(e){var chrome=document.getElementById("loven-rooms-sheet-chrome"),body=document.getElementById("loven-rooms-sheet-body");return chrome&&chrome.contains(e.target)?!0:!(!body||!body.contains(e.target)||body.scrollTop>2||e.target.closest('a, button, input, textarea, select, [role="button"], .grid-product__link'))}function bindSheetDragListeners(){document.addEventListener("pointermove",onSheetPointerMove),document.addEventListener("pointerup",onSheetPointerUp),document.addEventListener("pointercancel",onSheetPointerUp)}function unbindSheetDragListeners(){document.removeEventListener("pointermove",onSheetPointerMove),document.removeEventListener("pointerup",onSheetPointerUp),document.removeEventListener("pointercancel",onSheetPointerUp)}function onSheetPointerDown(e){if(isMapMobile()&&canStartSheetDrag(e)&&!(e.button!=null&&e.button!==0)){sheetDragMoved=!1,sheetDragging=!0,sheetDragState={startY:e.clientY,startH:readCurrentSheetHeight(),pointerId:e.pointerId,fromChrome:!!(e.target.closest&&e.target.closest("#loven-rooms-sheet-chrome"))};var root=getRoot();root&&root.classList.add("loven-rooms-sheet--dragging"),bindSheetDragListeners(),e.preventDefault()}}function onSheetPointerMove(e){if(!(!sheetDragging||!sheetDragState||e.pointerId!==sheetDragState.pointerId)){var dy=sheetDragState.startY-e.clientY;Math.abs(dy)>6&&(sheetDragMoved=!0),setSheetHeightPx(sheetDragState.startH+dy,!1),e.preventDefault()}}function onSheetPointerUp(e){if(!(!sheetDragging||!sheetDragState||e.pointerId!==sheetDragState.pointerId)){unbindSheetDragListeners();var root=getRoot();root&&root.classList.remove("loven-rooms-sheet--dragging"),sheetDragMoved?applySnapState(snapFromHeight(readCurrentSheetHeight()),!0):sheetDragState.fromChrome&&onSheetTap(),sheetDragging=!1,sheetDragState=null}}function onSheetTap(){currentSnap===SNAP.COLLAPSED?applySnapState(SNAP.DEFAULT,!0):currentSnap===SNAP.DEFAULT?applySnapState(SNAP.EXPANDED,!0):applySnapState(SNAP.DEFAULT,!0)}function initRoomsSheet(){if(!isMapMobile()){teardownRoomsSheet();return}var root=getRoot(),chrome=document.getElementById("loven-rooms-sheet-chrome"),sheet=document.getElementById("loven-rooms-sheet-root");if(!(!root||!chrome||!sheet)){if(chrome.getAttribute("data-loven-sheet-init")==="1"){applySnapState(currentSnap,!1);return}chrome.setAttribute("data-loven-sheet-init","1"),root.classList.add("loven-rooms-sheet--interactive"),chrome.addEventListener("pointerdown",onSheetPointerDown);var body=document.getElementById("loven-rooms-sheet-body");body&&body.addEventListener("pointerdown",onSheetPointerDown),applySnapState(currentSnap,!1)}}function setMobileMapHeight(){var root=getRoot();if(!(!root||!root.classList.contains("loven-collection-map-mobile"))){if(!window.matchMedia("(max-width: 768px)").matches){root.style.removeProperty("--loven-mobile-map-height");return}if(root.classList.contains("loven-rooms-sheet--interactive")){applySnapState(currentSnap,!1);return}var vh=window.visualViewport&&window.visualViewport.height||window.innerHeight||600,h=Math.round(Math.min(Math.max(vh*.38,216),Math.min(460,vh*.46)));root.style.setProperty("--loven-mobile-map-height",h+"px")}}function measureSearchStack(){var root=getRoot();if(!(!root||!root.classList.contains("loven-collection-map-mobile"))&&window.matchMedia("(max-width: 768px)").matches){var avail=document.getElementById("avail-search");if(!(avail&&avail.classList.contains("loven-mobile-search-open"))){var bar=root.querySelector(".collection-search-bar");if(bar){var h=Math.ceil(bar.getBoundingClientRect().height);root.style.setProperty("--loven-collection-search-stack",h+"px"),root.style.setProperty("--loven-mobile-map-top",h+"px"),setMobileMapHeight(),scheduleMapFix(),initRoomsSheet()}}}}function debounce(fn,ms){var t;return function(){clearTimeout(t),t=setTimeout(fn,ms)}}
1function init(){setMobileMapHeight(),measureSearchStack(),window.LovenMeasureCollectionSearchStack=measureSearchStack,requestAnimationFrame(function(){requestAnimationFrame(measureSearchStack)}),scheduleMapFix(),window.addEventListener("resize",debounce(function(){window.matchMedia("(max-width: 768px)").matches||teardownRoomsSheet(),measureSearchStack(),window.matchMedia("(max-width: 768px)").matches&&scheduleMapFix()},150)),window.visualViewport&&window.visualViewport.addEventListener("resize",debounce(function(){setMobileMapHeight(),measureSearchStack(),scheduleMapFix()},120))}document.addEventListener("DOMContentLoaded",init),document.addEventListener("collection:reloaded",function(){setMobileMapHeight(),measureSearchStack(),scheduleMapFix()})})();
2//# sourceMappingURL=/cdn/shop/t/129/assets/loven-collection-mobile.js.map?v=84758100147599986231790099332

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.