Leaflet/debug/leaflet-include.js

135 lines
3.4 KiB
JavaScript
Raw Normal View History

2010-12-15 23:14:59 +08:00
(function() {
//TODO replace script list with the one from ../buid/deps.js
2010-12-15 23:14:59 +08:00
var scripts = [
'Leaflet.js',
2011-12-14 19:12:54 +08:00
'core/Util.js',
2010-12-15 23:14:59 +08:00
'core/Class.js',
'core/Events.js',
'core/Browser.js',
2011-12-14 19:12:54 +08:00
2010-12-16 00:41:35 +08:00
'geometry/Point.js',
'geometry/Bounds.js',
'geometry/Transformation.js',
2011-02-26 01:01:29 +08:00
'geometry/LineUtil.js',
2011-03-01 23:41:33 +08:00
'geometry/PolyUtil.js',
2011-12-14 19:12:54 +08:00
2010-12-15 23:14:59 +08:00
'dom/DomEvent.js',
'dom/DomEvent.DoubleTap.js',
'dom/DomEvent.MsTouch.js',
2010-12-15 23:14:59 +08:00
'dom/DomUtil.js',
'dom/Draggable.js',
2011-12-14 19:12:54 +08:00
'dom/PosAnimation.js',
'dom/PosAnimation.Timer.js',
// 'dom/transition/Transition.js',
// 'dom/transition/Transition.Native.js',
// 'dom/transition/Transition.Timer.js',
2011-12-14 19:12:54 +08:00
2010-12-15 23:14:59 +08:00
'geo/LatLng.js',
'geo/LatLngBounds.js',
2011-12-14 19:12:54 +08:00
'geo/projection/Projection.js',
'geo/projection/Projection.SphericalMercator.js',
'geo/projection/Projection.LonLat.js',
'geo/projection/Projection.Mercator.js',
2011-12-14 19:12:54 +08:00
'geo/crs/CRS.js',
'geo/crs/CRS.EPSG3857.js',
'geo/crs/CRS.EPSG4326.js',
'geo/crs/CRS.EPSG3395.js',
2011-12-14 19:12:54 +08:00
2011-10-21 22:50:59 +08:00
'map/Map.js',
2011-12-14 19:12:54 +08:00
2011-10-21 22:50:59 +08:00
'map/ext/Map.Geolocation.js',
'map/ext/Map.Popup.js',
'map/ext/Map.Control.js',
2011-12-14 19:12:54 +08:00
'map/anim/Map.PanAnimation.js',
'map/anim/Map.ZoomAnimation.js',
'core/Handler.js',
'map/handler/Map.Drag.js',
'map/handler/Map.TouchZoom.js',
'map/handler/Map.DoubleClickZoom.js',
'map/handler/Map.ScrollWheelZoom.js',
'map/handler/Map.BoxZoom.js',
'map/handler/Map.Keyboard.js',
2011-12-14 19:12:54 +08:00
'layer/LayerGroup.js',
'layer/FeatureGroup.js',
2011-12-14 19:12:54 +08:00
2011-05-28 01:20:54 +08:00
'layer/tile/TileLayer.js',
'layer/tile/TileLayer.WMS.js',
'layer/tile/TileLayer.Canvas.js',
2010-12-15 23:14:59 +08:00
'layer/ImageOverlay.js',
2010-12-16 01:55:57 +08:00
'layer/Popup.js',
2011-12-14 19:12:54 +08:00
2011-01-21 17:55:08 +08:00
'layer/marker/Icon.js',
'layer/marker/Icon.Default.js',
'layer/marker/DivIcon.js',
2011-01-21 17:55:08 +08:00
'layer/marker/Marker.js',
'layer/marker/Marker.Popup.js',
2011-12-14 19:12:54 +08:00
'layer/marker/Marker.Drag.js',
2011-02-26 01:01:29 +08:00
'layer/vector/Path.js',
2011-06-21 22:58:26 +08:00
'layer/vector/Path.Popup.js',
'layer/vector/Path.SVG.js',
'layer/vector/Path.VML.js',
'layer/vector/canvas/Path.Canvas.js',
2011-02-26 01:01:29 +08:00
'layer/vector/Polyline.js',
'layer/vector/Polyline.Edit.js',
'layer/vector/canvas/Polyline.Canvas.js',
2011-03-01 16:26:42 +08:00
'layer/vector/Polygon.js',
'layer/vector/Rectangle.js',
'layer/vector/canvas/Polygon.Canvas.js',
'layer/vector/MultiPoly.js',
2011-03-01 23:41:33 +08:00
'layer/vector/Circle.js',
'layer/vector/canvas/Circle.Canvas.js',
'layer/vector/CircleMarker.js',
2011-12-14 19:12:54 +08:00
2011-06-10 19:26:16 +08:00
'layer/GeoJSON.js',
2011-12-14 19:12:54 +08:00
'control/Control.js',
'control/Control.Zoom.js',
'control/Control.Attribution.js',
2011-07-13 01:19:29 +08:00
'control/Control.Layers.js',
2012-02-25 23:04:27 +08:00
'control/Control.Scale.js'
2010-12-15 23:14:59 +08:00
];
2011-12-14 19:12:54 +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$/);
if (res) {
2011-06-02 22:07:56 +08:00
return res[1] + '../src/';
}
}
}
}
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++) {
document.writeln("<script src='" + path + scripts[i] + "'></script>");
2010-12-15 23:14:59 +08:00
}
2012-08-07 23:43:52 +08:00
document.writeln('<script defer>L.Icon.Default.imagePath = "' + path + '../dist/images";</script>');
})();
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);
}