"use strict";
function remoteJosm(urlJosm,dataJosm) {
// See https://en.wikipedia.org/wiki/XMLHttpRequest
// See https://stackoverflow.com/questions/1523686/timeout-xmlhttprequest
// See https://stackoverflow.com/questions/9713058/send-post-data-using-xmlhttprequest
// See https://stackoverflow.com/questions/57308079/how-to-handle-no-response-from-the-server-for-a-request
// var url = 'http://127.0.0.1:8111/version';
// var url = 'https://localhost:8112/load_and_zoom';
var url = urlJosm;
var params = '?'+dataJosm;
var timer;
var http = new XMLHttpRequest();
http.onload = function() { //response received - could be shown
// console.log('\nRequest: \t'+url+params+'\nResponse: \t'+http.responseText);
};
http.onreadystatechange = function() {
if(http.readyState == 4 && http.status == 200) { //responded Ok - message could be shown and/or timer cleared
clearTimeout(timer);
}
};
http.open('GET', url+params, true);
http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
timer = window.setTimeout( function() {
alert('Is JOSM running? \nIs remote control option in JOSM enabled?');
}, 5000);
http.send();
return false;
};
function initMap() {
var cDefoultCoord3 = [15, 47.3817, 15.0965];
var
attr_home = 'Disclaimer umleoben.borut.eu'
,attr_osm_dm = 'Data and map © OpenStreetMap contributors'
,attr_osm_d = 'Data © OpenStreetMap contributors'
,attr_tf = 'Map © Thunderforest'
,attr_wmcs = 'Map via Wikimedia Cloud Services'
,attr_overpass = 'POI via Overpass API'
,attr_mapbox = 'Map © MapBox'
;
function getQueryHashedGeoTriple(getWhat) {
// console.log('getQueryHashedGeoTriple BEGIN');
var result,
query,
hashString,
coord3,
coord1,
exception
;
try {
query = window.location.hash;
hashString=query.split('=');
coord3 = hashString[1].split('/');
result=+decodeURIComponent(coord3[getWhat]);
// console.log('RESULT='+result);
// console.log(typeof(result));
if (typeof(result)!='number') result=cDefoultCoord3[getWhat];
// console.log('RESULTR='+result);
}
catch (exception) {
// console.log(exception);
result=cDefoultCoord3[getWhat];
}
finally {
result = (result && result!=0) ? result : cDefoultCoord3[getWhat];
return result;
};
};
function getQuerySearchGeoTriple(getWhat) {
// console.log('getQuerySearchGeoTriple BEGIN');
var cCoordNames = ['zm', 'la', 'lo'];
var result,
query,
vars,
i,
pair
;
try {
query = window.location.search.substr(1);
vars = query.split('&');
for (i=0; i