PageSourceSearch

https://www.group-digital.fr/Assets/271999/Theme/Project/Generic/js/store.js

js group-digital.fr collected 2026-10-06 13:58:57 UTC 7,203 bytes, 15 lines download raw bytes

1(function(){var app=angular.module("RbsChangeApp");app.controller('RbsStorelocatorGoogleSearchOverride',['$scope','$element','$attrs','$compile','RbsChange.AjaxAPI','RbsGeo.GoogleMapService','$timeout','$controller',function(scope,elem,attrs,$compile,AjaxAPI,GoogleMapService,$timeout,$controller){angular.extend(this,$controller('RbsBaseStorelocatorSearch',{$scope:scope,$element:elem,$attrs:attrs}));var controller=this;var controllerInit=scope.blockData;var parameters=angular.copy(scope.blockParameters);function shuffleArray(array){for(let i=array.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1));const temp=array[i];array[i]=array[j];array[j]=temp;}
2return array;}
3function setMarkers(stores,viewCenter){if(scope.markers){for(var i=0;i<scope.markers.length;i++){scope.markers[i].setMap(null);}}
4scope.markers=[];if(stores.length){var mapOptions={center:new scope.maps.LatLng(viewCenter[0],viewCenter[1]),zoom:11,minZoom:7,maxZoom:15};scope.map=new scope.maps.Map(document.getElementById('map-'+scope.blockId),mapOptions);scope.bounds=new scope.maps.LatLngBounds();scope.bounds.extend(new scope.maps.LatLng(viewCenter[0],viewCenter[1]));angular.forEach(stores,function(store){var latLng=new scope.maps.LatLng(store.coordinates.latitude,store.coordinates.longitude);var markerOptions={position:latLng,map:scope.map};var markerImg=store.coordinates.marker;if(markerImg&&(!controllerInit.markerIcon||(markerImg.id!==controllerInit.markerIcon.id))){markerOptions.icon={url:markerImg.original,size:new scope.maps.Size(markerImg.size[0],markerImg.size[1]),origin:new scope.maps.Point(0,0),anchor:new scope.maps.Point(markerImg.size[0]/2,markerImg.size[1])}}
5else if(scope.markerIcon){markerOptions.icon=scope.markerIcon;}
6var marker=new scope.maps.Marker(markerOptions);scope.markers.push(marker);scope.bounds.extend(latLng);store.coordinates.openPopup=function(){if(scope.infoWindow){scope.infoWindow.close();scope.popupStore=null;}
7var html='<div data-rbs-storelocator-store-popup=""></div>';scope.infoWindow=new scope.maps.InfoWindow({content:$compile(html)(scope)[0]});scope.maps.event.addListener(scope.infoWindow,'domready',function(){scope.popupStore=store;scope.$digest();});scope.infoWindow.open(scope.map,marker);};scope.maps.event.addListener(marker,'click',function(){store.coordinates.openPopup();});});scope.map.fitBounds(scope.bounds);}}
8scope.search=function(){var coordinates=null;if(scope.myCoordinates){coordinates=scope.myCoordinates;}
9else if(scope.addressCoordinates){coordinates=scope.addressCoordinates;}
10if(coordinates){if(scope.map){scope.map.setCenter(new scope.maps.LatLng(coordinates.latitude,coordinates.longitude));}
11scope.addressLoading=true;controller.search({coordinates:coordinates,distance:scope.distance||(scope.searchR
11adius+scope.searchRadiusUnit),commercialSign:scope.commercialSignId?scope.commercialSignId:0}).then(function(result){if(!$('.modal-store-select.in').length){let tempItems=result.data.items;let tempItemsAllow=[];let tempItemsDisallow=[];let finalResult=[];angular.forEach(tempItems,function(item){if(item.allow.allowPickUp||item.allow.allowReservation){tempItemsAllow.push(item);}else{tempItemsDisallow.push(item);}});tempItemsDisallow=shuffleArray(tempItemsDisallow);finalResult=tempItemsAllow.concat(tempItemsDisallow)
12result.data.items=finalResult;}
13controller.handleSearchResults(result,coordinates).then(function(){setMarkers(scope.stores,[coordinates.latitude,coordinates.longitude])});},function(result){scope.addressLoading=false;scope.stores=[];console.error('Search store',result);});}};scope.viewStoreOnMap=function(storeIndex){var store=scope.stores[storeIndex];var latLng=new scope.maps.LatLng(store.coordinates.latitude,store.coordinates.longitude);scope.map.setCenter(latLng);scope.map.setZoom(15);store.coordinates.openPopup();};scope.selectLoadedAddress=function(){var place=scope.autocomplete.getPlace();if(!place.geometry){return;}
14scope.error=null;scope.myCoordinates=null;scope.filteredAddress=null;var location=place.geometry.location;scope.addressCoordinates={latitude:location.lat(),longitude:location.lng()};scope.formattedAddress=place.formatted_address;
14scope.distance=scope.searchRadius+scope.searchRadiusUnit;scope.search();};GoogleMapService.maps().then(function(maps){scope.maps=maps;var controllerInit=scope.blockData||{};if(controllerInit.markerIcon){scope.markerIconUrl=controllerInit.markerIcon.original;scope.markerIcon={url:scope.markerIconUrl,size:new maps.Size(controllerInit.markerIcon.size[0],controllerInit.markerIcon.size[1]),origin:new maps.Point(0,0),anchor:new maps.Point(controllerInit.markerIcon.size[0]/2,controllerInit.markerIcon.size[1])}}
15scope.autocomplete=new maps.places.Autocomplete((document.getElementById(scope.blockId+'_autocomplete')),{types:['geocode']});maps.event.addListener(scope.autocomplete,'place_changed',function(){scope.searchAddress=true;scope.selectLoadedAddress();});var initialStoresData=controller.getInitialStoresData();if(angular.isArray(initialStoresData)){let tempItems=initialStoresData;let tempItemsAllow=[];let tempItemsDisallow=[];angular.forEach(tempItems,function(item){if(item.allow.allowPickUp||item.allow.allowReservation){tempItemsAllow.push(item);}else{tempItemsDisallow.push(item);}});tempItemsDisallow=shuffleArray(tempItemsDisallow);finalResult=tempItemsAllow.concat(tempItemsDisallow);scope.stores=finalResult;scope.filteredAddress=controllerInit.facetValueTitle;if(scope.stores.length){$timeout(function(){parameters.filteredAddress=scope.filteredAddress;parameters.showHome=false;controller.reloadBlock(parameters).then(function(){var bounds=new maps.LatLngBounds();angular.forEach(initialStoresData,function(store){bounds.extend(new maps.LatLng(store.coordinates.latitude,store.coordinates.longitude));});var center=bounds.getCenter();setMarkers(scope.stores,[center.lat(),center.lng()]);scope.map.fitBounds(bounds);});});}}});}]);app.directive("projectSetAddressGoogle",["RbsChange.AjaxAPI",'$timeout',"RbsGeo.GoogleMapService",projectSetAddressGoogle,]);function projectSetAddressGoogle(AjaxAPI,$timeout,GoogleMapService){return{restrict:"A",link:function(scope,elem,attrs){GoogleMapService.maps().then(function(maps){scope.maps2=maps;scope.autocomplete=new maps.places.Autocomplete(document.getElementById(scope.blockId+'_autocomplete2'),{types:["geocode"],componentRestrictions:{country:['fr','re','gp','mq','mc']}});maps.event.addListener(scope.autocomplete,"place_changed",function(){var place=scope.autocomplete.getPlace();var data={coordinates:{longitude:place.geometry.location.lng(),latitude:place.geometry.location.lat()},addr:place.address_components,webStoreId:scope.parameters?.webStoreId,};scope.selectLoadedAddress();});});scope.defaultAddress=function(){var place=scope.blockData.userAddressCoordinates;var data={coordinates:{longitude:place.longitude,latitude:place.latitude},addr:place.address_components,webStoreId:scope.parameters.webStoreId,};scope.error=null;scope.myCoordinates=null;scope.filteredAddress=null;var location=place.geometry.location;scope.addressCoordinates=data.coordinates;scope.formattedAddress=place.formatted_address;
15scope.distance=scope.searchRadius+scope.searchRadiusUnit;scope.search();};}}}})();

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.