Commits

stefano cudini committed cbf515b Draft

resolve issue 44, circleLocation false

  • Participants
  • Parent commits 424eabd

Comments (0)

Files changed (12)

     [Line: 53] [low] //TODO important optimization!!! always append data in this._recordsCache
     [Line: 57] [low] //TODO here insert function that search inputText FIRST in _recordsCache keys and if not find results.. 
     [Line: 60] [low] //TODO change structure of _recordsCache
-    [Line: 345] [low] 		//TODO add option for case sesitive search, also showLocation
-    [Line: 348] [low] 		//TODO use .filter or .map
-    [Line: 410] [low] 		//TODO throw new Error("propertyName '"+propName+"' not found in JSON data");
-    [Line: 415] [low] 		//TODO remove script node after call run
-    [Line: 424] [low] 			//TODO add rnd param or randomize callback name! in recordsFromJsonp
-    [Line: 444] [low] 			//TODO add rnd param or randomize callback name! in recordsFromAjax			
-    [Line: 507] [low] 		//TODO implements autype without selection(useful for mobile device)
-    [Line: 607] [low] //TODO important optimization!!! always append data in this._recordsCache
-    [Line: 611] [low] //TODO here insert function that search inputText FIRST in _recordsCache keys and if not find results.. 
-    [Line: 614] [low] //TODO change structure of _recordsCache
-    [Line: 665] [low] 	    //TODO refact _handleAutoresize now is not accurate
-    [Line: 761] [low] 			//TODO showLocation: start animation after setView or panTo, maybe with map.on('moveend')...	
-    [Line: 845] [low] 	//TODO refact animate() more smooth! like this: http://goo.gl/DDlRs
-    [Line: 867] [low] 					//TODO use create event 'animateEnd' in SearchMarker 
+    [Line: 348] [low] 		//TODO add option for case sesitive search, also showLocation
+    [Line: 351] [low] 		//TODO use .filter or .map
+    [Line: 413] [low] 		//TODO throw new Error("propertyName '"+propName+"' not found in JSON data");
+    [Line: 418] [low] 		//TODO remove script node after call run
+    [Line: 427] [low] 			//TODO add rnd param or randomize callback name! in recordsFromJsonp
+    [Line: 447] [low] 			//TODO add rnd param or randomize callback name! in recordsFromAjax			
+    [Line: 510] [low] 		//TODO implements autype without selection(useful for mobile device)
+    [Line: 610] [low] //TODO important optimization!!! always append data in this._recordsCache
+    [Line: 614] [low] //TODO here insert function that search inputText FIRST in _recordsCache keys and if not find results.. 
+    [Line: 617] [low] //TODO change structure of _recordsCache
+    [Line: 668] [low] 	    //TODO refact _handleAutoresize now is not accurate
+    [Line: 764] [low] 			//TODO showLocation: start animation after setView or panTo, maybe with map.on('moveend')...	
+    [Line: 853] [low] 	//TODO refact animate() more smooth! like this: http://goo.gl/DDlRs
+    [Line: 877] [low] 						//TODO use create event 'animateEnd' in SearchMarker 
     [Line: 50] [med] //FIXME option condition problem {autoCollapse: true, markerLocation: true} not show location
     [Line: 51] [med] //FIXME option condition problem {autoCollapse: false }
