From 1ed712d4d81a447d81c2a81e720300024aaeef8a Mon Sep 17 00:00:00 2001 From: Jonatas Walker Date: Mon, 19 Dec 2016 10:54:40 -0200 Subject: [PATCH] Release v2.4.0 Release v2.4.0 Release v2.4.0 Remove base64 icon Release v2.4.0 --- build/ol3-geocoder-debug.js | 2527 ++++++++++++++++++----------------- build/ol3-geocoder.css | 250 +++- build/ol3-geocoder.js | 10 +- build/ol3-geocoder.js.map | 1 + build/ol3-geocoder.min.css | 9 +- package.json | 2 +- src/js/constants.js | 28 +- 7 files changed, 1503 insertions(+), 1324 deletions(-) create mode 100644 build/ol3-geocoder.js.map diff --git a/build/ol3-geocoder-debug.js b/build/ol3-geocoder-debug.js index 73a4acc..029e779 100644 --- a/build/ol3-geocoder-debug.js +++ b/build/ol3-geocoder-debug.js @@ -1,1235 +1,1308 @@ -/** +/*! + * ol3-geocoder - v2.4.0 * A geocoder extension for OpenLayers 3. * https://github.com/jonataswalker/ol3-geocoder - * Version: v2.3.0 - * Built: 2016-08-15T11:57:59-03:00 + * Built: Mon Dec 19 2016 11:15:26 GMT-0200 (BRST) */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global.Geocoder = factory()); -}(this, function () { 'use strict'; - - var namespace = "ol3-geocoder"; - var container_class = "-container"; - var control_class = "-search"; - var btn_search_class = "-btn-search"; - var loading_class = "-loading"; - var result_class = "-result"; - var expanded_class = "-search-expanded"; - var country_class = "-country"; - var city_class = "-city"; - var road_class = "-road"; - var OL3_control_class = "ol-control"; - var form_id = "form-geocoder"; - var input_search_class = "-input-search"; - var input_query_id = "gcd-input"; - - var eventType = { - ADDRESSCHOSEN: 'addresschosen' - }; - - var featureStyle = [ - new ol.style.Style({ - image: new ol.style.Icon({ - anchor: [0.5, 1], - src: [ - 'data:image/png;base64,', - 'iVBORw0KGgoAAAANSUhEUgAAAC0AAAAtCAYAAAA6GuKaAAAABmJLR0QA/wD/AP+gvaeT', -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gU9rJXeinBUjnxGBF4A', - 'fgWcsAN8DXgE2OnJGbIC/CHxoAXpOK/lRx1sIvn1mKTVirRO377EFnE0IfFYrudXxvkdD', - 'bvcCvwOZGEvkgOeBB0+kwwTU9tIccClmlC8Bubj9vKQNyAPAzxHX8YCDWsnluLpOAmB84', - 'fmIU+e1kstJ2r42OkVH/S5R2G7S0aSCsaFrHU+tZB44F3LaOa1k/l/pTzfZSQ4APwD7Wr', - 'jmgdeA5STAttKjltsLbdwWkhSf1UjXRfxZ4M8WLs9pJe/a0HIsAeMDnQlwOaOVvPufeFD', - 'UJLcH/H27t6EtcBDYTJrLViNdl9ubwLWG4Wv+uDUTWDb/LLlSNzSilVy1qeFYBsYHvOAP', - 'XdBKrtrK5Y5A19lJqo8kTnZi8U6kRy0YY8BNwNgqwP+1/Q09w5giQWRk7AAAAABJRU5Er', - 'kJggg==' - ].join('') - }) - }) - ]; - - var providers = { - OSM: 'osm', - MAPQUEST: 'mapquest', - GOOGLE: 'google', - PHOTON: 'photon', - BING: 'bing', - PELIAS: 'pelias' - }; - - var defaultOptions = { - provider: providers.OSM, - placeholder: 'Search for an address', - featureStyle: featureStyle, - lang: 'en-US', - limit: 5, - keepOpen: false, - preventDefault: false, - autoComplete: false, - autoCompleteMinLength: 2, - debug: false - }; - - /** - * @module utils - * All the helper functions needed in this project - */ - var utils = { - toQueryString: function toQueryString(obj) { - var this$1 = this; - - return Object.keys(obj).reduce(function (a, k) { - a.push( - typeof obj[k] === 'object' ? - this$1.toQueryString(obj[k]) : - encodeURIComponent(k) + '=' + encodeURIComponent(obj[k]) - ); - return a; - }, []).join('&'); - }, - encodeUrlXhr: function encodeUrlXhr(url, data) { - if(data && typeof(data) === 'object') { - var str_data = this.toQueryString(data); - url += (/\?/.test(url) ? '&' : '?') + str_data; - } - return url; - }, - json: function json(url, data) { - var xhr = new XMLHttpRequest(), - url_ = '', - data_type = '', - when = {}, - onload = function () { - if (xhr.status === 200) { - when.ready.call(undefined, JSON.parse(xhr.response)); - } - }, - onerror = function () { - console.info('Cannot XHR ' + JSON.stringify(url)); - }; - - if(typeof url === 'object') { - url_ = url.url; - data = url.data; - data_type = url.data_type || 'json'; - } else { - url_ = url; - } - - url_ = this.encodeUrlXhr(url_, data); - - if (data_type === 'jsonp') { - this.jsonp(url_, url.callbackName, function(data) { - when.ready.call(undefined, data); - }); - } else { - xhr.open('GET', url_, true); - xhr.setRequestHeader('Accept','application/json'); - xhr.onload = onload; - xhr.onerror = onerror; - xhr.send(null); - } - - return { - when: function (obj) { when.ready = obj.ready; } - }; - }, - jsonp: function jsonp(url, key, callback) { - // https://github.com/Fresheyeball/micro-jsonp/blob/master/src/jsonp.js - var head = document.head, - script = document.createElement('script'), - // generate minimally unique name for callback function - callbackName = 'f' + Math.round(Math.random() * Date.now()); - - // set request url - script.setAttribute('src', - /* add callback parameter to the url - where key is the parameter key supplied - and callbackName is the parameter value */ - (url + (url.indexOf('?') > 0 ? '&' : '?') + key + '=' + callbackName)); - - /* place jsonp callback on window, - the script sent by the server should call this - function as it was passed as a url parameter */ - window[callbackName] = function(json) { - window[callbackName] = undefined; - - // clean up script tag created for request - setTimeout(function() { - head.removeChild(script); - }, 0); - - // hand data back to the user - callback(json); - }; - - // actually make the request - head.appendChild(script); - }, - now: function now() { - // Polyfill for window.performance.now() - // @license http://opensource.org/licenses/MIT - // copyright Paul Irish 2015 - // https://gist.github.com/paulirish/5438650 - if ('performance' in window == false) { - window.performance = {}; - } - - Date.now = (Date.now || function () { // thanks IE8 - return new Date().getTime(); - }); - - if ('now' in window.performance == false) { - - var nowOffset = Date.now(); - - if (performance.timing && performance.timing.navigationStart){ - nowOffset = performance.timing.navigationStart - } - - window.performance.now = function now(){ - return Date.now() - nowOffset; - } - } - - return window.performance.now(); - }, - flyTo: function flyTo(map, coord, duration, resolution) { - resolution = resolution || 2.388657133911758; - duration = duration || 500; - - var view = map.getView(); - var pan = ol.animation.pan({ - duration: duration, - source: view.getCenter() - }); - var zoom = ol.animation.zoom({ - duration: duration, - resolution: view.getResolution() - }); - - map.beforeRender(pan, zoom); - view.setCenter(coord); - view.setResolution(resolution); - }, - randomId: function randomId(prefix) { - var id = this.now().toString(36); - return prefix ? prefix + id : id; - }, - isNumeric: function isNumeric(str) { - return /^\d+$/.test(str); - }, - classRegex: function classRegex(classname) { - return new RegExp(("(^|\\s+) " + classname + " (\\s+|$)")); - }, - /** - * @param {Element|Array} element DOM node or array of nodes. - * @param {String|Array} classname Class or array of classes. - * For example: 'class1 class2' or ['class1', 'class2'] - * @param {Number|undefined} timeout Timeout to remove a class. - */ - addClass: function addClass(element, classname, timeout) { - var this$1 = this; - - if (Array.isArray(element)) { - element.forEach(function (each) { this$1.addClass(each, classname) }); - return; - } - - var array = (Array.isArray(classname)) ? classname : classname.split(/\s+/); - var i = array.length; - - while(i--) { - if (!this$1.hasClass(element, array[i])) { - this$1._addClass(element, array[i], timeout); - } - } - }, - _addClass: function _addClass(el, c, timeout) { - var this$1 = this; - - // use native if available - if (el.classList) { - el.classList.add(c); - } else { - el.className = (el.className +' '+ c).trim(); - } - - if (timeout && this.isNumeric(timeout)) { - window.setTimeout(function () { this$1._removeClass(el, c) }, timeout); - } - }, - /** - * @param {Element|Array} element DOM node or array of nodes. - * @param {String|Array} classname Class or array of classes. - * For example: 'class1 class2' or ['class1', 'class2'] - * @param {Number|undefined} timeout Timeout to add a class. - */ - removeClass: function removeClass(element, classname, timeout) { - var this$1 = this; - - if (Array.isArray(element)) { - element.forEach(function (each) { this$1.removeClass(each, classname, timeout) }); - return; - } - - var array = (Array.isArray(classname)) ? classname : classname.split(/\s+/); - var i = array.length; - - while(i--) { - if (this$1.hasClass(element, array[i])) { - this$1._removeClass(element, array[i], timeout); - } - } - }, - _removeClass: function _removeClass(el, c, timeout) { - var this$1 = this; - - if (el.classList) { - el.classList.remove(c); - } else { - el.className = (el.className.replace(this.classRegex(c), ' ')).trim(); - } - if (timeout && this.isNumeric(timeout)) { - window.setTimeout(function () { - this$1._addClass(el, c); - }, timeout); - } - }, - /** - * @param {Element} element DOM node. - * @param {String} classname Classname. - * @return {Boolean} - */ - hasClass: function hasClass(element, c) { - // use native if available - return (element.classList) ? - element.classList.contains(c) : this.classRegex(c).test(element.className); - }, - /** - * @param {Element|Array} element DOM node or array of nodes. - * @param {String} classname Classe. - */ - toggleClass: function toggleClass(element, classname) { - var this$1 = this; - - if (Array.isArray(element)) { - element.forEach(function (each) { this$1.toggleClass(each, classname) }); - return; - } - - // use native if available - if (element.classList) { - element.classList.toggle(classname); - } else { - if (this.hasClass(element, classname)) { - this._removeClass(element, classname); - } else { - this._addClass(element, classname); - } - } - }, - $: function $(id) { - id = (id[0] === '#') ? id.substr(1, id.length) : id; - return document.getElementById(id); - }, - isElement: function isElement(obj) { - // DOM, Level2 - if ('HTMLElement' in window) { - return (!!obj && obj instanceof HTMLElement); - } - // Older browsers - return (!!obj && typeof obj === 'object' && - obj.nodeType === 1 && !!obj.nodeName); - }, - getAllChildren: function getAllChildren(node, tag) { - return [].slice.call(node.getElementsByTagName(tag)); - }, - isEmpty: function isEmpty(str) { - return (!str || 0 === str.length); - }, - emptyArray: function emptyArray(array) { - while(array.length) array.pop(); - }, - anyMatchInArray: function anyMatchInArray(source, target) { - return source.some(function (each) { return target.indexOf(each) >= 0; }); - }, - everyMatchInArray: function everyMatchInArray(arr1, arr2) { - return arr2.every(function (each) { return arr1.indexOf(each) >= 0; }); - }, - anyItemHasValue: function anyItemHasValue(obj, has) { - var this$1 = this; - if ( has === void 0 ) has = false; - - for(var key in obj) { - if(!this$1.isEmpty(obj[key])) { - has = true; - } - } - return has; - }, - removeAllChildren: function removeAllChildren(node) { - while (node.firstChild) { - node.removeChild(node.firstChild); - } - }, - removeAll: function removeAll(collection) { - var node; - while ((node = collection[0])) { - node.parentNode.removeChild(node); - } - }, - getChildren: function getChildren(node, tag) { - return [].filter.call(node.childNodes, function (el) { return tag ? - el.nodeType == 1 && el.tagName.toLowerCase() == tag : el.nodeType == 1; }); - }, - template: function template(html, row) { - var this$1 = this; - - return html.replace(/\{ *([\w_-]+) *\}/g, function (html, key) { - var value = (row[key] === undefined) ? '' : row[key]; - return this$1.htmlEscape(value); - }); - }, - htmlEscape: function htmlEscape(str) { - return String(str) - .replace(/&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"') - .replace(/'/g, '''); - }, - /** - * Overwrites obj1's values with obj2's and adds - * obj2's if non existent in obj1 - * @returns obj3 a new object based on obj1 and obj2 - */ - mergeOptions: function mergeOptions(obj1, obj2) { - var obj3 = {}; - for (var attr1 in obj1) { obj3[attr1] = obj1[attr1]; } - for (var attr2 in obj2) { obj3[attr2] = obj2[attr2]; } - return obj3; - }, - createElement: function createElement(node, html) { - var elem; - if (Array.isArray(node)) { - elem = document.createElement(node[0]); - - if (node[1].id) elem.id = node[1].id; - if (node[1].classname) elem.className = node[1].classname; - - if (node[1].attr) { - var attr = node[1].attr; - if (Array.isArray(attr)) { - var i = -1; - while(++i < attr.length) { - elem.setAttribute(attr[i].name, attr[i].value); - } - } else { - elem.setAttribute(attr.name, attr.value); - } - } - } else { - elem = document.createElement(node); - } - elem.innerHTML = html; - var frag = document.createDocumentFragment(); - - while (elem.childNodes[0]) { - frag.appendChild(elem.childNodes[0]); - } - elem.appendChild(frag); - return elem; - }, - assert: function assert(condition, message) { - if ( message === void 0 ) message = 'Assertion failed'; - - if (!condition) { - if (typeof Error !== 'undefined') { - throw new Error(message); - } - throw message; // Fallback - } - } - }; - - /** - * @class Photon - */ - var Photon = function Photon() { - - this.settings = { - url: '//photon.komoot.de/api/', - params: { - q: '', - limit: 10, - lang: 'en' - }, - langs: ['de', 'it', 'fr', 'en'] - }; - - }; - - Photon.prototype.getParameters = function getParameters (options) { - options.lang = options.lang.toLowerCase(); - - return { - url: this.settings.url, - params: { - q: options.query, - limit: options.limit || this.settings.params.limit, - lang: this.settings.langs.indexOf(options.lang) > -1 ? - options.lang : this.settings.params.lang - } - }; - }; - - Photon.prototype.handleResponse = function handleResponse (results) { - return results.map(function (result) { return ({ - lon: result.geometry.coordinates[0], - lat: result.geometry.coordinates[1], - address: { - name: result.properties.name, - postcode: result.properties.postcode, - city: result.properties.city, - state: result.properties.state, - country: result.properties.country - }, - original: { - formatted: result.properties.name, - details: result.properties - } - }); }); - }; - - /** - * @class OpenStreet - */ - var OpenStreet = function OpenStreet() { - - this.settings = { - url: '//nominatim.openstreetmap.org/search/', - params: { - q: '', - format: 'json', - addressdetails: 1, - limit: 10, - countrycodes: '', - 'accept-language': 'en-US' - } - }; - }; - - OpenStreet.prototype.getParameters = function getParameters (options) { - return { - url: this.settings.url, - params: { - q: options.query, - format: 'json', - addressdetails: 1, - limit: options.limit || this.settings.params.limit, - countrycodes: options.countrycodes || this.settings.params.countrycodes, - 'accept-language': options.lang || this.settings.params['accept-language'] - } - }; - }; - - OpenStreet.prototype.handleResponse = function handleResponse (results) { - return results.map(function (result) { return ({ - lon: result.lon, - lat: result.lat, - address: { - name: result.address.neighbourhood || '', - road: result.address.road || '', - postcode: result.address.postcode, - city: result.address.city || result.address.town, - state: result.address.state, - country: result.address.country - }, - original: { - formatted: result.display_name, - details: result.address - } - }); }); - }; - - /** - * @class MapQuest - */ - var MapQuest = function MapQuest() { - - this.settings = { - url: '//open.mapquestapi.com/nominatim/v1/search.php', - params: { - q: '', - key: '', - format: 'json', - addressdetails: 1, - limit: 10, - countrycodes: '', - 'accept-language': 'en-US' - } - }; - }; - - MapQuest.prototype.getParameters = function getParameters (options) { - return { - url: this.settings.url, - params: { - q: options.query, - key: options.key, - format: 'json', - addressdetails: 1, - limit: options.limit || this.settings.params.limit, - countrycodes: options.countrycodes || this.settings.params.countrycodes, - 'accept-language': options.lang || this.settings.params['accept-language'] - } - }; - }; - - MapQuest.prototype.handleResponse = function handleResponse (results) { - return results.map(function (result) { return ({ - lon: result.lon, - lat: result.lat, - address: { - name: result.address.neighbourhood || '', - road: result.address.road || '', - postcode: result.address.postcode, - city: result.address.city || result.address.town, - state: result.address.state, - country: result.address.country - }, - original: { - formatted: result.display_name, - details: result.address - } - }); }); - }; - - /** - * @class Pelias - */ - var Pelias = function Pelias() { - - this.settings = { - url: '//search.mapzen.com/v1/search', - params: { - text: '', - key: '', - size: 10 - } - }; - }; - - Pelias.prototype.getParameters = function getParameters (options) { - return { - url: this.settings.url, - params: { - text: options.query, - key: options.key, - size: options.limit || this.settings.params.size - } - }; - }; - - Pelias.prototype.handleResponse = function handleResponse (results) { - return results.map(function (result) { return ({ - lon: result.geometry.coordinates[0], - lat: result.geometry.coordinates[1], - address: { - name: result.properties.name, - house_number: result.properties.housenumber, - postcode: result.properties.postalcode, - road: result.properties.street, - city: result.properties.city, - state: result.properties.region, - country: result.properties.country - }, - original: { - formatted: result.properties.label, - details: result.properties - } - }); }); - }; - - /** - * @class Google - */ - var Google = function Google() { - - this.settings = { - url: '//maps.googleapis.com/maps/api/geocode/json', - params: { - address: '', - key: '', - language: 'en-US' - } - }; - }; - - Google.prototype.getParameters = function getParameters (options) { - return { - url: this.settings.url, - params: { - address: options.query, - key: options.key, - language: options.lang || this.settings.params.language - } - }; - }; - - Google.prototype.handleResponse = function handleResponse (results) { - var name = [ - 'point_of_interest', - 'establishment', - 'natural_feature', - 'airport' - ], - road = [ - 'street_address', - 'route', - 'sublocality_level_5', - 'intersection' - ], - postcode = [ 'postal_code' ], - city = [ 'locality' ], - state = [ 'administrative_area_level_1' ], - country = [ 'country' ]; - - /* - * @param {Array} details - address_components - */ - var getDetails = function (details) { - var parts = { - name: '', - road: '', - postcode: '', - city: '', - state: '', - country: '' - }; - details.forEach(function (detail) { - if(utils.anyMatchInArray(detail.types, name)){ - parts.name = detail.long_name; - } else if(utils.anyMatchInArray(detail.types, road)){ - parts.road = detail.long_name; - } else if(utils.anyMatchInArray(detail.types, postcode)){ - parts.postcode = detail.long_name; - } else if(utils.anyMatchInArray(detail.types, city)){ - parts.city = detail.long_name; - } else if(utils.anyMatchInArray(detail.types, state)){ - parts.state = detail.long_name; - } else if(utils.anyMatchInArray(detail.types, country)){ - parts.country = detail.long_name; - } - }); - return parts; - }; - - var array = []; - - results.forEach(function (result) { - var details = getDetails(result.address_components); - if(utils.anyItemHasValue(details)){ - array.push({ - lon: result.geometry.location.lng, - lat: result.geometry.location.lat, - address: { - name: details.name, - postcode: details.postcode, - road: details.road, - city: details.city, - state: details.state, - country: details.country - }, - original: { - formatted: result.formatted_address, - details: result.address_components - } - }); - } - }); - - return array; - }; - - /** - * @class Bing - */ - var Bing = function Bing() { - this.settings = { - url: '//dev.virtualearth.net/REST/v1/Locations', - callbackName: 'jsonp', - params: { - query: '', - key: '', - includeNeighborhood: 0, - maxResults: 10 - } - }; - }; - - Bing.prototype.getParameters = function getParameters (options) { - return { - url: this.settings.url, - callbackName: this.settings.callbackName, - params: { - query: options.query, - key: options.key, - includeNeighborhood: - options.includeNeighborhood || this.settings.params.includeNeighborhood, - maxResults: options.maxResults || this.settings.params.maxResults - } - }; - }; - - Bing.prototype.handleResponse = function handleResponse (results) { - return results.map(function (result) { return ({ - lon: result.point.coordinates[1], - lat: result.point.coordinates[0], - address: { - name: result.name - }, - original: { - formatted: result.address.formattedAddress, - details: result.address - } - }); }); - }; - - /** - * @class Nominatim - */ - var Nominatim = function Nominatim(base) { - this.Base = base; - - this.layer_name = utils.randomId('geocoder-layer-'); - this.layer = new ol.layer.Vector({ - name: this.layer_name, - source: new ol.source.Vector() - }); - - this.options = base.options; - this.options.provider = this.options.provider.toLowerCase(); - - this.els = this.createControl(); - this.container = this.els.container; - this.registered_listeners = { - map_click: false - }; - this.setListeners(); - - // providers - this.Photon = new Photon(); - this.OpenStreet = new OpenStreet(); - this.MapQuest = new MapQuest(); - this.Pelias = new Pelias(); - this.Google = new Google(); - this.Bing = new Bing(); - - return this; - }; - - Nominatim.prototype.createControl = function createControl () { - var container = utils.createElement([ - 'div', { classname: namespace + container_class } - ], Nominatim.html); - - var elements = { - container: container, - control: - container.querySelector(("." + (namespace + control_class))), - btn_search: - container.querySelector(("." + (namespace + btn_search_class))), - input_search: - container.querySelector(("." + (namespace + input_search_class))), - result_container: - container.querySelector(("." + (namespace + result_class))) - }; - //set placeholder from options - elements.input_search.placeholder = this.options.placeholder; - return elements; - }; - - Nominatim.prototype.setListeners = function setListeners () { - var this$1 = this; - - 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) { - var this$1 = this; - - var this_ = this, - ajax = {}, - options = this.options, - input = this.els.input_search, - provider = this.getProvider({ - query: q, - provider: options.provider, - key: options.key, - lang: options.lang, - countrycodes: options.countrycodes, - limit: options.limit - }); - - this.clearResults(); - utils.addClass(input, namespace + loading_class); - - ajax.url = provider.url; - ajax.data = provider.params; - - if (options.provider === providers.BING) { - ajax.data_type = 'jsonp'; - ajax.callbackName = provider.callbackName; - } - - utils.json(ajax).when({ - ready: function (response) { - if (options.debug) { - console.info(response); - } - - utils.removeClass(input, namespace + loading_class); - - //will be fullfiled according to provider - var response__; - - switch (options.provider) { - case providers.OSM: - response__ = response.length > 0 ? - this$1.OpenStreet.handleResponse(response) : undefined; - break; - case providers.MAPQUEST: - response__ = response.length > 0 ? - this$1.MapQuest.handleResponse(response) : undefined; - break; - case providers.PELIAS: - response__ = response.features.length > 0 ? - this$1.Pelias.handleResponse(response.features) : undefined; - break; - case providers.PHOTON: - response__ = response.features.length > 0 ? - this$1.Photon.handleResponse(response.features) : undefined; - break; - case providers.GOOGLE: - response__ = response.results.length > 0 ? - this$1.Google.handleResponse(response.results) : undefined; - break; - case providers.BING: - response__ = response.resourceSets[0].resources.length > 0 ? - this$1.Bing.handleResponse(response.resourceSets[0].resources) : undefined; - break; - } - if(response__){ - this$1.createList(response__); - this$1.listenMapClick(); - } - }, - error: function () { - utils.removeClass(input, namespace + loading_class); - var li = utils.createElement('li', - '
Error! No internet connection?
'); - this$1.els.result_container.appendChild(li); - } - }); - }; - - Nominatim.prototype.createList = function createList (response) { - var this$1 = this; - - var ul = this.els.result_container; - response.forEach(function (row) { - var address_html = this$1.addressTemplate(row.address), - html = '' + address_html + '', - li = utils.createElement('li', html); - - li.addEventListener('click', function (evt) { - evt.preventDefault(); - this$1.chosen(row, address_html, row.address, row.original); - }, false); - - ul.appendChild(li); - }); - }; - - Nominatim.prototype.chosen = function chosen (place, address_html, address_obj, address_original) { - var map = this.Base.getMap(); - var coord = ol.proj.transform([parseFloat(place.lon), parseFloat(place.lat)], - 'EPSG:4326', map.getView().getProjection()); - var address = { - formatted: address_html, - details: address_obj, - original: address_original - }; - - if(this.options.keepOpen === false){ - this.clearResults(true); - } - - if(this.options.preventDefault === true) { - this.Base.dispatchEvent({ - type: eventType.ADDRESSCHOSEN, - address: address, - coordinate: coord - }); - } else { - utils.flyTo(map, coord); - var feature = this.createFeature(coord, address); - - this.Base.dispatchEvent({ - type: eventType.ADDRESSCHOSEN, - address: address, - feature: feature, - coordinate: coord - }); - } - }; - - Nominatim.prototype.createFeature = function createFeature (coord) { - var feature = new ol.Feature(new ol.geom.Point(coord)); - this.addLayer(); - feature.setStyle(this.options.featureStyle); - feature.setId(utils.randomId('geocoder-ft-')); - this.getSource().addFeature(feature); - }; - - Nominatim.prototype.addressTemplate = function addressTemplate (address) { - var html = []; - if (address.name) { - html.push( - '{name}' - ); - } - if (address.road || address.building || address.house_number) { - html.push( - '{building} {road} {house_number}' - ); - } - if (address.city || address.town || address.village) { - html.push( - '{postcode} {city} {town} {village}' - ); - } - if (address.state || address.country) { - html.push( - '{state} {country}' - ); - } - return utils.template(html.join('
'), address); - }; - - Nominatim.prototype.getProvider = function getProvider (options) { - var provider; - - switch(options.provider) { - case providers.OSM: - provider = this.OpenStreet.getParameters(options); - break; - case providers.MAPQUEST: - provider = this.MapQuest.getParameters(options); - break; - case providers.PHOTON: - provider = this.Photon.getParameters(options); - break; - case providers.GOOGLE: - provider = this.Google.getParameters(options); - break; - case providers.PELIAS: - provider = this.Pelias.getParameters(options); - break; - case providers.BING: - provider = this.Bing.getParameters(options); - break; - } - return provider; - }; - - Nominatim.prototype.expand = function expand () { - var this$1 = this; - - utils.removeClass(this.els.input_search, namespace + loading_class); - utils.addClass(this.els.control, namespace + expanded_class); - window.setTimeout(function () { - this$1.els.input_search.focus(); - }, 100); - this.listenMapClick(); - }; - - Nominatim.prototype.collapse = function collapse () { - this.els.input_search.value = ''; - this.els.input_search.blur(); - utils.removeClass(this.els.control, namespace + expanded_class); - this.clearResults(); - }; - - Nominatim.prototype.listenMapClick = function listenMapClick () { - if(this.registered_listeners.map_click) { - // already registered - return; - } - - var this_ = this; - var map_element = this.Base.getMap().getTargetElement(); - this.registered_listeners.map_click = true; - - //one-time fire click - map_element.addEventListener('click', { - handleEvent: function (evt) { - this_.clearResults(true); - map_element.removeEventListener(evt.type, this, false); - this_.registered_listeners.map_click = false; - } - }, false); - }; - - Nominatim.prototype.clearResults = function clearResults (collapse) { - if(collapse) { - this.collapse(); - } else { - utils.removeAllChildren(this.els.result_container); - } - }; - - Nominatim.prototype.getSource = function getSource () { - return this.layer.getSource(); - }; - - Nominatim.prototype.addLayer = function addLayer () { - var this$1 = this; - - var found = false; - var map = this.Base.getMap(); - - map.getLayers().forEach(function (layer) { - if (layer === this$1.layer) found = true; - }); - if (!found) { - map.addLayer(this.layer); - } - }; - - Nominatim.html = [ - '
', - '', - '', - '
', - '', - '', - '
', - '
    ' - ].join(''); - - /** - * @class Base - * @extends {ol.control.Control} - */ - var Base = (function (superclass) { - function Base(control_type, opt_options) { - if ( control_type === void 0 ) control_type = 'nominatim'; - if ( opt_options === void 0 ) opt_options = {}; - - utils.assert(typeof control_type == 'string', - '@param `control_type` should be string type!' - ); - utils.assert(typeof opt_options == 'object', - '@param `opt_options` should be object type!' - ); - - this.options = utils.mergeOptions(defaultOptions, opt_options); - - Base.Nominatim = new Nominatim(this); - - superclass.call(this, { - element: Base.Nominatim.container - }); - } - - if ( superclass ) Base.__proto__ = superclass; - Base.prototype = Object.create( superclass && superclass.prototype ); - Base.prototype.constructor = Base; - - /** - * @return {ol.layer.Vector} Returns the layer created by this control - */ - Base.prototype.getLayer = function getLayer () { - return Base.Nominatim.layer; - }; - - /** - * @return {ol.source.Vector} Returns the source created by this control - */ - Base.prototype.getSource = function getSource () { - return this.getLayer().getSource(); - }; - - return Base; - }(ol.control.Control)); - - return Base; - -})); \ No newline at end of file +}(this, (function () { 'use strict'; + +var inputQueryId = "gcd-input-query"; +var inputResetId = "gcd-input-reset"; +var cssClasses = {"namespace":"ol-geocoder","spin":"gcd-pseudo-rotate","hidden":"gcd-hidden","country":"gcd-country","city":"gcd-city","road":"gcd-road","olControl":"ol-control","glass":{"container":"gcd-gl-container","control":"gcd-gl-control","button":"gcd-gl-btn","input":"gcd-gl-input","expanded":"gcd-gl-expanded","reset":"gcd-gl-reset","result":"gcd-gl-result"},"inputText":{"container":"gcd-txt-container","control":"gcd-txt-control","input":"gcd-txt-input","reset":"gcd-txt-reset","icon":"gcd-txt-glass","result":"gcd-txt-result"}}; +var vars$1 = { + inputQueryId: inputQueryId, + inputResetId: inputResetId, + cssClasses: cssClasses +}; + +var _VARS = Object.freeze({ + inputQueryId: inputQueryId, + inputResetId: inputResetId, + cssClasses: cssClasses, + default: vars$1 +}); + +var eventType = { + ADDRESSCHOSEN: 'addresschosen' +}; + +var controlType = { + NOMINATIM: 'nominatim', + REVERSE: 'reverse' +}; + +var targetType = { + GLASS: 'glass-button', + INPUT: 'text-input' +}; + +var vars = _VARS; + +var featureStyle = [ + new ol.style.Style({ + image: new ol.style.Icon({ + anchor: [0.5, 1], + scale: .7, + src: '//cdn.rawgit.com/jonataswalker/map-utils/master/images/marker.png' + }) + }) +]; + +var providers = { + OSM: 'osm', + MAPQUEST: 'mapquest', + GOOGLE: 'google', + PHOTON: 'photon', + BING: 'bing', + PELIAS: 'pelias' +}; + +var defaultOptions = { + provider: providers.OSM, + placeholder: 'Search for an address', + featureStyle: featureStyle, + targetType: targetType.GLASS, + lang: 'en-US', + limit: 5, + keepOpen: false, + preventDefault: false, + autoComplete: false, + autoCompleteMinLength: 2, + debug: false +}; + +/** + * @module utils + * All the helper functions needed in this project + */ +var utils = { + toQueryString: function toQueryString(obj) { + var this$1 = this; + + return Object.keys(obj).reduce(function (a, k) { + a.push( + typeof obj[k] === 'object' ? + this$1.toQueryString(obj[k]) : + encodeURIComponent(k) + '=' + encodeURIComponent(obj[k]) + ); + return a; + }, []).join('&'); + }, + encodeUrlXhr: function encodeUrlXhr(url, data) { + if (data && typeof data === 'object') { + var str_data = this.toQueryString(data); + url += (/\?/.test(url) ? '&' : '?') + str_data; + } + return url; + }, + json: function json(url, data) { + var xhr = new XMLHttpRequest(), + url_ = '', + data_type = '', + when = {}, + onload = function () { + if (xhr.status === 200) { + when.ready.call(undefined, JSON.parse(xhr.response)); + } + }, + onerror = function () { + console.error('Cannot XHR ' + JSON.stringify(url)); + }; + + if (typeof url === 'object') { + url_ = url.url; + data = url.data; + data_type = url.data_type || 'json'; + } else { + url_ = url; + } + + url_ = this.encodeUrlXhr(url_, data); + + if (data_type === 'jsonp') { + this.jsonp(url_, url.callbackName, function (res) { + when.ready.call(undefined, res); + }); + } else { + xhr.open('GET', url_, true); + xhr.setRequestHeader('Accept','application/json'); + xhr.onload = onload; + xhr.onerror = onerror; + xhr.send(null); + } + + return { + when: function (obj) { + when.ready = obj.ready; + } + }; + }, + jsonp: function jsonp(url, key, callback) { + // https://github.com/Fresheyeball/micro-jsonp/blob/master/src/jsonp.js + var head = document.head, + script = document.createElement('script'), + // generate minimally unique name for callback function + callbackName = 'f' + Math.round(Math.random() * Date.now()); + + // set request url + script.setAttribute('src', + /* add callback parameter to the url + where key is the parameter key supplied + and callbackName is the parameter value */ + (url + (url.indexOf('?') > 0 ? '&' : '?') + key + '=' + callbackName)); + + /* place jsonp callback on window, + the script sent by the server should call this + function as it was passed as a url parameter */ + window[callbackName] = function (json) { + window[callbackName] = undefined; + + // clean up script tag created for request + setTimeout(function () { + head.removeChild(script); + }, 0); + + // hand data back to the user + callback(json); + }; + + // actually make the request + head.appendChild(script); + }, + now: function now() { + // Polyfill for window.performance.now() + // @license http://opensource.org/licenses/MIT + // copyright Paul Irish 2015 + // https://gist.github.com/paulirish/5438650 + if ('performance' in window === false) { + window.performance = {}; + } + + Date.now = (Date.now || function () { // thanks IE8 + return new Date().getTime(); + }); + + if ('now' in window.performance === false) { + + var nowOffset = Date.now(); + + if (performance.timing && performance.timing.navigationStart) { + nowOffset = performance.timing.navigationStart; + } + + window.performance.now = function now() { + return Date.now() - nowOffset; + }; + } + + return window.performance.now(); + }, + flyTo: function flyTo(map, coord, duration, resolution) { + resolution = resolution || 2.388657133911758; + duration = duration || 500; + + var view = map.getView(); + var pan = ol.animation.pan({ + duration: duration, + source: view.getCenter() + }); + var zoom = ol.animation.zoom({ + duration: duration, + resolution: view.getResolution() + }); + + map.beforeRender(pan, zoom); + view.setCenter(coord); + view.setResolution(resolution); + }, + randomId: function randomId(prefix) { + var id = this.now().toString(36); + return prefix ? prefix + id : id; + }, + isNumeric: function isNumeric(str) { + return /^\d+$/.test(str); + }, + classRegex: function classRegex(classname) { + return new RegExp(("(^|\\s+) " + classname + " (\\s+|$)")); + }, + /** + * @param {Element|Array} element DOM node or array of nodes. + * @param {String|Array} classname Class or array of classes. + * For example: 'class1 class2' or ['class1', 'class2'] + * @param {Number|undefined} timeout Timeout to remove a class. + */ + addClass: function addClass(element, classname, timeout) { + var this$1 = this; + + if (Array.isArray(element)) { + element.forEach(function (each) { + this$1.addClass(each, classname); + }); + return; + } + + var array = (Array.isArray(classname)) + ? classname + : classname.split(/\s+/); + var i = array.length; + + while (i--) { + if (!this$1.hasClass(element, array[i])) { + this$1._addClass(element, array[i], timeout); + } + } + }, + _addClass: function _addClass(el, klass, timeout) { + var this$1 = this; + + // use native if available + if (el.classList) { + el.classList.add(klass); + } else { + el.className = (el.className + ' ' + klass).trim(); + } + + if (timeout && this.isNumeric(timeout)) { + window.setTimeout(function () { + this$1._removeClass(el, klass); + }, timeout); + } + }, + /** + * @param {Element|Array} element DOM node or array of nodes. + * @param {String|Array} classname Class or array of classes. + * For example: 'class1 class2' or ['class1', 'class2'] + * @param {Number|undefined} timeout Timeout to add a class. + */ + removeClass: function removeClass(element, classname, timeout) { + var this$1 = this; + + if (Array.isArray(element)) { + element.forEach(function (each) { + this$1.removeClass(each, classname, timeout); + }); + return; + } + + var array = (Array.isArray(classname)) + ? classname + : classname.split(/\s+/); + var i = array.length; + + while (i--) { + if (this$1.hasClass(element, array[i])) { + this$1._removeClass(element, array[i], timeout); + } + } + }, + _removeClass: function _removeClass(el, klass, timeout) { + var this$1 = this; + + if (el.classList) { + el.classList.remove(klass); + } else { + el.className = (el.className.replace(this.classRegex(klass), ' ')).trim(); + } + if (timeout && this.isNumeric(timeout)) { + window.setTimeout(function () { + this$1._addClass(el, klass); + }, timeout); + } + }, + /** + * @param {Element} element DOM node. + * @param {String} classname Classname. + * @return {Boolean} + */ + hasClass: function hasClass(element, c) { + // use native if available + return element.classList + ? element.classList.contains(c) + : this.classRegex(c).test(element.className); + }, + /** + * @param {Element|Array} element DOM node or array of nodes. + * @param {String} classname Classe. + */ + toggleClass: function toggleClass(element, classname) { + var this$1 = this; + + if (Array.isArray(element)) { + element.forEach(function (each) { + this$1.toggleClass(each, classname); + }); + return; + } + + // use native if available + if (element.classList) { + element.classList.toggle(classname); + } else { + if (this.hasClass(element, classname)) { + this._removeClass(element, classname); + } else { + this._addClass(element, classname); + } + } + }, + /** + * Abstraction to querySelectorAll for increased + * performance and greater usability + * @param {String} selector + * @param {Element} context (optional) + * @param {Boolean} find_all (optional) + * @return (find_all) {Element} : {Array} + */ + find: function find(selector, context, find_all) { + if ( context === void 0 ) context = window.document; + + var simpleRe = /^(#?[\w-]+|\.[\w-.]+)$/, + periodRe = /\./g, + slice = Array.prototype.slice, + matches = []; + + // Redirect call to the more performant function + // if it's a simple selector and return an array + // for easier usage + if (simpleRe.test(selector)) { + switch (selector[0]) { + case '#': + matches = [this.$(selector.substr(1))]; + break; + case '.': + matches = slice.call(context.getElementsByClassName( + selector.substr(1).replace(periodRe, ' '))); + break; + default: + matches = slice.call(context.getElementsByTagName(selector)); + } + } else { + // If not a simple selector, query the DOM as usual + // and return an array for easier usage + matches = slice.call(context.querySelectorAll(selector)); + } + + return (find_all) ? matches : matches[0]; + }, + $: function $(id) { + id = (id[0] === '#') ? id.substr(1, id.length) : id; + return document.getElementById(id); + }, + isElement: function isElement(obj) { + // DOM, Level2 + if ('HTMLElement' in window) { + return (!!obj && obj instanceof HTMLElement); + } + // Older browsers + return (!!obj && typeof obj === 'object' && obj.nodeType === 1 && + !!obj.nodeName); + }, + getAllChildren: function getAllChildren(node, tag) { + return [].slice.call(node.getElementsByTagName(tag)); + }, + isEmpty: function isEmpty(str) { + return (!str || 0 === str.length); + }, + emptyArray: function emptyArray(array) { + while (array.length) { array.pop(); } + }, + anyMatchInArray: function anyMatchInArray(source, target) { + return source.some(function (each) { return target.indexOf(each) >= 0; }); + }, + everyMatchInArray: function everyMatchInArray(arr1, arr2) { + return arr2.every(function (each) { return arr1.indexOf(each) >= 0; }); + }, + anyItemHasValue: function anyItemHasValue(obj, has) { + var this$1 = this; + if ( has === void 0 ) has = false; + + var keys = Object.keys(obj); + keys.forEach(function (key) { + if (!this$1.isEmpty(obj[key])) { has = true; } + }); + return has; + }, + removeAllChildren: function removeAllChildren(node) { + while (node.firstChild) { node.removeChild(node.firstChild); } + }, + removeAll: function removeAll(collection) { + var node; + while ((node = collection[0])) { node.parentNode.removeChild(node); } + }, + getChildren: function getChildren(node, tag) { + return [].filter.call( + node.childNodes, function (el) { return tag + ? el.nodeType === 1 && el.tagName.toLowerCase() === tag + : el.nodeType === 1; } + ); + }, + template: function template(html, row) { + var this$1 = this; + + return html.replace(/\{ *([\w_-]+) *\}/g, function (htm, key) { + var value = (row[key] === undefined) ? '' : row[key]; + return this$1.htmlEscape(value); + }); + }, + htmlEscape: function htmlEscape(str) { + return String(str) + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, '''); + }, + /** + * Overwrites obj1's values with obj2's and adds + * obj2's if non existent in obj1 + * @returns obj3 a new object based on obj1 and obj2 + */ + mergeOptions: function mergeOptions(obj1, obj2) { + var obj3 = {}; + for (var attr1 in obj1) { obj3[attr1] = obj1[attr1]; } + for (var attr2 in obj2) { obj3[attr2] = obj2[attr2]; } + return obj3; + }, + createElement: function createElement(node, html) { + var elem; + if (Array.isArray(node)) { + elem = document.createElement(node[0]); + + if (node[1].id) { elem.id = node[1].id; } + if (node[1].classname) { elem.className = node[1].classname; } + + if (node[1].attr) { + var attr = node[1].attr; + if (Array.isArray(attr)) { + var i = -1; + while (++i < attr.length) { + elem.setAttribute(attr[i].name, attr[i].value); + } + } else { + elem.setAttribute(attr.name, attr.value); + } + } + } else { + elem = document.createElement(node); + } + elem.innerHTML = html; + var frag = document.createDocumentFragment(); + + while (elem.childNodes[0]) { frag.appendChild(elem.childNodes[0]); } + elem.appendChild(frag); + return elem; + }, + assert: function assert(condition, message) { + if ( message === void 0 ) message = 'Assertion failed'; + + if (!condition) { + if (typeof Error !== 'undefined') { throw new Error(message); } + throw message; // Fallback + } + } +}; + +var klasses = vars.cssClasses; + +/** + * @class Html + */ +var Html = function Html(base) { + this.options = base.options; + this.els = this.createControl(); +}; + +Html.prototype.createControl = function createControl () { + var container, containerClass, elements; + + if (this.options.targetType === targetType.INPUT) { + containerClass = klasses.namespace + ' ' + klasses.inputText.container; + container = utils.createElement( + ['div', { classname: containerClass }], Html.input); + elements = { + container: container, + control: utils.find('.' + klasses.inputText.control, container), + input: utils.find('.' + klasses.inputText.input, container), + reset: utils.find('.' + klasses.inputText.reset, container), + result: utils.find('.' + klasses.inputText.result, container) + }; + } else { + containerClass = klasses.namespace + ' ' + klasses.glass.container; + container = utils.createElement( + ['div', { classname: containerClass }], Html.glass); + elements = { + container: container, + control: utils.find('.' + klasses.glass.control, container), + button: utils.find('.' + klasses.glass.button, container), + input: utils.find('.' + klasses.glass.input, container), + reset: utils.find('.' + klasses.glass.reset, container), + result: utils.find('.' + klasses.glass.result, container) + }; + } + //set placeholder from options + elements.input.placeholder = this.options.placeholder; + return elements; +}; + +/* eslint-disable indent */ +Html.glass = [ + '
    ', + '', + '', + '', + '
    ', + '
      ' +].join(''); + +Html.input = [ + '
      ', + '', + '', + '', + '
      ', + '
        ' +].join(''); +/* eslint-enable indent */ + +/** + * @class Photon + */ +var Photon = function Photon() { + + this.settings = { + url: '//photon.komoot.de/api/', + params: { + q: '', + limit: 10, + lang: 'en' + }, + langs: ['de', 'it', 'fr', 'en'] + }; +}; + +Photon.prototype.getParameters = function getParameters (options) { + options.lang = options.lang.toLowerCase(); + + return { + url: this.settings.url, + params: { + q: options.query, + limit: options.limit || this.settings.params.limit, + lang: this.settings.langs.indexOf(options.lang) > -1 ? + options.lang : this.settings.params.lang + } + }; +}; + +Photon.prototype.handleResponse = function handleResponse (results) { + return results.map(function (result) { return ({ + lon: result.geometry.coordinates[0], + lat: result.geometry.coordinates[1], + address: { + name: result.properties.name, + postcode: result.properties.postcode, + city: result.properties.city, + state: result.properties.state, + country: result.properties.country + }, + original: { + formatted: result.properties.name, + details: result.properties + } + }); }); +}; + +/** + * @class OpenStreet + */ +var OpenStreet = function OpenStreet() { + + this.settings = { + url: '//nominatim.openstreetmap.org/search/', + params: { + q: '', + format: 'json', + addressdetails: 1, + limit: 10, + countrycodes: '', + 'accept-language': 'en-US' + } + }; +}; + +OpenStreet.prototype.getParameters = function getParameters (options) { + return { + url: this.settings.url, + params: { + q: options.query, + format: 'json', + addressdetails: 1, + limit: options.limit || this.settings.params.limit, + countrycodes: options.countrycodes || this.settings.params.countrycodes, + 'accept-language': + options.lang || this.settings.params['accept-language'] + } + }; +}; + +OpenStreet.prototype.handleResponse = function handleResponse (results) { + return results.map(function (result) { return ({ + lon: result.lon, + lat: result.lat, + address: { + name: result.address.neighbourhood || '', + road: result.address.road || '', + postcode: result.address.postcode, + city: result.address.city || result.address.town, + state: result.address.state, + country: result.address.country + }, + original: { + formatted: result.display_name, + details: result.address + } + }); }); +}; + +/** + * @class MapQuest + */ +var MapQuest = function MapQuest() { + + this.settings = { + url: '//open.mapquestapi.com/nominatim/v1/search.php', + params: { + q: '', + key: '', + format: 'json', + addressdetails: 1, + limit: 10, + countrycodes: '', + 'accept-language': 'en-US' + } + }; +}; + +MapQuest.prototype.getParameters = function getParameters (options) { + return { + url: this.settings.url, + params: { + q: options.query, + key: options.key, + format: 'json', + addressdetails: 1, + limit: options.limit || this.settings.params.limit, + countrycodes: options.countrycodes || this.settings.params.countrycodes, + 'accept-language': + options.lang || this.settings.params['accept-language'] + } + }; +}; + +MapQuest.prototype.handleResponse = function handleResponse (results) { + return results.map(function (result) { return ({ + lon: result.lon, + lat: result.lat, + address: { + name: result.address.neighbourhood || '', + road: result.address.road || '', + postcode: result.address.postcode, + city: result.address.city || result.address.town, + state: result.address.state, + country: result.address.country + }, + original: { + formatted: result.display_name, + details: result.address + } + }); }); +}; + +/** + * @class Pelias + */ +var Pelias = function Pelias() { + + this.settings = { + url: '//search.mapzen.com/v1/search', + params: { + text: '', + key: '', + size: 10 + } + }; +}; + +Pelias.prototype.getParameters = function getParameters (options) { + return { + url: this.settings.url, + params: { + text: options.query, + key: options.key, + size: options.limit || this.settings.params.size + } + }; +}; + +Pelias.prototype.handleResponse = function handleResponse (results) { + return results.map(function (result) { return ({ + lon: result.geometry.coordinates[0], + lat: result.geometry.coordinates[1], + address: { + name: result.properties.name, + house_number: result.properties.housenumber, + postcode: result.properties.postalcode, + road: result.properties.street, + city: result.properties.city, + state: result.properties.region, + country: result.properties.country + }, + original: { + formatted: result.properties.label, + details: result.properties + } + }); }); +}; + +/** + * @class Google + */ +var Google = function Google() { + + this.settings = { + url: '//maps.googleapis.com/maps/api/geocode/json', + params: { + address: '', + key: '', + language: 'en-US' + } + }; +}; + +Google.prototype.getParameters = function getParameters (options) { + return { + url: this.settings.url, + params: { + address: options.query, + key: options.key, + language: options.lang || this.settings.params.language + } + }; +}; + +Google.prototype.handleResponse = function handleResponse (results) { + var name = [ + 'point_of_interest', + 'establishment', + 'natural_feature', + 'airport' + ], + road = [ + 'street_address', + 'route', + 'sublocality_level_5', + 'intersection' + ], + postcode = ['postal_code'], + city = ['locality'], + state = ['administrative_area_level_1'], + country = ['country']; + + /* + * @param {Array} details - address_components + */ + var getDetails = function (details) { + var parts = { + name: '', + road: '', + postcode: '', + city: '', + state: '', + country: '' + }; + details.forEach(function (detail) { + if (utils.anyMatchInArray(detail.types, name)) { + parts.name = detail.long_name; + } else if (utils.anyMatchInArray(detail.types, road)) { + parts.road = detail.long_name; + } else if (utils.anyMatchInArray(detail.types, postcode)) { + parts.postcode = detail.long_name; + } else if (utils.anyMatchInArray(detail.types, city)) { + parts.city = detail.long_name; + } else if (utils.anyMatchInArray(detail.types, state)) { + parts.state = detail.long_name; + } else if (utils.anyMatchInArray(detail.types, country)) { + parts.country = detail.long_name; + } + }); + return parts; + }; + + var array = []; + + results.forEach(function (result) { + var details = getDetails(result.address_components); + if (utils.anyItemHasValue(details)) { + array.push({ + lon: result.geometry.location.lng, + lat: result.geometry.location.lat, + address: { + name: details.name, + postcode: details.postcode, + road: details.road, + city: details.city, + state: details.state, + country: details.country + }, + original: { + formatted: result.formatted_address, + details: result.address_components + } + }); + } + }); + + return array; +}; + +/** + * @class Bing + */ +var Bing = function Bing() { + this.settings = { + url: '//dev.virtualearth.net/REST/v1/Locations', + callbackName: 'jsonp', + params: { + query: '', + key: '', + includeNeighborhood: 0, + maxResults: 10 + } + }; +}; + +Bing.prototype.getParameters = function getParameters (options) { + return { + url: this.settings.url, + callbackName: this.settings.callbackName, + params: { + query: options.query, + key: options.key, + includeNeighborhood: options.includeNeighborhood || + this.settings.params.includeNeighborhood, + maxResults: options.maxResults || this.settings.params.maxResults + } + }; +}; + +Bing.prototype.handleResponse = function handleResponse (results) { + return results.map(function (result) { return ({ + lon: result.point.coordinates[1], + lat: result.point.coordinates[0], + address: { + name: result.name + }, + original: { + formatted: result.address.formattedAddress, + details: result.address + } + }); }); +}; + +var klasses$1 = vars.cssClasses; + +/** + * @class Nominatim + */ +var Nominatim = function Nominatim(base, els) { + this.Base = base; + + this.layerName = utils.randomId('geocoder-layer-'); + this.layer = new ol.layer.Vector({ + name: this.layerName, + source: new ol.source.Vector() + }); + + this.options = base.options; + this.options.provider = this.options.provider.toLowerCase(); + + this.els = els; + this.lastQuery = ''; + this.container = this.els.container; + this.registeredListeners = { mapClick: false }; + this.setListeners(); + + // providers + this.Photon = new Photon(); + this.OpenStreet = new OpenStreet(); + this.MapQuest = new MapQuest(); + this.Pelias = new Pelias(); + this.Google = new Google(); + this.Bing = new Bing(); +}; + +Nominatim.prototype.setListeners = function setListeners () { + var this$1 = this; + + var timeout, lastQuery; + var openSearch = function () { + utils.hasClass(this$1.els.control, klasses$1.glass.expanded) ? + this$1.collapse() : this$1.expand(); + }; + var query = function (evt) { + var value = evt.target.value.trim(); + var hit = evt.key ? evt.key === 'Enter' : + evt.which ? evt.which === 13 : + evt.keyCode ? evt.keyCode === 13 : false; + + if (hit) { + evt.preventDefault(); + this$1.query(value); + } + }; + var reset = function (evt) { + this$1.els.input.focus(); + this$1.els.input.value = ''; + this$1.lastQuery = ''; + utils.addClass(this$1.els.reset, klasses$1.hidden); + this$1.clearResults(); + }; + var handleValue = function (evt) { + var value = evt.target.value.trim(); + + value.length + ? utils.removeClass(this$1.els.reset, klasses$1.hidden) + : utils.addClass(this$1.els.reset, klasses$1.hidden); + + if (this$1.options.autoComplete && value !== lastQuery) { + lastQuery = value; + timeout && clearTimeout(timeout); + timeout = setTimeout(function () { + if (value.length >= this$1.options.autoCompleteMinLength) { + this$1.query(value); + } + }, 200); + } + }; + this.els.input.addEventListener('keyup', query, false); + this.els.input.addEventListener('input', handleValue, false); + this.els.reset.addEventListener('click', reset, false); + if (this.options.targetType === targetType.GLASS) { + this.els.button.addEventListener('click', openSearch, false); + } +}; + +Nominatim.prototype.query = function query (q) { + var this$1 = this; + + var ajax = {}, options = this.options; + var provider = this.getProvider({ + query: q, + provider: options.provider, + key: options.key, + lang: options.lang, + countrycodes: options.countrycodes, + limit: options.limit + }); + if (this.lastQuery === q && this.els.result.firstChild) { return; } + this.lastQuery = q; + this.clearResults(); + utils.addClass(this.els.reset, klasses$1.spin); + + ajax.url = document.location.protocol + provider.url; + ajax.data = provider.params; + + if (options.provider === providers.BING) { + ajax.data_type = 'jsonp'; + ajax.callbackName = provider.callbackName; + } + + utils.json(ajax).when({ + ready: function (res) { + // eslint-disable-next-line no-console + options.debug && console.info(res); + utils.removeClass(this$1.els.reset, klasses$1.spin); + //will be fullfiled according to provider + var res_; + switch (options.provider) { + case providers.OSM: + res_ = res.length ? + this$1.OpenStreet.handleResponse(res) : undefined; + break; + case providers.MAPQUEST: + res_ = res.length ? + this$1.MapQuest.handleResponse(res) : undefined; + break; + case providers.PELIAS: + res_ = res.features.length ? + this$1.Pelias.handleResponse(res.features) : undefined; + break; + case providers.PHOTON: + res_ = res.features.length ? + this$1.Photon.handleResponse(res.features) : undefined; + break; + case providers.GOOGLE: + res_ = res.results.length ? + this$1.Google.handleResponse(res.results) : undefined; + break; + case providers.BING: + res_ = res.resourceSets[0].resources.length + ? this$1.Bing.handleResponse(res.resourceSets[0].resources) + : undefined; + break; + default: + // eslint-disable-next-line no-console + console.log('Unknown provider!'); + break; + } + if (res_) { + this$1.createList(res_); + this$1.listenMapClick(); + } + }, + error: function () { + utils.removeClass(this$1.els.reset, klasses$1.spin); + var li = utils.createElement( + 'li', '
        Error! No internet connection?
        '); + this$1.els.result.appendChild(li); + } + }); +}; + +Nominatim.prototype.createList = function createList (response) { + var this$1 = this; + + var ul = this.els.result; + response.forEach(function (row) { + var addressHtml = this$1.addressTemplate(row.address), + html = ['', addressHtml, ''].join(''), + li = utils.createElement('li', html); + li.addEventListener('click', function (evt) { + evt.preventDefault(); + this$1.chosen(row, addressHtml, row.address, row.original); + }, false); + ul.appendChild(li); + }); +}; + +Nominatim.prototype.chosen = function chosen (place, addressHtml, addressObj, addressOriginal) { + var map = this.Base.getMap(); + var coord_ = [parseFloat(place.lon), parseFloat(place.lat)]; + var projection = map.getView().getProjection(); + var coord = ol.proj.transform(coord_, 'EPSG:4326', projection); + var address = { + formatted: addressHtml, + details: addressObj, + original: addressOriginal + }; + + this.options.keepOpen === false && this.clearResults(true); + + if (this.options.preventDefault === true) { + this.Base.dispatchEvent({ + type: eventType.ADDRESSCHOSEN, + address: address, + coordinate: coord + }); + } else { + utils.flyTo(map, coord); + var feature = this.createFeature(coord, address); + + this.Base.dispatchEvent({ + type: eventType.ADDRESSCHOSEN, + address: address, + feature: feature, + coordinate: coord + }); + } +}; + +Nominatim.prototype.createFeature = function createFeature (coord) { + var feature = new ol.Feature(new ol.geom.Point(coord)); + this.addLayer(); + feature.setStyle(this.options.featureStyle); + feature.setId(utils.randomId('geocoder-ft-')); + this.getSource().addFeature(feature); +}; + +Nominatim.prototype.addressTemplate = function addressTemplate (address) { + var html = []; + if (address.name) { + html.push(['{name}'].join('')); + } + if (address.road || address.building || address.house_number) { + html.push([ + '{building} {road} {house_number}' + ].join('')); + } + if (address.city || address.town || address.village) { + html.push([ + '{postcode} {city} {town} {village}' + ].join('')); + } + if (address.state || address.country) { + html.push([ + '{state} {country}' + ].join('')); + } + return utils.template(html.join('
        '), address); +}; + +Nominatim.prototype.getProvider = function getProvider (options) { + var provider; + /*eslint default-case: 0*/ + switch (options.provider) { + case providers.OSM: + provider = this.OpenStreet.getParameters(options); + break; + case providers.MAPQUEST: + provider = this.MapQuest.getParameters(options); + break; + case providers.PHOTON: + provider = this.Photon.getParameters(options); + break; + case providers.GOOGLE: + provider = this.Google.getParameters(options); + break; + case providers.PELIAS: + provider = this.Pelias.getParameters(options); + break; + case providers.BING: + provider = this.Bing.getParameters(options); + break; + } + return provider; +}; + +Nominatim.prototype.expand = function expand () { + var this$1 = this; + + utils.removeClass(this.els.input, klasses$1.spin); + utils.addClass(this.els.control, klasses$1.glass.expanded); + window.setTimeout(function () { return this$1.els.input.focus(); }, 100); + this.listenMapClick(); +}; + +Nominatim.prototype.collapse = function collapse () { + this.els.input.value = ''; + this.els.input.blur(); + utils.addClass(this.els.reset, klasses$1.hidden); + utils.removeClass(this.els.control, klasses$1.glass.expanded); + this.clearResults(); +}; + +Nominatim.prototype.listenMapClick = function listenMapClick () { + // already registered + if (this.registeredListeners.mapClick) { return; } + + var this_ = this; + var mapElement = this.Base.getMap().getTargetElement(); + this.registeredListeners.mapClick = true; + + //one-time fire click + mapElement.addEventListener('click', { + handleEvent: function (evt) { + this_.clearResults(true); + mapElement.removeEventListener(evt.type, this, false); + this_.registeredListeners.mapClick = false; + } + }, false); +}; + +Nominatim.prototype.clearResults = function clearResults (collapse) { + collapse && this.options.targetType === targetType.GLASS ? + this.collapse() : utils.removeAllChildren(this.els.result); +}; + +Nominatim.prototype.getSource = function getSource () { + return this.layer.getSource(); +}; + +Nominatim.prototype.addLayer = function addLayer () { + var this$1 = this; + + var found = false; + var map = this.Base.getMap(); + + map.getLayers().forEach(function (layer) { + if (layer === this$1.layer) { found = true; } + }); + if (!found) { map.addLayer(this.layer); } +}; + +/** + * @class Base + * @extends {ol.control.Control} + */ +var Base = (function (superclass) { + function Base(type, options) { + if ( type === void 0 ) type = controlType.NOMINATIM; + if ( options === void 0 ) options = {}; + + + if (!(this instanceof Base)) { return new Base(); } + + utils.assert(typeof type === 'string', '@param `type` should be string!'); + utils.assert(typeof options === 'object', + '@param `options` should be object!'); + + this.options = utils.mergeOptions(defaultOptions, options); + this.container = undefined; + + var $nominatim; + var $html = new Html(this); + + if (type === controlType.NOMINATIM) { + this.container = $html.els.container; + $nominatim = new Nominatim(this, $html.els); + this.layer = $nominatim.layer; + } else if (type === controlType.REVERSE) { + // TODO + } + + superclass.call(this, { element: this.container }); + } + + if ( superclass ) Base.__proto__ = superclass; + Base.prototype = Object.create( superclass && superclass.prototype ); + Base.prototype.constructor = Base; + + /** + * @return {ol.layer.Vector} Returns the layer created by this control + */ + Base.prototype.getLayer = function getLayer () { + return this.layer; + }; + + /** + * @return {ol.source.Vector} Returns the source created by this control + */ + Base.prototype.getSource = function getSource () { + return this.getLayer().getSource(); + }; + + return Base; +}(ol.control.Control)); + +return Base; + +}))); diff --git a/build/ol3-geocoder.css b/build/ol3-geocoder.css index 728a500..c199c26 100644 --- a/build/ol3-geocoder.css +++ b/build/ol3-geocoder.css @@ -1,49 +1,77 @@ -/** +/*! + * ol3-geocoder - v2.4.0 * A geocoder extension for OpenLayers 3. * https://github.com/jonataswalker/ol3-geocoder - * Version: v2.3.0 - * Built: 2016-08-15T11:57:59-03:00 + * Built: Mon Dec 19 2016 11:15:29 GMT-0200 (BRST) */ - -.ol3-geocoder-container { +.ol-geocoder.gcd-gl-container { position: absolute; - top: calc(.5em + 65px); + top: 4.875em; left: .5em; box-sizing: border-box; } - .ol3-geocoder-container *, - .ol3-geocoder-container *::before, - .ol3-geocoder-container *::after { + .ol-geocoder.gcd-gl-container *, + .ol-geocoder.gcd-gl-container *::before, + .ol-geocoder.gcd-gl-container *::after { box-sizing: inherit; } - -.ol3-geocoder-search { - width: 31px; - height: 31px; + .ol-geocoder .gcd-gl-control { + width: 2.1875em; + height: 2.1875em; overflow: hidden; -webkit-transition: width 200ms, height 200ms; transition: width 200ms, height 200ms; } - -.ol3-geocoder-search-expanded { - width: 220px; - height: 35px; } - -.ol3-geocoder-input-search { + .ol-geocoder .gcd-gl-expanded { + width: 15.625em; + height: 2.1875em; } + .ol-geocoder .gcd-gl-input { position: absolute; - top: 2px; - left: 32px; - width: 180px; - padding: 5px; + z-index: 99; + top: 0.1875em; + left: 2.5em; + width: 14.84375em; + padding: 0.3125em; border: 1px solid #ccc; font-family: inherit; - font-size: 0.875rem; } - .ol3-geocoder-input-search:focus { - border-color: #35b5f4; } - -ul.ol3-geocoder-result { + font-size: 0.875em; + background-color: #fff; + color: #222; } + .ol-geocoder .gcd-gl-input:focus { + border: none; + outline: none; + box-shadow: inset 0 0 0 1px #4d90fe, inset 0 0 5px #4d90fe; } + .ol-geocoder .gcd-gl-reset { position: absolute; - top: 37px; - left: 32px; - width: 260px; - max-height: 300px; + z-index: 100; + top: 0; + right: 0; + width: 1.5625em; + height: 100%; + line-height: 1.4; + border: none; + background-color: transparent; + display: inline-block; + outline: 0; + cursor: pointer; } + .ol-geocoder .gcd-gl-reset::after { + content: "\d7"; + display: inline-block; + color: #333; + font-size: 1.5em; + cursor: pointer; } + .ol-geocoder .gcd-gl-btn { + position: absolute; + width: 1.5625em; + height: 1.5625em; + top: 0.125em; + left: 0.125em; + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAABPUlEQVQoU41SwXHCQAzUHh58eoUOIBWEDkI6oAToIKkg7iAuwakgpAIowXRACcnrzp6BzchjMx4wE/S6kW5XK60gvQghzJIkmVoqSZI9gJ9+/fINS5Cc1HX9QXIlIr/tpwcRyb33b7cIGnAIYQdg4pxbjcfj0nJ1Xc+Px+PGObdN03Q9RIAQwgpAnqbp7FKmjQGgJLlU1d2V7BjjRkQO3vvXIXarkyxVNbsCm2QR2Q0V7XOMMReRmfd+OQQubN6hYgs22ZtbnRcAtiRfLueqqmpJ8ovko6oeBq0KIWQA3gFkzrlmMafTaUEyI/mpqmbhVTRWWbRdbClPbeobQNES5KPRqOxs7DBn8K1DsAOKMZYApiTXqlrcDe4d0XN7jWeCfzt351tVle2iGalTcBd4gGDvvZ/fDe4RmCOFLe8Pr7mvEP2N9PQAAAAASUVORK5CYII="); + background-repeat: no-repeat; + background-position: center center; } + .ol-geocoder ul.gcd-gl-result { + position: absolute; + top: 2.1875em; + left: 2em; + width: 16.25em; + max-height: 18.75em; white-space: normal; list-style: none; padding: 0; @@ -58,47 +86,149 @@ ul.ol3-geocoder-result { box-shadow: 0 1px 7px rgba(0, 0, 0, 0.8); -webkit-transition: max-height 300ms ease-in; transition: max-height 300ms ease-in; } - ul.ol3-geocoder-result > li { + .ol-geocoder ul.gcd-gl-result > li { width: 100%; overflow: hidden; border-bottom: 1px solid #eee; padding: 0; line-height: 0.875rem; } - ul.ol3-geocoder-result > li > a { + .ol-geocoder ul.gcd-gl-result > li > a { display: block; text-decoration: none; padding: 3px 5px; } - ul.ol3-geocoder-result > li > a:hover { + .ol-geocoder ul.gcd-gl-result > li > a:hover { background-color: #d4d4d4; } - ul.ol3-geocoder-result > li:nth-child(odd) { + .ol-geocoder ul.gcd-gl-result > li:nth-child(odd) { background-color: #e0ffe0; } - -.ol3-geocoder-road { - font-size: 0.875rem; + .ol-geocoder.gcd-txt-container { + position: absolute; + width: 25em; + height: 4.375em; + top: .5em; + left: calc(50% - 12.5em); + box-sizing: border-box; } + .ol-geocoder.gcd-txt-container *, + .ol-geocoder.gcd-txt-container *::before, + .ol-geocoder.gcd-txt-container *::after { + box-sizing: inherit; } + .ol-geocoder .gcd-txt-control { + position: relative; + width: 100%; + height: 4.375em; + border: 1px solid #ccc; + background-color: #fff; + overflow: hidden; } + .ol-geocoder .gcd-txt-input { + position: absolute; + z-index: 99; + top: 0; + left: 0; + width: 100%; + height: 100%; + padding: 5px 30px 5px 40px; + border: none; + text-indent: 6px; + background-color: transparent; + font-family: inherit; + font-size: 0.875em; } + .ol-geocoder .gcd-txt-input:focus { + outline: none; + box-shadow: inset 0 0 0 1px #4d90fe, inset 0 0 6px #4d90fe; } + .ol-geocoder .gcd-txt-reset { + position: absolute; + z-index: 100; + top: 0; + right: 0; + width: 2.5em; + height: 100%; + line-height: 100%; + border: none; + background-color: transparent; + display: inline-block; + vertical-align: middle; + outline: 0; + cursor: pointer; } + .ol-geocoder .gcd-txt-reset::after { + content: "\d7"; + display: inline-block; + color: #333; + font-size: 2em; + cursor: pointer; } + .ol-geocoder .gcd-txt-glass { + position: absolute; + top: 0; + left: 0; + z-index: 100; + display: inline-block; + width: 2.5em; + height: 100%; + background-size: 1.38889em; + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath fill='%23333' d='M29.156 29.961l-.709.709a2.006 2.006 0 0 1-2.838 0l-5.676-5.674c-.656-.658-.729-1.644-.281-2.412l-3.104-3.102a9.975 9.975 0 0 1-5.965 1.979C5.043 21.461.552 16.97.552 11.43S5.043 1.398 10.583 1.398c5.541 0 10.031 4.491 10.031 10.032 0 2.579-.98 4.923-2.58 6.7l3.035 3.035c.768-.447 1.754-.375 2.41.283l5.676 5.674c.784.785.784 2.056.001 2.839zM18.088 11.389c0-4.155-3.369-7.523-7.524-7.523a7.523 7.523 0 1 0-.001 15.046 7.525 7.525 0 0 0 7.525-7.523z'/%3E%3C/svg%3E"); + background-repeat: no-repeat; + background-position: center center; } + .ol-geocoder ul.gcd-txt-result { + position: absolute; + top: 4.575em; + left: 0; + width: 25em; + max-height: 18.75em; + white-space: normal; + list-style: none; + padding: 0; + margin: 0; + background-color: white; + border-radius: 4px; + border-top: none; + border-top-left-radius: 0; + border-top-right-radius: 0; + overflow-x: hidden; + overflow-y: auto; + box-shadow: 0 1px 7px rgba(0, 0, 0, 0.8); + -webkit-transition: max-height 300ms ease-in; + transition: max-height 300ms ease-in; } + .ol-geocoder ul.gcd-txt-result > li { + width: 100%; + overflow: hidden; + border-bottom: 1px solid #eee; + padding: 0; + line-height: 0.875rem; } + .ol-geocoder ul.gcd-txt-result > li > a { + display: block; + text-decoration: none; + padding: 3px 5px; } + .ol-geocoder ul.gcd-txt-result > li > a:hover { + background-color: #d4d4d4; } + .ol-geocoder ul.gcd-txt-result > li:nth-child(odd) { + background-color: #e0ffe0; } + .ol-geocoder .gcd-hidden { + opacity: 0; + visibility: hidden; } + .ol-geocoder .gcd-pseudo-rotate::after { + -webkit-animation: spin .7s linear infinite; + animation: spin .7s linear infinite; } + @-webkit-keyframes spin { + from { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); } + to { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); } } + @keyframes spin { + from { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); } + to { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); } } + .ol-geocoder .gcd-road { + font-size: 0.875em; font-weight: 500; color: #000; } - -.ol3-geocoder-city { - font-size: 0.75rem; + .ol-geocoder .gcd-city { + font-size: 0.75em; font-weight: normal; color: #000; } - -.ol3-geocoder-country { - font-size: 0.75rem; + .ol-geocoder .gcd-country { + font-size: 0.75em; font-weight: lighter; color: #444; } - -.ol3-geocoder-btn-search { - position: absolute; - width: 25px; - height: 25px; - top: 2px; - left: 2px; - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAABPUlEQVQoU41SwXHCQAzUHh58eoUOIBWEDkI6oAToIKkg7iAuwakgpAIowXRACcnrzp6BzchjMx4wE/S6kW5XK60gvQghzJIkmVoqSZI9gJ9+/fINS5Cc1HX9QXIlIr/tpwcRyb33b7cIGnAIYQdg4pxbjcfj0nJ1Xc+Px+PGObdN03Q9RIAQwgpAnqbp7FKmjQGgJLlU1d2V7BjjRkQO3vvXIXarkyxVNbsCm2QR2Q0V7XOMMReRmfd+OQQubN6hYgs22ZtbnRcAtiRfLueqqmpJ8ovko6oeBq0KIWQA3gFkzrlmMafTaUEyI/mpqmbhVTRWWbRdbClPbeobQNES5KPRqOxs7DBn8K1DsAOKMZYApiTXqlrcDe4d0XN7jWeCfzt351tVle2iGalTcBd4gGDvvZ/fDe4RmCOFLe8Pr7mvEP2N9PQAAAAASUVORK5CYII="); - background-repeat: no-repeat; - background-position: center center; } - -.ol3-geocoder-loading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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABvlAmVBYqchSiURK5jIOn66CqCCriERGFqXgegpdp4RASGkJBYlTd9isthIKGcdxTLSMrjWBER+JQjIIgAgiI1UOVAoxACQTMhAnTwgQMgpvFBUjKy8AGCJeQxAiYixrMiERBqBCJyFxQghLq7MVKTExFgwaTqAuCBwUCSIxCy8XAaZevg4toxOvs6AVry4TDRqzLQIQayMPFxYDdKsfBCAoIZkdFiUfMicmVUYojgooEgRGFBqGHyUSMh48kEFhw5IKLRxV6TLCQAcqJkA80gDCSIVkLhp0iCBEhQohEjQ84DWkggAYnxoaMAQPQbInI4wUMGCASiYvQQAAIfkECQkALwAsAAAAABQAFACFBAIEhIKExMLEREJE5OLkpKKkZGJk1NLU9PL0LCostLK0lJKUdHJ0VFJUzMrM7Ors3Nrc/Pr8NDY0vLq8FBYUjIqMTEpMrKqsbGpsnJqcfHp8xMbE5ObkpKakZGZk1NbU9Pb0NDI0tLa0dHZ0XFpczM7M7O7s3N7c/P78PDo8vL68HBocjI6MTE5MnJ6c/v7+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABvLAl1CIQLxMCoXphYoMn8wCJfOKiETO04SAglZJAEl3MhEKFKXusPkChQCH18ZxVKicKPXFYzxRGC8HH4EiIFUOBC8IIRQDJy8qGE8lSwgqChMRIB0NFAkqXkIPIgoCJ2ovJwEjoYEfRkKvra0RJhIpFhgVqFAoBxsTSbctDCy8T74OKqQnhrNeEbAoEBksrSUHJmogIgwWJHGhD8EqpyAGFgwcLx8uVU4qiSCXmS8CFYYcDBcvImUbBZZEKLGOSRcQATysK1DgSIYLznihyOChghAW1l5cyDDhGBMHGgS0CRDAEIQOEDwKAeGEA8l1mqAEAQA7"); - background-repeat: no-repeat; - background-position: right center; } diff --git a/build/ol3-geocoder.js b/build/ol3-geocoder.js index b43970c..c33f902 100644 --- a/build/ol3-geocoder.js +++ b/build/ol3-geocoder.js @@ -1,8 +1,8 @@ -/** +/*! + * ol3-geocoder - v2.4.0 * A geocoder extension for OpenLayers 3. * https://github.com/jonataswalker/ol3-geocoder - * Version: v2.3.0 - * Built: 2016-08-15T11:57:59-03:00 + * Built: Mon Dec 19 2016 11:15:26 GMT-0200 (BRST) */ - -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Geocoder=t()}(this,function(){"use strict";var e="ol3-geocoder",t="-container",r="-search",n="-btn-search",s="-loading",a="-result",o="-search-expanded",i="-country",l="-city",c="-road",u="ol-control",d="form-geocoder",p="-input-search",m="gcd-input",h={ADDRESSCHOSEN:"addresschosen"},g=[new ol.style.Style({image:new ol.style.Icon({anchor:[.5,1],src:["data:image/png;base64,","iVBORw0KGgoAAAANSUhEUgAAAC0AAAAtCAYAAAA6GuKaAAAABmJLR0QA/wD/AP+gvaeT","AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4AQWCiErd9Z21AAABAJJREFUWMPVm","U1oXFUUx3/3zatJx04SDOgiVUMSgrXJwpqIKy26SrKoLjQgCkIFW7otuCvdllbo1q6Epg","vNQvtx710lEFdihwpSjdikJLGJWEhrM9MyX7nPxbypwzBv5n3cqXpgmOHOuff/mzPn3Pf","ueWDBpqZnrPq1M5EUVitZ+9wPvA0cAgaALqAIbAI3gAWt5HbjvCcGXROdmp4RwDDwBfBW","iKmLwKfAqlbSiwvvJAAeAeaBWyGB8f1uAfNT0zMj/jqdjXQd8Ds+sJsguyrAe1rJb6NGX","MQAPgJ8k7QefPOAd7WSl6OAi4jAk8D3cdKqhRngda3k9bDgUSL9NLAO9GPftoEXtZIPrR","WiXyzHwwAbA8WyoFAUFMsCY0JB9wPHwxalGyH3T4RxHByo8MZEgf4+w/ZfDt9lu9n4I5T","MCeBzP8+tQL8KDAZuA7swOljh4yM5JsaKGAPGA0fABzN5sje7+PJyht/WXNxU8O/1dbK2","9ulPWn05tL/CqWP3GR8tUSgKSmVBpVJ9LxQF46MlTh27z9D+SiKdqNCBFw/jwexUnr4eg","xfwx3oe9PUYZqfyGC+eThzo4SCYTNpweLLQtuCMgcOTBTLp4B8XpBMXuqnfroGxkTIi5M","YpRNV/1yTjCQv9oHmkBXu7vRD1/s/1b2+3h+eJSDpxoa83G0w5HisbLqRCrpKClQ2XlON","F0okL/XXTyQ6sbe1h/Y7bNkWEgPU7Lmtbe3CcaDpxoS8CuaYbfcpj7mqmVXE9Ltq5qxnc","VKBjztexBl0Azgd9uZTt4spimlJZkHKqUa29Ug6UyoIri2mWsl2tNM77OlZvmIaBn4B00","6tiRfDSUIk3JwocerlIzz7DTt7hxi9dLGW7+fX2U7huYJQfAeNayduduDX9Cni/3X5sPI","HnVSPtCK9VDj/OZa3krPVbUx++J+y2FNF6tZI71s+IfhR2gNOWgU9rJXeinBUjnxGBF4A","fgWcsAN8DXgE2OnJGbIC/CHxoAXpOK/lRx1sIvn1mKTVirRO377EFnE0IfFYrudXxvkdD","bvcCvwOZGEvkgOeBB0+kwwTU9tIccClmlC8Bubj9vKQNyAPAzxHX8YCDWsnluLpOAmB84","fmIU+e1kstJ2r42OkVH/S5R2G7S0aSCsaFrHU+tZB44F3LaOa1k/l/pTzfZSQ4APwD7Wr","jmgdeA5STAttKjltsLbdwWkhSf1UjXRfxZ4M8WLs9pJe/a0HIsAeMDnQlwOaOVvPufeFD","UJLcH/H27t6EtcBDYTJrLViNdl9ubwLWG4Wv+uDUTWDb/LLlSNzSilVy1qeFYBsYHvOAP","XdBKrtrK5Y5A19lJqo8kTnZi8U6kRy0YY8BNwNgqwP+1/Q09w5giQWRk7AAAAABJRU5Er","kJggg=="].join("")})})],f={OSM:"osm",MAPQUEST:"mapquest",GOOGLE:"google",PHOTON:"photon",BING:"bing",PELIAS:"pelias"},y={provider:f.OSM,placeholder:"Search for an address",featureStyle:g,lang:"en-US",limit:5,keepOpen:!1,preventDefault:!1,autoComplete:!1,autoCompleteMinLength:2,debug:!1},v={toQueryString:function(e){var t=this;return Object.keys(e).reduce(function(r,n){return r.push("object"==typeof e[n]?t.toQueryString(e[n]):encodeURIComponent(n)+"="+encodeURIComponent(e[n])),r},[]).join("&")},encodeUrlXhr:function(e,t){if(t&&"object"==typeof t){var r=this.toQueryString(t);e+=(/\?/.test(e)?"&":"?")+r}return e},json:function(e,t){var r=new XMLHttpRequest,n="",s="",a={},o=function(){200===r.status&&a.ready.call(void 0,JSON.parse(r.response))},i=function(){console.info("Cannot XHR "+JSON.stringify(e))};return"object"==typeof e?(n=e.url,t=e.data,s=e.data_type||"json"):n=e,n=this.encodeUrlXhr(n,t),"jsonp"===s?this.jsonp(n,e.callbackName,function(e){a.ready.call(void 0,e)}):(r.open("GET",n,!0),r.setRequestHeader("Accept","application/json"),r.onload=o,r.onerror=i,r.send(null)),{when:function(e){a.ready=e.ready}}},jsonp:function(e,t,r){var n=document.head,s=document.createElement("script"),a="f"+Math.round(Math.random()*Date.now());s.setAttribute("src",e+(e.indexOf("?")>0?"&":"?")+t+"="+a),window[a]=function(e){window[a]=void 0,setTimeout(function(){n.removeChild(s)},0),r(e)},n.appendChild(s)},now:function(){if("performance"in window==0&&(window.performance={}),Date.now=Date.now||function(){return(new Date).getTime()},"now"in window.performance==0){var e=Date.now();performance.timing&&performance.timing.navigationStart&&(e=performance.timing.navigationStart),window.performance.now=function(){return Date.now()-e}}return window.performance.now()},flyTo:function(e,t,r,n){n=n||2.388657133911758,r=r||500;var s=e.getView(),a=ol.animation.pan({duration:r,source:s.getCenter()}),o=ol.animation.zoom({duration:r,resolution:s.getResolution()});e.beforeRender(a,o),s.setCenter(t),s.setResolution(n)},randomId:function(e){var t=this.now().toString(36);return e?e+t:t},isNumeric:function(e){return/^\d+$/.test(e)},classRegex:function(e){return new RegExp("(^|\\s+) "+e+" (\\s+|$)")},addClass:function(e,t,r){var n=this;if(Array.isArray(e))return void e.forEach(function(e){n.addClass(e,t)});for(var s=Array.isArray(t)?t:t.split(/\s+/),a=s.length;a--;)n.hasClass(e,s[a])||n._addClass(e,s[a],r)},_addClass:function(e,t,r){var n=this;e.classList?e.classList.add(t):e.className=(e.className+" "+t).trim(),r&&this.isNumeric(r)&&window.setTimeout(function(){n._removeClass(e,t)},r)},removeClass:function(e,t,r){var n=this;if(Array.isArray(e))return void e.forEach(function(e){n.removeClass(e,t,r)});for(var s=Array.isArray(t)?t:t.split(/\s+/),a=s.length;a--;)n.hasClass(e,s[a])&&n._removeClass(e,s[a],r)},_removeClass:function(e,t,r){var n=this;e.classList?e.classList.remove(t):e.className=e.className.replace(this.classRegex(t)," ").trim(),r&&this.isNumeric(r)&&window.setTimeout(function(){n._addClass(e,t)},r)},hasClass:function(e,t){return e.classList?e.classList.contains(t):this.classRegex(t).test(e.className)},toggleClass:function(e,t){var r=this;return Array.isArray(e)?void e.forEach(function(e){r.toggleClass(e,t)}):void(e.classList?e.classList.toggle(t):this.hasClass(e,t)?this._removeClass(e,t):this._addClass(e,t))},$:function(e){return e="#"===e[0]?e.substr(1,e.length):e,document.getElementById(e)},isElement:function(e){return"HTMLElement"in window?!!e&&e instanceof HTMLElement:!!e&&"object"==typeof e&&1===e.nodeType&&!!e.nodeName},getAllChildren:function(e,t){return[].slice.call(e.getElementsByTagName(t))},isEmpty:function(e){return!e||0===e.length},emptyArray:function(e){for(;e.length;)e.pop()},anyMatchInArray:function(e,t){return e.some(function(e){return t.indexOf(e)>=0})},everyMatchInArray:function(e,t){return t.every(function(t){return e.indexOf(t)>=0})},anyItemHasValue:function(e,t){var r=this;void 0===t&&(t=!1);for(var n in e)r.isEmpty(e[n])||(t=!0);return t},removeAllChildren:function(e){for(;e.firstChild;)e.removeChild(e.firstChild)},removeAll:function(e){for(var t;t=e[0];)t.parentNode.removeChild(t)},getChildren:function(e,t){return[].filter.call(e.childNodes,function(e){return t?1==e.nodeType&&e.tagName.toLowerCase()==t:1==e.nodeType})},template:function(e,t){var r=this;return e.replace(/\{ *([\w_-]+) *\}/g,function(e,n){var s=void 0===t[n]?"":t[n];return r.htmlEscape(s)})},htmlEscape:function(e){return String(e).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")},mergeOptions:function(e,t){var r={};for(var n in e)r[n]=e[n];for(var s in t)r[s]=t[s];return r},createElement:function(e,t){var r;if(Array.isArray(e)){if(r=document.createElement(e[0]),e[1].id&&(r.id=e[1].id),e[1].classname&&(r.className=e[1].classname),e[1].attr){var n=e[1].attr;if(Array.isArray(n))for(var s=-1;++s-1?e.lang:this.settings.params.lang}}},A.prototype.handleResponse=function(e){return e.map(function(e){return{lon:e.geometry.coordinates[0],lat:e.geometry.coordinates[1],address:{name:e.properties.name,postcode:e.properties.postcode,city:e.properties.city,state:e.properties.state,country:e.properties.country},original:{formatted:e.properties.name,details:e.properties}}})};var w=function(){this.settings={url:"//nominatim.openstreetmap.org/search/",params:{q:"",format:"json",addressdetails:1,limit:10,countrycodes:"","accept-language":"en-US"}}};w.prototype.getParameters=function(e){return{url:this.settings.url,params:{q:e.query,format:"json",addressdetails:1,limit:e.limit||this.settings.params.limit,countrycodes:e.countrycodes||this.settings.params.countrycodes,"accept-language":e.lang||this.settings.params["accept-language"]}}},w.prototype.handleResponse=function(e){return e.map(function(e){return{lon:e.lon,lat:e.lat,address:{name:e.address.neighbourhood||"",road:e.address.road||"",postcode:e.address.postcode,city:e.address.city||e.address.town,state:e.address.state,country:e.address.country},original:{formatted:e.display_name,details:e.address}}})};var C=function(){this.settings={url:"//open.mapquestapi.com/nominatim/v1/search.php",params:{q:"",key:"",format:"json",addressdetails:1,limit:10,countrycodes:"","accept-language":"en-US"}}};C.prototype.getParameters=function(e){return{url:this.settings.url,params:{q:e.query,key:e.key,format:"json",addressdetails:1,limit:e.limit||this.settings.params.limit,countrycodes:e.countrycodes||this.settings.params.countrycodes,"accept-language":e.lang||this.settings.params["accept-language"]}}},C.prototype.handleResponse=function(e){return e.map(function(e){return{lon:e.lon,lat:e.lat,address:{name:e.address.neighbourhood||"",road:e.address.road||"",postcode:e.address.postcode,city:e.address.city||e.address.town,state:e.address.state,country:e.address.country},original:{formatted:e.display_name,details:e.address}}})};var b=function(){this.settings={url:"//search.mapzen.com/v1/search",params:{text:"",key:"",size:10}}};b.prototype.getParameters=function(e){return{url:this.settings.url,params:{text:e.query,key:e.key,size:e.limit||this.settings.params.size}}},b.prototype.handleResponse=function(e){return e.map(function(e){return{lon:e.geometry.coordinates[0],lat:e.geometry.coordinates[1],address:{name:e.properties.name,house_number:e.properties.housenumber,postcode:e.properties.postalcode,road:e.properties.street,city:e.properties.city,state:e.properties.region,country:e.properties.country},original:{formatted:e.properties.label,details:e.properties}}})};var S=function(){this.settings={url:"//maps.googleapis.com/maps/api/geocode/json",params:{address:"",key:"",language:"en-US"}}};S.prototype.getParameters=function(e){return{url:this.settings.url,params:{address:e.query,key:e.key,language:e.lang||this.settings.params.language}}},S.prototype.handleResponse=function(e){var t=["point_of_interest","establishment","natural_feature","airport"],r=["street_address","route","sublocality_level_5","intersection"],n=["postal_code"],s=["locality"],a=["administrative_area_level_1"],o=["country"],i=function(e){var i={name:"",road:"",postcode:"",city:"",state:"",country:""};return e.forEach(function(e){v.anyMatchInArray(e.types,t)?i.name=e.long_name:v.anyMatchInArray(e.types,r)?i.road=e.long_name:v.anyMatchInArray(e.types,n)?i.postcode=e.long_name:v.anyMatchInArray(e.types,s)?i.city=e.long_name:v.anyMatchInArray(e.types,a)?i.state=e.long_name:v.anyMatchInArray(e.types,o)&&(i.country=e.long_name)}),i},l=[];return e.forEach(function(e){var t=i(e.address_components);v.anyItemHasValue(t)&&l.push({lon:e.geometry.location.lng,lat:e.geometry.location.lat,address:{name:t.name,postcode:t.postcode,road:t.road,city:t.city,state:t.state,country:t.country},original:{formatted:e.formatted_address,details:e.address_components}})}),l};var E=function(){this.settings={url:"//dev.virtualearth.net/REST/v1/Locations",callbackName:"jsonp",params:{query:"",key:"",includeNeighborhood:0,maxResults:10}}};E.prototype.getParameters=function(e){return{url:this.settings.url,callbackName:this.settings.callbackName,params:{query:e.query,key:e.key,includeNeighborhood:e.includeNeighborhood||this.settings.params.includeNeighborhood,maxResults:e.maxResults||this.settings.params.maxResults}}},E.prototype.handleResponse=function(e){return e.map(function(e){return{lon:e.point.coordinates[1],lat:e.point.coordinates[0],address:{name:e.name},original:{formatted:e.address.formattedAddress,details:e.address}}})};var k=function(e){return this.Base=e,this.layer_name=v.randomId("geocoder-layer-"),this.layer=new ol.layer.Vector({name:this.layer_name,source:new ol.source.Vector}),this.options=e.options,this.options.provider=this.options.provider.toLowerCase(),this.els=this.createControl(),this.container=this.els.container,this.registered_listeners={map_click:!1},this.setListeners(),this.Photon=new A,this.OpenStreet=new w,this.MapQuest=new C,this.Pelias=new b,this.Google=new S,this.Bing=new E,this};k.prototype.createControl=function(){var s=v.createElement(["div",{classname:e+t}],k.html),o={container:s,control:s.querySelector("."+(e+r)),btn_search:s.querySelector("."+(e+n)),input_search:s.querySelector("."+(e+p)),result_container:s.querySelector("."+(e+a))};return o.input_search.placeholder=this.options.placeholder,o},k.prototype.setListeners=function(){var t,r,n=this,s=function(){v.hasClass(n.els.control,e+o)?n.collapse():n.expand()},a=function(e){13==e.keyCode&&(e.preventDefault(),n.query(e.target.value))},i=function(e){var s=e.target.value;s!=r&&(r=s,t&&clearTimeout(t),t=setTimeout(function(){s.length>=n.options.autoCompleteMinLength&&n.query(s)},200))};this.els.input_search.addEventListener("keydown",a,!1),this.els.btn_search.addEventListener("click",s,!1),this.options.autoComplete&&this.els.input_search.addEventListener("input",i,!1)},k.prototype.query=function(t){var r=this,n={},a=this.options,o=this.els.input_search,i=this.getProvider({query:t,provider:a.provider,key:a.key,lang:a.lang,countrycodes:a.countrycodes,limit:a.limit});this.clearResults(),v.addClass(o,e+s),n.url=i.url,n.data=i.params,a.provider===f.BING&&(n.data_type="jsonp",n.callbackName=i.callbackName),v.json(n).when({ready:function(t){a.debug&&console.info(t),v.removeClass(o,e+s);var n;switch(a.provider){case f.OSM:n=t.length>0?r.OpenStreet.handleResponse(t):void 0;break;case f.MAPQUEST:n=t.length>0?r.MapQuest.handleResponse(t):void 0;break;case f.PELIAS:n=t.features.length>0?r.Pelias.handleResponse(t.features):void 0;break;case f.PHOTON:n=t.features.length>0?r.Photon.handleResponse(t.features):void 0;break;case f.GOOGLE:n=t.results.length>0?r.Google.handleResponse(t.results):void 0;break;case f.BING:n=t.resourceSets[0].resources.length>0?r.Bing.handleResponse(t.resourceSets[0].resources):void 0}n&&(r.createList(n),r.listenMapClick())},error:function(){v.removeClass(o,e+s);var t=v.createElement("li","
        Error! No internet connection?
        ");r.els.result_container.appendChild(t)}})},k.prototype.createList=function(e){var t=this,r=this.els.result_container;e.forEach(function(e){var n=t.addressTemplate(e.address),s=''+n+"",a=v.createElement("li",s);a.addEventListener("click",function(r){r.preventDefault(),t.chosen(e,n,e.address,e.original)},!1),r.appendChild(a)})},k.prototype.chosen=function(e,t,r,n){var s=this.Base.getMap(),a=ol.proj.transform([parseFloat(e.lon),parseFloat(e.lat)],"EPSG:4326",s.getView().getProjection()),o={formatted:t,details:r,original:n};if(this.options.keepOpen===!1&&this.clearResults(!0),this.options.preventDefault===!0)this.Base.dispatchEvent({type:h.ADDRESSCHOSEN,address:o,coordinate:a});else{v.flyTo(s,a);var i=this.createFeature(a,o);this.Base.dispatchEvent({type:h.ADDRESSCHOSEN,address:o,feature:i,coordinate:a})}},k.prototype.createFeature=function(e){var t=new ol.Feature(new ol.geom.Point(e));this.addLayer(),t.setStyle(this.options.featureStyle),t.setId(v.randomId("geocoder-ft-")),this.getSource().addFeature(t)},k.prototype.addressTemplate=function(t){var r=[];return t.name&&r.push('{name}'),(t.road||t.building||t.house_number)&&r.push('{building} {road} {house_number}'),(t.city||t.town||t.village)&&r.push('{postcode} {city} {town} {village}'),(t.state||t.country)&&r.push('{state} {country}'),v.template(r.join("
        "),t)},k.prototype.getProvider=function(e){var t;switch(e.provider){case f.OSM:t=this.OpenStreet.getParameters(e);break;case f.MAPQUEST:t=this.MapQuest.getParameters(e);break;case f.PHOTON:t=this.Photon.getParameters(e);break;case f.GOOGLE:t=this.Google.getParameters(e);break;case f.PELIAS:t=this.Pelias.getParameters(e);break;case f.BING:t=this.Bing.getParameters(e)}return t},k.prototype.expand=function(){var t=this;v.removeClass(this.els.input_search,e+s),v.addClass(this.els.control,e+o),window.setTimeout(function(){t.els.input_search.focus()},100),this.listenMapClick()},k.prototype.collapse=function(){this.els.input_search.value="",this.els.input_search.blur(),v.removeClass(this.els.control,e+o),this.clearResults()},k.prototype.listenMapClick=function(){if(!this.registered_listeners.map_click){var e=this,t=this.Base.getMap().getTargetElement();this.registered_listeners.map_click=!0,t.addEventListener("click",{handleEvent:function(r){e.clearResults(!0),t.removeEventListener(r.type,this,!1),e.registered_listeners.map_click=!1}},!1)}},k.prototype.clearResults=function(e){e?this.collapse():v.removeAllChildren(this.els.result_container)},k.prototype.getSource=function(){return this.layer.getSource()},k.prototype.addLayer=function(){var e=this,t=!1,r=this.Base.getMap();r.getLayers().forEach(function(r){r===e.layer&&(t=!0)}),t||r.addLayer(this.layer)},k.html=['
        ',"',"",'
        ',"',"","
        ",'
          '].join("");var L=function(e){function t(r,n){void 0===r&&(r="nominatim"),void 0===n&&(n={}),v.assert("string"==typeof r,"@param `control_type` should be string type!"),v.assert("object"==typeof n,"@param `opt_options` should be object type!"),this.options=v.mergeOptions(y,n),t.Nominatim=new k(this),e.call(this,{element:t.Nominatim.container})}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getLayer=function(){return t.Nominatim.layer},t.prototype.getSource=function(){return this.getLayer().getSource()},t}(ol.control.Control);return L}); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Geocoder=t()}(this,function(){"use strict";var e="gcd-input-query",t="gcd-input-reset",s={namespace:"ol-geocoder",spin:"gcd-pseudo-rotate",hidden:"gcd-hidden",country:"gcd-country",city:"gcd-city",road:"gcd-road",olControl:"ol-control",glass:{container:"gcd-gl-container",control:"gcd-gl-control",button:"gcd-gl-btn",input:"gcd-gl-input",expanded:"gcd-gl-expanded",reset:"gcd-gl-reset",result:"gcd-gl-result"},inputText:{container:"gcd-txt-container",control:"gcd-txt-control",input:"gcd-txt-input",reset:"gcd-txt-reset",icon:"gcd-txt-glass",result:"gcd-txt-result"}},n={inputQueryId:e,inputResetId:t,cssClasses:s},r=Object.freeze({inputQueryId:e,inputResetId:t,cssClasses:s,default:n}),a={ADDRESSCHOSEN:"addresschosen"},o={NOMINATIM:"nominatim",REVERSE:"reverse"},i={GLASS:"glass-button",INPUT:"text-input"},l=r,c=[new ol.style.Style({image:new ol.style.Icon({anchor:[.5,1],scale:.7,src:"//cdn.rawgit.com/jonataswalker/map-utils/master/images/marker.png"})})],u={OSM:"osm",MAPQUEST:"mapquest",GOOGLE:"google",PHOTON:"photon",BING:"bing",PELIAS:"pelias"},d={provider:u.OSM,placeholder:"Search for an address",featureStyle:c,targetType:i.GLASS,lang:"en-US",limit:5,keepOpen:!1,preventDefault:!1,autoComplete:!1,autoCompleteMinLength:2,debug:!1},p={toQueryString:function(e){var t=this;return Object.keys(e).reduce(function(s,n){return s.push("object"==typeof e[n]?t.toQueryString(e[n]):encodeURIComponent(n)+"="+encodeURIComponent(e[n])),s},[]).join("&")},encodeUrlXhr:function(e,t){if(t&&"object"==typeof t){var s=this.toQueryString(t);e+=(/\?/.test(e)?"&":"?")+s}return e},json:function(e,t){var s=new XMLHttpRequest,n="",r="",a={},o=function(){200===s.status&&a.ready.call(void 0,JSON.parse(s.response))},i=function(){console.error("Cannot XHR "+JSON.stringify(e))};return"object"==typeof e?(n=e.url,t=e.data,r=e.data_type||"json"):n=e,n=this.encodeUrlXhr(n,t),"jsonp"===r?this.jsonp(n,e.callbackName,function(e){a.ready.call(void 0,e)}):(s.open("GET",n,!0),s.setRequestHeader("Accept","application/json"),s.onload=o,s.onerror=i,s.send(null)),{when:function(e){a.ready=e.ready}}},jsonp:function(e,t,s){var n=document.head,r=document.createElement("script"),a="f"+Math.round(Math.random()*Date.now());r.setAttribute("src",e+(e.indexOf("?")>0?"&":"?")+t+"="+a),window[a]=function(e){window[a]=void 0,setTimeout(function(){n.removeChild(r)},0),s(e)},n.appendChild(r)},now:function(){if("performance"in window==!1&&(window.performance={}),Date.now=Date.now||function(){return(new Date).getTime()},"now"in window.performance==!1){var e=Date.now();performance.timing&&performance.timing.navigationStart&&(e=performance.timing.navigationStart),window.performance.now=function(){return Date.now()-e}}return window.performance.now()},flyTo:function(e,t,s,n){n=n||2.388657133911758,s=s||500;var r=e.getView(),a=ol.animation.pan({duration:s,source:r.getCenter()}),o=ol.animation.zoom({duration:s,resolution:r.getResolution()});e.beforeRender(a,o),r.setCenter(t),r.setResolution(n)},randomId:function(e){var t=this.now().toString(36);return e?e+t:t},isNumeric:function(e){return/^\d+$/.test(e)},classRegex:function(e){return new RegExp("(^|\\s+) "+e+" (\\s+|$)")},addClass:function(e,t,s){var n=this;if(Array.isArray(e))return void e.forEach(function(e){n.addClass(e,t)});for(var r=Array.isArray(t)?t:t.split(/\s+/),a=r.length;a--;)n.hasClass(e,r[a])||n._addClass(e,r[a],s)},_addClass:function(e,t,s){var n=this;e.classList?e.classList.add(t):e.className=(e.className+" "+t).trim(),s&&this.isNumeric(s)&&window.setTimeout(function(){n._removeClass(e,t)},s)},removeClass:function(e,t,s){var n=this;if(Array.isArray(e))return void e.forEach(function(e){n.removeClass(e,t,s)});for(var r=Array.isArray(t)?t:t.split(/\s+/),a=r.length;a--;)n.hasClass(e,r[a])&&n._removeClass(e,r[a],s)},_removeClass:function(e,t,s){var n=this;e.classList?e.classList.remove(t):e.className=e.className.replace(this.classRegex(t)," ").trim(),s&&this.isNumeric(s)&&window.setTimeout(function(){n._addClass(e,t)},s)},hasClass:function(e,t){return e.classList?e.classList.contains(t):this.classRegex(t).test(e.className)},toggleClass:function(e,t){var s=this;return Array.isArray(e)?void e.forEach(function(e){s.toggleClass(e,t)}):void(e.classList?e.classList.toggle(t):this.hasClass(e,t)?this._removeClass(e,t):this._addClass(e,t))},find:function(e,t,s){void 0===t&&(t=window.document);var n=/^(#?[\w-]+|\.[\w-.]+)$/,r=/\./g,a=Array.prototype.slice,o=[];if(n.test(e))switch(e[0]){case"#":o=[this.$(e.substr(1))];break;case".":o=a.call(t.getElementsByClassName(e.substr(1).replace(r," ")));break;default:o=a.call(t.getElementsByTagName(e))}else o=a.call(t.querySelectorAll(e));return s?o:o[0]},$:function(e){return e="#"===e[0]?e.substr(1,e.length):e,document.getElementById(e)},isElement:function(e){return"HTMLElement"in window?!!e&&e instanceof HTMLElement:!!e&&"object"==typeof e&&1===e.nodeType&&!!e.nodeName},getAllChildren:function(e,t){return[].slice.call(e.getElementsByTagName(t))},isEmpty:function(e){return!e||0===e.length},emptyArray:function(e){for(;e.length;)e.pop()},anyMatchInArray:function(e,t){return e.some(function(e){return t.indexOf(e)>=0})},everyMatchInArray:function(e,t){return t.every(function(t){return e.indexOf(t)>=0})},anyItemHasValue:function(e,t){var s=this;void 0===t&&(t=!1);var n=Object.keys(e);return n.forEach(function(n){s.isEmpty(e[n])||(t=!0)}),t},removeAllChildren:function(e){for(;e.firstChild;)e.removeChild(e.firstChild)},removeAll:function(e){for(var t;t=e[0];)t.parentNode.removeChild(t)},getChildren:function(e,t){return[].filter.call(e.childNodes,function(e){return t?1===e.nodeType&&e.tagName.toLowerCase()===t:1===e.nodeType})},template:function(e,t){var s=this;return e.replace(/\{ *([\w_-]+) *\}/g,function(e,n){var r=void 0===t[n]?"":t[n];return s.htmlEscape(r)})},htmlEscape:function(e){return String(e).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")},mergeOptions:function(e,t){var s={};for(var n in e)s[n]=e[n];for(var r in t)s[r]=t[r];return s},createElement:function(e,t){var s;if(Array.isArray(e)){if(s=document.createElement(e[0]),e[1].id&&(s.id=e[1].id),e[1].classname&&(s.className=e[1].classname),e[1].attr){var n=e[1].attr;if(Array.isArray(n))for(var r=-1;++r','','',"","",'
            '].join(""),m.input=['
            ','','','","
            ",'
              '].join("");var g=function(){this.settings={url:"//photon.komoot.de/api/",params:{q:"",limit:10,lang:"en"},langs:["de","it","fr","en"]}};g.prototype.getParameters=function(e){return e.lang=e.lang.toLowerCase(),{url:this.settings.url,params:{q:e.query,limit:e.limit||this.settings.params.limit,lang:this.settings.langs.indexOf(e.lang)>-1?e.lang:this.settings.params.lang}}},g.prototype.handleResponse=function(e){return e.map(function(e){return{lon:e.geometry.coordinates[0],lat:e.geometry.coordinates[1],address:{name:e.properties.name,postcode:e.properties.postcode,city:e.properties.city,state:e.properties.state,country:e.properties.country},original:{formatted:e.properties.name,details:e.properties}}})};var y=function(){this.settings={url:"//nominatim.openstreetmap.org/search/",params:{q:"",format:"json",addressdetails:1,limit:10,countrycodes:"","accept-language":"en-US"}}};y.prototype.getParameters=function(e){return{url:this.settings.url,params:{q:e.query,format:"json",addressdetails:1,limit:e.limit||this.settings.params.limit,countrycodes:e.countrycodes||this.settings.params.countrycodes,"accept-language":e.lang||this.settings.params["accept-language"]}}},y.prototype.handleResponse=function(e){return e.map(function(e){return{lon:e.lon,lat:e.lat,address:{name:e.address.neighbourhood||"",road:e.address.road||"",postcode:e.address.postcode,city:e.address.city||e.address.town,state:e.address.state,country:e.address.country},original:{formatted:e.display_name,details:e.address}}})};var f=function(){this.settings={url:"//open.mapquestapi.com/nominatim/v1/search.php",params:{q:"",key:"",format:"json",addressdetails:1,limit:10,countrycodes:"","accept-language":"en-US"}}};f.prototype.getParameters=function(e){return{url:this.settings.url,params:{q:e.query,key:e.key,format:"json",addressdetails:1,limit:e.limit||this.settings.params.limit,countrycodes:e.countrycodes||this.settings.params.countrycodes,"accept-language":e.lang||this.settings.params["accept-language"]}}},f.prototype.handleResponse=function(e){return e.map(function(e){return{lon:e.lon,lat:e.lat,address:{name:e.address.neighbourhood||"",road:e.address.road||"",postcode:e.address.postcode,city:e.address.city||e.address.town,state:e.address.state,country:e.address.country},original:{formatted:e.display_name,details:e.address}}})};var v=function(){this.settings={url:"//search.mapzen.com/v1/search",params:{text:"",key:"",size:10}}};v.prototype.getParameters=function(e){return{url:this.settings.url,params:{text:e.query,key:e.key,size:e.limit||this.settings.params.size}}},v.prototype.handleResponse=function(e){return e.map(function(e){return{lon:e.geometry.coordinates[0],lat:e.geometry.coordinates[1],address:{name:e.properties.name,house_number:e.properties.housenumber,postcode:e.properties.postalcode,road:e.properties.street,city:e.properties.city,state:e.properties.region,country:e.properties.country},original:{formatted:e.properties.label,details:e.properties}}})};var C=function(){this.settings={url:"//maps.googleapis.com/maps/api/geocode/json",params:{address:"",key:"",language:"en-US"}}};C.prototype.getParameters=function(e){return{url:this.settings.url,params:{address:e.query,key:e.key,language:e.lang||this.settings.params.language}}},C.prototype.handleResponse=function(e){var t=["point_of_interest","establishment","natural_feature","airport"],s=["street_address","route","sublocality_level_5","intersection"],n=["postal_code"],r=["locality"],a=["administrative_area_level_1"],o=["country"],i=function(e){var i={name:"",road:"",postcode:"",city:"",state:"",country:""};return e.forEach(function(e){p.anyMatchInArray(e.types,t)?i.name=e.long_name:p.anyMatchInArray(e.types,s)?i.road=e.long_name:p.anyMatchInArray(e.types,n)?i.postcode=e.long_name:p.anyMatchInArray(e.types,r)?i.city=e.long_name:p.anyMatchInArray(e.types,a)?i.state=e.long_name:p.anyMatchInArray(e.types,o)&&(i.country=e.long_name)}),i},l=[];return e.forEach(function(e){var t=i(e.address_components);p.anyItemHasValue(t)&&l.push({lon:e.geometry.location.lng,lat:e.geometry.location.lat,address:{name:t.name,postcode:t.postcode,road:t.road,city:t.city,state:t.state,country:t.country},original:{formatted:e.formatted_address,details:e.address_components}})}),l};var w=function(){this.settings={url:"//dev.virtualearth.net/REST/v1/Locations",callbackName:"jsonp",params:{query:"",key:"",includeNeighborhood:0,maxResults:10}}};w.prototype.getParameters=function(e){return{url:this.settings.url,callbackName:this.settings.callbackName,params:{query:e.query,key:e.key,includeNeighborhood:e.includeNeighborhood||this.settings.params.includeNeighborhood,maxResults:e.maxResults||this.settings.params.maxResults}}},w.prototype.handleResponse=function(e){return e.map(function(e){return{lon:e.point.coordinates[1],lat:e.point.coordinates[0],address:{name:e.name},original:{formatted:e.address.formattedAddress,details:e.address}}})};var b=l.cssClasses,E=function(e,t){this.Base=e,this.layerName=p.randomId("geocoder-layer-"),this.layer=new ol.layer.Vector({name:this.layerName,source:new ol.source.Vector}),this.options=e.options,this.options.provider=this.options.provider.toLowerCase(),this.els=t,this.lastQuery="",this.container=this.els.container,this.registeredListeners={mapClick:!1},this.setListeners(),this.Photon=new g,this.OpenStreet=new y,this.MapQuest=new f,this.Pelias=new v,this.Google=new C,this.Bing=new w};E.prototype.setListeners=function(){var e,t,s=this,n=function(){p.hasClass(s.els.control,b.glass.expanded)?s.collapse():s.expand()},r=function(e){var t=e.target.value.trim(),n=e.key?"Enter"===e.key:e.which?13===e.which:!!e.keyCode&&13===e.keyCode;n&&(e.preventDefault(),s.query(t))},a=function(e){s.els.input.focus(),s.els.input.value="",s.lastQuery="",p.addClass(s.els.reset,b.hidden),s.clearResults()},o=function(n){var r=n.target.value.trim();r.length?p.removeClass(s.els.reset,b.hidden):p.addClass(s.els.reset,b.hidden),s.options.autoComplete&&r!==t&&(t=r,e&&clearTimeout(e),e=setTimeout(function(){r.length>=s.options.autoCompleteMinLength&&s.query(r)},200))};this.els.input.addEventListener("keyup",r,!1),this.els.input.addEventListener("input",o,!1),this.els.reset.addEventListener("click",a,!1),this.options.targetType===i.GLASS&&this.els.button.addEventListener("click",n,!1)},E.prototype.query=function(e){var t=this,s={},n=this.options,r=this.getProvider({query:e,provider:n.provider,key:n.key,lang:n.lang,countrycodes:n.countrycodes,limit:n.limit});this.lastQuery===e&&this.els.result.firstChild||(this.lastQuery=e,this.clearResults(),p.addClass(this.els.reset,b.spin),s.url=document.location.protocol+r.url,s.data=r.params,n.provider===u.BING&&(s.data_type="jsonp",s.callbackName=r.callbackName),p.json(s).when({ready:function(e){n.debug&&console.info(e),p.removeClass(t.els.reset,b.spin);var s;switch(n.provider){case u.OSM:s=e.length?t.OpenStreet.handleResponse(e):void 0;break;case u.MAPQUEST:s=e.length?t.MapQuest.handleResponse(e):void 0;break;case u.PELIAS:s=e.features.length?t.Pelias.handleResponse(e.features):void 0;break;case u.PHOTON:s=e.features.length?t.Photon.handleResponse(e.features):void 0;break;case u.GOOGLE:s=e.results.length?t.Google.handleResponse(e.results):void 0;break;case u.BING:s=e.resourceSets[0].resources.length?t.Bing.handleResponse(e.resourceSets[0].resources):void 0;break;default:console.log("Unknown provider!")}s&&(t.createList(s),t.listenMapClick())},error:function(){p.removeClass(t.els.reset,b.spin);var e=p.createElement("li","
              Error! No internet connection?
              ");t.els.result.appendChild(e)}}))},E.prototype.createList=function(e){var t=this,s=this.els.result;e.forEach(function(e){var n=t.addressTemplate(e.address),r=['',n,""].join(""),a=p.createElement("li",r);a.addEventListener("click",function(s){s.preventDefault(),t.chosen(e,n,e.address,e.original)},!1),s.appendChild(a)})},E.prototype.chosen=function(e,t,s,n){var r=this.Base.getMap(),o=[parseFloat(e.lon),parseFloat(e.lat)],i=r.getView().getProjection(),l=ol.proj.transform(o,"EPSG:4326",i),c={formatted:t,details:s,original:n};if(this.options.keepOpen===!1&&this.clearResults(!0),this.options.preventDefault===!0)this.Base.dispatchEvent({type:a.ADDRESSCHOSEN,address:c,coordinate:l});else{p.flyTo(r,l);var u=this.createFeature(l,c);this.Base.dispatchEvent({type:a.ADDRESSCHOSEN,address:c,feature:u,coordinate:l})}},E.prototype.createFeature=function(e){var t=new ol.Feature(new ol.geom.Point(e));this.addLayer(),t.setStyle(this.options.featureStyle),t.setId(p.randomId("geocoder-ft-")),this.getSource().addFeature(t)},E.prototype.addressTemplate=function(e){var t=[];return e.name&&t.push(['{name}'].join("")),(e.road||e.building||e.house_number)&&t.push(['{building} {road} {house_number}'].join("")),(e.city||e.town||e.village)&&t.push(['{postcode} {city} {town} {village}'].join("")),(e.state||e.country)&&t.push(['{state} {country}'].join("")),p.template(t.join("
              "),e)},E.prototype.getProvider=function(e){var t;switch(e.provider){case u.OSM:t=this.OpenStreet.getParameters(e);break;case u.MAPQUEST:t=this.MapQuest.getParameters(e);break;case u.PHOTON:t=this.Photon.getParameters(e);break;case u.GOOGLE:t=this.Google.getParameters(e);break;case u.PELIAS:t=this.Pelias.getParameters(e);break;case u.BING:t=this.Bing.getParameters(e)}return t},E.prototype.expand=function(){var e=this;p.removeClass(this.els.input,b.spin),p.addClass(this.els.control,b.glass.expanded),window.setTimeout(function(){return e.els.input.focus()},100),this.listenMapClick()},E.prototype.collapse=function(){this.els.input.value="",this.els.input.blur(),p.addClass(this.els.reset,b.hidden),p.removeClass(this.els.control,b.glass.expanded),this.clearResults()},E.prototype.listenMapClick=function(){if(!this.registeredListeners.mapClick){var e=this,t=this.Base.getMap().getTargetElement();this.registeredListeners.mapClick=!0,t.addEventListener("click",{handleEvent:function(s){e.clearResults(!0),t.removeEventListener(s.type,this,!1),e.registeredListeners.mapClick=!1}},!1)}},E.prototype.clearResults=function(e){e&&this.options.targetType===i.GLASS?this.collapse():p.removeAllChildren(this.els.result)},E.prototype.getSource=function(){return this.layer.getSource()},E.prototype.addLayer=function(){var e=this,t=!1,s=this.Base.getMap();s.getLayers().forEach(function(s){s===e.layer&&(t=!0)}),t||s.addLayer(this.layer)};var S=function(e){function t(s,n){if(void 0===s&&(s=o.NOMINATIM),void 0===n&&(n={}),!(this instanceof t))return new t;p.assert("string"==typeof s,"@param `type` should be string!"),p.assert("object"==typeof n,"@param `options` should be object!"),this.options=p.mergeOptions(d,n),this.container=void 0;var r,a=new m(this);s===o.NOMINATIM?(this.container=a.els.container,r=new E(this,a.els),this.layer=r.layer):s===o.REVERSE,e.call(this,{element:this.container})}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getLayer=function(){return this.layer},t.prototype.getSource=function(){return this.getLayer().getSource()},t}(ol.control.Control);return S}); +//# sourceMappingURL=ol3-geocoder.js.map \ No newline at end of file diff --git a/build/ol3-geocoder.js.map b/build/ol3-geocoder.js.map new file mode 100644 index 0000000..a0f0174 --- /dev/null +++ b/build/ol3-geocoder.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["?"],"names":["global","factory","exports","module","define","amd","Geocoder","this","inputQueryId","inputResetId","cssClasses","namespace","spin","hidden","country","city","road","olControl","glass","container","control","button","input","expanded","reset","result","inputText","icon","vars$1","_VARS","Object","freeze","default","eventType","ADDRESSCHOSEN","controlType","NOMINATIM","REVERSE","targetType","GLASS","INPUT","vars","featureStyle","ol","style","Style","image","Icon","anchor","scale","src","providers","OSM","MAPQUEST","GOOGLE","PHOTON","BING","PELIAS","defaultOptions","provider","placeholder","lang","limit","keepOpen","preventDefault","autoComplete","autoCompleteMinLength","debug","utils","toQueryString","obj","this$1","keys","reduce","a","k","push","encodeURIComponent","join","encodeUrlXhr","url","data","str_data","test","json","xhr","XMLHttpRequest","url_","data_type","when","onload","status","ready","call","undefined","JSON","parse","response","onerror","console","error","stringify","jsonp","callbackName","res","open","setRequestHeader","send","key","callback","head","document","script","createElement","Math","round","random","Date","now","setAttribute","indexOf","window","setTimeout","removeChild","appendChild","performance","getTime","nowOffset","timing","navigationStart","flyTo","map","coord","duration","resolution","view","getView","pan","animation","source","getCenter","zoom","getResolution","beforeRender","setCenter","setResolution","randomId","prefix","id","toString","isNumeric","str","classRegex","classname","RegExp","addClass","element","timeout","Array","isArray","forEach","each","array","split","i","length","hasClass","_addClass","el","klass","classList","add","className","trim","_removeClass","removeClass","remove","replace","c","contains","toggleClass","toggle","find","selector","context","find_all","simpleRe","periodRe","slice","prototype","matches","$","substr","getElementsByClassName","getElementsByTagName","querySelectorAll","getElementById","isElement","HTMLElement","nodeType","nodeName","getAllChildren","node","tag","isEmpty","emptyArray","pop","anyMatchInArray","target","some","everyMatchInArray","arr1","arr2","every","anyItemHasValue","has","removeAllChildren","firstChild","removeAll","collection","parentNode","getChildren","filter","childNodes","tagName","toLowerCase","template","html","row","htm","value","htmlEscape","String","mergeOptions","obj1","obj2","obj3","attr1","attr2","elem","attr","name","innerHTML","frag","createDocumentFragment","assert","condition","message","Error","klasses","Html","base","options","els","createControl","containerClass","elements","Photon","settings","params","q","langs","getParameters","query","handleResponse","results","lon","geometry","coordinates","lat","address","properties","postcode","state","original","formatted","details","OpenStreet","format","addressdetails","countrycodes","accept-language","neighbourhood","town","display_name","MapQuest","Pelias","text","size","house_number","housenumber","postalcode","street","region","label","Google","language","getDetails","parts","detail","types","long_name","address_components","location","lng","formatted_address","Bing","includeNeighborhood","maxResults","point","formattedAddress","klasses$1","Nominatim","Base","layerName","layer","Vector","lastQuery","registeredListeners","mapClick","setListeners","openSearch","collapse","expand","evt","hit","which","keyCode","focus","clearResults","handleValue","clearTimeout","addEventListener","ajax","getProvider","protocol","info","res_","features","resourceSets","resources","log","createList","listenMapClick","li","ul","addressHtml","addressTemplate","chosen","place","addressObj","addressOriginal","getMap","coord_","parseFloat","projection","getProjection","proj","transform","dispatchEvent","type","coordinate","feature","createFeature","Feature","geom","Point","addLayer","setStyle","setId","getSource","addFeature","building","village","blur","this_","mapElement","getTargetElement","handleEvent","removeEventListener","found","getLayers","superclass","$nominatim","$html","__proto__","create","constructor","getLayer","Control"],"mappings":";;;;;;CAOC,SAAUA,EAAQC,GACC,gBAAZC,UAA0C,mBAAXC,QAAyBA,OAAOD,QAAUD,IAC9D,kBAAXG,SAAyBA,OAAOC,IAAMD,OAAOH,GACnDD,EAAOM,SAAWL,KAClBM,KAAM,WAAe,YAEvB,IAAIC,GAAe,kBACfC,EAAe,kBACfC,GAAcC,UAAY,cAAcC,KAAO,oBAAoBC,OAAS,aAAaC,QAAU,cAAcC,KAAO,WAAWC,KAAO,WAAWC,UAAY,aAAaC,OAASC,UAAY,mBAAmBC,QAAU,iBAAiBC,OAAS,aAAaC,MAAQ,eAAeC,SAAW,kBAAkBC,MAAQ,eAAeC,OAAS,iBAAiBC,WAAaP,UAAY,oBAAoBC,QAAU,kBAAkBE,MAAQ,gBAAgBE,MA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AKkT,KAAKuC,QAEpB7N,GAAI0P,YAAY7N,QAAQ,SAAU2J,GAC5BA,IAAUpP,EAAOoP,QAASiE,GAAQ,KAEnCA,GAASzP,EAAI4O,SAASxW,KAAKoT,OAOlC,IAAIF,GAAQ,SAAUqE,GACpB,QAASrE,GAAK+C,EAAM5G,GAKlB,GAJc,SAAT4G,IAAkBA,EAAOrU,EAAYC,WACzB,SAAZwN,IAAqBA,QAGpBrP,eAAgBkT,IAAS,MAAO,IAAIA,EAE1CrP,GAAMiL,OAAuB,gBAATmH,GAAmB,mCACvCpS,EAAMiL,OAA0B,gBAAZO,GAChB,sCAEJrP,KAAKqP,QAAUxL,EAAMqK,aAAa/K,EAAgBkM,GAClDrP,KAAKY,UAAY2E,MAEjB,IAAIiS,GACAC,EAAQ,GAAItI,GAAKnP,KAEjBiW,KAASrU,EAAYC,WACvB7B,KAAKY,UAAY6W,EAAMnI,IAAI1O,UAC3B4W,EAAa,GAAIvE,GAAUjT,KAAMyX,EAAMnI,KACvCtP,KAAKoT,MAAQoE,EAAWpE,OACf6C,IAASrU,EAAYE,QAIhCyV,EAAWjS,KAAKtF,MAAQqJ,QAASrJ,KAAKY,YAqBxC,MAlBK2W,KAAarE,EAAKwE,UAAYH,GACnCrE,EAAK5H,UAAY/J,OAAOoW,OAAQJ,GAAcA,EAAWjM,WACzD4H,EAAK5H,UAAUsM,YAAc1E,EAK7BA,EAAK5H,UAAUuM,SAAW,WACxB,MAAO7X,MAAKoT,OAMdF,EAAK5H,UAAUqL,UAAY,WACzB,MAAO3W,MAAK6X,WAAWlB,aAGlBzD,GACP9Q,GAAGvB,QAAQiX,QAEb,OAAO5E","file":"ol3-geocoder.js"} \ No newline at end of file diff --git a/build/ol3-geocoder.min.css b/build/ol3-geocoder.min.css index 290cdb1..0c2dab8 100644 --- a/build/ol3-geocoder.min.css +++ b/build/ol3-geocoder.min.css @@ -1,8 +1,7 @@ -/** +/*! + * ol3-geocoder - v2.4.0 * A geocoder extension for OpenLayers 3. * https://github.com/jonataswalker/ol3-geocoder - * Version: v2.3.0 - * Built: 2016-08-15T11:57:59-03:00 + * Built: Mon Dec 19 2016 11:15:29 GMT-0200 (BRST) */ - -.ol3-geocoder-container{position:absolute;top:calc(.5em + 65px);left:.5em;box-sizing:border-box}.ol3-geocoder-container *,.ol3-geocoder-container ::after,.ol3-geocoder-container ::before{box-sizing:inherit}.ol3-geocoder-search{width:31px;height:31px;overflow:hidden;-webkit-transition:width .2s,height .2s;transition:width .2s,height .2s}.ol3-geocoder-search-expanded{width:220px;height:35px}.ol3-geocoder-input-search{position:absolute;top:2px;left:32px;width:180px;padding:5px;border:1px solid #ccc;font-family:inherit;font-size:.875rem}.ol3-geocoder-input-search:focus{border-color:#35b5f4}ul.ol3-geocoder-result{position:absolute;top:37px;left:32px;width:260px;max-height:300px;white-space:normal;list-style:none;padding:0;margin:0;background-color:#fff;border-radius:0 0 4px 4px;border-top:none;overflow-x:hidden;overflow-y:auto;box-shadow:0 1px 7px rgba(0,0,0,.8);-webkit-transition:max-height .3s ease-in;transition:max-height .3s ease-in}ul.ol3-geocoder-result>li{width:100%;overflow:hidden;border-bottom:1px solid #eee;padding:0;line-height:.875rem}ul.ol3-geocoder-result>li>a{display:block;text-decoration:none;padding:3px 5px}ul.ol3-geocoder-result>li>a:hover{background-color:#d4d4d4}ul.ol3-geocoder-result>li:nth-child(odd){background-color:#e0ffe0}.ol3-geocoder-road{font-size:.875rem;font-weight:500;color:#000}.ol3-geocoder-city{font-size:.75rem;font-weight:400;color:#000}.ol3-geocoder-country{font-size:.75rem;font-weight:lighter;color:#444}.ol3-geocoder-btn-search{position:absolute;width:25px;height:25px;top:2px;left:2px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAABPUlEQVQoU41SwXHCQAzUHh58eoUOIBWEDkI6oAToIKkg7iAuwakgpAIowXRACcnrzp6BzchjMx4wE/S6kW5XK60gvQghzJIkmVoqSZI9gJ9+/fINS5Cc1HX9QXIlIr/tpwcRyb33b7cIGnAIYQdg4pxbjcfj0nJ1Xc+Px+PGObdN03Q9RIAQwgpAnqbp7FKmjQGgJLlU1d2V7BjjRkQO3vvXIXarkyxVNbsCm2QR2Q0V7XOMMReRmfd+OQQubN6hYgs22ZtbnRcAtiRfLueqqmpJ8ovko6oeBq0KIWQA3gFkzrlmMafTaUEyI/mpqmbhVTRWWbRdbClPbeobQNES5KPRqOxs7DBn8K1DsAOKMZYApiTXqlrcDe4d0XN7jWeCfzt351tVle2iGalTcBd4gGDvvZ/fDe4RmCOFLe8Pr7mvEP2N9PQAAAAASUVORK5CYII=);background-repeat:no-repeat;background-position:center center}.ol3-geocoder-loading{background-image:url(data:image/gif;base64,R0lGODlhFAAUAKUAAAQCBISChMTCxERCRKSipOTi5GRiZJSSlNTS1LSytPTy9CQiJHRydExOTIyKjMzKzKyqrOzq7JyanNza3Ly6vPz6/CwuLHx6fBwaHExKTGxubFRWVAQGBISGhMTGxERGRKSmpOTm5GRmZJSWlNTW1LS2tPT29CQmJHR2dFRSVIyOjMzOzKyurOzu7JyenNze3Ly+vPz+/DQyNHx+fP7+/gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJCQA0ACwAAAAAFAAUAAAG80CaUKgw0RAAAIJWqQyftBjEAqIpOBwF7UUpxKBMDSbjPC2EAtbqO4w5TR8MiZbJ0FoJgTPGLqGMBRYzNAwMRyVGFQ8FVhkyG4wCKE8IEVYwCRQmJgkGMgMeYEIhJSUCL2xbBx2iRyRaQi+wrWAVLQ0pBjMjqVAxCB4UCSW4IgEuvU8VJA+YCQVGtLWwMQUgBK0rCC1sJgIBIgxzohHCMKgmFyIdlhMsUU4rliaYFE4PLk4RHRQ0HqEkKGipsCKEEDc0TIwIYLCUFRYCovWSMsOFEAhVaAhI8CBZFAQqVjCRIMHJCxheWjWhEUHCiBZMnDwJAgAh+QQJCQAwACwAAAAAFAA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XusPkChQCH18ZxVKicKPXFYzxRGC8HH4EiIFUOBC8IIRQDJy8qGE8lSwgqChMRIB0NFAkqXkIPIgoCJ2ovJwEjoYEfRkKvra0RJhIpFhgVqFAoBxsTSbctDCy8T74OKqQnhrNeEbAoEBksrSUHJmogIgwWJHGhD8EqpyAGFgwcLx8uVU4qiSCXmS8CFYYcDBcvImUbBZZEKLGOSRcQATysK1DgSIYLznihyOChghAW1l5cyDDhGBMHGgS0CRDAEIQOEDwKAeGEA8l1mqAEAQA7);background-repeat:no-repeat;background-position:right center} \ No newline at end of file +.ol-geocoder.gcd-gl-container{position:absolute;top:4.875em;left:.5em;box-sizing:border-box}.ol-geocoder.gcd-gl-container *,.ol-geocoder.gcd-gl-container :after,.ol-geocoder.gcd-gl-container :before{box-sizing:inherit}.ol-geocoder .gcd-gl-control{width:2.1875em;height:2.1875em;overflow:hidden;-webkit-transition:width .2s,height .2s;transition:width .2s,height .2s}.ol-geocoder .gcd-gl-expanded{width:15.625em;height:2.1875em}.ol-geocoder .gcd-gl-input{position:absolute;z-index:1;top:.1875em;left:2.5em;width:14.84375em;padding:.3125em;border:1px solid #ccc;font-family:inherit;font-size:.875em;background-color:#fff;color:#222}.ol-geocoder .gcd-gl-input:focus{border:none;outline:none;box-shadow:inset 0 0 0 1px #4d90fe,inset 0 0 5px #4d90fe}.ol-geocoder .gcd-gl-reset{position:absolute;z-index:2;top:0;right:0;width:1.5625em;height:100%;line-height:1.4;border:none;background-color:transparent;display:inline-block;outline:0;cursor:pointer}.ol-geocoder .gcd-gl-reset:after{content:"\d7";display:inline-block;color:#333;font-size:1.5em;cursor:pointer}.ol-geocoder .gcd-gl-btn{position:absolute;width:1.5625em;height:1.5625em;top:.125em;left:.125em;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAABPUlEQVQoU41SwXHCQAzUHh58eoUOIBWEDkI6oAToIKkg7iAuwakgpAIowXRACcnrzp6BzchjMx4wE/S6kW5XK60gvQghzJIkmVoqSZI9gJ9+/fINS5Cc1HX9QXIlIr/tpwcRyb33b7cIGnAIYQdg4pxbjcfj0nJ1Xc+Px+PGObdN03Q9RIAQwgpAnqbp7FKmjQGgJLlU1d2V7BjjRkQO3vvXIXarkyxVNbsCm2QR2Q0V7XOMMReRmfd+OQQubN6hYgs22ZtbnRcAtiRfLueqqmpJ8ovko6oeBq0KIWQA3gFkzrlmMafTaUEyI/mpqmbhVTRWWbRdbClPbeobQNES5KPRqOxs7DBn8K1DsAOKMZYApiTXqlrcDe4d0XN7jWeCfzt351tVle2iGalTcBd4gGDvvZ/fDe4RmCOFLe8Pr7mvEP2N9PQAAAAASUVORK5CYII=");background-repeat:no-repeat;background-position:50%}.ol-geocoder ul.gcd-gl-result{position:absolute;top:2.1875em;left:2em;width:16.25em;max-height:18.75em;white-space:normal;list-style:none;padding:0;margin:0;background-color:#fff;border-radius:4px;border-top:none;border-top-left-radius:0;border-top-right-radius:0;overflow-x:hidden;overflow-y:auto;box-shadow:0 1px 7px rgba(0,0,0,.8);-webkit-transition:max-height .3s ease-in;transition:max-height .3s ease-in}.ol-geocoder ul.gcd-gl-result>li{width:100%;overflow:hidden;border-bottom:1px solid #eee;padding:0;line-height:.875rem}.ol-geocoder ul.gcd-gl-result>li>a{display:block;text-decoration:none;padding:3px 5px}.ol-geocoder ul.gcd-gl-result>li>a:hover{background-color:#d4d4d4}.ol-geocoder ul.gcd-gl-result>li:nth-child(odd){background-color:#e0ffe0}.ol-geocoder.gcd-txt-container{position:absolute;width:25em;height:4.375em;top:.5em;left:calc(50% - 12.5em);box-sizing:border-box}.ol-geocoder.gcd-txt-container *,.ol-geocoder.gcd-txt-container :after,.ol-geocoder.gcd-txt-container :before{box-sizing:inherit}.ol-geocoder .gcd-txt-control{position:relative;width:100%;height:4.375em;border:1px solid #ccc;background-color:#fff;overflow:hidden}.ol-geocoder .gcd-txt-input{position:absolute;z-index:1;top:0;left:0;width:100%;height:100%;padding:5px 30px 5px 40px;border:none;text-indent:6px;background-color:transparent;font-family:inherit;font-size:.875em}.ol-geocoder .gcd-txt-input:focus{outline:none;box-shadow:inset 0 0 0 1px #4d90fe,inset 0 0 6px #4d90fe}.ol-geocoder .gcd-txt-reset{position:absolute;z-index:2;top:0;right:0;width:2.5em;height:100%;line-height:100%;border:none;background-color:transparent;display:inline-block;vertical-align:middle;outline:0;cursor:pointer}.ol-geocoder .gcd-txt-reset:after{content:"\d7";display:inline-block;color:#333;font-size:2em;cursor:pointer}.ol-geocoder .gcd-txt-glass{position:absolute;top:0;left:0;z-index:2;display:inline-block;width:2.5em;height:100%;background-size:1.38889em;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath fill='%23333' d='M29.156 29.961l-.709.709a2.006 2.006 0 0 1-2.838 0l-5.676-5.674c-.656-.658-.729-1.644-.281-2.412l-3.104-3.102a9.975 9.975 0 0 1-5.965 1.979C5.043 21.461.552 16.97.552 11.43S5.043 1.398 10.583 1.398c5.541 0 10.031 4.491 10.031 10.032 0 2.579-.98 4.923-2.58 6.7l3.035 3.035c.768-.447 1.754-.375 2.41.283l5.676 5.674c.784.785.784 2.056.001 2.839zM18.088 11.389a7.524 7.524 0 0 0-7.524-7.523 7.523 7.523 0 1 0-.001 15.046 7.525 7.525 0 0 0 7.525-7.523z'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:50%}.ol-geocoder ul.gcd-txt-result{position:absolute;top:4.575em;left:0;width:25em;max-height:18.75em;white-space:normal;list-style:none;padding:0;margin:0;background-color:#fff;border-radius:4px;border-top:none;border-top-left-radius:0;border-top-right-radius:0;overflow-x:hidden;overflow-y:auto;box-shadow:0 1px 7px rgba(0,0,0,.8);-webkit-transition:max-height .3s ease-in;transition:max-height .3s ease-in}.ol-geocoder ul.gcd-txt-result>li{width:100%;overflow:hidden;border-bottom:1px solid #eee;padding:0;line-height:.875rem}.ol-geocoder ul.gcd-txt-result>li>a{display:block;text-decoration:none;padding:3px 5px}.ol-geocoder ul.gcd-txt-result>li>a:hover{background-color:#d4d4d4}.ol-geocoder ul.gcd-txt-result>li:nth-child(odd){background-color:#e0ffe0}.ol-geocoder .gcd-hidden{opacity:0;visibility:hidden}.ol-geocoder .gcd-pseudo-rotate:after{-webkit-animation:a .7s linear infinite;animation:a .7s linear infinite}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.ol-geocoder .gcd-road{font-size:.875em;font-weight:500;color:#000}.ol-geocoder .gcd-city{font-size:.75em;font-weight:400;color:#000}.ol-geocoder .gcd-country{font-size:.75em;font-weight:lighter;color:#444} \ No newline at end of file diff --git a/package.json b/package.json index b51c3a3..e21835d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ol3-geocoder", - "version": "2.3.0", + "version": "2.4.0", "description": "A geocoder extension for OpenLayers 3.", "author": "Jonatas Walker", "homepage": "https://github.com/jonataswalker/ol3-geocoder", diff --git a/src/js/constants.js b/src/js/constants.js index 4cdd1cc..3607238 100644 --- a/src/js/constants.js +++ b/src/js/constants.js @@ -16,36 +16,12 @@ export const targetType = { export const vars = _VARS; -const icon = [ - 'data:image/png;base64,', - 'iVBORw0KGgoAAAANSUhEUgAAAC0AAAAtCAYAAAA6GuKaAAAABmJLR0QA/wD/AP+gvaeTAAAACX', - 'BIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4AQWCiErd9Z21AAABAJJREFUWMPVmU1oXFUUx3/3', - 'zatJx04SDOgiVUMSgrXJwpqIKy26SrKoLjQgCkIFW7otuCvdllbo1q6EpgvNQvtx710lEFdihw', - 'pSjdikJLGJWEhrM9MyX7nPxbypwzBv5n3cqXpgmOHOuff/mzPn3PfueWDBpqZnrPq1M5EUVitZ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gdeA5STAttKjltsLbdwW', - 'khSf1UjXRfxZ4M8WLs9pJe/a0HIsAeMDnQlwOaOVvPufeFDUJLcH/H27t6EtcBDYTJrLViNdl9', - 'ubwLWG4Wv+uDUTWDb/LLlSNzSilVy1qeFYBsYHvOAPXdBKrtrK5Y5A19lJqo8kTnZi8U6kRy0Y', - 'Y8BNwNgqwP+1/Q09w5giQWRk7AAAAABJRU5ErkJggg==' -].join(''); - export const featureStyle = [ new ol.style.Style({ image: new ol.style.Icon({ anchor: [0.5, 1], - src: icon + scale: .7, + src: '//cdn.rawgit.com/jonataswalker/map-utils/master/images/marker.png' }) }) ];