2010-12-15 23:14:59 +08:00
|
|
|
(function() {
|
2013-01-31 18:59:23 +08:00
|
|
|
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;
|
|
|
|
}
|
2013-01-31 04:01:32 +08:00
|
|
|
var scripts = getFiles();
|
2013-01-31 18:59:23 +08:00
|
|
|
|
2011-06-02 22:07:56 +08:00
|
|
|
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$/);
|
2011-06-03 16:45:07 +08:00
|
|
|
if (res) {
|
2013-01-31 18:59:23 +08:00
|
|
|
return res[1] + '../src/';
|
2011-06-02 22:07:56 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-12-14 19:12:54 +08:00
|
|
|
|
2011-06-02 22:07:56 +08:00
|
|
|
var path = getSrcUrl();
|
2012-05-16 20:34:36 +08:00
|
|
|
for (var i = 0; i < scripts.length; i++) {
|
2012-05-10 22:03:50 +08:00
|
|
|
document.writeln("<script src='" + path + scripts[i] + "'></script>");
|
2010-12-15 23:14:59 +08:00
|
|
|
}
|
2011-06-20 16:15:53 +08:00
|
|
|
})();
|
2011-08-11 19:30:46 +08:00
|
|
|
|
|
|
|
function getRandomLatLng(map) {
|
|
|
|
var bounds = map.getBounds(),
|
|
|
|
southWest = bounds.getSouthWest(),
|
|
|
|
northEast = bounds.getNorthEast(),
|
|
|
|
lngSpan = northEast.lng - southWest.lng,
|
|
|
|
latSpan = northEast.lat - southWest.lat;
|
2011-12-14 19:12:54 +08:00
|
|
|
|
2011-08-11 19:30:46 +08:00
|
|
|
return new L.LatLng(
|
|
|
|
southWest.lat + latSpan * Math.random(),
|
|
|
|
southWest.lng + lngSpan * Math.random());
|
2011-12-14 19:12:54 +08:00
|
|
|
}
|
2012-11-14 19:37:25 +08:00
|
|
|
|
|
|
|
function logEvent(e) {
|
|
|
|
console.log(e.type);
|
|
|
|
}
|