From 26b334173990223d4a2b810613b30f5f96bb6e56 Mon Sep 17 00:00:00 2001 From: Kiran Prajapati Date: Fri, 16 Feb 2024 19:48:03 +0530 Subject: [PATCH] OSM directions route should use listing location as an end point - CHANGED --- assets/leaflet/routing/leaflet-routing-machine.js | 10 +++++++--- assets/leaflet/routing/leaflet-routing-machine.min.js | 2 +- readme.txt | 3 +++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/assets/leaflet/routing/leaflet-routing-machine.js b/assets/leaflet/routing/leaflet-routing-machine.js index 675f6069..30570882 100644 --- a/assets/leaflet/routing/leaflet-routing-machine.js +++ b/assets/leaflet/routing/leaflet-routing-machine.js @@ -2235,9 +2235,13 @@ if (!this._waypoints[i].latLng) return false; return true }, - getWaypoints: function() { - var i, wps = []; - for (i = 0; i < this._waypoints.length; i++) wps.push(this._waypoints[i]); + getWaypoints: function() {/* CHANGE: Switch inttial to destination */ + var i, wps = [], gdReverse = 0; + for (i = 0; i < this._waypoints.length; i++) { + wps.push(this._waypoints[i]); + if (i > 0 && this._waypoints[i].latLng) gdReverse++; + } + if (gdReverse > 0) wps.reverse(); return wps }, setWaypoints: function(waypoints) { diff --git a/assets/leaflet/routing/leaflet-routing-machine.min.js b/assets/leaflet/routing/leaflet-routing-machine.min.js index 3c581aa7..edd01255 100644 --- a/assets/leaflet/routing/leaflet-routing-machine.min.js +++ b/assets/leaflet/routing/leaflet-routing-machine.min.js @@ -1 +1 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined")module.exports=f();else if(typeof define==="function"&&define.amd)define([],f);else{var g;if(typeof window!=="undefined")g=window;else if(typeof global!=="undefined")g=global;else if(typeof self!=="undefined")g=self;else g=this;(g.L||(g.L={})).Routing=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o=200&&status<300||status===304}if(cors&&!("withCredentials"in x)){x=new window.XDomainRequest;var original=callback;callback=function(){if(sent)original.apply(this,arguments);else{var that=this,args=arguments;setTimeout(function(){original.apply(that,args)},0)}}}function loaded(){if(x.status===undefined||isSuccessful(x.status))callback.call(x,null,x);else callback.call(x,x,null)}if("onload"in x)x.onload=loaded;else x.onreadystatechange=function readystate(){if(x.readyState===4)loaded()};x.onerror=function error(evt){callback.call(this,evt||true,null);callback=function(){}};x.onprogress=function(){};x.ontimeout=function(evt){callback.call(this,evt,null);callback=function(){}};x.onabort=function(evt){callback.call(this,evt,null);callback=function(){}};x.open("GET",url,true);x.send(null);sent=true;return x}if(typeof module!=="undefined")module.exports=corslite},{}],2:[function(require,module,exports){var polyline={};function encode(coordinate,factor){coordinate=Math.round(coordinate*factor);coordinate<<=1;if(coordinate<0)coordinate=~coordinate;var output="";while(coordinate>=32){output+=String.fromCharCode((32|coordinate&31)+63);coordinate>>=5}output+=String.fromCharCode(coordinate+63);return output}polyline.decode=function(str,precision){var index=0,lat=0,lng=0,coordinates=[],shift=0,result=0,byte=null,latitude_change,longitude_change,factor=Math.pow(10,precision||5);while(index=32);latitude_change=result&1?~(result>>1):result>>1;shift=result=0;do{byte=str.charCodeAt(index++)-63;result|=(byte&31)<=32);longitude_change=result&1?~(result>>1):result>>1;lat+=latitude_change;lng+=longitude_change;coordinates.push([lat/factor,lng/factor])}return coordinates};polyline.encode=function(coordinates,precision){if(!coordinates.length)return"";var factor=Math.pow(10,precision||5),output=encode(coordinates[0][0],factor)+encode(coordinates[0][1],factor);for(var i=1;i0)this._select(1)},_createClickListener:function(r){var resultSelected=this._resultSelected(r);return L.bind(function(){this._elem.blur();resultSelected()},this)},_resultSelected:function(r){return L.bind(function(){this.close();this._elem.value=r.name;this._lastCompletedText=r.name;this._selectFn(r)},this)},_keyPressed:function(e){var index;if(this._isOpen&&e.keyCode===13&&this._selection){index=parseInt(this._selection.getAttribute("data-result-index"),10);this._resultSelected(this._results[index])();L.DomEvent.preventDefault(e);return}if(e.keyCode===13){this._complete(this._resultFn,true);return}if(this._autocomplete&&document.activeElement===this._elem){if(this._timer)clearTimeout(this._timer);this._timer=setTimeout(L.Util.bind(function(){this._complete(this._autocomplete)},this),this.options.timeout);return}this._unselect()},_select:function(dir){var sel=this._selection;if(sel){L.DomUtil.removeClass(sel.firstChild,"leaflet-routing-geocoder-selected");sel=sel[dir>0?"nextSibling":"previousSibling"]}if(!sel)sel=this._resultTable[dir>0?"firstChild":"lastChild"];if(sel){L.DomUtil.addClass(sel.firstChild,"leaflet-routing-geocoder-selected");this._selection=sel}},_unselect:function(){if(this._selection)L.DomUtil.removeClass(this._selection.firstChild,"leaflet-routing-geocoder-selected");delete this._selection},_keyDown:function(e){if(this._isOpen)switch(e.keyCode){case 27:this.close();L.DomEvent.preventDefault(e);return;case 38:this._select(-1);L.DomEvent.preventDefault(e);return;case 40:this._select(1);L.DomEvent.preventDefault(e);return}},_complete:function(completeFn,trySelect){var v=this._elem.value;function completeResults(results){this._lastCompletedText=v;if(!results)return;if(trySelect&&results.length===1)this._resultSelected(results[0])();else this._setResults(results)}if(!v)return;if(v!==this._lastCompletedText)completeFn(v,completeResults,this);else if(trySelect)completeResults.call(this,this._results)}})})()},{}],4:[function(require,module,exports){(function(global){(function(){var L=typeof window!=="undefined"?window.L:typeof global!=="undefined"?global.L:null;L.Routing=L.Routing||{};L.extend(L.Routing,require("./L.Routing.Itinerary"));L.extend(L.Routing,require("./L.Routing.Line"));L.extend(L.Routing,require("./L.Routing.Plan"));L.extend(L.Routing,require("./L.Routing.OSRMv1"));L.extend(L.Routing,require("./L.Routing.Mapbox"));L.extend(L.Routing,require("./L.Routing.ErrorControl"));L.Routing.Control=L.Routing.Itinerary.extend({options:{fitSelectedRoutes:"smart",routeLine:function(route,options){return L.Routing.line(route,options)},autoRoute:true,routeWhileDragging:false,routeDragInterval:500,waypointMode:"connect",showAlternatives:false,defaultErrorHandler:function(e){console.error("Routing error:",e.error)}},initialize:function(options){L.Util.setOptions(this,options);this._router=this.options.router||new L.Routing.OSRMv1(options);this._plan=this.options.plan||L.Routing.plan(this.options.waypoints,options);this._requestCount=0;L.Routing.Itinerary.prototype.initialize.call(this,options);this.on("routeselected",this._routeSelected,this);if(this.options.defaultErrorHandler)this.on("routingerror",this.options.defaultErrorHandler);this._plan.on("waypointschanged",this._onWaypointsChanged,this);if(options.routeWhileDragging)this._setupRouteDragging();if(this.options.autoRoute)this.route()},onAdd:function(map){if(!map)map=jQuery.goMap.map;var container=L.Routing.Itinerary.prototype.onAdd.call(this,map);this._map=map;this._map.on("zoomend",function(){if(!this._selectedRoute||!this._router.requiresMoreDetail)return;var map=this._map;if(this._router.requiresMoreDetail(this._selectedRoute,map.getZoom(),map.getBounds()))this.route({callback:L.bind(function(err,routes){var i;if(!err){for(i=0;imapSize.x/5||boundsSize.y>mapSize.y/5)&&this._waypointsInViewport()}catch(e){return false}},_waypointsInViewport:function(){var wps=this.getWaypoints(),mapBounds,i;try{mapBounds=this._map.getBounds()}catch(e){return false}for(i=0;i
"+error.message+"
=1e3)data={value:round(d/1609.344,sensitivity),unit:un.miles};else data={value:round(yards,sensitivity),unit:un.yards}}else{v=round(d,sensitivity);data={value:v>=1e3?v/1e3:v,unit:v>=1e3?un.kilometers:un.meters}}if(simpleRounding)data.value=data.value.toFixed(-sensitivity);return L.Util.template(this.options.distanceTemplate,data)},_round:function(d,sensitivity){var s=sensitivity||this.options.roundingSensitivity,pow10=Math.pow(10,(Math.floor(d/s)+"").length-1),r=Math.floor(d/pow10),p=r>5?pow10:pow10/2;return Math.round(d/p)*p},formatTime:function(t){var un=this.options.unitNames||this._localization.localize("units");t=Math.round(t/30)*30;if(t>86400)return Math.round(t/3600)+" "+un.hours;else if(t>3600)return Math.floor(t/3600)+" "+un.hours+" "+Math.round(t%3600/60)+" "+un.minutes;else if(t>300)return Math.round(t/60)+" "+un.minutes;else if(t>60)return Math.floor(t/60)+" "+un.minutes+(t%60!==0?" "+t%60+" "+un.seconds:"");else return t+" "+un.seconds},formatInstruction:function(instr,i){if(instr.text===undefined)return this.capitalize(L.Util.template(this._getInstructionTemplate(instr,i),L.extend({},instr,{exitStr:instr.exit?this._localization.localize("formatOrder")(instr.exit):"",dir:this._localization.localize(["directions",instr.direction]),modifier:this._localization.localize(["directions",instr.modifier])})));else return instr.text},getIconName:function(instr,i){switch(instr.type){case"Head":if(i===0)return"depart";break;case"WaypointReached":return"via";case"Roundabout":return"enter-roundabout";case"DestinationReached":return"arrive"}switch(instr.modifier){case"Straight":return"continue";case"SlightRight":return"bear-right";case"Right":return"turn-right";case"SharpRight":return"sharp-right";case"TurnAround":case"Uturn":return"u-turn";case"SharpLeft":return"sharp-left";case"Left":return"turn-left";case"SlightLeft":return"bear-left"}},capitalize:function(s){return s.charAt(0).toUpperCase()+s.substring(1)},_getInstructionTemplate:function(instr,i){var type=instr.type==="Straight"?i===0?"Head":"Continue":instr.type,strings=this._localization.localize(["instructions",type]);if(!strings)strings=[this._localization.localize(["directions",type])," "+this._localization.localize(["instructions","Onto"])];return strings[0]+(strings.length>1&&instr.road?strings[1]:"")}});module.exports=L.Routing})()}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./L.Routing.Localization":11}],7:[function(require,module,exports){(function(global){(function(){var L=typeof window!=="undefined"?window.L:typeof global!=="undefined"?global.L:null;L.Routing=L.Routing||{};L.extend(L.Routing,require("./L.Routing.Autocomplete"));function selectInputText(input){if(input.setSelectionRange)input.setSelectionRange(0,9999);else input.select()}L.Routing.GeocoderElement=L.Class.extend({includes:typeof L.Evented!=="undefined"&&L.Evented.prototype||L.Mixin.Events,options:{createGeocoder:function(i,nWps,options){var container=L.DomUtil.create("div","leaflet-routing-geocoder leaflet-routing-geocoder-"+i),input=L.DomUtil.create("input","",container),remove=options.addWaypoints?L.DomUtil.create("span","leaflet-routing-remove-waypoint",container):undefined;input.disabled=!options.addWaypoints;return{container:container,input:input,closeButton:remove}},geocoderPlaceholder:function(i,numberWaypoints,geocoderElement){var l=new L.Routing.Localization(geocoderElement.options.language).localize("ui");var startPlaceholder=typeof geodir_params!=="undefined"?geodir_params.osmStart:l.startPlaceholder;var viaPlaceholder=typeof geodir_params!=="undefined"?geodir_params.osmVia:l.viaPlaceholder;var endPlaceholder=typeof geodir_params!=="undefined"?geodir_params.osmEnd:l.endPlaceholder;return i===0?startPlaceholder:i0&&rs[0].center.distanceTo(wp.latLng){name}

