text: $(".modal").draggable({handle:".modal-header"});$("body").on("hidden.bs.modal",".modal",function(){$(this).removeData("bs.modal")});var map;getTileServers();loadWms();initializeMap();$("#loading").hide();navigator.geolocation.getCurrentPosition(success,error);function success(a){map.setView([a.coords.latitude,a.coords.longitude]);map.setZoom(13);$.UIkit.notify({message:"Map view set to browser's location",status:"info",timeout:ApplicationOptions.constance.NOTIFY_INFO_TIMEOUT,pos:"top-center"})}
  function error(){$.UIkit.notify({message:"Unable to find browser location!",status:"warning",timeout:ApplicationOptions.constance.NOTIFY_WARNING_TIMEOUT,pos:"top-center"})}function initializeMap(){"undefined"!==typeof map&&map.remove();map=L.map("map",{zoom:10,center:[6.934846,79.85198],layers:[defaultOSM],zoomControl:!1,attributionControl:!1,maxZoom:20,maxNativeZoom:18});map.on("click",function(a){$.UIkit.offcanvas.hide()})}
  function updateAttribution(a){$.each(map._layers,function(a,c){c.getAttribution&&$("#attribution").html(c.getAttribution())})}map.on("layeradd",updateAttribution);map.on("layerremove",updateAttribution);var attributionControl=L.control({position:"bottomright"});attributionControl.onAdd=function(a){a=L.DomUtil.create("div","leaflet-control-attribution");a.innerHTML="<a href='#' onclick='$(\"#attributionModal\").modal(\"show\"); return false;'>Attribution</a>";return a};map.addControl(attributionControl);
  L.control.fullscreen({position:"bottomright"}).addTo(map);L.control.zoom({position:"bottomright"}).addTo(map);var groupedOverlays={"Web Map Service layers":{}},layerControl=L.control.groupedLayers(baseLayers,groupedOverlays,{collapsed:!0}).addTo(map);$("#searchbox").click(function(){$(this).select()});var substringMatcher=function(){return function(a,b){var c,d;c=[];d=new RegExp(a,"i");$.each(currentSpatialObjects,function(a,b){d.test(a)&&c.push({value:a})});b(c)}},chart;
  function createChart(){chart=c3.generate({bindto:"#chart_div",data:{columns:[["speed"]]},subchart:{show:!0},axis:{y:{label:{text:"Speed",position:"outer-middle"}}},legend:{show:!1}})}$("#searchbox").typeahead({hint:!0,highlight:!0,minLength:1},{name:"speed",displayKey:"value",source:substringMatcher()}).on("typeahead:selected",function(a,b){objectId=b.value;focusOnSpatialObject(objectId)});var toggled=!1;
  function focusOnSpatialObject(a){var b=currentSpatialObjects[a];if(!b)return $.UIkit.notify({message:"Spatial Object <span style='color:red'>"+a+"</span> not in the Map!!",status:"warning",timeout:ApplicationOptions.constance.NOTIFY_WARNING_TIMEOUT,pos:"top-center"}),!1;clearFocus();selectedSpatialObject=a;map.setView(b.marker.getLatLng(),17,{animate:!0});$("#objectInfo").find("#objectInfoId").html(selectedSpatialObject);b.marker.openPopup();toggled||($("#objectInfo").animate({width:"toggle"},100),
  toggled=!0);getAlertsHistory(a);b.drawPath();setTimeout(function(){createChart();chart.load({columns:[b.speedHistory.getArray()]})},100)}function clearFocus(){selectedSpatialObject&&(spatialObject=currentSpatialObjects[selectedSpatialObject],spatialObject.removePath(),spatialObject.marker.closePopup(),selectedSpatialObject=null)};
  