PageSourceSearch

https://www.istore.pt/cdn/shop/t/39/assets/map-page.js?v=103384211591196203711784730425

js istore.pt collected 2026-10-04 12:34:10 UTC 9,139 bytes, 14 lines download raw bytes

1function mapPage(){const config={dom:{map:"map",desktopMapWrapper:"desktopMapWrapper",mobileMapWrapper:"mobileMapWrapper",search:"search",results:"myLocationResults",result:".js-my-location-result",result_button:".js-make-my-store-btn",active_result:".js-my-location-result:first-child",acc_button:".js-acc-button",acc_icon:".js-acc-icon",acc_details:".js-acc-details",result_link:".js-my-location-link",result_details:".js-my-results-details"},cls:{active:"is-active"}},appleToken=SDG?.Data?.mapsToken||null,googleToken=SDG?.Data?.googleMapsToken||null,apiProvider=SDG?.Data?.mapProvider||null,$map=document.getElementById(config.dom.map)||null,$results=document.getElementById(config.dom.results),isAppleMaps=apiProvider==="apple_maps",isGoogleMaps=apiProvider==="google_maps",googleMarkers=[];let map=null;function init(){isAppleMaps&&appleToken&&$map&&initAppleMaps(),isGoogleMaps&&googleToken&&$map&&initGoogleMaps(),$results&&(checkIfMapShouldBeMoved(),addEvents())}function initGoogleMaps(){async function initMap(){const{Map}=await google.maps.importLibrary("maps");map=new Map(document.getElementById("map"),{zoom:4}),new google.maps.Geocoder().geocode({address:SDG.Data.shopCountry},(results,status)=>{status==google.maps.GeocoderStatus.OK&&map.setCenter(results[0].geometry.location)})}initMap()}function initAppleMaps(){mapkit&&(map=new mapkit.Map(config.dom.map),map&&(map.cameraDistance=750,map._allowWheelToZoom=!0))}function showLocation($location){if($location){const{id}=$location.dataset||null;if(isAppleMaps){const pin=map.annotations.find(annotation=>annotation.data.id===id);pin&&(map.showItems([pin],{padding:new mapkit.Padding(50,50,50,50)}),map.cameraDistance=750)}if(isGoogleMaps){const markerData=googleMarkers.find(marker=>marker.id===id);markerData&&(map.panTo(markerData.marker.getPosition()),map.setZoom(18))}}}function addEvents(){function openAcc(el){el.setAttribute("aria-expanded",!0),el.classList.add(config.cls.active)}function closeAcc(el){el.setAttribute("aria-expanded",!1),el.classList.remove(config.cls.active)}new MutationObserver(mutations=>{mutations.forEach(mutation=>{if(mutation?.type==="childList"){const $resultLocations=document.querySelectorAll(config.dom.result)||null,$activeResult=document.querySelector(config.dom.active_result)||null;if(mutation?.addedNodes?.length<=0)return;$resultLocations?.length>0&&[...$resultLocations].forEach($resultLocation=>{if($resultLocation.getAttribute("data-events-added")||!1)return;addPin($resultLocation),$resultLocation.setAttribute("data-events-added",!0);const $accButton=$resultLocation.querySelector(config.dom.acc_button)||null,$accIcon=$resultLocation.querySelector(config.dom.acc_icon)||null,$accDetails=$resultLocation.querySelector(config.dom.acc_details)||null;$resultLocation.addEventListener("click",e=>{const $target=e.currentTarget||null;showLocation($target)}
1),$accButton&&$accDetails&&$accButton.addEventListener("click",()=>{$accDetails.classList.contains(config.cls.active)?(closeAcc($accDetails),$accIcon&&closeAcc($accIcon)):(openAcc($accDetails),$accIcon&&openAcc($accIcon)),$accButton.setAttribute("data-acc",!0)})}),$activeResult&&showLocation($activeResult)}})}).observe($results,{childList:!0}),window.addEventListener("resize",()=>{checkIfMapShouldBeMoved()})}function checkIfMapShouldBeMoved(){const width=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,$desktopMapWrapper=document.getElementById(config.dom.desktopMapWrapper)||null,$mobileMapWrapper=document.getElementById(config.dom.mobileMapWrapper)||null,$map2=document.getElementById(config.dom.map);$map2&&(width<=767?$mobileMapWrapper.appendChild($map2):$desktopMapWrapper.appendChild($map2))}function addPinAndAnimate(latitude,longitude,name=""){if(!map||!latitude||!longitude)return;latitude=parseFloat(latitude),longitude=parseFloat(longitude);const $details=(document.querySelector(config.dom.active_result)||null)?.querySelector(config.dom.result_details)||null,$link=$details?.querySelector(config.dom.result_link)||null;if(isAppleMaps){const coordinate=new mapkit.Coordinate(latitude,longitude);let pin;if($details){const calloutDelegate={calloutElementForAnnotation:function(annotation){const $wrapper=document.createElement("div");return $wrapper.className="my-location-result__callout my-location-result__callout--apple",$wrapper.innerHTML=$details.innerHTML,$link&&($wrapper.innerHTML+=$link.innerHTML),$wrapper}};pin=new mapkit.MarkerAnnotation(coordinate,{title:`${name}`,callout:calloutDelegate})}else pin=new mapkit.MarkerAnnotation(coordinate,{title:`${name}`,callout:{enabled:!0,alignment:"center"}});map.annotations.forEach(annotation=>{map.removeAnnotation(annotation)}),map.addAnnotation(pin),map.showItems([pin],{animate:!0,padding:new mapkit.Padding(50,50,50,50)})}if(isGoogleMaps){const marker=new google.maps.Marker({position:{lat:latitude,lng:longitude},map,title:`${name}`}),infoWindow=new google.maps.InfoWindow({content:`${name}`,maxWidth:300});if($details){const businessDetailsCallout=`
2          <div class="my-location-result__callout">
3            ${$details.innerHTML}
4            ${$link?$link.innerHTML:""}
5          </div>
6        `;marker.addListener("click",()=>{infoWindow.setContent(businessDetailsCallout),infoWindow.open(map,marker)})}else marker.addListener("click",()=>{infoWindow.open(map,marker)});map.setZoom(18),map.panTo(marker.getPosition())}}function addPin($result){if(!$result?.dataset||!map)return;const{id,latitude:latitudeString,longitude:longitudeString,name,active}=$result.dataset,latitude=parseFloat(latitudeString),longitude=parseFloat(longitudeString),$details=$result?.querySelector(config.dom.result_details)||null,$link=$details?.querySelector(config.dom.result_link)||null,factory=function(){const div=document.createElement("div");div.className="cd-annotation default_icon_color";const iconshow=div.appendChild(document.createElement("i")),activeClass=active==="true"?" active":"";return iconshow.className=`fa fa-location-dot${activeClass}`,div},options={data:{id,title:`${name}`}};if(isAppleMaps){const coordinate=new mapkit.Coordinate(latitude,longitude);let pin;if($details){const calloutDelegate={calloutElementForAnnotation:()=>{const $wrapper=document.createElement("div");return $wrapper.className="my-location-result__callout my-location-result__callout--apple",$wrapper.innerHTML=$details.innerHTML,$link&&($wrapper.innerHTML+=$link.innerHTML),$wrapper}};options.callout=calloutDelegate,pin=new mapkit.Annotation(coordinate,factory,options)}else options.callout={enabled:!0,alignment:"center"},pin=new mapkit.Annotation(coordinate,factory,options);map.annotations.forEach(annotation=>{annotation.data.id===id&&map.removeAnnotation(annotation)}),map.addAnnotation(pin)}if(isGoogleMaps){const icon="data:image/svg+xml;charset=UTF-8;base64,"+btoa(`<svg xmlns="http://www.w3.org/2000/svg" width="30" height="40" viewBox="0 0 15 20" fill="none">
7          <path fill="${active==="true"?"#0071e3":"#1D1D1F"}" fill-rule="evenodd" clip-rule="evenodd" d="M7.95601 0.343032C9.74513 0.43
76043 11.4364 1.18848 12.7034 2.45513C13.8786 3.63038 14.6141 5.17388 14.7867 6.82694C14.9592 8.48 14.5583 10.1421 13.6511 11.5348L8.61319 19.2686C8.50108 19.4407 8.34779 19.5821 8.16722 19.68C7.98665 19.7779 7.78451 19.8291 7.57912 19.8291C7.37373 19.8291 7.17159 19.7779 6.99102 19.68C6.81046 19.5821 6.65717 19.4407 6.54506 19.2686L1.50727 11.5348C0.529579 10.0335 0.142632 8.22332 0.421112 6.45356C0.699591 4.6838 1.62376 3.07992 3.01524 1.95148C4.40672 0.823033 6.16688 0.250021 7.95601 0.343032ZM6.09693 5.366C6.53546 5.07298 7.05103 4.91658 7.57845 4.91658C8.28545 4.91739 8.96326 5.1986 9.46318 5.69852C9.9631 6.19844 10.2443 6.87625 10.2451 7.58325C10.2451 8.11067 10.0887 8.62624 9.7957 9.06477C9.50269 9.5033 9.08621 9.8451 8.59894 10.0469C8.11167 10.2488 7.57549 10.3016 7.05821 10.1987C6.54093 10.0958 6.06577 9.84181 5.69283 9.46887C5.31989 9.09593 5.06592 8.62077 4.96302 8.10349C4.86013 7.58621 4.91294 7.05003 5.11477 6.56276C5.31661 6.07549 5.6584 5.65902 6.09693 5.366ZM6.80207 6.54574C6.75654 6.56936 6.72618 6.58614 6.72023 6.59004C6.71372 6.59429 6.73632 6.58319 6.80003 6.54886C6.80071 6.54782 6.80139 6.54678 6.80207 6.54574ZM8.08869 6.35141C8.14343 6.37409 8.12507 6.37215 8.06535 6.35802C8.07319 6.35573 8.08097 6.35353 8.08869 6.35141Z"/>
8        </svg>`),marker=new google.maps.Marker({position:{lat:latitude,lng:longitude},map,title:name,icon}),infoWindow=new google.maps.InfoWindow({content:`${name}`,maxWidth:300});if($details){const businessDetailsCallout=`
9          <div class="my-location-result__callout">
10            ${$details.innerHTML}
11            ${$link?$link.innerHTML:""}
12          </div>
13        `;marker.addListener("click",()=>{infoWindow.setContent(businessDetailsCallout),infoWindow.open(map,marker)})}else marker.addListener("click",()=>{infoWindow.open(map,marker)});googleMarkers.forEach(googleMarker=>{googleMarker.id===id&&googleMarker.marker.setMap(null)}),googleMarkers.push({infoWindow,marker,id})}}return init()}mapPage();
14//# sourceMappingURL=/cdn/shop/t/39/assets/map-page.js.map?v=103384211591196203711784730425

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.