{distance}, {time}

",timeTemplate:"{time}",containerClassName:"",alternativeClassName:"",minimizedClassName:"",itineraryClassName:"",totalDistanceRoundingSensitivity:-1,show:true,collapsible:true,collapseBtn:function(itinerary){var collapseBtn=L.DomUtil.create("span",itinerary.options.collapseBtnClass);L.DomEvent.on(collapseBtn,"click",itinerary._toggle,itinerary);itinerary._container.insertBefore(collapseBtn,itinerary._container.firstChild)},collapseBtnClass:"leaflet-routing-collapse-btn"},initialize:function(options){L.setOptions(this,options);this._formatter=this.options.formatter||new L.Routing.Formatter(this.options);this._itineraryBuilder=this.options.itineraryBuilder||new L.Routing.ItineraryBuilder({containerClassName:this.options.itineraryClassName})},onAdd:function(map){var collapsible=this.options.collapsible;collapsible=collapsible||collapsible===undefined&&map.getSize().x<=640;this._container=L.DomUtil.create("div","leaflet-routing-container leaflet-bar "+(!this.options.show?"leaflet-routing-container-hide ":"")+(collapsible?"leaflet-routing-collapsible ":"")+this.options.containerClassName);this._altContainer=this.createAlternativesContainer();this._container.appendChild(this._altContainer);L.DomEvent.disableClickPropagation(this._container);L.DomEvent.addListener(this._container,"mousewheel",function(e){L.DomEvent.stopPropagation(e)});if(collapsible)this.options.collapseBtn(this);return this._container},onRemove:function(){},createAlternativesContainer:function(){return L.DomUtil.create("div","leaflet-routing-alternatives-container")},setAlternatives:function(routes){var i,alt,altDiv;this._clearAlts();this._routes=routes;for(i=0;i0?" leaflet-routing-alt-minimized "+this.options.minimizedClassName:"")),template=this.options.summaryTemplate,data=L.extend({name:alt.name,distance:this._formatter.formatDistance(alt.summary.totalDistance,this.options.totalDistanceRoundingSensitivity),time:this._formatter.formatTime(alt.summary.totalTime)},alt);altDiv.innerHTML=typeof template==="function"?template(data):L.Util.template(template,data);L.DomEvent.addListener(altDiv,"click",this._onAltClicked,this);this.on("routeselected",this._selectAlt,this);altDiv.appendChild(this._createItineraryContainer(alt));return altDiv},_clearAlts:function(){var el=this._altContainer;while(el&&el.firstChild)el.removeChild(el.firstChild);this._altElements=[]},_createItineraryContainer:function(r){var container=this._itineraryBuilder.createContainer(),steps=this._itineraryBuilder.createStepsContainer(),i,instr,step,distance,text,icon;container.appendChild(steps);for(i=0;i=0;i--){d=latlng.distanceTo(this._route.coordinates[i]);if(dthis.options.missingRouteTolerance)this._addSegment([wpLatLng,routeCoord],this.options.missingRouteStyles)}},_addSegment:function(coords,styles,mouselistener){var i,pl;for(i=0;i=0&&wpIndices[j]>i)j--;return j},_onLineTouched:function(e){var afterIndex=this._findNearestWpBefore(this._findClosestRoutePoint(e.latlng));this.fire("linetouched",{afterIndex:afterIndex,latlng:e.latlng})},_getWaypointIndices:function(){if(!this._wpIndices)this._wpIndices=this._route.waypointIndices||this._findWaypointIndices();return this._wpIndices}});L.Routing.line=function(route,options){return new L.Routing.Line(route,options)};module.exports=L.Routing})()}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],11:[function(require,module,exports){(function(){L.Routing=L.Routing||{};L.Routing.Localization=L.Class.extend({initialize:function(langs){this._langs=L.Util.isArray(langs)?langs:[langs,"en"];for(var i=0,l=this._langs.length;i=20){return n+"ste"}else{return n+"de"}},ui:{startPlaceholder:"Vertrekpunt",viaPlaceholder:"Via {viaNumber}",endPlaceholder:"Bestemming"}},fr:{directions:{N:"nord",NE:"nord-est",E:"est",SE:"sud-est",S:"sud",SW:"sud-ouest",W:"ouest",NW:"nord-ouest"},instructions:{Head:["Tout droit au {dir}"," sur {road}"],Continue:["Continuer au {dir}"," sur {road}"],SlightRight:["Légèrement à droite"," sur {road}"],Right:["A droite"," sur {road}"],SharpRight:["Complètement à droite"," sur {road}"],TurnAround:["Faire demi-tour"],SharpLeft:["Complètement à gauche"," sur {road}"],Left:["A gauche"," sur {road}"],SlightLeft:["Légèrement à gauche"," sur {road}"],WaypointReached:["Point d'étape atteint"],Roundabout:["Au rond-point, prenez la {exitStr} sortie"," sur {road}"],DestinationReached:["Destination atteinte"]},formatOrder:function(n){return n+"º"},ui:{startPlaceholder:"Départ",viaPlaceholder:"Intermédiaire {viaNumber}",endPlaceholder:"Arrivée"}},it:{directions:{N:"nord",NE:"nord-est",E:"est",SE:"sud-est",S:"sud",SW:"sud-ovest",W:"ovest",NW:"nord-ovest"},instructions:{Head:["Dritto verso {dir}"," su {road}"],Continue:["Continuare verso {dir}"," su {road}"],SlightRight:["Mantenere la destra"," su {road}"],Right:["A destra"," su {road}"],SharpRight:["Strettamente a destra"," su {road}"],TurnAround:["Fare inversione di marcia"],SharpLeft:["Strettamente a sinistra"," su {road}"],Left:["A sinistra"," sur {road}"],SlightLeft:["Mantenere la sinistra"," su {road}"],WaypointReached:["Punto di passaggio raggiunto"],Roundabout:["Alla rotonda, prendere la {exitStr} uscita"],DestinationReached:["Destinazione raggiunta"]},formatOrder:function(n){return n+"º"},ui:{startPlaceholder:"Partenza",viaPlaceholder:"Intermedia {viaNumber}",endPlaceholder:"Destinazione"}},pt:{directions:{N:"norte",NE:"nordeste",E:"leste",SE:"sudeste",S:"sul",SW:"sudoeste",W:"oeste",NW:"noroeste",SlightRight:"curva ligeira a direita",Right:"direita",SharpRight:"curva fechada a direita",SlightLeft:"ligeira a esquerda",Left:"esquerda",SharpLeft:"curva fechada a esquerda",Uturn:"Meia volta"},instructions:{Head:["Siga {dir}"," na {road}"],Continue:["Continue {dir}"," na {road}"],SlightRight:["Curva ligeira a direita"," na {road}"],Right:["Curva a direita"," na {road}"],SharpRight:["Curva fechada a direita"," na {road}"],TurnAround:["Retorne"],SharpLeft:["Curva fechada a esquerda"," na {road}"],Left:["Curva a esquerda"," na {road}"],SlightLeft:["Curva ligueira a esquerda"," na {road}"],WaypointReached:["Ponto de interesse atingido"],Roundabout:["Pegue a {exitStr} saída na rotatória"," na {road}"],DestinationReached:["Destino atingido"],Fork:["Na encruzilhada, vire a {modifier}"," na {road}"],Merge:["Entre à {modifier}"," na {road}"],OnRamp:["Vire {modifier} na rampa"," na {road}"],OffRamp:["Entre na rampa na {modifier}"," na {road}"],EndOfRoad:["Vire {modifier} no fim da rua"," na {road}"],Onto:"na {road}"},formatOrder:function(n){return n+"º"},ui:{startPlaceholder:"Origem",viaPlaceholder:"Intermédio {viaNumber}",endPlaceholder:"Destino"}},sk:{directions:{N:"sever",NE:"serverovýchod",E:"východ",SE:"juhovýchod",S:"juh",SW:"juhozápad",W:"západ",NW:"serverozápad"},instructions:{Head:["Mierte na {dir}"," na {road}"],Continue:["Pokračujte na {dir}"," na {road}"],SlightRight:["Mierne doprava"," na {road}"],Right:["Doprava"," na {road}"],SharpRight:["Prudko doprava"," na {road}"],TurnAround:["Otočte sa"],SharpLeft:["Prudko doľava"," na {road}"],Left:["Doľava"," na {road}"],SlightLeft:["Mierne doľava"," na {road}"],WaypointReached:["Ste v prejazdovom bode."],Roundabout:["Odbočte na {exitStr} výjazde"," na {road}"],DestinationReached:["Prišli ste do cieľa."]},formatOrder:function(n){var i=n%10-1,suffix=[".",".","."];return suffix[i]?n+suffix[i]:n+"."},ui:{startPlaceholder:"Začiatok",viaPlaceholder:"Cez {viaNumber}",endPlaceholder:"Koniec"}},el:{directions:{N:"βόρεια",NE:"βορειοανατολικά",E:"ανατολικά",SE:"νοτιοανατολικά",S:"νότια",SW:"νοτιοδυτικά",W:"δυτικά",NW:"βορειοδυτικά"},instructions:{Head:["Κατευθυνθείτε {dir}"," στην {road}"],Continue:["Συνεχίστε {dir}"," στην {road}"],SlightRight:["Ελαφρώς δεξιά"," στην {road}"],Right:["Δεξιά"," στην {road}"],SharpRight:["Απότομη δεξιά στροφή"," στην {road}"],TurnAround:["Κάντε αναστροφή"],SharpLeft:["Απότομη αριστερή στροφή"," στην {road}"],Left:["Αριστερά"," στην {road}"],SlightLeft:["Ελαφρώς αριστερά"," στην {road}"],WaypointReached:["Φτάσατε στο σημείο αναφοράς"],Roundabout:["Ακολουθήστε την {exitStr} έξοδο στο κυκλικό κόμβο"," στην {road}"],DestinationReached:["Φτάσατε στον προορισμό σας"]},formatOrder:function(n){return n+"º"},ui:{startPlaceholder:"Αφετηρία",viaPlaceholder:"μέσω {viaNumber}",endPlaceholder:"Προορισμός"}},ca:{directions:{N:"nord",NE:"nord-est",E:"est",SE:"sud-est",S:"sud",SW:"sud-oest",W:"oest",NW:"nord-oest",SlightRight:"lleu gir a la dreta",Right:"dreta",SharpRight:"gir pronunciat a la dreta",SlightLeft:"gir pronunciat a l'esquerra",Left:"esquerra",SharpLeft:"lleu gir a l'esquerra",Uturn:"mitja volta"},instructions:{Head:["Recte {dir}"," sobre {road}"],Continue:["Continuar {dir}"],TurnAround:["Donar la volta"],WaypointReached:["Ha arribat a un punt del camí"],Roundabout:["Agafar {exitStr} sortida a la rotonda"," a {road}"],DestinationReached:["Arribada al destí"],Fork:["A la cruïlla gira a la {modifier}"," cap a {road}"],Merge:["Incorpora't {modifier}"," a {road}"],OnRamp:["Gira {modifier} a la sortida"," cap a {road}"],OffRamp:["Pren la sortida {modifier}"," cap a {road}"],EndOfRoad:["Gira {modifier} al final de la carretera"," cap a {road}"],Onto:"cap a {road}"},formatOrder:function(n){return n+"º"},ui:{startPlaceholder:"Origen",viaPlaceholder:"Via {viaNumber}",endPlaceholder:"Destí"},units:{meters:"m",kilometers:"km",yards:"yd",miles:"mi",hours:"h",minutes:"min",seconds:"s"}},ru:{directions:{N:"север",NE:"северовосток",E:"восток",SE:"юговосток",S:"юг",SW:"югозапад",W:"запад",NW:"северозапад",SlightRight:"плавно направо",Right:"направо",SharpRight:"резко направо",SlightLeft:"плавно налево",Left:"налево",SharpLeft:"резко налево",Uturn:"развернуться"},instructions:{Head:["Начать движение на {dir}"," по {road}"],Continue:["Продолжать движение на {dir}"," по {road}"],SlightRight:["Плавный поворот направо"," на {road}"],Right:["Направо"," на {road}"],SharpRight:["Резкий поворот направо"," на {road}"],TurnAround:["Развернуться"],SharpLeft:["Резкий поворот налево"," на {road}"],Left:["Поворот налево"," на {road}"],SlightLeft:["Плавный поворот налево"," на {road}"],WaypointReached:["Точка достигнута"],Roundabout:["{exitStr} съезд с кольца"," на {road}"],DestinationReached:["Окончание маршрута"],Fork:["На развилке поверните {modifier}"," на {road}"],Merge:["Перестройтесь {modifier}"," на {road}"],OnRamp:["Поверните {modifier} на съезд"," на {road}"],OffRamp:["Съезжайте на {modifier}"," на {road}"],EndOfRoad:["Поверните {modifier} в конце дороги"," на {road}"],Onto:"на {road}"},formatOrder:function(n){return n+"-й"},ui:{startPlaceholder:"Начало",viaPlaceholder:"Через {viaNumber}",endPlaceholder:"Конец"},units:{meters:"м",kilometers:"км",yards:"ярд",miles:"ми",hours:"ч",minutes:"м",seconds:"с"}},pl:{directions:{N:"północ",NE:"północny wschód",E:"wschód",SE:"południowy wschód",S:"południe",SW:"południowy zachód",W:"zachód",NW:"północny zachód",SlightRight:"lekko w prawo",Right:"w prawo",SharpRight:"ostro w prawo",SlightLeft:"lekko w lewo",Left:"w lewo",SharpLeft:"ostro w lewo",Uturn:"zawróć"},instructions:{Head:["Kieruj się na {dir}"," na {road}"],Continue:["Jedź dalej przez {dir}"],TurnAround:["Zawróć"],WaypointReached:["Punkt pośredni"],Roundabout:["Wyjedź {exitStr} zjazdem na rondzie"," na {road}"],DestinationReached:["Dojechano do miejsca docelowego"],Fork:["Na rozwidleniu {modifier}"," na {road}"],Merge:["Zjedź {modifier}"," na {road}"],OnRamp:["Wjazd {modifier}"," na {road}"],OffRamp:["Zjazd {modifier}"," na {road}"],EndOfRoad:["Skręć {modifier} na końcu drogi"," na {road}"],Onto:"na {road}"},formatOrder:function(n){return n+"."},ui:{startPlaceholder:"Początek",viaPlaceholder:"Przez {viaNumber}",endPlaceholder:"Koniec"},units:{meters:"m",kilometers:"km",yards:"yd",miles:"mi",hours:"godz",minutes:"min",seconds:"s"}},uk:{directions:{N:"північ",NE:"північний схід",E:"схід",SE:"південний схід",S:"південь",SW:"південний захід",W:"захід",NW:"північний захід",SlightRight:"плавно направо",Right:"направо",SharpRight:"різко направо",SlightLeft:"плавно наліво",Left:"наліво",SharpLeft:"різко наліво",Uturn:"розвернутися"},instructions:{Head:["Почати рух на {dir}","по {road}"],Continue:["Продовжувати рух на {dir}","по {road}"],SlightRight:["Плавний поворот направо","на {road}"],Right:["Направо","на {road}"],SharpRight:["Різкий поворот направо","на {road}"],TurnAround:["Розгорнутися"],SharpLeft:["Різкий поворот наліво","на {road}"],Left:["Поворот наліво","на {road}"],SlightLeft:["Плавний поворот наліво","на {road}"],WaypointReached:["Точка досягнута"],Roundabout:["{ExitStr} з'їзд з кільця","на {road}"],DestinationReached:["Закінчення маршруту"],Fork:["На розвилці поверніть {modifier}","на {road}"],Merge:["Візьміть {modifier}","на {road}"],OnRamp:["Поверніть {modifier} на з'їзд","на {road}"],OffRamp:["З'їжджайте на {modifier}","на {road}"],EndOfRoad:["Поверніть {modifier} в кінці дороги","на {road}"],Onto:"на {road}"},formatOrder:function(n){return n+"-й"},ui:{startPlaceholder:"Початок",viaPlaceholder:"Через {viaNumber}",endPlaceholder:"Кінець"},units:{meters:"м",kilometers:"км",yards:"ярд",miles:"ми",hours:"г",minutes:"хв",seconds:"сек"}}});module.exports=L.Routing})()},{}],12:[function(require,module,exports){(function(global){(function(){var L=typeof window!=="undefined"?window.L:typeof global!=="undefined"?global.L:null;L.Routing=L.Routing||{};L.extend(L.Routing,require("./L.Routing.OSRMv1"));L.Routing.Mapbox=L.Routing.OSRMv1.extend({options:{serviceUrl:"https://api.mapbox.com/directions/v5",profile:"mapbox/driving",useHints:false},initialize:function(accessToken,options){L.Routing.OSRMv1.prototype.initialize.call(this,options);this.options.requestParameters=this.options.requestParameters||{};this.options.requestParameters.access_token=accessToken}});L.Routing.mapbox=function(accessToken,options){return new L.Routing.Mapbox(accessToken,options)};module.exports=L.Routing})()}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./L.Routing.OSRMv1":13}],13:[function(require,module,exports){(function(global){(function(){var L=typeof window!=="undefined"?window.L:typeof global!=="undefined"?global.L:null,corslite=require("corslite"),polyline=require("polyline");L.Routing=L.Routing||{};L.extend(L.Routing,require("./L.Routing.Waypoint"));L.Routing.OSRMv1=L.Class.extend({options:{serviceUrl:"https://router.project-osrm.org/route/v1",profile:"driving",timeout:30*1e3,routingOptions:{alternatives:true,steps:true},polylinePrecision:5,useHints:true},initialize:function(options){L.Util.setOptions(this,options);this._hints={locations:{}}},route:function(waypoints,callback,context,options){var timedOut=false,wps=[],url,timer,wp,i;options=L.extend({},this.options.routingOptions,options);url=this.buildRouteUrl(waypoints,options);if(this.options.requestParameters)url+=L.Util.getParamString(this.options.requestParameters,url);timer=setTimeout(function(){timedOut=true;callback.call(context||callback,{status:-1,message:"OSRM request timed out."})},this.options.timeout);for(i=0;i0,i,j,leg,step,geometry,type,modifier;for(i=0;i=0?"Left":"Right"},_decodePolyline:function(routeGeometry){var cs=polyline.decode(routeGeometry,this.options.polylinePrecision),result=new Array(cs.length),i;for(i=cs.length-1;i>=0;i--)result[i]=L.latLng(cs[i]);return result},_toWaypoints:function(inputWaypoints,vias){var wps=[],i;for(i=0;i=0;i--){loc=waypoints[i].latLng;this._hints.locations[this._locationKey(loc)]=actualWaypoints[i].hint}}});L.Routing.osrmv1=function(options){return new L.Routing.OSRMv1(options)};module.exports=L.Routing})()}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./L.Routing.Waypoint":15,corslite:1,polyline:2}],14:[function(require,module,exports){(function(global){(function(){var L=typeof window!=="undefined"?window.L:typeof global!=="undefined"?global.L:null;L.Routing=L.Routing||{};L.extend(L.Routing,require("./L.Routing.GeocoderElement"));L.extend(L.Routing,require("./L.Routing.Waypoint"));L.Routing.Plan=L.Class.extend({includes:typeof L.Evented!=="undefined"&&L.Evented.prototype||L.Mixin.Events,options:{dragStyles:[{color:"black",opacity:.15,weight:9},{color:"white",opacity:.8,weight:6},{color:"red",opacity:1,weight:2,dashArray:"7,12"}],draggableWaypoints:true,routeWhileDragging:false,addWaypoints:true,reverseWaypoints:false,addButtonClassName:"",language:"en",createGeocoderElement:L.Routing.geocoderElement,createMarker:function(i,wp){var options={draggable:this.draggableWaypoints};if(i==0){options.draggable=false;options.opacity=0}var marker=L.marker(wp.latLng,options);return marker},geocodersClassName:""},initialize:function(waypoints,options){L.Util.setOptions(this,options);this._waypoints=[];this.setWaypoints(waypoints)},isReady:function(){var i;for(i=0;i0||this._waypoints.length>2)this.spliceWaypoints(i,1);else this.spliceWaypoints(i,1,new L.Routing.Waypoint)},this).on("geocoded",function(e){this._updateMarkers();this._fireChanged();this._focusGeocoder(i+1);this.fire("waypointgeocoded",{waypointIndex:i,waypoint:e.waypoint})},this).on("reversegeocoded",function(e){this.fire("waypointgeocoded",{waypointIndex:i,waypoint:e.waypoint})},this);return geocoder},_updateGeocoders:function(){var elems=[],i,geocoderElem;for(i=0;i=0;i--){geocoderElem=this._createGeocoder(i);this._geocoderContainer.insertBefore(geocoderElem.getContainer(),this._geocoderContainer.firstChild);elems.push(geocoderElem)}this._geocoderElems=elems.reverse()},_removeMarkers:function(){var i;if(jQuery.goMap.gdwpmarkers)for(i=0;i=2)this.fire("waypointsspliced",{index:Array.prototype.shift.call(arguments),nRemoved:Array.prototype.shift.call(arguments),added:arguments})},_hookWaypointEvents:function(m,i,trackMouseMove){var eventLatLng=function(e){return trackMouseMove?e.latlng:e.target.getLatLng()},dragStart=L.bind(function(e){this.fire("waypointdragstart",{index:i,latlng:eventLatLng(e)})},this),drag=L.bind(function(e){this._waypoints[i].latLng=eventLatLng(e);this.fire("waypointdrag",{index:i,latlng:eventLatLng(e)})},this),dragEnd=L.bind(function(e){this._waypoints[i].latLng=eventLatLng(e);this._waypoints[i].name="";if(this._geocoderElems)this._geocoderElems[i].update(true);this.fire("waypointdragend",{index:i,latlng:eventLatLng(e)});this._fireChanged()},this),mouseMove,mouseUp;if(trackMouseMove){mouseMove=L.bind(function(e){jQuery.goMap.gdwpmarkers[i].setLatLng(e.latlng);drag(e)},this);mouseUp=L.bind(function(e){this._map.dragging.enable();this._map.off("mouseup",mouseUp);this._map.off("mousemove",mouseMove);dragEnd(e)},this);this._map.dragging.disable();this._map.on("mousemove",mouseMove);this._map.on("mouseup",mouseUp);dragStart({latlng:this._waypoints[i].latLng})}else{m.on("dragstart",dragStart);m.on("drag",drag);m.on("dragend",dragEnd)}},dragNewWaypoint:function(e){var newWpIndex=e.afterIndex+1;if(this.options.routeWhileDragging){this.spliceWaypoints(newWpIndex,0,e.latlng);this._hookWaypointEvents(jQuery.goMap.gdwpmarkers[newWpIndex],newWpIndex,true)}else this._dragNewWaypoint(newWpIndex,e.latlng)},_dragNewWaypoint:function(newWpIndex,initialLatLng){var wp=new L.Routing.Waypoint(initialLatLng),prevWp=this._waypoints[newWpIndex-1],nextWp=this._waypoints[newWpIndex],marker=this.options.createMarker(newWpIndex,wp,this._waypoints.length+1),lines=[],mouseMove=L.bind(function(e){var i;if(marker)marker.setLatLng(e.latlng);for(i=0;i0){this._alts.innerHTML="";this._results=results;L.DomUtil.removeClass(this._alts,"leaflet-control-geocoder-alternatives-minimized");for(var i=0;i=0)this._collapse();else this._expand()},_expand:function(){L.DomUtil.addClass(this._container,"leaflet-control-geocoder-expanded");this._input.select()},_collapse:function(){this._container.className=this._container.className.replace(" leaflet-control-geocoder-expanded","");L.DomUtil.addClass(this._alts,"leaflet-control-geocoder-alternatives-minimized");L.DomUtil.removeClass(this._errorElement,"leaflet-control-geocoder-error")},_clearResults:function(){L.DomUtil.addClass(this._alts,"leaflet-control-geocoder-alternatives-minimized");this._selection=null;L.DomUtil.removeClass(this._errorElement,"leaflet-control-geocoder-error")},_createAlt:function(result,index){var li=document.createElement("li"),a=L.DomUtil.create("a","",li),icon=this.options.showResultIcons&&result.icon?L.DomUtil.create("img","",a):null,text=result.html?undefined:document.createTextNode(result.name);if(icon)icon.src=result.icon;a.href="#";a.setAttribute("data-result-index",index);if(result.html)a.innerHTML=result.html;else a.appendChild(text);L.DomEvent.addListener(li,"click",function clickHandler(e){L.DomEvent.preventDefault(e);this._geocodeResultSelected(result)},this);return li},_keydown:function(e){var _this=this,select=function select(dir){if(_this._selection){L.DomUtil.removeClass(_this._selection.firstChild,"leaflet-control-geocoder-selected");_this._selection=_this._selection[dir>0?"nextSibling":"previousSibling"]}if(!_this._selection)_this._selection=_this._alts[dir>0?"firstChild":"lastChild"];if(_this._selection)L.DomUtil.addClass(_this._selection.firstChild,"leaflet-control-geocoder-selected")};switch(e.keyCode){case 27:this._collapse();break;case 38:select(-1);L.DomEvent.preventDefault(e);break;case 40:select(1);L.DomEvent.preventDefault(e);break;case 13:if(this._selection){var index=parseInt(this._selection.firstChild.getAttribute("data-result-index"),10);this._geocodeResultSelected(this._results[index]);this._clearResults();L.DomEvent.preventDefault(e)}}return true}});L.Control.geocoder=function(id,options){return new L.Control.Geocoder(id,options)};L.Control.Geocoder.callbackId=0;L.Control.Geocoder.jsonp=function(url,params,callback,context,jsonpParam){var callbackId="_l_geocoder_"+L.Control.Geocoder.callbackId++;params[jsonpParam||"callback"]=callbackId;window[callbackId]=L.Util.bind(callback,context);var script=document.createElement("script");script.type="text/javascript";script.src=url+L.Util.getParamString(params);script.id=callbackId;document.getElementsByTagName("head")[0].appendChild(script)};L.Control.Geocoder.getJSON=function(url,params,callback){var xmlHttp=new XMLHttpRequest;xmlHttp.open("GET",url+L.Util.getParamString(params),true);xmlHttp.send(null);xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState!=4)return;if(xmlHttp.status!=200&&req.status!=304)return;callback(JSON.parse(xmlHttp.response))}};L.Control.Geocoder.template=function(str,data,htmlEscape){return str.replace(/\{ *([\w_]+) *\}/g,function(str,key){var value=data[key];if(value===undefined)value="";else if(typeof value==="function")value=value(data);return L.Control.Geocoder.htmlEscape(value)})};L.Control.Geocoder.htmlEscape=function(){var badChars=/[&<>"'`]/g;var possible=/[&<>"'`]/;var escape={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"};function escapeChar(chr){return escape[chr]}return function(string){if(string==null)return"";else if(!string)return string+"";string=""+string;if(!possible.test(string))return string;return string.replace(badChars,escapeChar)}}();L.Control.Geocoder.Nominatim=L.Class.extend({options:{serviceUrl:"//nominatim.openstreetmap.org/",geocodingQueryParams:{},reverseQueryParams:{},htmlTemplate:function(r){var a=r.address,parts=[];if(a.road||a.building)parts.push("{building} {road} {house_number}");if(a.city||a.town||a.village)parts.push('{postcode} {city}{town}{village}');if(a.state||a.country)parts.push('{state} {country}');return L.Control.Geocoder.template(parts.join("
"),a,true)}},initialize:function(options){L.Util.setOptions(this,options)},geocode:function(query,cb,context){jQuery(context._elem).parent().removeClass("leaflet-routing-searching").addClass("leaflet-routing-searching");L.Control.Geocoder.jsonp(this.options.serviceUrl+"search",L.extend({q:query,limit:5,format:"json",addressdetails:1},this.options.geocodingQueryParams),function(data){jQuery(context._elem).parent().removeClass("leaflet-routing-searching");var results=[];for(var i=data.length-1;i>=0;i--){var bbox=data[i].boundingbox;for(var j=0;j<4;j++)bbox[j]=parseFloat(bbox[j]);results[i]={icon:data[i].icon,name:data[i].display_name,html:this.options.htmlTemplate?this.options.htmlTemplate(data[i]):undefined,bbox:L.latLngBounds([bbox[0],bbox[2]],[bbox[1],bbox[3]]),center:L.latLng(data[i].lat,data[i].lon),properties:data[i]}}cb.call(context,results)},this,"json_callback")},reverse:function(location,scale,cb,context){L.Control.Geocoder.jsonp(this.options.serviceUrl+"reverse",L.extend({lat:location.lat,lon:location.lng,zoom:Math.round(Math.log(scale/256)/Math.log(2)),addressdetails:1,format:"json"},this.options.reverseQueryParams),function(data){var result=[],loc;if(data&&data.lat&&data.lon){loc=L.latLng(data.lat,data.lon);result.push({name:data.display_name,html:this.options.htmlTemplate?this.options.htmlTemplate(data):undefined,center:loc,bounds:L.latLngBounds(loc,loc),properties:data})}cb.call(context,result)},this,"json_callback")}});L.Control.Geocoder.nominatim=function(options){return new L.Control.Geocoder.Nominatim(options)};return L.Control.Geocoder}); \ No newline at end of file +(function(f){if(typeof exports==="object"&&typeof module!=="undefined")module.exports=f();else if(typeof define==="function"&&define.amd)define([],f);else{var g;if(typeof window!=="undefined")g=window;else if(typeof global!=="undefined")g=global;else if(typeof self!=="undefined")g=self;else g=this;(g.L||(g.L={})).Routing=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o=200&&status<300||status===304}if(cors&&!("withCredentials"in x)){x=new window.XDomainRequest;var original=callback;callback=function(){if(sent)original.apply(this,arguments);else{var that=this,args=arguments;setTimeout(function(){original.apply(that,args)},0)}}}function loaded(){if(x.status===undefined||isSuccessful(x.status))callback.call(x,null,x);else callback.call(x,x,null)}if("onload"in x)x.onload=loaded;else x.onreadystatechange=function readystate(){if(x.readyState===4)loaded()};x.onerror=function error(evt){callback.call(this,evt||true,null);callback=function(){}};x.onprogress=function(){};x.ontimeout=function(evt){callback.call(this,evt,null);callback=function(){}};x.onabort=function(evt){callback.call(this,evt,null);callback=function(){}};x.open("GET",url,true);x.send(null);sent=true;return x}if(typeof module!=="undefined")module.exports=corslite},{}],2:[function(require,module,exports){var polyline={};function encode(coordinate,factor){coordinate=Math.round(coordinate*factor);coordinate<<=1;if(coordinate<0)coordinate=~coordinate;var output="";while(coordinate>=32){output+=String.fromCharCode((32|coordinate&31)+63);coordinate>>=5}output+=String.fromCharCode(coordinate+63);return output}polyline.decode=function(str,precision){var index=0,lat=0,lng=0,coordinates=[],shift=0,result=0,byte=null,latitude_change,longitude_change,factor=Math.pow(10,precision||5);while(index=32);latitude_change=result&1?~(result>>1):result>>1;shift=result=0;do{byte=str.charCodeAt(index++)-63;result|=(byte&31)<=32);longitude_change=result&1?~(result>>1):result>>1;lat+=latitude_change;lng+=longitude_change;coordinates.push([lat/factor,lng/factor])}return coordinates};polyline.encode=function(coordinates,precision){if(!coordinates.length)return"";var factor=Math.pow(10,precision||5),output=encode(coordinates[0][0],factor)+encode(coordinates[0][1],factor);for(var i=1;i0)this._select(1)},_createClickListener:function(r){var resultSelected=this._resultSelected(r);return L.bind(function(){this._elem.blur();resultSelected()},this)},_resultSelected:function(r){return L.bind(function(){this.close();this._elem.value=r.name;this._lastCompletedText=r.name;this._selectFn(r)},this)},_keyPressed:function(e){var index;if(this._isOpen&&e.keyCode===13&&this._selection){index=parseInt(this._selection.getAttribute("data-result-index"),10);this._resultSelected(this._results[index])();L.DomEvent.preventDefault(e);return}if(e.keyCode===13){this._complete(this._resultFn,true);return}if(this._autocomplete&&document.activeElement===this._elem){if(this._timer)clearTimeout(this._timer);this._timer=setTimeout(L.Util.bind(function(){this._complete(this._autocomplete)},this),this.options.timeout);return}this._unselect()},_select:function(dir){var sel=this._selection;if(sel){L.DomUtil.removeClass(sel.firstChild,"leaflet-routing-geocoder-selected");sel=sel[dir>0?"nextSibling":"previousSibling"]}if(!sel)sel=this._resultTable[dir>0?"firstChild":"lastChild"];if(sel){L.DomUtil.addClass(sel.firstChild,"leaflet-routing-geocoder-selected");this._selection=sel}},_unselect:function(){if(this._selection)L.DomUtil.removeClass(this._selection.firstChild,"leaflet-routing-geocoder-selected");delete this._selection},_keyDown:function(e){if(this._isOpen)switch(e.keyCode){case 27:this.close();L.DomEvent.preventDefault(e);return;case 38:this._select(-1);L.DomEvent.preventDefault(e);return;case 40:this._select(1);L.DomEvent.preventDefault(e);return}},_complete:function(completeFn,trySelect){var v=this._elem.value;function completeResults(results){this._lastCompletedText=v;if(!results)return;if(trySelect&&results.length===1)this._resultSelected(results[0])();else this._setResults(results)}if(!v)return;if(v!==this._lastCompletedText)completeFn(v,completeResults,this);else if(trySelect)completeResults.call(this,this._results)}})})()},{}],4:[function(require,module,exports){(function(global){(function(){var L=typeof window!=="undefined"?window.L:typeof global!=="undefined"?global.L:null;L.Routing=L.Routing||{};L.extend(L.Routing,require("./L.Routing.Itinerary"));L.extend(L.Routing,require("./L.Routing.Line"));L.extend(L.Routing,require("./L.Routing.Plan"));L.extend(L.Routing,require("./L.Routing.OSRMv1"));L.extend(L.Routing,require("./L.Routing.Mapbox"));L.extend(L.Routing,require("./L.Routing.ErrorControl"));L.Routing.Control=L.Routing.Itinerary.extend({options:{fitSelectedRoutes:"smart",routeLine:function(route,options){return L.Routing.line(route,options)},autoRoute:true,routeWhileDragging:false,routeDragInterval:500,waypointMode:"connect",showAlternatives:false,defaultErrorHandler:function(e){console.error("Routing error:",e.error)}},initialize:function(options){L.Util.setOptions(this,options);this._router=this.options.router||new L.Routing.OSRMv1(options);this._plan=this.options.plan||L.Routing.plan(this.options.waypoints,options);this._requestCount=0;L.Routing.Itinerary.prototype.initialize.call(this,options);this.on("routeselected",this._routeSelected,this);if(this.options.defaultErrorHandler)this.on("routingerror",this.options.defaultErrorHandler);this._plan.on("waypointschanged",this._onWaypointsChanged,this);if(options.routeWhileDragging)this._setupRouteDragging();if(this.options.autoRoute)this.route()},onAdd:function(map){if(!map)map=jQuery.goMap.map;var container=L.Routing.Itinerary.prototype.onAdd.call(this,map);this._map=map;this._map.on("zoomend",function(){if(!this._selectedRoute||!this._router.requiresMoreDetail)return;var map=this._map;if(this._router.requiresMoreDetail(this._selectedRoute,map.getZoom(),map.getBounds()))this.route({callback:L.bind(function(err,routes){var i;if(!err){for(i=0;imapSize.x/5||boundsSize.y>mapSize.y/5)&&this._waypointsInViewport()}catch(e){return false}},_waypointsInViewport:function(){var wps=this.getWaypoints(),mapBounds,i;try{mapBounds=this._map.getBounds()}catch(e){return false}for(i=0;i
"+error.message+"
=1e3)data={value:round(d/1609.344,sensitivity),unit:un.miles};else data={value:round(yards,sensitivity),unit:un.yards}}else{v=round(d,sensitivity);data={value:v>=1e3?v/1e3:v,unit:v>=1e3?un.kilometers:un.meters}}if(simpleRounding)data.value=data.value.toFixed(-sensitivity);return L.Util.template(this.options.distanceTemplate,data)},_round:function(d,sensitivity){var s=sensitivity||this.options.roundingSensitivity,pow10=Math.pow(10,(Math.floor(d/s)+"").length-1),r=Math.floor(d/pow10),p=r>5?pow10:pow10/2;return Math.round(d/p)*p},formatTime:function(t){var un=this.options.unitNames||this._localization.localize("units");t=Math.round(t/30)*30;if(t>86400)return Math.round(t/3600)+" "+un.hours;else if(t>3600)return Math.floor(t/3600)+" "+un.hours+" "+Math.round(t%3600/60)+" "+un.minutes;else if(t>300)return Math.round(t/60)+" "+un.minutes;else if(t>60)return Math.floor(t/60)+" "+un.minutes+(t%60!==0?" "+t%60+" "+un.seconds:"");else return t+" "+un.seconds},formatInstruction:function(instr,i){if(instr.text===undefined)return this.capitalize(L.Util.template(this._getInstructionTemplate(instr,i),L.extend({},instr,{exitStr:instr.exit?this._localization.localize("formatOrder")(instr.exit):"",dir:this._localization.localize(["directions",instr.direction]),modifier:this._localization.localize(["directions",instr.modifier])})));else return instr.text},getIconName:function(instr,i){switch(instr.type){case"Head":if(i===0)return"depart";break;case"WaypointReached":return"via";case"Roundabout":return"enter-roundabout";case"DestinationReached":return"arrive"}switch(instr.modifier){case"Straight":return"continue";case"SlightRight":return"bear-right";case"Right":return"turn-right";case"SharpRight":return"sharp-right";case"TurnAround":case"Uturn":return"u-turn";case"SharpLeft":return"sharp-left";case"Left":return"turn-left";case"SlightLeft":return"bear-left"}},capitalize:function(s){return s.charAt(0).toUpperCase()+s.substring(1)},_getInstructionTemplate:function(instr,i){var type=instr.type==="Straight"?i===0?"Head":"Continue":instr.type,strings=this._localization.localize(["instructions",type]);if(!strings)strings=[this._localization.localize(["directions",type])," "+this._localization.localize(["instructions","Onto"])];return strings[0]+(strings.length>1&&instr.road?strings[1]:"")}});module.exports=L.Routing})()}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./L.Routing.Localization":11}],7:[function(require,module,exports){(function(global){(function(){var L=typeof window!=="undefined"?window.L:typeof global!=="undefined"?global.L:null;L.Routing=L.Routing||{};L.extend(L.Routing,require("./L.Routing.Autocomplete"));function selectInputText(input){if(input.setSelectionRange)input.setSelectionRange(0,9999);else input.select()}L.Routing.GeocoderElement=L.Class.extend({includes:typeof L.Evented!=="undefined"&&L.Evented.prototype||L.Mixin.Events,options:{createGeocoder:function(i,nWps,options){var container=L.DomUtil.create("div","leaflet-routing-geocoder leaflet-routing-geocoder-"+i),input=L.DomUtil.create("input","",container),remove=options.addWaypoints?L.DomUtil.create("span","leaflet-routing-remove-waypoint",container):undefined;input.disabled=!options.addWaypoints;return{container:container,input:input,closeButton:remove}},geocoderPlaceholder:function(i,numberWaypoints,geocoderElement){var l=new L.Routing.Localization(geocoderElement.options.language).localize("ui");var startPlaceholder=typeof geodir_params!=="undefined"?geodir_params.osmStart:l.startPlaceholder;var viaPlaceholder=typeof geodir_params!=="undefined"?geodir_params.osmVia:l.viaPlaceholder;var endPlaceholder=typeof geodir_params!=="undefined"?geodir_params.osmEnd:l.endPlaceholder;return i===0?startPlaceholder:i0&&rs[0].center.distanceTo(wp.latLng){name}

