Check the browsers websocket support and added flag to turn websocket on/off.

This commit is contained in:
Raimund Renkert 2015-03-04 11:05:36 +01:00
parent 7413221341
commit c32e2646af

View File

@ -41,6 +41,7 @@
<script type="text/javascript" src="js/leaflet-hash.js"></script>
<script>
var useWebsocket = false; // Set to true if you want websocket support
L.Projection.NoWrap = {
project: function (latlng) {
@ -95,14 +96,16 @@ L.control.coordinates({
}).addTo(map);
var manualUpdateControl;
L.autoUpdate('autoUpdate', function(pressed) {
if (pressed) {
manualUpdateControl.getContainer().style = 'visibility: hidden';
}
else {
manualUpdateControl.getContainer().style = 'visibility: visible';
}
});
if (window.WebSocket && useWebsocket) {
L.autoUpdate('autoUpdate', function(pressed) {
if (pressed) {
manualUpdateControl.getContainer().style = 'visibility: hidden';
}
else {
manualUpdateControl.getContainer().style = 'visibility: visible';
}
});
}
var layersControl = new L.Control.Layers(rasterMaps, overlayMaps, {collapsed: false});
map.addControl(layersControl);