e9957cfa02
* CSS-based paths for L.Icon.Default. #4604, #3696, #4579 * Unit tests for default icons * Make CSS icon path detection IE8-friendly * Backwards compatibility for L.Icon.Default.imagePath override. * Don't overwrite options
59 lines
1.2 KiB
JavaScript
59 lines
1.2 KiB
JavaScript
(function() {
|
|
function getFiles() {
|
|
var memo = {},
|
|
files = [],
|
|
i, src;
|
|
|
|
function addFiles(srcs) {
|
|
for (var j = 0, len = srcs.length; j < len; j++) {
|
|
memo[srcs[j]] = true;
|
|
}
|
|
}
|
|
|
|
for (i in deps) {
|
|
addFiles(deps[i].src);
|
|
}
|
|
|
|
for (src in memo) {
|
|
files.push(src);
|
|
}
|
|
|
|
return files;
|
|
}
|
|
var scripts = getFiles();
|
|
|
|
function getSrcUrl() {
|
|
var scripts = document.getElementsByTagName('script');
|
|
for (var i = 0; i < scripts.length; i++) {
|
|
var src = scripts[i].src;
|
|
if (src) {
|
|
var res = src.match(/^(.*)leaflet-include\.js$/);
|
|
if (res) {
|
|
return res[1] + '../src/';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
var path = getSrcUrl();
|
|
for (var i = 0; i < scripts.length; i++) {
|
|
document.writeln("<script src='" + path + scripts[i] + "'></script>");
|
|
}
|
|
})();
|
|
|
|
function getRandomLatLng(map) {
|
|
var bounds = map.getBounds(),
|
|
southWest = bounds.getSouthWest(),
|
|
northEast = bounds.getNorthEast(),
|
|
lngSpan = northEast.lng - southWest.lng,
|
|
latSpan = northEast.lat - southWest.lat;
|
|
|
|
return new L.LatLng(
|
|
southWest.lat + latSpan * Math.random(),
|
|
southWest.lng + lngSpan * Math.random());
|
|
}
|
|
|
|
function logEvent(e) {
|
|
console.log(e.type);
|
|
}
|