-    [Line: 361] [med] 	//FIXME problem with jsonp/ajax when remote filter has different behavior of this._filterRecords
-    [Line: 734] [med] 				//FIXME if collapse in _handleSubmit hide _markerLoc!
-    [Line: 764] [med] 		//FIXME autoCollapse option hide this._markerLoc before that visualized!!
+    [Line: 364] [med] 	//FIXME problem with jsonp/ajax when remote filter has different behavior of this._filterRecords
+    [Line: 737] [med] 				//FIXME if collapse in _handleSubmit hide _markerLoc!
+    [Line: 767] [med] 		//FIXME autoCollapse option hide this._markerLoc before that visualized!!
 {
   "name": "leaflet-search",
-  "version": "1.5.3",
+  "version": "1.5.5",
   "main": "leaflet-search.js",
   "ignore": [
     "**/.*",

dist/leaflet-search.min.css

 /* 
- * Leaflet Control Search v1.5.3 - 2014-07-08 
+ * Leaflet Control Search v1.5.5 - 2014-08-09 
  * 
  * Copyright 2014 Stefano Cudini 
  * stefano.cudini@gmail.com 

dist/leaflet-search.min.js

 /* 
- * Leaflet Control Search v1.5.3 - 2014-07-08 
+ * Leaflet Control Search v1.5.5 - 2014-08-09 
  * 
  * Copyright 2014 Stefano Cudini 
  * stefano.cudini@gmail.com 
  * git@github.com:stefanocudini/leaflet-search.git 
  * 
  */
-(function(){L.Control.Search=L.Control.extend({includes:L.Mixin.Events,options:{wrapper:"",url:"",jsonpParam:null,layer:null,callData:null,propertyName:"title",propertyLoc:"loc",callTip:null,filterJSON:null,minLength:1,initial:!0,autoType:!0,delayType:400,tooltipLimit:-1,tipAutoSubmit:!0,autoResize:!0,collapsed:!0,autoCollapse:!1,autoCollapseTime:1200,zoom:null,text:"Search...",textCancel:"Cancel",textErr:"Location not found",position:"topleft",animateLocation:!0,circleLocation:!0,markerLocation:!1,markerIcon:new L.Icon.Default},initialize:function(a){L.Util.setOptions(this,a||{}),this._inputMinSize=this.options.text?this.options.text.length:10,this._layer=this.options.layer||new L.LayerGroup,this._filterJSON=this.options.filterJSON||this._defaultFilterJSON,this._autoTypeTmp=this.options.autoType,this._countertips=0,this._recordsCache={}},onAdd:function(b){return this._map=b,this._container=L.DomUtil.create("div","leaflet-control-search"),this._input=this._createInput(this.options.text,"search-input"),this._tooltip=this._createTooltip("search-tooltip"),this._cancel=this._createCancel(this.options.textCancel,"search-cancel"),this._button=this._createButton(this.options.text,"search-button"),this._alert=this._createAlert("search-alert"),this.options.collapsed===!1&&this.expand(),(this.options.circleLocation||this.options.markerLocation||this.options.markerIcon)&&(this._markerLoc=new a([0,0],{showMarker:this.options.markerLocation,icon:this.options.markerIcon})),this.setLayer(this._layer),b.on({resize:this._handleAutoresize},this),this._container},addTo:function(a){return this.options.wrapper?(this._container=this.onAdd(a),this._wrapper=L.DomUtil.get(this.options.wrapper),this._wrapper.style.position="relative",this._wrapper.appendChild(this._container)):L.Control.prototype.addTo.call(this,a),this},onRemove:function(){this._recordsCache={}},_getPath:function(a,b){var c=b.split("."),d=c.pop(),e=c.length,f=c[0],g=1;if(e>0)for(;(a=a[f])&&e>g;)f=c[g++];return a?a[d]:void 0},setLayer:function(a){return this._layer=a,this._layer.addTo(this._map),this._markerLoc&&this._layer.addLayer(this._markerLoc),this},showAlert:function(a){a=a||this.options.textErr,this._alert.style.display="block",this._alert.innerHTML=a,clearTimeout(this.timerAlert);var b=this;return this.timerAlert=setTimeout(function(){b.hideAlert()},this.options.autoCollapseTime),this},hideAlert:function(){return this._alert.style.display="none",this},cancel:function(){return this._input.value="",this._handleKeypress({keyCode:8}),this._input.size=this._inputMinSize,this._input.focus(),this._cancel.style.display="none",this},expand:function(){return this._input.style.display="block",L.DomUtil.addClass(this._container,"search-exp"),this._input.focus(),this._map.on("dragstart click",this.collapse,this),this},collapse:function(){return this._hideTooltip(),this.cancel(),this._alert.style.display="none",this._input.blur(),this.options.collapsed&&(this._input.style.display="none",this._cancel.style.display="none",L.DomUtil.removeClass(this._container,"search-exp"),this._map.off("dragstart click",this.collapse,this)),this.fire("search_collapsed"),this},collapseDelayed:function(){if(!this.options.autoCollapse)return this;var a=this;return clearTimeout(this.timerCollapse),this.timerCollapse=setTimeout(function(){a.collapse()},this.options.autoCollapseTime),this},collapseDelayedStop:function(){return clearTimeout(this.timerCollapse),this},_createAlert:function(a){var b=L.DomUtil.create("div",a,this._container);return b.style.display="none",L.DomEvent.on(b,"click",L.DomEvent.stop,this).on(b,"click",this.hideAlert,this),b},_createInput:function(a,b){var c=L.DomUtil.create("input",b,this._container);return c.type="text",c.size=this._inputMinSize,c.value="",c.autocomplete="off",c.placeholder=a,c.style.display="none",L.DomEvent.disableClickPropagation(c).on(c,"keyup",this._handleKeypress,this).on(c,"keydown",this._handleAutoresize,this).on(c,"blur",this.collapseDelayed,this).on(c,"focus",this.collapseDelayedStop,this),c},_createCancel:function(a,b){var c=L.DomUtil.create("a",b,this._container);return c.href="#",c.title=a,c.style.display="none",c.innerHTML="<span>&otimes;</span>",L.DomEvent.on(c,"click",L.DomEvent.stop,this).on(c,"click",this.cancel,this),c},_createButton:function(a,b){var c=L.DomUtil.create("a",b,this._container);return c.href="#",c.title=a,L.DomEvent.on(c,"click",L.DomEvent.stop,this).on(c,"click",this._handleSubmit,this).on(c,"focus",this.collapseDelayedStop,this).on(c,"blur",this.collapseDelayed,this),c},_createTooltip:function(a){var b=L.DomUtil.create("div",a,this._container);b.style.display="none";var c=this;return L.DomEvent.disableClickPropagation(b).on(b,"blur",this.collapseDelayed,this).on(b,"mousewheel",function(a){c.collapseDelayedStop(),L.DomEvent.stopPropagation(a)},this).on(b,"mouseover",function(){c.collapseDelayedStop()},this),b},_createTip:function(a,b){var c;if(this.options.callTip){if(c=this.options.callTip(a,b),"string"==typeof c){var d=L.DomUtil.create("div");d.innerHTML=c,c=d.firstChild}}else c=L.DomUtil.create("a",""),c.href="#",c.innerHTML=a;return L.DomUtil.addClass(c,"search-tip"),c._text=a,L.DomEvent.disableClickPropagation(c).on(c,"click",L.DomEvent.stop,this).on(c,"click",function(){this._input.value=a,this._handleAutoresize(),this._input.focus(),this._hideTooltip(),this.options.tipAutoSubmit&&this._handleSubmit()},this),c},_filterRecords:function(a){var b,c,d=new RegExp("^[.]$|[[]|()*]","g"),e={};a=a.replace(d,""),b=this.options.initial?"^":"",c=new RegExp(b+a,"i");for(var f in this._recordsCache)c.test(f)&&(e[f]=this._recordsCache[f]);return e},showTooltip:function(){var a,b;this._countertips=0,a=this.options.layer?this._filterRecords(this._input.value):this._recordsCache,this._tooltip.innerHTML="",this._tooltip.currentSelection=-1;for(var c in a){if(++this._countertips==this.options.tooltipLimit)break;b=this._createTip(c,a[c]),this._tooltip.appendChild(b)}return this._countertips>0?(this._tooltip.style.display="block",this._autoTypeTmp&&this._autoType(),this._autoTypeTmp=this.options.autoType):this._hideTooltip(),this._tooltip.scrollTop=0,this._countertips},_hideTooltip:function(){return this._tooltip.style.display="none",this._tooltip.innerHTML="",0},_defaultFilterJSON:function(a){var b,c={},d=this.options.propertyName,e=this.options.propertyLoc;if(L.Util.isArray(e))for(b in a)c[this._getPath(a[b],d)]=L.latLng(a[b][e[0]],a[b][e[1]]);else for(b in a)c[this._getPath(a[b],d)]=L.latLng(this._getPath(a[b],e));return c},_recordsFromJsonp:function(a,b){var c=this;L.Control.Search.callJsonp=function(a){var d=c._filterJSON(a);b(d)};var d=L.DomUtil.create("script","search-jsonp",document.getElementsByTagName("body")[0]),e=L.Util.template(this.options.url+"&"+this.options.jsonpParam+"=L.Control.Search.callJsonp",{s:a});return d.type="text/javascript",d.src=e,this},_recordsFromAjax:function(a,b){void 0===window.XMLHttpRequest&&(window.XMLHttpRequest=function(){try{return new ActiveXObject("Microsoft.XMLHTTP.6.0")}catch(a){try{return new ActiveXObject("Microsoft.XMLHTTP.3.0")}catch(b){throw new Error("XMLHttpRequest is not supported")}}});var c=new XMLHttpRequest,d=L.Util.template(this.options.url,{s:a}),e={};c.open("GET",d);var f=this;return c.onreadystatechange=function(){if(4===c.readyState&&200===c.status){e=JSON.parse(c.responseText);var a=f._filterJSON(e);b(a)}},c.send(),this},_recordsFromLayer:function(){var b,c=this,d={},e=this.options.propertyName;return this._layer.eachLayer(function(f){f instanceof a||(f instanceof L.Marker?c._getPath(f.options,e)?(b=f.getLatLng(),b.layer=f,d[c._getPath(f.options,e)]=b):c._getPath(f.feature.properties,e)?(b=f.getLatLng(),b.layer=f,d[c._getPath(f.feature.properties,e)]=b):console.log("propertyName '"+e+"' not found in marker",f):f.hasOwnProperty("feature")&&(f.feature.properties.hasOwnProperty(e)?(b=f.getBounds().getCenter(),b.layer=f,d[f.feature.properties[e]]=b):console.log("propertyName '"+e+"' not found in feature",f)))},this),d},_autoType:function(){var a=this._input.value.length,b=this._tooltip.firstChild._text,c=b.length;if(0===b.indexOf(this._input.value))if(this._input.value=b,this._handleAutoresize(),this._input.createTextRange){var d=this._input.createTextRange();d.collapse(!0),d.moveStart("character",a),d.moveEnd("character",c),d.select()}else this._input.setSelectionRange?this._input.setSelectionRange(a,c):this._input.selectionStart&&(this._input.selectionStart=a,this._input.selectionEnd=c)},_hideAutoType:function(){var a;if((a=this._input.selection)&&a.empty)a.empty();else if(this._input.createTextRange){a=this._input.createTextRange(),a.collapse(!0);var b=this._input.value.length;a.moveStart("character",b),a.moveEnd("character",b),a.select()}else this._input.getSelection&&this._input.getSelection().removeAllRanges(),this._input.selectionStart=this._input.selectionEnd},_handleKeypress:function(a){switch(a.keyCode){case 27:this.collapse();break;case 13:1==this._countertips&&this._handleArrowSelect(1),this._handleSubmit();break;case 38:this._handleArrowSelect(-1);break;case 40:this._handleArrowSelect(1);break;case 37:case 39:case 16:case 17:break;case 8:case 46:this._autoTypeTmp=!1;break;default:if(this._cancel.style.display=this._input.value.length?"block":"none",this._input.value.length>=this.options.minLength){var b=this;clearTimeout(this.timerKeypress),this.timerKeypress=setTimeout(function(){b._fillRecordsCache()},this.options.delayType)}else this._hideTooltip()}},_fillRecordsCache:function(){var a,b=this._input.value;L.DomUtil.addClass(this._container,"search-load"),this.options.callData?(a=this,this.options.callData(b,function(b){a._recordsCache=a._filterJSON(b),a.showTooltip(),L.DomUtil.removeClass(a._container,"search-load")})):this.options.url?this.options.jsonpParam?(a=this,this._recordsFromJsonp(b,function(b){a._recordsCache=b,a.showTooltip(),L.DomUtil.removeClass(a._container,"search-load")})):(a=this,this._recordsFromAjax(b,function(b){a._recordsCache=b,a.showTooltip(),L.DomUtil.removeClass(a._container,"search-load")})):this.options.layer&&(this._recordsCache=this._recordsFromLayer(),this.showTooltip(),L.DomUtil.removeClass(this._container,"search-load"))},_handleAutoresize:function(){this._input.style.maxWidth!=this._map._container.offsetWidth&&(this._input.style.maxWidth=L.DomUtil.getStyle(this._map._container,"width")),this.options.autoResize&&this._container.offsetWidth+45<this._map._container.offsetWidth&&(this._input.size=this._input.value.length<this._inputMinSize?this._inputMinSize:this._input.value.length)},_handleArrowSelect:function(a){var b=this._tooltip.hasChildNodes()?this._tooltip.childNodes:[];for(i=0;i<b.length;i++)L.DomUtil.removeClass(b[i],"search-tip-select");if(1==a&&this._tooltip.currentSelection>=b.length-1)L.DomUtil.addClass(b[this._tooltip.currentSelection],"search-tip-select");else if(-1==a&&this._tooltip.currentSelection<=0)this._tooltip.currentSelection=-1;else if("none"!=this._tooltip.style.display){this._tooltip.currentSelection+=a,L.DomUtil.addClass(b[this._tooltip.currentSelection],"search-tip-select"),this._input.value=b[this._tooltip.currentSelection]._text;var c=b[this._tooltip.currentSelection].offsetTop;c+b[this._tooltip.currentSelection].clientHeight>=this._tooltip.scrollTop+this._tooltip.clientHeight?this._tooltip.scrollTop=c-this._tooltip.clientHeight+b[this._tooltip.currentSelection].clientHeight:c<=this._tooltip.scrollTop&&(this._tooltip.scrollTop=c)}},_handleSubmit:function(){if(this._hideAutoType(),this.hideAlert(),this._hideTooltip(),"none"==this._input.style.display)this.expand();else if(""===this._input.value)this.collapse();else{var a=this._getLocation(this._input.value);a===!1?this.showAlert():(this.showLocation(a,this._input.value),this.fire("search_locationfound",{latlng:a,text:this._input.value,layer:a.layer?a.layer:null}))}},_getLocation:function(a){return this._recordsCache.hasOwnProperty(a)?this._recordsCache[a]:!1},showLocation:function(a,b){return this.options.zoom?this._map.setView(a,this.options.zoom):this._map.panTo(a),this._markerLoc&&(this._markerLoc.setLatLng(a),this._markerLoc.setTitle(b),this._markerLoc.show(),this.options.animateLocation&&this._markerLoc.animate()),this.options.autoCollapse&&this.collapse(),this}});var a=L.Marker.extend({includes:L.Mixin.Events,options:{radius:10,weight:3,color:"#e03",stroke:!0,fill:!1,title:"",icon:new L.Icon.Default,showMarker:!1},initialize:function(a,b){L.setOptions(this,b),L.Marker.prototype.initialize.call(this,a,b),this._circleLoc=new L.CircleMarker(a,this.options)},onAdd:function(a){L.Marker.prototype.onAdd.call(this,a),a.addLayer(this._circleLoc),this.hide()},onRemove:function(a){L.Marker.prototype.onRemove.call(this,a),a.removeLayer(this._circleLoc)},setLatLng:function(a){return L.Marker.prototype.setLatLng.call(this,a),this._circleLoc.setLatLng(a),this},setTitle:function(a){return a=a||"",this.options.title=a,this._icon&&(this._icon.title=a),this},show:function(){return this.options.showMarker&&(this._icon&&(this._icon.style.display="block"),this._shadow&&(this._shadow.style.display="block")),this._circleLoc&&this._circleLoc.setStyle({fill:this.options.fill,stroke:this.options.stroke}),this},hide:function(){return this._icon&&(this._icon.style.display="none"),this._shadow&&(this._shadow.style.display="none"),this._circleLoc&&this._circleLoc.setStyle({fill:!1,stroke:!1}),this},animate:function(){var a=this._circleLoc,b=200,c=10,d=parseInt(a._radius/c),e=this.options.radius,f=2.5*a._radius,g=0;return a._timerAnimLoc=setInterval(function(){g+=.5,d+=g,f-=d,a.setRadius(f),e>f&&(clearInterval(a._timerAnimLoc),a.setRadius(e))},b),this}});L.Map.addInitHook(function(){this.options.searchControl&&(this.searchControl=L.control.search(this.options.searchControl),this.addControl(this.searchControl))}),L.control.search=function(a){return new L.Control.Search(a)}}).call(this);
+(function(){L.Control.Search=L.Control.extend({includes:L.Mixin.Events,options:{wrapper:"",url:"",jsonpParam:null,layer:null,callData:null,propertyName:"title",propertyLoc:"loc",callTip:null,filterJSON:null,minLength:1,initial:!0,autoType:!0,delayType:400,tooltipLimit:-1,tipAutoSubmit:!0,autoResize:!0,collapsed:!0,autoCollapse:!1,autoCollapseTime:1200,zoom:null,text:"Search...",textCancel:"Cancel",textErr:"Location not found",position:"topleft",animateLocation:!0,circleLocation:!0,markerLocation:!1,markerIcon:new L.Icon.Default},initialize:function(a){L.Util.setOptions(this,a||{}),this._inputMinSize=this.options.text?this.options.text.length:10,this._layer=this.options.layer||new L.LayerGroup,this._filterJSON=this.options.filterJSON||this._defaultFilterJSON,this._autoTypeTmp=this.options.autoType,this._countertips=0,this._recordsCache={}},onAdd:function(b){return this._map=b,this._container=L.DomUtil.create("div","leaflet-control-search"),this._input=this._createInput(this.options.text,"search-input"),this._tooltip=this._createTooltip("search-tooltip"),this._cancel=this._createCancel(this.options.textCancel,"search-cancel"),this._button=this._createButton(this.options.text,"search-button"),this._alert=this._createAlert("search-alert"),this.options.collapsed===!1&&this.expand(),(this.options.circleLocation||this.options.markerLocation||this.options.markerIcon)&&(this._markerLoc=new a([0,0],{showCircle:this.options.circleLocation,showMarker:this.options.markerLocation,icon:this.options.markerIcon})),this.setLayer(this._layer),b.on({resize:this._handleAutoresize},this),this._container},addTo:function(a){return this.options.wrapper?(this._container=this.onAdd(a),this._wrapper=L.DomUtil.get(this.options.wrapper),this._wrapper.style.position="relative",this._wrapper.appendChild(this._container)):L.Control.prototype.addTo.call(this,a),this},onRemove:function(){this._recordsCache={}},_getPath:function(a,b){var c=b.split("."),d=c.pop(),e=c.length,f=c[0],g=1;if(e>0)for(;(a=a[f])&&e>g;)f=c[g++];return a?a[d]:void 0},setLayer:function(a){return this._layer=a,this._layer.addTo(this._map),this._markerLoc&&this._layer.addLayer(this._markerLoc),this},showAlert:function(a){a=a||this.options.textErr,this._alert.style.display="block",this._alert.innerHTML=a,clearTimeout(this.timerAlert);var b=this;return this.timerAlert=setTimeout(function(){b.hideAlert()},this.options.autoCollapseTime),this},hideAlert:function(){return this._alert.style.display="none",this},cancel:function(){return this._input.value="",this._handleKeypress({keyCode:8}),this._input.size=this._inputMinSize,this._input.focus(),this._cancel.style.display="none",this},expand:function(){return this._input.style.display="block",L.DomUtil.addClass(this._container,"search-exp"),this._input.focus(),this._map.on("dragstart click",this.collapse,this),this},collapse:function(){return this._hideTooltip(),this.cancel(),this._alert.style.display="none",this._input.blur(),this.options.collapsed&&(this._input.style.display="none",this._cancel.style.display="none",L.DomUtil.removeClass(this._container,"search-exp"),this._map.off("dragstart click",this.collapse,this)),this.fire("search_collapsed"),this},collapseDelayed:function(){if(!this.options.autoCollapse)return this;var a=this;return clearTimeout(this.timerCollapse),this.timerCollapse=setTimeout(function(){a.collapse()},this.options.autoCollapseTime),this},collapseDelayedStop:function(){return clearTimeout(this.timerCollapse),this},_createAlert:function(a){var b=L.DomUtil.create("div",a,this._container);return b.style.display="none",L.DomEvent.on(b,"click",L.DomEvent.stop,this).on(b,"click",this.hideAlert,this),b},_createInput:function(a,b){var c=L.DomUtil.create("input",b,this._container);return c.type="text",c.size=this._inputMinSize,c.value="",c.autocomplete="off",c.autocorrect="off",c.autocapitalize="off",c.placeholder=a,c.style.display="none",L.DomEvent.disableClickPropagation(c).on(c,"keyup",this._handleKeypress,this).on(c,"keydown",this._handleAutoresize,this).on(c,"blur",this.collapseDelayed,this).on(c,"focus",this.collapseDelayedStop,this),c},_createCancel:function(a,b){var c=L.DomUtil.create("a",b,this._container);return c.href="#",c.title=a,c.style.display="none",c.innerHTML="<span>&otimes;</span>",L.DomEvent.on(c,"click",L.DomEvent.stop,this).on(c,"click",this.cancel,this),c},_createButton:function(a,b){var c=L.DomUtil.create("a",b,this._container);return c.href="#",c.title=a,L.DomEvent.on(c,"click",L.DomEvent.stop,this).on(c,"click",this._handleSubmit,this).on(c,"focus",this.collapseDelayedStop,this).on(c,"blur",this.collapseDelayed,this),c},_createTooltip:function(a){var b=L.DomUtil.create("div",a,this._container);b.style.display="none";var c=this;return L.DomEvent.disableClickPropagation(b).on(b,"blur",this.collapseDelayed,this).on(b,"mousewheel",function(a){c.collapseDelayedStop(),L.DomEvent.stopPropagation(a)},this).on(b,"mouseover",function(){c.collapseDelayedStop()},this),b},_createTip:function(a,b){var c;if(this.options.callTip){if(c=this.options.callTip(a,b),"string"==typeof c){var d=L.DomUtil.create("div");d.innerHTML=c,c=d.firstChild}}else c=L.DomUtil.create("a",""),c.href="#",c.innerHTML=a;return L.DomUtil.addClass(c,"search-tip"),c._text=a,L.DomEvent.disableClickPropagation(c).on(c,"click",L.DomEvent.stop,this).on(c,"click",function(){this._input.value=a,this._handleAutoresize(),this._input.focus(),this._hideTooltip(),this.options.tipAutoSubmit&&this._handleSubmit()},this),c},_filterRecords:function(a){var b,c,d=new RegExp("^[.]$|[[]|()*]","g"),e={};a=a.replace(d,""),b=this.options.initial?"^":"",c=new RegExp(b+a,"i");for(var f in this._recordsCache)c.test(f)&&(e[f]=this._recordsCache[f]);return e},showTooltip:function(){var a,b;this._countertips=0,a=this.options.layer?this._filterRecords(this._input.value):this._recordsCache,this._tooltip.innerHTML="",this._tooltip.currentSelection=-1;for(var c in a){if(++this._countertips==this.options.tooltipLimit)break;b=this._createTip(c,a[c]),this._tooltip.appendChild(b)}return this._countertips>0?(this._tooltip.style.display="block",this._autoTypeTmp&&this._autoType(),this._autoTypeTmp=this.options.autoType):this._hideTooltip(),this._tooltip.scrollTop=0,this._countertips},_hideTooltip:function(){return this._tooltip.style.display="none",this._tooltip.innerHTML="",0},_defaultFilterJSON:function(a){var b,c={},d=this.options.propertyName,e=this.options.propertyLoc;if(L.Util.isArray(e))for(b in a)c[this._getPath(a[b],d)]=L.latLng(a[b][e[0]],a[b][e[1]]);else for(b in a)c[this._getPath(a[b],d)]=L.latLng(this._getPath(a[b],e));return c},_recordsFromJsonp:function(a,b){var c=this;L.Control.Search.callJsonp=function(a){var d=c._filterJSON(a);b(d)};var d=L.DomUtil.create("script","search-jsonp",document.getElementsByTagName("body")[0]),e=L.Util.template(this.options.url+"&"+this.options.jsonpParam+"=L.Control.Search.callJsonp",{s:a});return d.type="text/javascript",d.src=e,this},_recordsFromAjax:function(a,b){void 0===window.XMLHttpRequest&&(window.XMLHttpRequest=function(){try{return new ActiveXObject("Microsoft.XMLHTTP.6.0")}catch(a){try{return new ActiveXObject("Microsoft.XMLHTTP.3.0")}catch(b){throw new Error("XMLHttpRequest is not supported")}}});var c=new XMLHttpRequest,d=L.Util.template(this.options.url,{s:a}),e={};c.open("GET",d);var f=this;return c.onreadystatechange=function(){if(4===c.readyState&&200===c.status){e=JSON.parse(c.responseText);var a=f._filterJSON(e);b(a)}},c.send(),this},_recordsFromLayer:function(){var b,c=this,d={},e=this.options.propertyName;return this._layer.eachLayer(function(f){f instanceof a||(f instanceof L.Marker?c._getPath(f.options,e)?(b=f.getLatLng(),b.layer=f,d[c._getPath(f.options,e)]=b):c._getPath(f.feature.properties,e)?(b=f.getLatLng(),b.layer=f,d[c._getPath(f.feature.properties,e)]=b):console.log("propertyName '"+e+"' not found in marker",f):f.hasOwnProperty("feature")&&(f.feature.properties.hasOwnProperty(e)?(b=f.getBounds().getCenter(),b.layer=f,d[f.feature.properties[e]]=b):console.log("propertyName '"+e+"' not found in feature",f)))},this),d},_autoType:function(){var a=this._input.value.length,b=this._tooltip.firstChild._text,c=b.length;if(0===b.indexOf(this._input.value))if(this._input.value=b,this._handleAutoresize(),this._input.createTextRange){var d=this._input.createTextRange();d.collapse(!0),d.moveStart("character",a),d.moveEnd("character",c),d.select()}else this._input.setSelectionRange?this._input.setSelectionRange(a,c):this._input.selectionStart&&(this._input.selectionStart=a,this._input.selectionEnd=c)},_hideAutoType:function(){var a;if((a=this._input.selection)&&a.empty)a.empty();else if(this._input.createTextRange){a=this._input.createTextRange(),a.collapse(!0);var b=this._input.value.length;a.moveStart("character",b),a.moveEnd("character",b),a.select()}else this._input.getSelection&&this._input.getSelection().removeAllRanges(),this._input.selectionStart=this._input.selectionEnd},_handleKeypress:function(a){switch(a.keyCode){case 27:this.collapse();break;case 13:1==this._countertips&&this._handleArrowSelect(1),this._handleSubmit();break;case 38:this._handleArrowSelect(-1);break;case 40:this._handleArrowSelect(1);break;case 37:case 39:case 16:case 17:break;case 8:case 46:this._autoTypeTmp=!1;break;default:if(this._cancel.style.display=this._input.value.length?"block":"none",this._input.value.length>=this.options.minLength){var b=this;clearTimeout(this.timerKeypress),this.timerKeypress=setTimeout(function(){b._fillRecordsCache()},this.options.delayType)}else this._hideTooltip()}},_fillRecordsCache:function(){var a,b=this._input.value;L.DomUtil.addClass(this._container,"search-load"),this.options.callData?(a=this,this.options.callData(b,function(b){a._recordsCache=a._filterJSON(b),a.showTooltip(),L.DomUtil.removeClass(a._container,"search-load")})):this.options.url?this.options.jsonpParam?(a=this,this._recordsFromJsonp(b,function(b){a._recordsCache=b,a.showTooltip(),L.DomUtil.removeClass(a._container,"search-load")})):(a=this,this._recordsFromAjax(b,function(b){a._recordsCache=b,a.showTooltip(),L.DomUtil.removeClass(a._container,"search-load")})):this.options.layer&&(this._recordsCache=this._recordsFromLayer(),this.showTooltip(),L.DomUtil.removeClass(this._container,"search-load"))},_handleAutoresize:function(){this._input.style.maxWidth!=this._map._container.offsetWidth&&(this._input.style.maxWidth=L.DomUtil.getStyle(this._map._container,"width")),this.options.autoResize&&this._container.offsetWidth+45<this._map._container.offsetWidth&&(this._input.size=this._input.value.length<this._inputMinSize?this._inputMinSize:this._input.value.length)},_handleArrowSelect:function(a){var b=this._tooltip.hasChildNodes()?this._tooltip.childNodes:[];for(i=0;i<b.length;i++)L.DomUtil.removeClass(b[i],"search-tip-select");if(1==a&&this._tooltip.currentSelection>=b.length-1)L.DomUtil.addClass(b[this._tooltip.currentSelection],"search-tip-select");else if(-1==a&&this._tooltip.currentSelection<=0)this._tooltip.currentSelection=-1;else if("none"!=this._tooltip.style.display){this._tooltip.currentSelection+=a,L.DomUtil.addClass(b[this._tooltip.currentSelection],"search-tip-select"),this._input.value=b[this._tooltip.currentSelection]._text;var c=b[this._tooltip.currentSelection].offsetTop;c+b[this._tooltip.currentSelection].clientHeight>=this._tooltip.scrollTop+this._tooltip.clientHeight?this._tooltip.scrollTop=c-this._tooltip.clientHeight+b[this._tooltip.currentSelection].clientHeight:c<=this._tooltip.scrollTop&&(this._tooltip.scrollTop=c)}},_handleSubmit:function(){if(this._hideAutoType(),this.hideAlert(),this._hideTooltip(),"none"==this._input.style.display)this.expand();else if(""===this._input.value)this.collapse();else{var a=this._getLocation(this._input.value);a===!1?this.showAlert():(this.showLocation(a,this._input.value),this.fire("search_locationfound",{latlng:a,text:this._input.value,layer:a.layer?a.layer:null}))}},_getLocation:function(a){return this._recordsCache.hasOwnProperty(a)?this._recordsCache[a]:!1},showLocation:function(a,b){return this.options.zoom?this._map.setView(a,this.options.zoom):this._map.panTo(a),this._markerLoc&&(this._markerLoc.setLatLng(a),this._markerLoc.setTitle(b),this._markerLoc.show(),this.options.animateLocation&&this._markerLoc.animate()),this.options.autoCollapse&&this.collapse(),this}});var a=L.Marker.extend({includes:L.Mixin.Events,options:{radius:10,weight:3,color:"#e03",stroke:!0,fill:!1,title:"",icon:new L.Icon.Default,showCircle:!0,showMarker:!1},initialize:function(a,b){L.setOptions(this,b),L.Marker.prototype.initialize.call(this,a,b),this.options.showCircle&&(this._circleLoc=new L.CircleMarker(a,this.options))},onAdd:function(a){L.Marker.prototype.onAdd.call(this,a),this._circleLoc&&a.addLayer(this._circleLoc),this.hide()},onRemove:function(a){L.Marker.prototype.onRemove.call(this,a),this._circleLoc&&a.removeLayer(this._circleLoc)},setLatLng:function(a){return L.Marker.prototype.setLatLng.call(this,a),this._circleLoc&&this._circleLoc.setLatLng(a),this},setTitle:function(a){return a=a||"",this.options.title=a,this._icon&&(this._icon.title=a),this},show:function(){return this.options.showMarker&&(this._icon&&(this._icon.style.display="block"),this._shadow&&(this._shadow.style.display="block")),this._circleLoc&&this._circleLoc.setStyle({fill:this.options.fill,stroke:this.options.stroke}),this},hide:function(){return this._icon&&(this._icon.style.display="none"),this._shadow&&(this._shadow.style.display="none"),this._circleLoc&&this._circleLoc.setStyle({fill:!1,stroke:!1}),this},animate:function(){if(this._circleLoc){var a=this._circleLoc,b=200,c=10,d=parseInt(a._radius/c),e=this.options.radius,f=2.5*a._radius,g=0;a._timerAnimLoc=setInterval(function(){g+=.5,d+=g,f-=d,a.setRadius(f),e>f&&(clearInterval(a._timerAnimLoc),a.setRadius(e))},b)}return this}});L.Map.addInitHook(function(){this.options.searchControl&&(this.searchControl=L.control.search(this.options.searchControl),this.addControl(this.searchControl))}),L.control.search=function(a){return new L.Control.Search(a)}}).call(this);

dist/leaflet-search.mobile.min.css

 /* 
- * Leaflet Control Search v1.5.3 - 2014-07-08 
+ * Leaflet Control Search v1.5.5 - 2014-08-09 
  * 
  * Copyright 2014 Stefano Cudini 
  * stefano.cudini@gmail.com 

dist/leaflet-search.mobile.src.css

 /* 
- * Leaflet Control Search v1.5.3 - 2014-07-08 
+ * Leaflet Control Search v1.5.5 - 2014-08-09 
  * 
  * Copyright 2014 Stefano Cudini 
  * stefano.cudini@gmail.com 

dist/leaflet-search.src.css

 /* 
- * Leaflet Control Search v1.5.3 - 2014-07-08 
+ * Leaflet Control Search v1.5.5 - 2014-08-09 
  * 
  * Copyright 2014 Stefano Cudini 
  * stefano.cudini@gmail.com 

dist/leaflet-search.src.js

 /* 
- * Leaflet Control Search v1.5.3 - 2014-07-08 
+ * Leaflet Control Search v1.5.5 - 2014-08-09 
  * 
  * Copyright 2014 Stefano Cudini 
  * stefano.cudini@gmail.com 
 
 		if(this.options.circleLocation || this.options.markerLocation || this.options.markerIcon)
 			this._markerLoc = new SearchMarker([0,0], {
+					showCircle: this.options.circleLocation,
 					showMarker: this.options.markerLocation,
 					icon: this.options.markerIcon
 				});//see below
 		input.size = this._inputMinSize;
 		input.value = '';
 		input.autocomplete = 'off';
+		input.autocorrect = 'off';
+		input.autocapitalize = 'off';
 		input.placeholder = text;
 		input.style.display = 'none';
 		
 		fill: false,
 		title: '',
 		icon: new L.Icon.Default(),
+		showCircle: true,
 		showMarker: false	//show icon optional, show only circleLoc
 	},
 	
 	initialize: function (latlng, options) {
 		L.setOptions(this, options);
 		L.Marker.prototype.initialize.call(this, latlng, options);
-		this._circleLoc = new L.CircleMarker(latlng, this.options);
+		if(this.options.showCircle)
+			this._circleLoc =  new L.CircleMarker(latlng, this.options);
 	},
 
 	onAdd: function (map) {
 		L.Marker.prototype.onAdd.call(this, map);
-		map.addLayer(this._circleLoc);
+		if(this._circleLoc)
+			map.addLayer(this._circleLoc);
 		this.hide();
 	},
 
 	onRemove: function (map) {
 		L.Marker.prototype.onRemove.call(this, map);
-		map.removeLayer(this._circleLoc);
+		if(this._circleLoc)
+			map.removeLayer(this._circleLoc);
 	},	
 	
 	setLatLng: function (latlng) {
 		L.Marker.prototype.setLatLng.call(this, latlng);
-		this._circleLoc.setLatLng(latlng);
+		if(this._circleLoc)
+			this._circleLoc.setLatLng(latlng);
 		return this;
 	},
 	
 
 	animate: function() {
 	//TODO refact animate() more smooth! like this: http://goo.gl/DDlRs
-		var circle = this._circleLoc,
-			tInt = 200,	//time interval
-			ss = 10,	//frames
-			mr = parseInt(circle._radius/ss),
-			oldrad = this.options.radius,
-			newrad = circle._radius * 2.5,
-			acc = 0;
+		if(this._circleLoc)
+		{
+			var circle = this._circleLoc,
+				tInt = 200,	//time interval
+				ss = 10,	//frames
+				mr = parseInt(circle._radius/ss),
+				oldrad = this.options.radius,
+				newrad = circle._radius * 2.5,
+				acc = 0;
 
-		circle._timerAnimLoc = setInterval(function() {
-			acc += 0.5;
-			mr += acc;	//adding acceleration
-			newrad -= mr;
-			
-			circle.setRadius(newrad);
+			circle._timerAnimLoc = setInterval(function() {
+				acc += 0.5;
+				mr += acc;	//adding acceleration
+				newrad -= mr;
+				
+				circle.setRadius(newrad);
 
-			if(newrad<oldrad)
-			{
-				clearInterval(circle._timerAnimLoc);
-				circle.setRadius(oldrad);//reset radius
-				//if(typeof afterAnimCall == 'function')
-					//afterAnimCall();
-					//TODO use create event 'animateEnd' in SearchMarker 
-			}
-		}, tInt);
+				if(newrad<oldrad)
+				{
+					clearInterval(circle._timerAnimLoc);
+					circle.setRadius(oldrad);//reset radius
+					//if(typeof afterAnimCall == 'function')
+						//afterAnimCall();
+						//TODO use create event 'animateEnd' in SearchMarker 
+				}
+			}, tInt);
+		}
 		
 		return this;
 	}

examples/nominatim.html

 			jsonpParam: 'json_callback',
 			propertyName: 'display_name',
 			propertyLoc: ['lat','lon'],
-			markerLocation: true,
+			circleLocation: false,
+			markerLocation: false,			
 			autoType: false,
 			autoCollapse: true,
 			minLength: 2,
 {
   "name": "leaflet-search",
-  "version": "1.5.3",
+  "version": "1.5.5",
   "description": "Leaflet Control for searching markers/features by attribute on map or remote searching in jsonp/ajax",
   "repository": {
     "type": "git",
 {
 	"name": "leaflet-search",
-	"version": "1.5.3",
+	"version": "1.5.5",
 	"description": "Leaflet Control for searching markers/features by attribute on map or remote searching in jsonp/ajax",
 	"homepage": "http://labs.easyblog.it/maps/leaflet-search/",
 	"author": "Stefano Cudini <stefano.cudini@gmail.com>",

src/leaflet-search.js

 
 		if(this.options.circleLocation || this.options.markerLocation || this.options.markerIcon)
 			this._markerLoc = new SearchMarker([0,0], {
+					showCircle: this.options.circleLocation,
 					showMarker: this.options.markerLocation,
 					icon: this.options.markerIcon
 				});//see below
 		input.size = this._inputMinSize;
 		input.value = '';
 		input.autocomplete = 'off';
+		input.autocorrect = 'off';
+		input.autocapitalize = 'off';
 		input.placeholder = text;
 		input.style.display = 'none';
 		
 		fill: false,
 		title: '',
 		icon: new L.Icon.Default(),
+		showCircle: true,
 		showMarker: false	//show icon optional, show only circleLoc
 	},
 	
 	initialize: function (latlng, options) {
 		L.setOptions(this, options);
 		L.Marker.prototype.initialize.call(this, latlng, options);
-		this._circleLoc = new L.CircleMarker(latlng, this.options);
+		if(this.options.showCircle)
+			this._circleLoc =  new L.CircleMarker(latlng, this.options);
 	},
 
 	onAdd: function (map) {
 		L.Marker.prototype.onAdd.call(this, map);
-		map.addLayer(this._circleLoc);
+		if(this._circleLoc)
+			map.addLayer(this._circleLoc);
 		this.hide();
 	},
 
 	onRemove: function (map) {
 		L.Marker.prototype.onRemove.call(this, map);
-		map.removeLayer(this._circleLoc);
+		if(this._circleLoc)
+			map.removeLayer(this._circleLoc);
 	},	
 	
 	setLatLng: function (latlng) {
 		L.Marker.prototype.setLatLng.call(this, latlng);
-		this._circleLoc.setLatLng(latlng);
+		if(this._circleLoc)
+			this._circleLoc.setLatLng(latlng);
 		return this;
 	},
 	
 
 	animate: function() {
 	//TODO refact animate() more smooth! like this: http://goo.gl/DDlRs
-		var circle = this._circleLoc,
-			tInt = 200,	//time interval
-			ss = 10,	//frames
-			mr = parseInt(circle._radius/ss),
-			oldrad = this.options.radius,
-			newrad = circle._radius * 2.5,
-			acc = 0;
+		if(this._circleLoc)
+		{
+			var circle = this._circleLoc,
+				tInt = 200,	//time interval
+				ss = 10,	//frames
+				mr = parseInt(circle._radius/ss),
+				oldrad = this.options.radius,
+				newrad = circle._radius * 2.5,
+				acc = 0;
 
-		circle._timerAnimLoc = setInterval(function() {
-			acc += 0.5;
-			mr += acc;	//adding acceleration
-			newrad -= mr;
-			
-			circle.setRadius(newrad);
+			circle._timerAnimLoc = setInterval(function() {
+				acc += 0.5;
+				mr += acc;	//adding acceleration
+				newrad -= mr;
+				
+				circle.setRadius(newrad);
 
-			if(newrad<oldrad)
-			{
-				clearInterval(circle._timerAnimLoc);
-				circle.setRadius(oldrad);//reset radius
-				//if(typeof afterAnimCall == 'function')
-					//afterAnimCall();
-					//TODO use create event 'animateEnd' in SearchMarker 
-			}
-		}, tInt);
+				if(newrad<oldrad)
+				{
+					clearInterval(circle._timerAnimLoc);
+					circle.setRadius(oldrad);//reset radius
+					//if(typeof afterAnimCall == 'function')
+						//afterAnimCall();
+						//TODO use create event 'animateEnd' in SearchMarker 
+				}
+			}, tInt);
+		}
 		
 		return this;
 	}