PageSourceSearch

https://educazoo.com/js/min/js_sw-localisation.min.js?1784205407

js educazoo.com collected 2026-10-04 12:57:52 UTC 1,768 bytes, 7 lines download raw bytes

1$(document).ready(function(){function getDistance(lat1,lon1,lat2,lon2){const R=6371;const dLat=(lat2-lat1)*Math.PI/180;const dLon=(lon2-lon1)*Math.PI/180;const a=Math.sin(dLat/2)*Math.sin(dLat/2)+
2Math.cos(lat1*Math.PI/180)*Math.cos(lat2*Math.PI/180)*Math.sin(dLon/2)*Math.sin(dLon/2);return R*2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));}
3function findClosestWarehouse(userLat,userLon){let closest=null;let minDistance=Infinity;$('.js-warehouse').each(function(){const lat=parseFloat($(this).data('lat'));const lon=parseFloat($(this).data('lon'));const warehouseId=$(this).data('warehouse');if(!lat||!lon)return;const distance=getDistance(userLat,userLon,lat,lon);if(distance<minDistance){minDistance=distance;closest=warehouseId;}});if(closest!==null){$('[data-warehouse]').removeClass('current');$('[data-warehouse="'+closest+'"]').addClass('current');}}
4const regionCache={};function geocodeRegion(regionName,callback){if(regionCache[regionName]){callback(regionCache[regionName]);return;}
5fetch(`https://nominatim.openstreetmap.org/search?q=${encodeURIComponent(regionName + ', Canada')}&format=json&limit=1&countrycodes=ca`).then(res=>res.json()).then(data=>{if(data&&data.length>0){const coords={lat:parseFloat(data[0].lat),lon:parseFloat(data[0].lon)};regionCache[regionName]=coords;callback(coords);}else{console.warn('Région introuvable :',regionName);}}).catch(err=>console.error('Erreur géocodage:',err));}
6$('body').on('click.sw','.js-localisation',function(e){e.preventDefault();const $selectedOption=$('#IdCity option:selected');const regionName=$selectedOption.text().trim();if(!$selectedOption.val()){console.warn('Aucune région sélectionnée');return;}
7geocodeRegion(regionName,function(coords){findClosestWarehouse(coords.lat,coords.lon);});});});

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.