Upload files to "js"
This commit is contained in:
parent
5505313648
commit
902cb5d5b6
6 changed files with 24197 additions and 0 deletions
121
js/Leaflet_Search.js
Normal file
121
js/Leaflet_Search.js
Normal file
|
|
@ -0,0 +1,121 @@
|
||||||
|
/*
|
||||||
|
* Leaflet Geocoding plugin that look good.
|
||||||
|
*/
|
||||||
|
L.Control.Search = L.Control.extend({
|
||||||
|
options: {
|
||||||
|
position: 'topleft',
|
||||||
|
title: 'Nominatim Search',
|
||||||
|
email: 'thomas.brus@gmx.at'
|
||||||
|
},
|
||||||
|
|
||||||
|
onAdd: function( map ) {
|
||||||
|
this._map = map;
|
||||||
|
var container = L.DomUtil.create('div', 'leaflet-bar');
|
||||||
|
var wrapper = document.createElement('div');
|
||||||
|
container.appendChild(wrapper);
|
||||||
|
var link = L.DomUtil.create('a', '', wrapper);
|
||||||
|
link.href = '#';
|
||||||
|
link.style.width = '26px';
|
||||||
|
link.style.height = '26px';
|
||||||
|
link.style.backgroundImage = 'url(' + this._icon + ')';
|
||||||
|
link.style.backgroundSize = '26px 26px';
|
||||||
|
link.style.backgroundRepeat = 'no-repeat';
|
||||||
|
link.title = this.options.title;
|
||||||
|
|
||||||
|
var stop = L.DomEvent.stopPropagation;
|
||||||
|
L.DomEvent
|
||||||
|
.on(link, 'click', stop)
|
||||||
|
.on(link, 'mousedown', stop)
|
||||||
|
.on(link, 'dblclick', stop)
|
||||||
|
.on(link, 'click', L.DomEvent.preventDefault)
|
||||||
|
.on(link, 'click', this._toggle, this);
|
||||||
|
|
||||||
|
|
||||||
|
var form = this._form = document.createElement('form');
|
||||||
|
form.style.display = 'none';
|
||||||
|
form.style.position = 'absolute';
|
||||||
|
form.style.left = '27px';
|
||||||
|
form.style.top = '0px';
|
||||||
|
form.style.zIndex = -10;
|
||||||
|
var input = this._input = document.createElement('input');
|
||||||
|
input.style.height = '25px';
|
||||||
|
input.style.border = '1px solid grey';
|
||||||
|
input.style.padding = '0 0 0 10px';
|
||||||
|
form.appendChild(input);
|
||||||
|
L.DomEvent.on(form, 'submit', function() { this._doSearch(input.value); return false; }, this).on(form, 'submit', L.DomEvent.preventDefault);
|
||||||
|
container.appendChild(form);
|
||||||
|
|
||||||
|
return container;
|
||||||
|
},
|
||||||
|
|
||||||
|
_toggle: function() {
|
||||||
|
if( this._form.style.display != 'block' ) {
|
||||||
|
this._form.style.display = 'block';
|
||||||
|
this._input.focus();
|
||||||
|
} else {
|
||||||
|
this._collapse();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_collapse: function() {
|
||||||
|
this._form.style.display = 'none';
|
||||||
|
this._input.value = '';
|
||||||
|
},
|
||||||
|
|
||||||
|
_nominatimCallback: function( results ) {
|
||||||
|
if( results && results.length > 0 ) {
|
||||||
|
var bbox = results[0].boundingbox;
|
||||||
|
this._map.fitBounds(L.latLngBounds([[bbox[0], bbox[2]], [bbox[1], bbox[3]]]));
|
||||||
|
}
|
||||||
|
this._collapse();
|
||||||
|
},
|
||||||
|
|
||||||
|
_callbackId: 0,
|
||||||
|
|
||||||
|
_doSearch: function( query ) {
|
||||||
|
var callback = '_l_osmgeocoder_' + this._callbackId++;
|
||||||
|
window[callback] = L.Util.bind(this._nominatimCallback, this);
|
||||||
|
var queryParams = {
|
||||||
|
q: query,
|
||||||
|
format: 'json',
|
||||||
|
limit: 1,
|
||||||
|
'json_callback': callback
|
||||||
|
};
|
||||||
|
if( this.options.email )
|
||||||
|
queryParams.email = this.options.email;
|
||||||
|
if( this._map.getBounds() )
|
||||||
|
queryParams.viewbox = this._map.getBounds().toBBoxString();
|
||||||
|
var url = 'http://nominatim.openstreetmap.org/search' + L.Util.getParamString(queryParams);
|
||||||
|
var script = document.createElement('script');
|
||||||
|
script.type = 'text/javascript';
|
||||||
|
script.src = url;
|
||||||
|
document.getElementsByTagName('head')[0].appendChild(script);
|
||||||
|
},
|
||||||
|
|
||||||
|
/* jshint laxbreak: true */
|
||||||
|
_icon: 'data:image/png;base64,'
|
||||||
|
+'iVBORw0KGgoAA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mhprN5jvAOTo3sRVUClesV/5/a7MtTmdnZx9ttVrXCc4k'
|
||||||
|
+'4HcROWOMuVKpVG4ClEqlw8BRVT1Np1ANc1tEpqvV6s+2i9+PvqrtmZmZIyLyNTCx59JtYAN4cI99'
|
||||||
|
+'E8iF+n/5vj/teV5su11fn+C1Wm1lbGzsORF5HwhX2ePsESMi36jqYyLihsz3GmMul0ql8GHdF7F8'
|
||||||
|
+'sUKnAm+1WseMMZNBSTOiqldFZBlYcl33N+jsdJlMZgGYCbnH9vjFJigKgaiLQDFkjkXUQP761Ov1'
|
||||||
|
+'za2trROAFzKPq+qlfh+/gWRoh6mpqZF8Pn8RmA6Z+8rUQP/LNRqNjbW1tRPApZC5r0wN/EfjjigR'
|
||||||
|
+'uRwyjwNnbeYbuCDoiFpdXX0Z+DYwfa+qr9rMlQhBsJupl1T1w2w2W3Zdd91mnoFuCneCxGQoLlJB'
|
||||||
|
+'SScVlHRSQUknFZR0UkFJ564T9C+LGmRQ/iQvLwAAAABJRU5ErkJggg=='
|
||||||
|
});
|
||||||
|
|
||||||
|
L.control.search = function( options ) {
|
||||||
|
return new L.Control.Search(options);
|
||||||
|
};
|
||||||
|
|
||||||
1296
js/leaflet-control-geocoder.Geocoder.js
Normal file
1296
js/leaflet-control-geocoder.Geocoder.js
Normal file
File diff suppressed because it is too large
Load diff
7648
js/leaflet-measure.js
Normal file
7648
js/leaflet-measure.js
Normal file
File diff suppressed because it is too large
Load diff
1032
js/leaflet-search.src.js
Normal file
1032
js/leaflet-search.src.js
Normal file
File diff suppressed because it is too large
Load diff
132
js/leaflet-sidebar.js
Normal file
132
js/leaflet-sidebar.js
Normal file
|
|
@ -0,0 +1,132 @@
|
||||||
|
L.Control.Sidebar = L.Control.extend({
|
||||||
|
includes: L.Mixin.Events,
|
||||||
|
|
||||||
|
initialize: function (id, options) {
|
||||||
|
var i, child;
|
||||||
|
|
||||||
|
L.setOptions(this, options);
|
||||||
|
|
||||||
|
// Find sidebar HTMLElement
|
||||||
|
this._sidebar = L.DomUtil.get(id);
|
||||||
|
|
||||||
|
// Attach touch styling if necessary
|
||||||
|
if (L.Browser.touch)
|
||||||
|
L.DomUtil.addClass(this._sidebar, 'leaflet-touch');
|
||||||
|
|
||||||
|
// Find sidebar > ul.sidebar-tabs and sidebar > div.sidebar-content
|
||||||
|
for (i = this._sidebar.children.length - 1; i >= 0; i--) {
|
||||||
|
child = this._sidebar.children[i];
|
||||||
|
if (child.tagName == 'UL' &&
|
||||||
|
L.DomUtil.hasClass(child, 'sidebar-tabs'))
|
||||||
|
this._tabs = child;
|
||||||
|
|
||||||
|
else if (child.tagName == 'DIV' &&
|
||||||
|
L.DomUtil.hasClass(child, 'sidebar-content'))
|
||||||
|
this._container = child;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find sidebar > ul.sidebar-tabs > li
|
||||||
|
this._tabitems = [];
|
||||||
|
for (i = this._tabs.children.length - 1; i >= 0; i--) {
|
||||||
|
child = this._tabs.children[i];
|
||||||
|
if (child.tagName == 'LI') {
|
||||||
|
this._tabitems.push(child);
|
||||||
|
child._sidebar = this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find sidebar > div.sidebar-content > div.sidebar-pane
|
||||||
|
this._panes = [];
|
||||||
|
for (i = this._container.children.length - 1; i >= 0; i--) {
|
||||||
|
child = this._container.children[i];
|
||||||
|
if (child.tagName == 'DIV' &&
|
||||||
|
L.DomUtil.hasClass(child, 'sidebar-pane'))
|
||||||
|
this._panes.push(child);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._hasTouchStart = L.Browser.touch &&
|
||||||
|
('ontouchstart' in document.documentElement);
|
||||||
|
},
|
||||||
|
|
||||||
|
addTo: function (map) {
|
||||||
|
this._map = map;
|
||||||
|
|
||||||
|
var e = this._hasTouchStart ? 'touchstart' : 'click';
|
||||||
|
for (var i = this._tabitems.length - 1; i >= 0; i--) {
|
||||||
|
var child = this._tabitems[i];
|
||||||
|
L.DomEvent.on(child.firstChild, e, this._onClick, child);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
removeFrom: function (map) {
|
||||||
|
this._map = null;
|
||||||
|
|
||||||
|
var e = this._hasTouchStart ? 'touchstart' : 'click';
|
||||||
|
for (var i = this._tabitems.length - 1; i >= 0; i--) {
|
||||||
|
var child = this._tabitems[i];
|
||||||
|
L.DomEvent.off(child.firstChild, e, this._onClick);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
open: function(id) {
|
||||||
|
var i, child;
|
||||||
|
|
||||||
|
// hide old active contents and show new content
|
||||||
|
for (i = this._panes.length - 1; i >= 0; i--) {
|
||||||
|
child = this._panes[i];
|
||||||
|
if (child.id == id)
|
||||||
|
L.DomUtil.addClass(child, 'active');
|
||||||
|
else if (L.DomUtil.hasClass(child, 'active'))
|
||||||
|
L.DomUtil.removeClass(child, 'active');
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove old active highlights and set new highlight
|
||||||
|
for (i = this._tabitems.length - 1; i >= 0; i--) {
|
||||||
|
child = this._tabitems[i];
|
||||||
|
if (child.firstChild.hash == '#' + id)
|
||||||
|
L.DomUtil.addClass(child, 'active');
|
||||||
|
else if (L.DomUtil.hasClass(child, 'active'))
|
||||||
|
L.DomUtil.removeClass(child, 'active');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.fire('content', { id: id });
|
||||||
|
|
||||||
|
// open sidebar (if necessary)
|
||||||
|
if (L.DomUtil.hasClass(this._sidebar, 'collapsed')) {
|
||||||
|
this.fire('opening');
|
||||||
|
L.DomUtil.removeClass(this._sidebar, 'collapsed');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
close: function() {
|
||||||
|
// remove old active highlights
|
||||||
|
for (var i = this._tabitems.length - 1; i >= 0; i--) {
|
||||||
|
var child = this._tabitems[i];
|
||||||
|
if (L.DomUtil.hasClass(child, 'active'))
|
||||||
|
L.DomUtil.removeClass(child, 'active');
|
||||||
|
}
|
||||||
|
|
||||||
|
// close sidebar
|
||||||
|
if (!L.DomUtil.hasClass(this._sidebar, 'collapsed')) {
|
||||||
|
this.fire('closing');
|
||||||
|
L.DomUtil.addClass(this._sidebar, 'collapsed');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_onClick: function(e) {
|
||||||
|
if (L.DomUtil.hasClass(this, 'active'))
|
||||||
|
this._sidebar.close();
|
||||||
|
else
|
||||||
|
this._sidebar.open(this.firstChild.hash.slice(1));
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
L.control.sidebar = function (sidebar, options) {
|
||||||
|
return new L.Control.Sidebar(sidebar, options);
|
||||||
|
};
|
||||||
|
|
||||||
13968
js/leaflet-src.esm.js
Normal file
13968
js/leaflet-src.esm.js
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue