Update leaflet-control-geocoder to v1.5.4.

This commit is contained in:
David Molineus
2016-11-25 09:44:27 +01:00
parent 0dbb9424e2
commit 37efd85ad1
6 changed files with 131 additions and 77 deletions

View File

@@ -1,7 +1,7 @@
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.leafletControlGeocoder = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
(function (global){
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
Nominatim = require('./geocoders/nominatim')["class"];
Nominatim = _dereq_('./geocoders/nominatim')["class"];
module.exports = {
"class": L.Control.extend({
@@ -51,12 +51,14 @@ module.exports = {
this._alts = L.DomUtil.create('ul',
className + '-alternatives leaflet-control-geocoder-alternatives-minimized',
container);
L.DomEvent.disableClickPropagation(this._alts);
L.DomEvent.addListener(input, 'keydown', this._keydown, this);
L.DomEvent.addListener(input, 'blur', function() {
if (this.options.collapsed) {
if (this.options.collapsed && !this._preventBlurCollapse) {
this._collapse();
}
this._preventBlurCollapse = false;
}, this);
@@ -147,9 +149,7 @@ module.exports = {
},
_geocodeResultSelected: function(result) {
if (this.options.collapsed) {
this._collapse();
} else {
if (!this.options.collapsed) {
this._clearResults();
}
@@ -188,9 +188,20 @@ module.exports = {
a = L.DomUtil.create('a', '', li),
icon = this.options.showResultIcons && result.icon ? L.DomUtil.create('img', '', a) : null,
text = result.html ? undefined : document.createTextNode(result.name),
clickHandler = function clickHandler(e) {
L.DomEvent.preventDefault(e);
mouseDownHandler = function mouseDownHandler(e) {
// In some browsers, a click will fire on the map if the control is
// collapsed directly after mousedown. To work around this, we
// wait until the click is completed, and _then_ collapse the
// control. Messy, but this is the workaround I could come up with
// for #142.
this._preventBlurCollapse = true;
L.DomEvent.stop(e);
this._geocodeResultSelected(result);
L.DomEvent.on(li, 'click', function() {
if (this.options.collapsed) {
this._collapse();
}
}, this);
};
if (icon) {
@@ -205,7 +216,10 @@ module.exports = {
a.appendChild(text);
}
L.DomEvent.addListener(li, 'mousedown', clickHandler, this);
// Use mousedown and not click, since click will fire _after_ blur,
// causing the control to have collapsed and removed the items
// before the click can fire.
L.DomEvent.addListener(li, 'mousedown', mouseDownHandler, this);
return li;
},
@@ -275,10 +289,10 @@ module.exports = {
};
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./geocoders/nominatim":9}],2:[function(require,module,exports){
},{"./geocoders/nominatim":9}],2:[function(_dereq_,module,exports){
(function (global){
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
Util = require('../util');
Util = _dereq_('../util');
module.exports = {
"class": L.Class.extend({
@@ -362,10 +376,10 @@ module.exports = {
};
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"../util":13}],3:[function(require,module,exports){
},{"../util":13}],3:[function(_dereq_,module,exports){
(function (global){
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
Util = require('../util');
Util = _dereq_('../util');
module.exports = {
"class": L.Class.extend({
@@ -419,10 +433,10 @@ module.exports = {
};
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"../util":13}],4:[function(require,module,exports){
},{"../util":13}],4:[function(_dereq_,module,exports){
(function (global){
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
Util = require('../util');
Util = _dereq_('../util');
module.exports = {
"class": L.Class.extend({
@@ -512,10 +526,10 @@ module.exports = {
};
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"../util":13}],5:[function(require,module,exports){
},{"../util":13}],5:[function(_dereq_,module,exports){
(function (global){
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
Util = require('../util');
Util = _dereq_('../util');
module.exports = {
"class": L.Class.extend({
@@ -586,10 +600,10 @@ module.exports = {
};
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"../util":13}],6:[function(require,module,exports){
},{"../util":13}],6:[function(_dereq_,module,exports){
(function (global){
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
Util = require('../util');
Util = _dereq_('../util');
module.exports = {
"class": L.Class.extend({
@@ -678,10 +692,10 @@ module.exports = {
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"../util":13}],7:[function(require,module,exports){
},{"../util":13}],7:[function(_dereq_,module,exports){
(function (global){
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
Util = require('../util');
Util = _dereq_('../util');
module.exports = {
"class": L.Class.extend({
@@ -767,10 +781,10 @@ module.exports = {
};
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"../util":13}],8:[function(require,module,exports){
},{"../util":13}],8:[function(_dereq_,module,exports){
(function (global){
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
Util = require('../util');
Util = _dereq_('../util');
module.exports = {
"class": L.Class.extend({
@@ -856,10 +870,10 @@ module.exports = {
};
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"../util":13}],9:[function(require,module,exports){
},{"../util":13}],9:[function(_dereq_,module,exports){
(function (global){
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
Util = require('../util');
Util = _dereq_('../util');
module.exports = {
"class": L.Class.extend({
@@ -954,10 +968,10 @@ module.exports = {
};
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"../util":13}],10:[function(require,module,exports){
},{"../util":13}],10:[function(_dereq_,module,exports){
(function (global){
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
Util = require('../util');
Util = _dereq_('../util');
module.exports = {
"class": L.Class.extend({
@@ -1057,10 +1071,10 @@ module.exports = {
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"../util":13}],11:[function(require,module,exports){
},{"../util":13}],11:[function(_dereq_,module,exports){
(function (global){
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
Util = require('../util');
Util = _dereq_('../util');
module.exports = {
"class": L.Class.extend({
@@ -1123,20 +1137,20 @@ module.exports = {
};
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"../util":13}],12:[function(require,module,exports){
},{"../util":13}],12:[function(_dereq_,module,exports){
(function (global){
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
Control = require('./control'),
Nominatim = require('./geocoders/nominatim'),
Bing = require('./geocoders/bing'),
MapQuest = require('./geocoders/mapquest'),
Mapbox = require('./geocoders/mapbox'),
What3Words = require('./geocoders/what3words'),
Google = require('./geocoders/google'),
Photon = require('./geocoders/photon'),
Mapzen = require('./geocoders/mapzen'),
ArcGis = require('./geocoders/arcgis'),
HERE = require('./geocoders/here');
Control = _dereq_('./control'),
Nominatim = _dereq_('./geocoders/nominatim'),
Bing = _dereq_('./geocoders/bing'),
MapQuest = _dereq_('./geocoders/mapquest'),
Mapbox = _dereq_('./geocoders/mapbox'),
What3Words = _dereq_('./geocoders/what3words'),
Google = _dereq_('./geocoders/google'),
Photon = _dereq_('./geocoders/photon'),
Mapzen = _dereq_('./geocoders/mapzen'),
ArcGis = _dereq_('./geocoders/arcgis'),
HERE = _dereq_('./geocoders/here');
module.exports = L.Util.extend(Control["class"], {
Nominatim: Nominatim["class"],
@@ -1167,7 +1181,7 @@ L.Util.extend(L.Control, {
});
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./control":1,"./geocoders/arcgis":2,"./geocoders/bing":3,"./geocoders/google":4,"./geocoders/here":5,"./geocoders/mapbox":6,"./geocoders/mapquest":7,"./geocoders/mapzen":8,"./geocoders/nominatim":9,"./geocoders/photon":10,"./geocoders/what3words":11}],13:[function(require,module,exports){
},{"./control":1,"./geocoders/arcgis":2,"./geocoders/bing":3,"./geocoders/google":4,"./geocoders/here":5,"./geocoders/mapbox":6,"./geocoders/mapquest":7,"./geocoders/mapzen":8,"./geocoders/nominatim":9,"./geocoders/photon":10,"./geocoders/what3words":11}],13:[function(_dereq_,module,exports){
(function (global){
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
lastCallbackId = 0,
@@ -1253,4 +1267,5 @@ module.exports = {
};
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}]},{},[12]);
},{}]},{},[12])(12)
});

File diff suppressed because one or more lines are too long

46
assets/control-geocoder/README.md Normal file → Executable file
View File

@@ -6,7 +6,7 @@ I strongly believe that it is my &mdash; and your &mdash; duty to make the open
While I can't force anyone to do anything, if you happen to disagree with this, I ask of you not to use any of the open source I have published. Nor am I interested in contributions from people who can't accept or act respectfully towards other humans regardless of gender identity, sexual orientation, disability, ethnicity, religion, age, physical appearance, body size, race, or similar personal characteristics. If you think feminism, anti-racism or the LGBT movement is somehow wrong, disturbing or irrelevant, I ask you to go elsewhere to find software.
Leaflet Control Geocoder [![NPM version](https://badge.fury.io/js/leaflet-control-geocoder.png)](http://badge.fury.io/js/leaflet-control-geocoder)
Leaflet Control Geocoder [![NPM version](https://img.shields.io/npm/v/leaflet-control-geocoder.svg)](https://www.npmjs.com/package/leaflet-control-geocoder) ![Leaflet 1.0.0 compatible!](https://img.shields.io/badge/Leaflet%201.0.0-%E2%9C%93-1EB300.svg?style=flat)
=============================
A simple geocoder for [Leaflet](http://leafletjs.com/) that by default uses [OSM](http://www.openstreetmap.org/)/[Nominatim](http://wiki.openstreetmap.org/wiki/Nominatim).
@@ -18,18 +18,24 @@ The plugin supports many different data providers:
* [Google Geocoding API](https://developers.google.com/maps/documentation/geocoding/)
* [Mapbox Geocoding](https://www.mapbox.com/developers/api/geocoding/)
* [MapQuest Geocoding API](http://developer.mapquest.com/web/products/dev-services/geocoding-ws)
* [RaveGeo](http://www2.idevio.com/ravegeo-server.html)
* [What3Words](http://what3words.com/)
* [Photon](http://photon.komoot.de/)
* [Mapzen Search](https://mapzen.com/projects/search)
* [HERE Geocoder API] (https://developer.here.com/rest-apis/documentation/geocoder/topics/overview.html)
The plugin can easily be extended to support other providers.
The plugin can easily be extended to support other providers. Current extensions:
* [DAWA Geocoder](https://github.com/kjoller/leaflet-control-geocoder-dawa/tree/new) - support for Danish Address Web API by [Niels Kjøller Hansen](https://github.com/kjoller)
See the [Leaflet Control Geocoder Demo](http://perliedman.github.com/leaflet-control-geocoder/).
# Usage
Load the CSS and Javascript:
[Download latest release](https://github.com/perliedman/leaflet-control-geocoder/releases). Load the CSS and Javascript, located in
the `dist` folder:
```HTML
<link rel="stylesheet" href="../Control.Geocoder.css" />
<link rel="stylesheet" href="Control.Geocoder.css" />
<script src="Control.Geocoder.js"></script>
```
@@ -46,23 +52,27 @@ L.Control.geocoder().addTo(map);
# Customizing
By default, when a geocoding result is found, the control will center the map on it and place
a marker at its location. This can be customized by overwriting the control's ```markGeocode```
function, to perform any action desired.
a marker at its location. This can be customized by listening to the control's `markgeocode`
event. To remove the control's default handler for marking a result, set the option
`defaultMarkGeocode` to `false`.
For example:
```javascript
var geocoder = L.Control.geocoder().addTo(map);
geocoder.markGeocode = function(result) {
var bbox = result.bbox;
L.polygon([
bbox.getSouthEast(),
bbox.getNorthEast(),
bbox.getNorthWest(),
bbox.getSouthWest()
]).addTo(map);
};
var geocoder = L.Control.geocoder({
defaultMarkGeocode: false
})
.on('markgeocode', function(e) {
var bbox = e.geocode.bbox;
var poly = L.polygon([
bbox.getSouthEast(),
bbox.getNorthEast(),
bbox.getNorthWest(),
bbox.getSouthWest()
]).addTo(map);
map.fitBounds(poly.getBounds());
})
.addTo(map);
```
This will add a polygon representing the result's boundingbox when a result is selected.

25
assets/control-geocoder/bower.json Normal file → Executable file
View File

@@ -1,12 +1,17 @@
{
"name": "leaflet-control-geocoder",
"version": "1.1.0",
"version": "1.5.4",
"homepage": "https://github.com/perliedman/leaflet-control-geocoder",
"authors": [
"Per Liedman <per@liedman.net>"
],
"description": "Extendable geocoder with builtin OSM/Nominatim support",
"main": "Control.Geocoder.js",
"main": [
"Control.Geocoder.js",
"Control.Geocoder.css",
"images/geocoder.png",
"images/throbber.gif"
],
"moduleType": [
"amd",
"globals"
@@ -14,7 +19,16 @@
"keywords": [
"leaflet",
"geocoder",
"nominatim"
"locations",
"nominatim",
"bing",
"google",
"mapbox",
"photon",
"what3words",
"mapquest",
"mapzen",
"here"
],
"license": "BSD-2-Clause",
"ignore": [
@@ -23,8 +37,5 @@
"bower_components",
"test",
"tests"
],
"dependencies": {
"leaflet": "~0.7.2"
}
]
}

View File

@@ -1,10 +1,12 @@
{
"name": "leaflet-control-geocoder",
"version": "1.1.0",
"description": "Extendable geocoder with builtin OSM/Nominatim support",
"main": "Control.Geocoder.js",
"version": "1.5.4",
"description": "Extendable geocoder with builtin support for Nominatim, Bing, Google, Mapbox, Photon, What3Words, MapQuest, Mapzen, HERE",
"main": "dist/Control.Geocoder.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"prepublish": "sh ./scripts/build.sh",
"publish": "sh ./scripts/publish.sh",
"postpublish": "sh ./scripts/postpublish.sh"
},
"repository": {
"type": "git",
@@ -13,14 +15,30 @@
"keywords": [
"leaflet",
"geocoder",
"nominatim"
"locations",
"nominatim",
"bing",
"google",
"mapbox",
"photon",
"what3words",
"mapquest",
"mapzen",
"here"
],
"author": "Per Liedman <per@liedman.net>",
"license": "BSD-2-Clause",
"bugs": {
"url": "https://github.com/perliedman/leaflet-control-geocoder/issues"
},
"dependencies": {
"leaflet": "~0.7.2"
"browserify-shim": {
"leaflet": "global:L"
},
"dependencies": {},
"devDependencies": {
"browserify": "^11.0.1",
"browserify-shim": "^3.8.10",
"derequire": "^2.0.3",
"es3ify": "^0.1.4"
}
}

View File

@@ -75,7 +75,7 @@ $GLOBALS['LEAFLET_LIBRARIES']['leaflet-fullscreen'] = array
$GLOBALS['LEAFLET_LIBRARIES']['leaflet-control-geocoder'] = array
(
'name' => 'Leaflet Control Geocoder',
'version' => '1.5.1',
'version' => '1.5.4',
'license' => '<a href="https://github.com/perliedman/leaflet-control-geocoder/blob/master/LICENSE" target="_blank">BSD-2-Clause</a>',
'homepage' => 'https://github.com/perliedman/leaflet-control-geocoder',
'css' => 'assets/leaflet/libs/control-geocoder/Control.Geocoder.min.css',