worldmap/worldmap.js
function() {
    ws = new SockJS(location.pathname.split("index")[0] + 'socket');
    ws.onopen = function() {
        console.log("CONNECTED");
        if (!inIframe) {
            document.getElementById("footer").innerHTML = "<font color='#494'>"+ibmfoot+"</font>";
        }
        ws.send(JSON.stringify({action:"connected"}));
        onoffline();
    };
    ws.onclose = function() {
        console.log("DISCONNECTED");
        if (!inIframe) {
            document.getElementById("footer").innerHTML = "<font color='#900'>"+ibmfoot+"</font>";
        }
        setTimeout(function() { connect(); }, 2500);
    };
    ws.onmessage = function(e) {
        var data = JSON.parse(e.data);
        //console.log("DATA" typeof data,data);
        if (Array.isArray(data)) {
            //console.log("ARRAY");
            // map.closePopup();
            // var bnds= L.latLngBounds([0,0]);
            for (var prop in data) {
                if (data[prop].command) { doCommand(data[prop].command); delete data[prop].command; }
                if (data[prop].hasOwnProperty("name")) {
                    setMarker(data[prop]);
                    // bnds.extend(markers[data[prop].name].getLatLng());
                }
                else { console.log("SKIP A",data[prop]); }
            }
            // map.fitBounds(bnds.pad(0.25));
        }
        else {
            if (data.command) { doCommand(data.command); delete data.command; }
            if (data.hasOwnProperty("name")) { setMarker(data); }
            else if (data.hasOwnProperty("type")) { doGeojson(data); }
            else {
                console.log("SKIP",data);
                // if (typeof data === "string") { doDialog(data); }
                // else { console.log("SKIP",data); }
            }
        }
    };
}
function() {
    ws = new SockJS(location.pathname.split("index")[0] + 'socket');
    ws.onopen = function() {
        console.log("CONNECTED");
        if (!inIframe) {
            document.getElementById("footer").innerHTML = "<font color='#494'>"+ibmfoot+"</font>";
        }
        ws.send(JSON.stringify({action:"connected"}));
        onoffline();
    };
    ws.onclose = function() {
        console.log("DISCONNECTED");
        if (!inIframe) {
            document.getElementById("footer").innerHTML = "<font color='#900'>"+ibmfoot+"</font>";
        }
        setTimeout(function() { connect(); }, 2500);
    };
    ws.onmessage = function(e) {
        var data = JSON.parse(e.data);
        //console.log("DATA" typeof data,data);
        if (Array.isArray(data)) {
            //console.log("ARRAY");
            // map.closePopup();
            // var bnds= L.latLngBounds([0,0]);
            for (var prop in data) {
                if (data[prop].command) { doCommand(data[prop].command); delete data[prop].command; }
                if (data[prop].hasOwnProperty("name")) {
                    setMarker(data[prop]);
                    // bnds.extend(markers[data[prop].name].getLatLng());
                }
                else { console.log("SKIP A",data[prop]); }
            }
            // map.fitBounds(bnds.pad(0.25));
        }
        else {
            if (data.command) { doCommand(data.command); delete data.command; }
            if (data.hasOwnProperty("name")) { setMarker(data); }
            else if (data.hasOwnProperty("type")) { doGeojson(data); }
            else {
                console.log("SKIP",data);
                // if (typeof data === "string") { doDialog(data); }
                // else { console.log("SKIP",data); }
            }
        }
    };
}
function ( ) { ws = new SockJS ( location . pathname . split ( "index" ) [ 0 ] + 'socket' ) ; ws . onopen = function ( ) { console . log ( "CONNECTED" ) ; if ( ! inIframe ) { document . getElementById ( "footer" ) . innerHTML = "<font color='#494'>" + ibmfoot + "</font>" ; } ws . send ( JSON . stringify ( { action : "connected" } ) ) ; onoffline ( ) ; } ; ws . onclose = function ( ) { console . log ( "DISCONNECTED" ) ; if ( ! inIframe ) { document . getElementById ( "footer" ) . innerHTML = "<font color='#900'>" + ibmfoot + "</font>" ; } setTimeout ( function ( ) { connect ( ) ; } , 2500 ) ; } ; ws . onmessage = function ( e ) { var data = JSON . parse ( e . data ) ; //console.log("DATA" typeof data,data); if ( Array . isArray ( data ) ) { //console.log("ARRAY"); // map.closePopup(); // var bnds= L.latLngBounds([0,0]); for ( var prop in data ) { if ( data [ prop ] . command ) { doCommand ( data [ prop ] . command ) ; delete data [ prop ] . command ; } if ( data [ prop ] . hasOwnProperty ( "name" ) ) { setMarker ( data [ prop ] ) ; // bnds.extend(markers[data[prop].name].getLatLng()); } else { console . log ( "SKIP A" , data [ prop ] ) ; } } // map.fitBounds(bnds.pad(0.25)); } else { if ( data . command ) { doCommand ( data . command ) ; delete data . command ; } if ( data . hasOwnProperty ( "name" ) ) { setMarker ( data ) ; } else if ( data . hasOwnProperty ( "type" ) ) { doGeojson ( data ) ; } else { console . log ( "SKIP" , data ) ; // if (typeof data === "string") { doDialog(data); } // else { console.log("SKIP",data); } } } } ; }
Create the socket
Create the socket