Update leaflet loading library.

This commit is contained in:
David Molineus
2015-06-18 16:08:17 +02:00
parent 35929524bb
commit 9c3c6c8d25
8 changed files with 59 additions and 4 deletions

2
assets/leaflet-loading/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*.swp
.DS_Store

View File

@@ -0,0 +1,20 @@
Contributing
============
Your pull requests are very welcome! Please follow these guidelines:
* Keep code compatible with the same browsers Leaflet aims to be [compatible
with](http://leafletjs.com/features.html).
* Use four spaces rather than tabs.
## Contributors
* [Eric Brelsford](https://github.com/ebrelsford)
* [Nick Iaconis](https://github.com/codefox421)
* [Matthias Althaus](https://github.com/althaus)
* [Yohan Boniface](https://github.com/yohanboniface)
* [kermit-the-frog](https://github.com/kermit-the-frog)
* [kcwu](https://github.com/kcwu)
* [Robbie Trencheny](https://github.com/robbiet480)
* [David Molineus](https://github.com/dmolineus)

View File

@@ -5,6 +5,11 @@
(function () {
var console = window.console || {
error: function () {},
warn: function () {}
};
function defineLeafletLoading(L) {
L.Control.Loading = L.Control.extend({
options: {

View File

@@ -1 +1 @@
!function(){function o(o){o.Control.Loading=o.Control.extend({options:{position:"topleft",separate:!1,zoomControl:null,spinjs:!1,spin:{lines:7,length:3,width:3,radius:5,rotate:13,top:"83%"}},initialize:function(t){o.setOptions(this,t),this._dataLoaders={},null!==this.options.zoomControl&&(this.zoomControl=this.options.zoomControl)},onAdd:function(t){if(this.options.spinjs&&"function"!=typeof Spinner)return console.error("Leaflet.loading cannot load because you didn't load spin.js (http://fgnass.github.io/spin.js/), even though you set it in options.");this._addLayerListeners(t),this._addMapListeners(t),this.options.separate||this.zoomControl||(t.zoomControl?this.zoomControl=t.zoomControl:t.zoomsliderControl&&(this.zoomControl=t.zoomsliderControl));var n,i="leaflet-control-loading";return this.zoomControl&&!this.options.separate?(n=this.zoomControl._container,i+=" leaflet-bar-part-bottom leaflet-bar-part last",o.DomUtil.addClass(this._getLastControlButton(),"leaflet-bar-part-bottom")):n=o.DomUtil.create("div","leaflet-control-zoom leaflet-bar"),this._indicator=o.DomUtil.create("a",i,n),this.options.spinjs&&(this._spinner=new Spinner(this.options.spin).spin(),this._indicator.appendChild(this._spinner.el)),n},onRemove:function(o){this._removeLayerListeners(o),this._removeMapListeners(o)},removeFrom:function(t){return this.zoomControl&&!this.options.separate?(this._container.removeChild(this._indicator),this._map=null,this.onRemove(t),this):o.Control.prototype.removeFrom.call(this,t)},addLoader:function(o){this._dataLoaders[o]=!0,this.updateIndicator()},removeLoader:function(o){delete this._dataLoaders[o],this.updateIndicator()},updateIndicator:function(){this.isLoading()?this._showIndicator():this._hideIndicator()},isLoading:function(){return this._countLoaders()>0},_countLoaders:function(){var o,t=0;for(o in this._dataLoaders)this._dataLoaders.hasOwnProperty(o)&&t++;return t},_showIndicator:function(){o.DomUtil.addClass(this._indicator,"is-loading"),this.options.separate||(this.zoomControl instanceof o.Control.Zoom?o.DomUtil.removeClass(this._getLastControlButton(),"leaflet-bar-part-bottom"):"function"==typeof o.Control.Zoomslider&&this.zoomControl instanceof o.Control.Zoomslider&&o.DomUtil.removeClass(this.zoomControl._ui.zoomOut,"leaflet-bar-part-bottom"))},_hideIndicator:function(){o.DomUtil.removeClass(this._indicator,"is-loading"),this.options.separate||(this.zoomControl instanceof o.Control.Zoom?o.DomUtil.addClass(this._getLastControlButton(),"leaflet-bar-part-bottom"):"function"==typeof o.Control.Zoomslider&&this.zoomControl instanceof o.Control.Zoomslider&&o.DomUtil.addClass(this.zoomControl._ui.zoomOut,"leaflet-bar-part-bottom"))},_getLastControlButton:function(){for(var o=this.zoomControl._container,t=o.children.length-1;t>0;){var n=o.children[t];if(this._indicator!==n&&0!==n.offsetWidth&&0!==n.offsetHeight)break;t--}return o.children[t]},_handleLoading:function(o){this.addLoader(this.getEventId(o))},_handleLoad:function(o){this.removeLoader(this.getEventId(o))},getEventId:function(o){return o.id?o.id:o.layer?o.layer._leaflet_id:o.target._leaflet_id},_layerAdd:function(o){if(o.layer&&o.layer.on)try{o.layer.on({loading:this._handleLoading,load:this._handleLoad},this)}catch(t){console.warn("L.Control.Loading: Tried and failed to add event handlers to layer",o.layer),console.warn("L.Control.Loading: Full details",t)}},_addLayerListeners:function(o){o.eachLayer(function(o){o.on&&o.on({loading:this._handleLoading,load:this._handleLoad},this)},this),o.on("layeradd",this._layerAdd,this)},_removeLayerListeners:function(o){o.eachLayer(function(o){o.off&&o.off({loading:this._handleLoading,load:this._handleLoad},this)},this),o.off("layeradd",this._layerAdd,this)},_addMapListeners:function(o){o.on({dataloading:this._handleLoading,dataload:this._handleLoad,layerremove:this._handleLoad},this)},_removeMapListeners:function(o){o.off({dataloading:this._handleLoading,dataload:this._handleLoad,layerremove:this._handleLoad},this)}}),o.Map.addInitHook(function(){this.options.loadingControl&&(this.loadingControl=new o.Control.Loading,this.addControl(this.loadingControl))}),o.Control.loading=function(t){return new o.Control.Loading(t)}}"function"==typeof define&&define.amd?define(["leaflet"],function(t){o(t)}):o(L)}();
!function(){function o(o){o.Control.Loading=o.Control.extend({options:{position:"topleft",separate:!1,zoomControl:null,spinjs:!1,spin:{lines:7,length:3,width:3,radius:5,rotate:13,top:"83%"}},initialize:function(t){o.setOptions(this,t),this._dataLoaders={},null!==this.options.zoomControl&&(this.zoomControl=this.options.zoomControl)},onAdd:function(n){if(this.options.spinjs&&"function"!=typeof Spinner)return t.error("Leaflet.loading cannot load because you didn't load spin.js (http://fgnass.github.io/spin.js/), even though you set it in options.");this._addLayerListeners(n),this._addMapListeners(n),this.options.separate||this.zoomControl||(n.zoomControl?this.zoomControl=n.zoomControl:n.zoomsliderControl&&(this.zoomControl=n.zoomsliderControl));var i,a="leaflet-control-loading";return this.zoomControl&&!this.options.separate?(i=this.zoomControl._container,a+=" leaflet-bar-part-bottom leaflet-bar-part last",o.DomUtil.addClass(this._getLastControlButton(),"leaflet-bar-part-bottom")):i=o.DomUtil.create("div","leaflet-control-zoom leaflet-bar"),this._indicator=o.DomUtil.create("a",a,i),this.options.spinjs&&(this._spinner=new Spinner(this.options.spin).spin(),this._indicator.appendChild(this._spinner.el)),i},onRemove:function(o){this._removeLayerListeners(o),this._removeMapListeners(o)},removeFrom:function(t){return this.zoomControl&&!this.options.separate?(this._container.removeChild(this._indicator),this._map=null,this.onRemove(t),this):o.Control.prototype.removeFrom.call(this,t)},addLoader:function(o){this._dataLoaders[o]=!0,this.updateIndicator()},removeLoader:function(o){delete this._dataLoaders[o],this.updateIndicator()},updateIndicator:function(){this.isLoading()?this._showIndicator():this._hideIndicator()},isLoading:function(){return this._countLoaders()>0},_countLoaders:function(){var o,t=0;for(o in this._dataLoaders)this._dataLoaders.hasOwnProperty(o)&&t++;return t},_showIndicator:function(){o.DomUtil.addClass(this._indicator,"is-loading"),this.options.separate||(this.zoomControl instanceof o.Control.Zoom?o.DomUtil.removeClass(this._getLastControlButton(),"leaflet-bar-part-bottom"):"function"==typeof o.Control.Zoomslider&&this.zoomControl instanceof o.Control.Zoomslider&&o.DomUtil.removeClass(this.zoomControl._ui.zoomOut,"leaflet-bar-part-bottom"))},_hideIndicator:function(){o.DomUtil.removeClass(this._indicator,"is-loading"),this.options.separate||(this.zoomControl instanceof o.Control.Zoom?o.DomUtil.addClass(this._getLastControlButton(),"leaflet-bar-part-bottom"):"function"==typeof o.Control.Zoomslider&&this.zoomControl instanceof o.Control.Zoomslider&&o.DomUtil.addClass(this.zoomControl._ui.zoomOut,"leaflet-bar-part-bottom"))},_getLastControlButton:function(){for(var o=this.zoomControl._container,t=o.children.length-1;t>0;){var n=o.children[t];if(this._indicator!==n&&0!==n.offsetWidth&&0!==n.offsetHeight)break;t--}return o.children[t]},_handleLoading:function(o){this.addLoader(this.getEventId(o))},_handleLoad:function(o){this.removeLoader(this.getEventId(o))},getEventId:function(o){return o.id?o.id:o.layer?o.layer._leaflet_id:o.target._leaflet_id},_layerAdd:function(o){if(o.layer&&o.layer.on)try{o.layer.on({loading:this._handleLoading,load:this._handleLoad},this)}catch(n){t.warn("L.Control.Loading: Tried and failed to add event handlers to layer",o.layer),t.warn("L.Control.Loading: Full details",n)}},_addLayerListeners:function(o){o.eachLayer(function(o){o.on&&o.on({loading:this._handleLoading,load:this._handleLoad},this)},this),o.on("layeradd",this._layerAdd,this)},_removeLayerListeners:function(o){o.eachLayer(function(o){o.off&&o.off({loading:this._handleLoading,load:this._handleLoad},this)},this),o.off("layeradd",this._layerAdd,this)},_addMapListeners:function(o){o.on({dataloading:this._handleLoading,dataload:this._handleLoad,layerremove:this._handleLoad},this)},_removeMapListeners:function(o){o.off({dataloading:this._handleLoading,dataload:this._handleLoad,layerremove:this._handleLoad},this)}}),o.Map.addInitHook(function(){this.options.loadingControl&&(this.loadingControl=new o.Control.Loading,this.addControl(this.loadingControl))}),o.Control.loading=function(t){return new o.Control.Loading(t)}}var t=window.console||{error:function(){},warn:function(){}};"function"==typeof define&&define.amd?define(["leaflet"],function(t){o(t)}):o(L)}();

View File

@@ -71,7 +71,7 @@ See Leaflet.loading in action (zoom or pan to make tiles load):
- With the loading indicator and zoom control on the [top right][topright] of
the map.
- The [simplest example using spin.js](http://ebrelsford.github.io/Leaflet.loading/spinjs.html) instead of an image
- Combined with a [fullscreen control][combined] (e.g. [https://github.com/brunob/leaflet.fullscreen]).
- Combined with a [fullscreen control][combined] (e.g. [leaflet.fullscreen][]).
## License
@@ -86,3 +86,4 @@ License.
[separate]: http://ebrelsford.github.io/Leaflet.loading/separate.html
[topright]: http://ebrelsford.github.io/Leaflet.loading/topright.html
[combined]: http://ebrelsford.github.io/Leaflet.loading/combined.html
[leaflet.fullscreen]: https://github.com/brunob/leaflet.fullscreen

View File

@@ -1,6 +1,6 @@
{
"name": "leaflet.loading",
"version": "0.1.15",
"version": "0.1.16",
"homepage": "https://github.com/ebrelsford/leaflet.loading",
"authors": [
"Eric Brelsford <ebrelsford@gmail.com>"

View File

@@ -0,0 +1,27 @@
{
"name": "leaflet-loading",
"version": "0.1.16",
"description": "A simple loading control for Leaflet",
"main": "src/Control.Loading.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/ebrelsford/Leaflet.loading.git"
},
"keywords": [
"leaflet",
"map",
"maps",
"gis",
"geoweb",
"loading"
],
"author": "Eric Brelsford <ebrelsford@gmail.com> (http://ebrelsford.github.io/)",
"license": "MIT",
"bugs": {
"url": "https://github.com/ebrelsford/Leaflet.loading/issues"
},
"homepage": "https://github.com/ebrelsford/Leaflet.loading"
}

View File

@@ -55,7 +55,7 @@ $GLOBALS['LEAFLET_LIBRARIES']['leaflet-markercluster'] = array
$GLOBALS['LEAFLET_LIBRARIES']['leaflet-loading'] = array
(
'name' => 'Leaflet.loading',
'version' => '0.1.15',
'version' => '0.1.16',
'license' => '<a href="https://github.com/ebrelsford/Leaflet.loading/blob/master/LICENSE" target="_blank">MIT</a>',
'homepage' => 'https://github.com/ebrelsford/Leaflet.loading',
'css' => 'assets/leaflet/libs/leaflet-loading/Control.Loading.min.css',