@@ -22,11 +22,11 @@ var xmlHttpRequestCodeDone = 4;
22
22
23
23
var locomotivMarker ;
24
24
var map ;
25
- var latLongPrev = [ 0 , 0 ] ;
25
+ var latLonPrev = [ 0 , 0 ] ;
26
26
27
- function MapInit ( latLong ) {
27
+ function MapInit ( latLon ) {
28
28
29
- map = L . map ( 'map' ) . setView ( latLong , 13 ) ;
29
+ map = L . map ( 'map' ) . setView ( latLon , 13 ) ;
30
30
L . tileLayer ( 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png' , {
31
31
maxZoom : 19 ,
32
32
attribution : 'Map data: © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
@@ -46,33 +46,33 @@ function ApiMap() {
46
46
if ( this . readyState == xmlHttpRequestCodeDone && this . status == httpCodeSuccess ) {
47
47
var responseText = JSON . parse ( hr . responseText ) ;
48
48
if ( responseText . length > 0 ) {
49
- latLong = responseText . split ( " " ) ;
49
+ latLon = responseText . split ( " " ) ;
50
50
if ( typeof locomotivMarker !== 'undefined' ) {
51
- if ( ( latLong [ 0 ] != latLongPrev [ 0 ] ) && ( latLong [ 1 ] != latLongPrev [ 1 ] ) ) {
52
- map . panTo ( latLong ) ;
51
+ if ( ( latLon [ 0 ] != latLonPrev [ 0 ] ) && ( latLon [ 1 ] != latLonPrev [ 1 ] ) ) {
52
+ map . panTo ( latLon ) ;
53
53
}
54
54
} else {
55
- MapInit ( latLong ) ;
55
+ MapInit ( latLon ) ;
56
56
}
57
57
58
- if ( ( latLong [ 0 ] != latLongPrev [ 0 ] ) || ( latLong [ 1 ] != latLongPrev [ 1 ] ) ) {
58
+ if ( ( latLon [ 0 ] != latLonPrev [ 0 ] ) || ( latLon [ 1 ] != latLonPrev [ 1 ] ) ) {
59
59
if ( typeof locomotivMarker !== 'undefined' ) {
60
60
locomotivMarker . removeFrom ( map ) ;
61
61
}
62
62
locomotivMarker = L . marker (
63
- latLong ,
63
+ latLon ,
64
64
{ icon : myIcon }
65
65
) . addTo ( map ) ;
66
- latLongPrev [ 0 ] = latLong [ 0 ] ;
67
- latLongPrev [ 1 ] = latLong [ 1 ] ;
66
+ latLonPrev [ 0 ] = latLon [ 0 ] ;
67
+ latLonPrev [ 1 ] = latLon [ 1 ] ;
68
68
}
69
69
}
70
70
}
71
71
}
72
72
}
73
73
74
74
var myIcon = L . icon ( {
75
- iconUrl : 'locomotiv .png' ,
75
+ iconUrl : 'locomotive .png' ,
76
76
iconSize : [ 29 , 24 ] ,
77
77
iconAnchor : [ 9 , 21 ] ,
78
78
} )
0 commit comments