Leaflet/dist/leaflet.js

6 lines
93 KiB
JavaScript
Raw Normal View History

2010-09-23 20:56:29 +08:00
/*
2012-02-13 22:25:57 +08:00
Copyright (c) 2010-2012, CloudMade, Vladimir Agafonkin
2011-12-13 04:10:29 +08:00
Leaflet is a modern open-source JavaScript library for interactive maps.
http://leaflet.cloudmade.com
2010-09-23 20:56:29 +08:00
*/
2012-06-21 19:54:09 +08:00
(function(){var e,t;typeof exports!="undefined"?e=exports:(e={},t=window.L,e.noConflict=function(){return window.L=t,e},window.L=e),e.version="0.4",e.Util={extend:function(e){var t=Array.prototype.slice.call(arguments,1);for(var n=0,r=t.length,i;n<r;n++){i=t[n]||{};for(var s in i)i.hasOwnProperty(s)&&(e[s]=i[s])}return e},bind:function(e,t){var n=arguments.length>2?Array.prototype.slice.call(arguments,2):null;return function(){return e.apply(t,n||arguments)}},stamp:function(){var e=0,t="_leaflet_id";return function(n){return n[t]=n[t]||++e,n[t]}}(),requestAnimFrame:function(){function t(e){window.setTimeout(e,1e3/60)}var n=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||t;return function(r,i,s,o){r=i?e.Util.bind(r,i):r;if(!s||n!==t)return n.call(window,r,o);r()}}(),cancelAnimFrame:function(){var e=window.cancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||clearTimeout;return function(t){if(!t)return;return e.call(window,t)}}(),limitExecByInterval:function(e,t,n){var r,i;return function s(){var o=arguments;if(r){i=!0;return}r=!0,setTimeout(function(){r=!1,i&&(s.apply(n,o),i=!1)},t),e.apply(n,o)}},falseFn:function(){return!1},formatNum:function(e,t){var n=Math.pow(10,t||5);return Math.round(e*n)/n},setOptions:function(t,n){return t.options=e.Util.extend({},t.options,n),t.options},getParamString:function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n+"="+e[n]);return"?"+t.join("&")},template:function(e,t){return e.replace(/\{ *([\w_]+) *\}/g,function(e,n){var r=t[n];if(!t.hasOwnProperty(n))throw Error("No value provided for variable "+e);return r})},emptyImageUrl:"data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="},e.Class=function(){},e.Class.extend=function(t){var n=function(){this.initialize&&this.initialize.apply(this,arguments)},r=function(){};r.prototype=this.prototype;var i=new r;i.constructor=n,n.prototype=i;for(var s in this)this.hasOwnProperty(s)&&s!=="prototype"&&(n[s]=this[s]);return t.statics&&(e.Util.extend(n,t.statics),delete t.statics),t.includes&&(e.Util.extend.apply(null,[i].concat(t.includes)),delete t.includes),t.options&&i.options&&(t.options=e.Util.extend({},i.options,t.options)),e.Util.extend(i,t),n},e.Class.include=function(t){e.Util.extend(this.prototype,t)},e.Class.mergeOptions=function(t){e.Util.extend(this.prototype.options,t)},e.Mixin={},e.Mixin.Events={addEventListener:function(e,t,n){var r=this._leaflet_events=this._leaflet_events||{};return r[e]=r[e]||[],r[e].push({action:t,context:n||this}),this},hasEventListeners:function(e){var t="_leaflet_events";return t in this&&e in this[t]&&this[t][e].length>0},removeEventListener:function(e,t,n){if(!this.hasEventListeners(e))return this;for(var r=0,i=this._leaflet_events,s=i[e].length;r<s;r++)if(i[e][r].action===t&&(!n||i[e][r].context===n))return i[e].splice(r,1),this;return this},fireEvent:function(t,n){if(!this.hasEventListeners(t))return this;var r=e.Util.extend({type:t,target:this},n),i=this._leaflet_events[t].slice();for(var s=0,o=i.length;s<o;s++)i[s].action.call(i[s].context||this,r);return this}},e.Mixin.Events.on=e.Mixin.Events.addEventListener,e.Mixin.Events.off=e.Mixin.Events.removeEventListener,e.Mixin.Events.fire=e.Mixin.Events.fireEvent,function(){var t=navigator.userAgent.toLowerCase(),n=!!window.ActiveXObject,r=t.indexOf("webkit")!==-1,i=t.indexOf("gecko")!==-1,s=typeof orientation!="undefined"?!0:!1,o=t.indexOf("android")!==-1,u=window.opera;e.Browser={ie:n,ie6:n&&!window.XMLHttpRequest,webkit:r,webkit3d:r&&"WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix,gecko:i,gecko3d:i&&"MozPerspective"in document.createElement("div").style,opera:u,opera3d:u&&"OTransition"in document.createElement("div").style,android:o,mobileWebkit:s&&r,mobileOpera:s&&u,mobile:s,touch:function(){var e=!1,t="ontouchstart";if(t in document.documentElement)return!0;var n=document.createElement("