Skip to content

Commit

Permalink
Merge pull request #58 from jonataswalker/v2.3.0
Browse files Browse the repository at this point in the history
Release v2.3.0
  • Loading branch information
jonataswalker authored Aug 15, 2016
2 parents c29d18c + 5fa51d1 commit e29e65b
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 24 deletions.
52 changes: 36 additions & 16 deletions build/ol3-geocoder-debug.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* A geocoder extension for OpenLayers 3.
* https://github.com/jonataswalker/ol3-geocoder
* Version: v2.2.0
* Built: 2016-07-29T12:53:37-03:00
* Version: v2.3.0
* Built: 2016-08-15T11:57:59-03:00
*/

(function (global, factory) {
Expand Down Expand Up @@ -81,6 +81,8 @@
limit: 5,
keepOpen: false,
preventDefault: false,
autoComplete: false,
autoCompleteMinLength: 2,
debug: false
};

Expand Down Expand Up @@ -868,22 +870,40 @@
Nominatim.prototype.setListeners = function setListeners () {
var this$1 = this;

var openSearch = function () {
if(utils.hasClass(this$1.els.control, namespace + expanded_class)) {
this$1.collapse();
} else {
this$1.expand();
}
},
query = function (evt) {
if (evt.keyCode == 13) { //enter key
evt.preventDefault();
var q = utils.htmlEscape(this$1.els.input_search.value);
this$1.query(q);
}
};
var timeout, last_query,
openSearch = function () {
if(utils.hasClass(this$1.els.control, namespace + expanded_class)) {
this$1.collapse();
} else {
this$1.expand();
}
},
query = function (evt) {
if (evt.keyCode == 13) { // enter key
evt.preventDefault();
this$1.query(evt.target.value);
}
},
autoComplete = function (evt) {
var query = evt.target.value;

if (query != last_query) {
last_query = query;

if (timeout) clearTimeout(timeout);

timeout = setTimeout(function () {
if(query.length >= this$1.options.autoCompleteMinLength) {
this$1.query(query);
}
}, 200);
}
};
this.els.input_search.addEventListener('keydown', query, false);
this.els.btn_search.addEventListener('click', openSearch, false);
if (this.options.autoComplete) {
this.els.input_search.addEventListener('input', autoComplete, false);
}
};

Nominatim.prototype.query = function query (q) {
Expand Down
4 changes: 2 additions & 2 deletions build/ol3-geocoder.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* A geocoder extension for OpenLayers 3.
* https://github.com/jonataswalker/ol3-geocoder
* Version: v2.2.0
* Built: 2016-07-29T12:53:37-03:00
* Version: v2.3.0
* Built: 2016-08-15T11:57:59-03:00
*/

.ol3-geocoder-container {
Expand Down
Loading

0 comments on commit e29e65b

Please sign in to comment.