Applied rrenkert's patch to have an autoupdating client.

This commit is contained in:
Sascha L. Teichmann 2015-03-03 15:22:00 +01:00
parent 7249a60043
commit 0b7c8b6afe

View File

@ -37,6 +37,7 @@
<script src="js/leaflet.js"></script> <script src="js/leaflet.js"></script>
<script src="js/Leaflet.Coordinates-0.1.4.min.js"></script> <script src="js/Leaflet.Coordinates-0.1.4.min.js"></script>
<script src="js/easy-button.js"></script> <script src="js/easy-button.js"></script>
<script src="js/auto-update.js"></script>
<script type="text/javascript" src="js/leaflet-hash.js"></script> <script type="text/javascript" src="js/leaflet-hash.js"></script>
<script> <script>
@ -93,10 +94,19 @@ L.control.coordinates({
useLatLngOrder: true //ordering of labels, default false-> lng-lat useLatLngOrder: true //ordering of labels, default false-> lng-lat
}).addTo(map); }).addTo(map);
var manualUpdateControl;
L.autoUpdate('autoUpdate', function(e) {
if (e.target.checked) {
manualUpdateControl.getContainer().style = 'visibility: hidden';
}
else {
manualUpdateControl.getContainer().style = 'visibility: visible';
}
});
var layersControl = new L.Control.Layers(rasterMaps, overlayMaps, {collapsed: false}); var layersControl = new L.Control.Layers(rasterMaps, overlayMaps, {collapsed: false});
map.addControl(layersControl); map.addControl(layersControl);
L.easyButton('fa-refresh', manualUpdateControl = L.easyButton('fa-refresh',
function (){ function (){
var tiles = document.getElementsByTagName("img"); var tiles = document.getElementsByTagName("img");
for (var i = 0; i < tiles.length; i++) { for (var i = 0; i < tiles.length; i++) {
@ -114,7 +124,7 @@ L.easyButton('fa-refresh',
//map._resetView(map.getCenter(), map.getZoom(), false); //map._resetView(map.getCenter(), map.getZoom(), false);
}, },
'Update view' 'Update view'
) );
var hash = new L.Hash(map) var hash = new L.Hash(map)
</script> </script>
</body> </body>