{distance}, {time}

",timeTemplate:"{time}",containerClassName:"",alternativeClassName:"",minimizedClassName:"",itineraryClassName:"",totalDistanceRoundingSensitivity:-1,show:true,collapsible:true,collapseBtn:function(itinerary){var collapseBtn=L.DomUtil.create("span",itinerary.options.collapseBtnClass);L.DomEvent.on(collapseBtn,"click",itinerary._toggle,itinerary);itinerary._container.insertBefore(collapseBtn,itinerary._container.firstChild)},collapseBtnClass:"leaflet-routing-collapse-btn"},initialize:function(options){L.setOptions(this,options);this._formatter=this.options.formatter||new L.Routing.Formatter(this.options);this._itineraryBuilder=this.options.itineraryBuilder||new L.Routing.ItineraryBuilder({containerClassName:this.options.itineraryClassName})},onAdd:function(map){var collapsible=this.options.collapsible;collapsible=collapsible||collapsible===undefined&&map.getSize().x<=640;this._container=L.DomUtil.create("div","leaflet-routing-container leaflet-bar "+(!this.options.show?"leaflet-routing-container-hide ":"")+(collapsible?"leaflet-routing-collapsible ":"")+this.options.containerClassName);this._altContainer=this.createAlternativesContainer();this._container.appendChild(this._altContainer);L.DomEvent.disableClickPropagation(this._container);L.DomEvent.addListener(this._container,"mousewheel",function(e){L.DomEvent.stopPropagation(e)});if(collapsible)this.options.collapseBtn(this);return this._container},onRemove:function(){},createAlternativesContainer:function(){return L.DomUtil.create("div","leaflet-routing-alternatives-container")},setAlternatives:function(routes){var i,alt,altDiv;this._clearAlts();this._routes=routes;for(i=0;i0?" leaflet-routing-alt-minimized "+this.options.minimizedClassName:"")),template=this.options.summaryTemplate,data=L.extend({name:alt.name,distance:this._formatter.formatDistance(alt.summary.totalDistance,this.options.totalDistanceRoundingSensitivity),time:this._formatter.formatTime(alt.summary.totalTime)},alt);altDiv.innerHTML=typeof template==="function"?template(data):L.Util.template(template,data);L.DomEvent.addListener(altDiv,"click",this._onAltClicked,this);this.on("routeselected",this._selectAlt,this);altDiv.appendChild(this._createItineraryContainer(alt));return altDiv},_clearAlts:function(){var el=this._altContainer;while(el&&el.firstChild)el.removeChild(el.firstChild);this._altElements=[]},_createItineraryContainer:function(r){var container=this._itineraryBuilder.createContainer(),steps=this._itineraryBuilder.createStepsContainer(),i,instr,step,distance,text,icon;container.appendChild(steps);for(i=0;i=0;i--){d=latlng.distanceTo(this._route.coordinates[i]);if(dthis.options.missingRouteTolerance)this._addSegment([wpLatLng,routeCoord],this.options.missingRouteStyles)}},_addSegment:function(coords,styles,mouselistener){var i,pl;for(i=0;i=0&&wpIndices[j]>i)j--;return j},_onLineTouched:function(e){var afterIndex=this._findNearestWpBefore(this._findClosestRoutePoint(e.latlng));this.fire("linetouched",{afterIndex:afterIndex,latlng:e.latlng})},_getWaypointIndices:function(){if(!this._wpIndices)this._wpIndices=this._route.waypointIndices||this._findWaypointIndices();return this._wpIndices}});L.Routing.line=function(route,options){return new L.Routing.Line(route,options)};module.exports=L.Routing})()}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],11:[function(require,module,exports){(function(){L.Routing=L.Routing||{};L.Routing.Localization=L.Class.extend({initialize:function(langs){this._langs=L.Util.isArray(langs)?langs:[langs,"en"];for(var i=0,l=this._langs.length;i=20){return n+"ste"}else{return n+"de"}},ui:{startPlaceholder:"Vertrekpunt",viaPlaceholder:"Via {viaNumber}",endPlaceholder:"Bestemming"}},fr:{directions:{N:"nord",NE:"nord-est",E:"est",SE:"sud-est",S:"sud",SW:"sud-ouest",W:"ouest",NW:"nord-ouest"},instructions:{Head:["Tout droit au {dir}"," sur {road}"],Continue:["Continuer au {dir}"," sur {road}"],SlightRight:["Légèrement à droite"," sur {road}"],Right:["A droite"," sur {road}"],SharpRight:["Complètement à droite"," sur {road}"],TurnAround:["Faire demi-tour"],SharpLeft:["Complètement à gauche"," sur {road}"],Left:["A gauche"," sur {road}"],SlightLeft:["Légèrement à gauche"," sur {road}"],WaypointReached:["Point d'étape atteint"],Roundabout:["Au rond-point, prenez la {exitStr} sortie"," sur {road}"],DestinationReached:["Destination atteinte"]},formatOrder:function(n){return n+"º"},ui:{startPlaceholder:"Départ",viaPlaceholder:"Intermédiaire {viaNumber}",endPlaceholder:"Arrivée"}},it:{directions:{N:"nord",NE:"nord-est",E:"est",SE:"sud-est",S:"sud",SW:"sud-ovest",W:"ovest",NW:"nord-ovest"},instructions:{Head:["Dritto verso {dir}"," su {road}"],Continue:["Continuare verso {dir}"," su {road}"],SlightRight:["Mantenere la destra"," su {road}"],Right:["A destra"," su {road}"],SharpRight:["Strettamente a destra"," su {road}"],TurnAround:["Fare inversione di marcia"],SharpLeft:["Strettamente a sinistra"," su {road}"],Left:["A sinistra"," sur {road}"],SlightLeft:["Mantenere la sinistra"," su {road}"],WaypointReached:["Punto di passaggio raggiunto"],Roundabout:["Alla rotonda, prendere la {exitStr} uscita"],DestinationReached:["Destinazione raggiunta"]},formatOrder:function(n){return n+"º"},ui:{startPlaceholder:"Partenza",viaPlaceholder:"Intermedia {viaNumber}",endPlaceholder:"Destinazione"}},pt:{directions:{N:"norte",NE:"nordeste",E:"leste",SE:"sudeste",S:"sul",SW:"sudoeste",W:"oeste",NW:"noroeste",SlightRight:"curva ligeira a direita",Right:"direita",SharpRight:"curva fechada a direita",SlightLeft:"ligeira a esquerda",Left:"esquerda",SharpLeft:"curva fechada a esquerda",Uturn:"Meia volta"},instructions:{Head:["Siga {dir}"," na {road}"],Continue:["Continue {dir}"," na {road}"],SlightRight:["Curva ligeira a direita"," na {road}"],Right:["Curva a direita"," na {road}"],SharpRight:["Curva fechada a direita"," na {road}"],TurnAround:["Retorne"],SharpLeft:["Curva fechada a esquerda"," na {road}"],Left:["Curva a esquerda"," na {road}"],SlightLeft:["Curva ligueira a esquerda"," na {road}"],WaypointReached:["Ponto de interesse atingido"],Roundabout:["Pegue a {exitStr} saída na rotatória"," na {road}"],DestinationReached:["Destino atingido"],Fork:["Na encruzilhada, vire a {modifier}"," na {road}"],Merge:["Entre à {modifier}"," na {road}"],OnRamp:["Vire {modifier} na rampa"," na {road}"],OffRamp:["Entre na rampa na {modifier}"," na {road}"],EndOfRoad:["Vire {modifier} no fim da rua"," na {road}"],Onto:"na {road}"},formatOrder:function(n){return n+"º"},ui:{startPlaceholder:"Origem",viaPlaceholder:"Intermédio {viaNumber}",endPlaceholder:"Destino"}},sk:{directions:{N:"sever",NE:"serverovýchod",E:"východ",SE:"juhovýchod",S:"juh",SW:"juhozápad",W:"západ",NW:"serverozápad"},instructions:{Head:["Mierte na {dir}"," na {road}"],Continue:["Pokračujte na {dir}"," na {road}"],SlightRight:["Mierne doprava"," na {road}"],Right:["Doprava"," na {road}"],SharpRight:["Prudko doprava"," na {road}"],TurnAround:["Otočte sa"],SharpLeft:["Prudko doľava"," na {road}"],Left:["Doľava"," na {road}"],SlightLeft:["Mierne doľava"," na {road}"],WaypointReached:["Ste v prejazdovom bode."],Roundabout:["Odbočte na {exitStr} výjazde"," na {road}"],DestinationReached:["Prišli ste do cieľa."]},formatOrder:function(n){var i=n%10-1,suffix=[".",".","."];return suffix[i]?n+suffix[i]:n+"."},ui:{startPlaceholder:"Začiatok",viaPlaceholder:"Cez {viaNumber}",endPlaceholder:"Koniec"}},el:{directions:{N:"βόρεια",NE:"βορειοανατολικά",E:"ανατολικά",SE:"νοτιοανατολικά",S:"νότια",SW:"νοτιοδυτικά",W:"δυτικά",NW:"βορειοδυτικά"},instructions:{Head:["Κατευθυνθείτε {dir}"," στην {road}"],Continue:["Συνεχίστε {dir}"," στην {road}"],SlightRight:["Ελαφρώς δεξιά"," στην {road}"],Right:["Δεξιά"," στην {road}"],SharpRight:["Απότομη δεξιά στροφή"," στην {road}"],TurnAround:["Κάντε αναστροφή"],SharpLeft:["Απότομη αριστερή στροφή"," στην {road}"],Left:["Αριστερά"," στην {road}"],SlightLeft:["Ελαφρώς αριστερά"," στην {road}"],WaypointReached:["Φτάσατε στο σημείο αναφοράς"],Roundabout:["Ακολουθήστε την {exitStr} έξοδο στο κυκλικό κόμβο"," στην {road}"],DestinationReached:["Φτάσατε στον προορισμό σας"]},formatOrder:function(n){return n+"º"},ui:{startPlaceholder:"Αφετηρία",viaPlaceholder:"μέσω {viaNumber}",endPlaceholder:"Προορισμός"}},ca:{directions:{N:"nord",NE:"nord-est",E:"est",SE:"sud-est",S:"sud",SW:"sud-oest",W:"oest",NW:"nord-oest",SlightRight:"lleu gir a la dreta",Right:"dreta",SharpRight:"gir pronunciat a la dreta",SlightLeft:"gir pronunciat a l'esquerra",Left:"esquerra",SharpLeft:"lleu gir a l'esquerra",Uturn:"mitja volta"},instructions:{Head:["Recte {dir}"," sobre {road}"],Continue:["Continuar {dir}"],TurnAround:["Donar la volta"],WaypointReached:["Ha arribat a un punt del camí"],Roundabout:["Agafar {exitStr} sortida a la rotonda"," a {road}"],DestinationReached:["Arribada al destí"],Fork:["A la cruïlla gira a la {modifier}"," cap a {road}"],Merge:["Incorpora't {modifier}"," a {road}"],OnRamp:["Gira {modifier} a la sortida"," cap a {road}"],OffRamp:["Pren la sortida {modifier}"," cap a {road}"],EndOfRoad:["Gira {modifier} al final de la carretera"," cap a {road}"],Onto:"cap a {road}"},formatOrder:function(n){return n+"º"},ui:{startPlaceholder:"Origen",viaPlaceholder:"Via {viaNumber}",endPlaceholder:"Destí"},units:{meters:"m",kilometers:"km",yards:"yd",miles:"mi",hours:"h",minutes:"min",seconds:"s"}},ru:{directions:{N:"север",NE:"северовосток",E:"восток",SE:"юговосток",S:"юг",SW:"югозапад",W:"запад",NW:"северозапад",SlightRight:"плавно направо",Right:"направо",SharpRight:"резко направо",SlightLeft:"плавно налево",Left:"налево",SharpLeft:"резко налево",Uturn:"развернуться"},instructions:{Head:["Начать движение на {dir}"," по {road}"],Continue:["Продолжать движение на {dir}"," по {road}"],SlightRight:["Плавный поворот направо"," на {road}"],Right:["Направо"," на {road}"],SharpRight:["Резкий поворот направо"," на {road}"],TurnAround:["Развернуться"],SharpLeft:["Резкий поворот налево"," на {road}"],Left:["Поворот налево"," на {road}"],SlightLeft:["Плавный поворот налево"," на {road}"],WaypointReached:["Точка достигнута"],Roundabout:["{exitStr} съезд с кольца"," на {road}"],DestinationReached:["Окончание маршрута"],Fork:["На развилке поверните {modifier}"," на {road}"],Merge:["Перестройтесь {modifier}"," на {road}"],OnRamp:["Поверните {modifier} на съезд"," на {road}"],OffRamp:["Съезжайте на {modifier}"," на {road}"],EndOfRoad:["Поверните {modifier} в конце дороги"," на {road}"],Onto:"на {road}"},formatOrder:function(n){return n+"-й"},ui:{startPlaceholder:"Начало",viaPlaceholder:"Через {viaNumber}",endPlaceholder:"Конец"},units:{meters:"м",kilometers:"км",yards:"ярд",miles:"ми",hours:"ч",minutes:"м",seconds:"с"}},pl:{directions:{N:"północ",NE:"północny wschód",E:"wschód",SE:"południowy wschód",S:"południe",SW:"południowy zachód",W:"zachód",NW:"północny zachód",SlightRight:"lekko w prawo",Right:"w prawo",SharpRight:"ostro w prawo",SlightLeft:"lekko w lewo",Left:"w lewo",SharpLeft:"ostro w lewo",Uturn:"zawróć"},instructions:{Head:["Kieruj się na {dir}"," na {road}"],Continue:["Jedź dalej przez {dir}"],TurnAround:["Zawróć"],WaypointReached:["Punkt pośredni"],Roundabout:["Wyjedź {exitStr} zjazdem na rondzie"," na {road}"],DestinationReached:["Dojechano do miejsca docelowego"],Fork:["Na rozwidleniu {modifier}"," na {road}"],Merge:["Zjedź {modifier}"," na {road}"],OnRamp:["Wjazd {modifier}"," na {road}"],OffRamp:["Zjazd {modifier}"," na {road}"],EndOfRoad:["Skręć {modifier} na końcu drogi"," na {road}"],Onto:"na {road}"},formatOrder:function(n){return n+"."},ui:{startPlaceholder:"Początek",viaPlaceholder:"Przez {viaNumber}",endPlaceholder:"Koniec"},units:{meters:"m",kilometers:"km",yards:"yd",miles:"mi",hours:"godz",minutes:"min",seconds:"s"}},uk:{directions:{N:"північ",NE:"північний схід",E:"схід",SE:"південний схід",S:"південь",SW:"південний захід",W:"захід",NW:"північний захід",SlightRight:"плавно направо",Right:"направо",SharpRight:"різко направо",SlightLeft:"плавно наліво",Left:"наліво",SharpLeft:"різко наліво",Uturn:"розвернутися"},instructions:{Head:["Почати рух на {dir}","по {road}"],Continue:["Продовжувати рух на {dir}","по {road}"],SlightRight:["Плавний поворот направо","на {road}"],Right:["Направо","на {road}"],SharpRight:["Різкий поворот направо","на {road}"],TurnAround:["Розгорнутися"],SharpLeft:["Різкий поворот наліво","на {road}"],Left:["Поворот наліво","на {road}"],SlightLeft:["Плавний поворот наліво","на {road}"],WaypointReached:["Точка досягнута"],Roundabout:["{ExitStr} з'їзд з кільця","на {road}"],DestinationReached:["Закінчення маршруту"],Fork:["На розвилці поверніть {modifier}","на {road}"],Merge:["Візьміть {modifier}","на {road}"],OnRamp:["Поверніть {modifier} на з'їзд","на {road}"],OffRamp:["З'їжджайте на {modifier}","на {road}"],EndOfRoad:["Поверніть {modifier} в кінці дороги","на {road}"],Onto:"на {road}"},formatOrder:function(n){return n+"-й"},ui:{startPlaceholder:"Початок",viaPlaceholder:"Через {viaNumber}",endPlaceholder:"Кінець"},units:{meters:"м",kilometers:"км",yards:"ярд",miles:"ми",hours:"г",minutes:"хв",seconds:"сек"}}});module.exports=L.Routing})()},{}],12:[function(require,module,exports){(function(global){(function(){var L=typeof window!=="undefined"?window.L:typeof global!=="undefined"?global.L:null;L.Routing=L.Routing||{};L.extend(L.Routing,require("./L.Routing.OSRMv1"));L.Routing.Mapbox=L.Routing.OSRMv1.extend({options:{serviceUrl:"https://api.mapbox.com/directions/v5",profile:"mapbox/driving",useHints:false},initialize:function(accessToken,options){L.Routing.OSRMv1.prototype.initialize.call(this,options);this.options.requestParameters=this.options.requestParameters||{};this.options.requestParameters.access_token=accessToken}});L.Routing.mapbox=function(accessToken,options){return new L.Routing.Mapbox(accessToken,options)};module.exports=L.Routing})()}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./L.Routing.OSRMv1":13}],13:[function(require,module,exports){(function(global){(function(){var L=typeof window!=="undefined"?window.L:typeof global!=="undefined"?global.L:null,corslite=require("corslite"),polyline=require("polyline");L.Routing=L.Routing||{};L.extend(L.Routing,require("./L.Routing.Waypoint"));L.Routing.OSRMv1=L.Class.extend({options:{serviceUrl:"https://router.project-osrm.org/route/v1",profile:"driving",timeout:30*1e3,routingOptions:{alternatives:true,steps:true},polylinePrecision:5,useHints:true},initialize:function(options){L.Util.setOptions(this,options);this._hints={locations:{}}},route:function(waypoints,callback,context,options){var timedOut=false,wps=[],url,timer,wp,i;options=L.extend({},this.options.routingOptions,options);url=this.buildRouteUrl(waypoints,options);if(this.options.requestParameters)url+=L.Util.getParamString(this.options.requestParameters,url);timer=setTimeout(function(){timedOut=true;callback.call(context||callback,{status:-1,message:"OSRM request timed out."})},this.options.timeout);for(i=0;i0,i,j,leg,step,geometry,type,modifier;for(i=0;i=0?"Left":"Right"},_decodePolyline:function(routeGeometry){var cs=polyline.decode(routeGeometry,this.options.polylinePrecision),result=new Array(cs.length),i;for(i=cs.length-1;i>=0;i--)result[i]=L.latLng(cs[i]);return result},_toWaypoints:function(inputWaypoints,vias){var wps=[],i;for(i=0;i=0;i--){loc=waypoints[i].latLng;this._hints.locations[this._locationKey(loc)]=actualWaypoints[i].hint}}});L.Routing.osrmv1=function(options){return new L.Routing.OSRMv1(options)};module.exports=L.Routing})()}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./L.Routing.Waypoint":15,corslite:1,polyline:2}],14:[function(require,module,exports){(function(global){(function(){var L=typeof window!=="undefined"?window.L:typeof global!=="undefined"?global.L:null;L.Routing=L.Routing||{};L.extend(L.Routing,require("./L.Routing.GeocoderElement"));L.extend(L.Routing,require("./L.Routing.Waypoint"));L.Routing.Plan=L.Class.extend({includes:typeof L.Evented!=="undefined"&&L.Evented.prototype||L.Mixin.Events,options:{dragStyles:[{color:"black",opacity:.15,weight:9},{color:"white",opacity:.8,weight:6},{color:"red",opacity:1,weight:2,dashArray:"7,12"}],draggableWaypoints:true,routeWhileDragging:false,addWaypoints:true,reverseWaypoints:false,addButtonClassName:"",language:"en",createGeocoderElement:L.Routing.geocoderElement,createMarker:function(i,wp){var options={draggable:this.draggableWaypoints};if(i==0){options.draggable=false;options.opacity=0}var marker=L.marker(wp.latLng,options);return marker},geocodersClassName:""},initialize:function(waypoints,options){L.Util.setOptions(this,options);this._waypoints=[];this.setWaypoints(waypoints)},isReady:function(){var i;for(i=0;i0&&this._waypoints[i].latLng)gdReverse++}if(gdReverse>0)wps.reverse();return wps},setWaypoints:function(waypoints){var args=[0,this._waypoints.length].concat(waypoints);this.spliceWaypoints.apply(this,args);return this},spliceWaypoints:function(){var args=[arguments[0],arguments[1]],i;for(i=2;i0||this._waypoints.length>2)this.spliceWaypoints(i,1);else this.spliceWaypoints(i,1,new L.Routing.Waypoint)},this).on("geocoded",function(e){this._updateMarkers();this._fireChanged();this._focusGeocoder(i+1);this.fire("waypointgeocoded",{waypointIndex:i,waypoint:e.waypoint})},this).on("reversegeocoded",function(e){this.fire("waypointgeocoded",{waypointIndex:i,waypoint:e.waypoint})},this);return geocoder},_updateGeocoders:function(){var elems=[],i,geocoderElem;for(i=0;i=0;i--){geocoderElem=this._createGeocoder(i);this._geocoderContainer.insertBefore(geocoderElem.getContainer(),this._geocoderContainer.firstChild);elems.push(geocoderElem)}this._geocoderElems=elems.reverse()},_removeMarkers:function(){var i;if(jQuery.goMap.gdwpmarkers)for(i=0;i=2)this.fire("waypointsspliced",{index:Array.prototype.shift.call(arguments),nRemoved:Array.prototype.shift.call(arguments),added:arguments})},_hookWaypointEvents:function(m,i,trackMouseMove){var eventLatLng=function(e){return trackMouseMove?e.latlng:e.target.getLatLng()},dragStart=L.bind(function(e){this.fire("waypointdragstart",{index:i,latlng:eventLatLng(e)})},this),drag=L.bind(function(e){this._waypoints[i].latLng=eventLatLng(e);this.fire("waypointdrag",{index:i,latlng:eventLatLng(e)})},this),dragEnd=L.bind(function(e){this._waypoints[i].latLng=eventLatLng(e);this._waypoints[i].name="";if(this._geocoderElems)this._geocoderElems[i].update(true);this.fire("waypointdragend",{index:i,latlng:eventLatLng(e)});this._fireChanged()},this),mouseMove,mouseUp;if(trackMouseMove){mouseMove=L.bind(function(e){jQuery.goMap.gdwpmarkers[i].setLatLng(e.latlng);drag(e)},this);mouseUp=L.bind(function(e){this._map.dragging.enable();this._map.off("mouseup",mouseUp);this._map.off("mousemove",mouseMove);dragEnd(e)},this);this._map.dragging.disable();this._map.on("mousemove",mouseMove);this._map.on("mouseup",mouseUp);dragStart({latlng:this._waypoints[i].latLng})}else{m.on("dragstart",dragStart);m.on("drag",drag);m.on("dragend",dragEnd)}},dragNewWaypoint:function(e){var newWpIndex=e.afterIndex+1;if(this.options.routeWhileDragging){this.spliceWaypoints(newWpIndex,0,e.latlng);this._hookWaypointEvents(jQuery.goMap.gdwpmarkers[newWpIndex],newWpIndex,true)}else this._dragNewWaypoint(newWpIndex,e.latlng)},_dragNewWaypoint:function(newWpIndex,initialLatLng){var wp=new L.Routing.Waypoint(initialLatLng),prevWp=this._waypoints[newWpIndex-1],nextWp=this._waypoints[newWpIndex],marker=this.options.createMarker(newWpIndex,wp,this._waypoints.length+1),lines=[],mouseMove=L.bind(function(e){var i;if(marker)marker.setLatLng(e.latlng);for(i=0;i0){this._alts.innerHTML="";this._results=results;L.DomUtil.removeClass(this._alts,"leaflet-control-geocoder-alternatives-minimized");for(var i=0;i=0)this._collapse();else this._expand()},_expand:function(){L.DomUtil.addClass(this._container,"leaflet-control-geocoder-expanded");this._input.select()},_collapse:function(){this._container.className=this._container.className.replace(" leaflet-control-geocoder-expanded","");L.DomUtil.addClass(this._alts,"leaflet-control-geocoder-alternatives-minimized");L.DomUtil.removeClass(this._errorElement,"leaflet-control-geocoder-error")},_clearResults:function(){L.DomUtil.addClass(this._alts,"leaflet-control-geocoder-alternatives-minimized");this._selection=null;L.DomUtil.removeClass(this._errorElement,"leaflet-control-geocoder-error")},_createAlt:function(result,index){var li=document.createElement("li"),a=L.DomUtil.create("a","",li),icon=this.options.showResultIcons&&result.icon?L.DomUtil.create("img","",a):null,text=result.html?undefined:document.createTextNode(result.name);if(icon)icon.src=result.icon;a.href="#";a.setAttribute("data-result-index",index);if(result.html)a.innerHTML=result.html;else a.appendChild(text);L.DomEvent.addListener(li,"click",function clickHandler(e){L.DomEvent.preventDefault(e);this._geocodeResultSelected(result)},this);return li},_keydown:function(e){var _this=this,select=function select(dir){if(_this._selection){L.DomUtil.removeClass(_this._selection.firstChild,"leaflet-control-geocoder-selected");_this._selection=_this._selection[dir>0?"nextSibling":"previousSibling"]}if(!_this._selection)_this._selection=_this._alts[dir>0?"firstChild":"lastChild"];if(_this._selection)L.DomUtil.addClass(_this._selection.firstChild,"leaflet-control-geocoder-selected")};switch(e.keyCode){case 27:this._collapse();break;case 38:select(-1);L.DomEvent.preventDefault(e);break;case 40:select(1);L.DomEvent.preventDefault(e);break;case 13:if(this._selection){var index=parseInt(this._selection.firstChild.getAttribute("data-result-index"),10);this._geocodeResultSelected(this._results[index]);this._clearResults();L.DomEvent.preventDefault(e)}}return true}});L.Control.geocoder=function(id,options){return new L.Control.Geocoder(id,options)};L.Control.Geocoder.callbackId=0;L.Control.Geocoder.jsonp=function(url,params,callback,context,jsonpParam){var callbackId="_l_geocoder_"+L.Control.Geocoder.callbackId++;params[jsonpParam||"callback"]=callbackId;window[callbackId]=L.Util.bind(callback,context);var script=document.createElement("script");script.type="text/javascript";script.src=url+L.Util.getParamString(params);script.id=callbackId;document.getElementsByTagName("head")[0].appendChild(script)};L.Control.Geocoder.getJSON=function(url,params,callback){var xmlHttp=new XMLHttpRequest;xmlHttp.open("GET",url+L.Util.getParamString(params),true);xmlHttp.send(null);xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState!=4)return;if(xmlHttp.status!=200&&req.status!=304)return;callback(JSON.parse(xmlHttp.response))}};L.Control.Geocoder.template=function(str,data,htmlEscape){return str.replace(/\{ *([\w_]+) *\}/g,function(str,key){var value=data[key];if(value===undefined)value="";else if(typeof value==="function")value=value(data);return L.Control.Geocoder.htmlEscape(value)})};L.Control.Geocoder.htmlEscape=function(){var badChars=/[&<>"'`]/g;var possible=/[&<>"'`]/;var escape={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"};function escapeChar(chr){return escape[chr]}return function(string){if(string==null)return"";else if(!string)return string+"";string=""+string;if(!possible.test(string))return string;return string.replace(badChars,escapeChar)}}();L.Control.Geocoder.Nominatim=L.Class.extend({options:{serviceUrl:"//nominatim.openstreetmap.org/",geocodingQueryParams:{},reverseQueryParams:{},htmlTemplate:function(r){var a=r.address,parts=[];if(a.road||a.building)parts.push("{building} {road} {house_number}");if(a.city||a.town||a.village)parts.push('{postcode} {city}{town}{village}');if(a.state||a.country)parts.push('{state} {country}');return L.Control.Geocoder.template(parts.join("
"),a,true)}},initialize:function(options){L.Util.setOptions(this,options)},geocode:function(query,cb,context){jQuery(context._elem).parent().removeClass("leaflet-routing-searching").addClass("leaflet-routing-searching");L.Control.Geocoder.jsonp(this.options.serviceUrl+"search",L.extend({q:query,limit:5,format:"json",addressdetails:1},this.options.geocodingQueryParams),function(data){jQuery(context._elem).parent().removeClass("leaflet-routing-searching");var results=[];for(var i=data.length-1;i>=0;i--){var bbox=data[i].boundingbox;for(var j=0;j<4;j++)bbox[j]=parseFloat(bbox[j]);results[i]={icon:data[i].icon,name:data[i].display_name,html:this.options.htmlTemplate?this.options.htmlTemplate(data[i]):undefined,bbox:L.latLngBounds([bbox[0],bbox[2]],[bbox[1],bbox[3]]),center:L.latLng(data[i].lat,data[i].lon),properties:data[i]}}cb.call(context,results)},this,"json_callback")},reverse:function(location,scale,cb,context){L.Control.Geocoder.jsonp(this.options.serviceUrl+"reverse",L.extend({lat:location.lat,lon:location.lng,zoom:Math.round(Math.log(scale/256)/Math.log(2)),addressdetails:1,format:"json"},this.options.reverseQueryParams),function(data){var result=[],loc;if(data&&data.lat&&data.lon){loc=L.latLng(data.lat,data.lon);result.push({name:data.display_name,html:this.options.htmlTemplate?this.options.htmlTemplate(data):undefined,center:loc,bounds:L.latLngBounds(loc,loc),properties:data})}cb.call(context,result)},this,"json_callback")}});L.Control.Geocoder.nominatim=function(options){return new L.Control.Geocoder.Nominatim(options)};return L.Control.Geocoder}); \ No newline at end of file diff --git a/readme.txt b/readme.txt index ca0ac7cb..86a51fff 100644 --- a/readme.txt +++ b/readme.txt @@ -305,6 +305,9 @@ We don't offer free trials, but we have a 30-day money-back guarantee if you are __WARNING: GDv2 is a significant update over GDv1 and may require manual work, such as adding widgets to sidebars to recreate your current layout. As always, we recommend trying this on a staging site first. [Learn more](https://docs.wpgeodirectory.com/article/260-upgrading-from-gdv1-to-gdv2)__ += GeoDirectory v2.3.41 - TBD = +* OSM directions route should use listing location as an end point - CHANGED + = GeoDirectory v2.3.40 - 2024-02-15 = * Custom single post map is not loading on non GD pages - FIXED * PHP 8.2 compatibility changes in Emogrifier class - CHANGED