Skip to content

Commit 4757b80

Browse files
committed
cleanup duplicate declarations
1 parent b204f96 commit 4757b80

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

worldmap/worldmap.js

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,9 @@ var edgeAware = function () {
452452
var viewBounds = L.latLngBounds(map.options.crs.pointToLatLng(L.point(pSW.x - (pCenter.x - pSW.x ), pSW.y - (pCenter.y - pSW.y )), map.getZoom()) , map.options.crs.pointToLatLng(L.point(pNE.x + (pNE.x - pCenter.x) , pNE.y + (pNE.y - pCenter.y) ), map.getZoom()) );
453453
for (var id in markers) {
454454
if (allData[id] && allData[id].hasOwnProperty("SIDC")) {
455-
markerLatLng = markers[id].getLatLng();
455+
var markerLatLng = markers[id].getLatLng();
456456
if ( viewBounds.contains(markerLatLng) && !mapBounds.contains(markerLatLng) ) {
457+
var x,y;
457458
var k = (markerLatLng.lat - mapBoundsCenter.lat) / (markerLatLng.lng - mapBoundsCenter.lng);
458459

459460
if (markerLatLng.lng > mapBoundsCenter.lng) { x = mapBounds.getEast() - mapBoundsCenter.lng; }
@@ -726,12 +727,12 @@ function clearSearch() {
726727
}
727728
}
728729
removeMarks();
729-
if (lockit) {
730+
// if (lockit) {
730731
document.getElementById('searchResult').innerHTML = "";
731-
}
732-
else {
733-
document.getElementById('searchResult').innerHTML = "";
734-
}
732+
// }
733+
// else {
734+
// document.getElementById('searchResult').innerHTML = "";
735+
// }
735736
}
736737

737738
function removeMarks() {
@@ -902,7 +903,7 @@ var addThing = function() {
902903
colo = colorKeywordToRGB(colo);
903904
var hdg = parseFloat(bits[4] || 0);
904905
var drag = true;
905-
var regi = /^[S,G,E,I,O][A-Z]{3}.*/i; // if it looks like a SIDC code
906+
var regi = /^[SGEIO][A-Z]{3}.*/i; // if it looks like a SIDC code
906907
var d = {action:"point", name:bits[0].trim(), layer:lay, draggable:drag, lat:rclk.lat, lon:rclk.lng, hdg:hdg, ttl:0 };
907908
if (regi.test(icon)) {
908909
d.SIDC = (icon.toUpperCase()+"------------").substr(0,12);
@@ -1756,7 +1757,7 @@ function setMarker(data) {
17561757
polygons[data["name"]].lay = lay;
17571758
// if clickable then add popup
17581759
if (opt.clickable === true) {
1759-
var words = "<b>"+data["name"]+"</b>";
1760+
let words = "<b>"+data["name"]+"</b>";
17601761
if (data.popup) { words = words + "<br/>" + data.popup.replace(/\${name}/g,data["name"]); }
17611762
polygons[data["name"]].bindPopup(words, {autoClose:false, closeButton:true, closeOnClick:true, minWidth:200});
17621763
}
@@ -1852,11 +1853,11 @@ function setMarker(data) {
18521853
data.iconColor = data.iconColor ?? "black";
18531854
icon = '<svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="20" height="20">';
18541855
icon += '<path d="M15.388 4.781c.068.068.061.154-.171.656-.028.06-.18.277-.18.277s.102.113.13.14c.054.055.078.175.056.27-.068.295-.89 1.47-1.35 1.93-.285.286-.432.481-.422.56.009.068.117.356.24.64.219.5.3.599 2.762 3.339 1.95 2.169 2.546 2.87 2.582 3.028.098.439-.282.847-1.264 1.356l-.507.263-7.389-5.29-4.43 3.365.102.18c.056.099.519.676 1.029 1.283.51.607.933 1.161.94 1.232.026.284-1.111 1.177-1.282 1.006-.27-.27-1.399-1.131-1.494-1.14-.068-.007-1.04-.747-1.37-1.077-.329-.33-1.07-1.301-1.076-1.37-.01-.094-.871-1.224-1.14-1.493-.171-.171.722-1.308 1.006-1.282.07.007.625.43 1.231.94.607.51 1.185.973 1.283 1.029l.18.101 3.365-4.43-5.29-7.388.263-.507c.51-.982.918-1.362 1.357-1.264.158.035.859.632 3.028 2.581 2.74 2.462 2.838 2.544 3.339 2.762.284.124.572.232.639.24.08.01.274-.136.56-.422.46-.46 1.635-1.282 1.93-1.35.095-.022.216.003.27.057.028.028.139.129.139.129s.217-.153.277-.18c.502-.233.59-.238.657-.17z" fill="'+data.iconColor+'"/></svg>';
1855-
var svgplane = "data:image/svg+xml;base64," + btoa(icon);
1856+
var svgsplane = "data:image/svg+xml;base64," + btoa(icon);
18561857
myMarker = L.divIcon({
18571858
className:"planeicon",
18581859
iconAnchor: [16, 16],
1859-
html:'<img src="'+svgplane+'" style="width:32px; height:32px; -webkit-transform:rotate('+(dir - 45)+'deg); -moz-transform:rotate('+(dir - 45)+'deg);"/>'
1860+
html:'<img src="'+svgsplane+'" style="width:32px; height:32px; -webkit-transform:rotate('+(dir - 45)+'deg); -moz-transform:rotate('+(dir - 45)+'deg);"/>'
18601861
});
18611862
marker = L.marker(ll, {title:data["name"], icon:myMarker, draggable:drag});
18621863
}
@@ -2052,7 +2053,7 @@ function setMarker(data) {
20522053
}
20532054
else if (data.icon.match(/^:.*:$/g)) { // emoji icon :smile:
20542055
var em = emojify(data.icon);
2055-
var col = data.iconColor ?? "#910000";
2056+
let col = data.iconColor ?? "#910000";
20562057
myMarker = L.divIcon({
20572058
className:"emicon",
20582059
html: '<center><span style="font-size:2em; color:'+col+'">'+em+'</span></center>',
@@ -2062,7 +2063,7 @@ function setMarker(data) {
20622063
labelOffset = [12,-4];
20632064
}
20642065
else if (data.icon.match(/^https?:.*$|^\/|^data:image\//)) { // web url icon https://...
2065-
var sz = data.iconSize ?? 32;
2066+
let sz = data.iconSize ?? 32;
20662067
myMarker = L.icon({
20672068
iconUrl: data.icon,
20682069
iconSize: [sz, sz],
@@ -2074,8 +2075,8 @@ function setMarker(data) {
20742075
delete data.iconSize;
20752076
}
20762077
else if (data.icon.substr(0,3) === "fa-") { // fa icon
2077-
var col = data.iconColor ?? "#910000";
2078-
var imod = "";
2078+
let col = data.iconColor ?? "#910000";
2079+
let imod = "";
20792080
if (data.icon.indexOf(" ") === -1) { imod = "fa-2x "; }
20802081
myMarker = L.divIcon({
20812082
className:"faicon",
@@ -2088,8 +2089,8 @@ function setMarker(data) {
20882089
labelOffset = [8,-8];
20892090
}
20902091
else if (data.icon.substr(0,3) === "wi-") { // weather icon
2091-
var col = data.iconColor ?? "#910000";
2092-
var imod = "";
2092+
let col = data.iconColor ?? "#910000";
2093+
let imod = "";
20932094
if (data.icon.indexOf(" ") === -1) { imod = "wi-2x "; }
20942095
myMarker = L.divIcon({
20952096
className:"wiicon",
@@ -2447,7 +2448,7 @@ function setMarker(data) {
24472448
polygon.setStyle({opacity:0});
24482449
}
24492450
}
2450-
polygon.name = data["name"];
2451+
if (polygon !== null) { polygon.name = data["name"]; }
24512452
if (polygons[data["name"]] != null && polygons[data["name"]].hasOwnProperty("_layers")) {
24522453
polygons[data["name"]].addLayer(polygon);
24532454
}
@@ -2553,7 +2554,7 @@ function doCommand(cmd) {
25532554
}
25542555
if (cmd.hasOwnProperty("grid")) {
25552556
if (cmd.grid.hasOwnProperty("showgrid")) {
2556-
var changed = false;
2557+
let changed = false;
25572558
if ((cmd.grid.showgrid == "true" || cmd.grid.showgrid == true ) && !showGrid) { changed = true; }
25582559
if ((cmd.grid.showgrid == "false" || cmd.grid.showgrid == false ) && showGrid) { changed = true; }
25592560
if (changed) {
@@ -2572,7 +2573,7 @@ function doCommand(cmd) {
25722573
}
25732574
if (cmd.hasOwnProperty("ruler")) {
25742575
if (cmd.ruler.hasOwnProperty("showruler")) {
2575-
var changed = false;
2576+
let changed = false;
25762577
if ((cmd.ruler.showruler == "true" || cmd.ruler.showruler == true ) && !showRuler) { changed = true; }
25772578
if ((cmd.ruler.showruler == "false" || cmd.ruler.showruler == false ) && showRuler) { changed = true; }
25782579
if (changed) {
@@ -2702,7 +2703,7 @@ function doCommand(cmd) {
27022703
basemaps[cmd.map.name].removeFrom(map);
27032704
existsalready = true;
27042705
}
2705-
var opt = {};
2706+
let opt = {};
27062707
if (cmd.map.hasOwnProperty("opt")) { opt = cmd.map.opt || {}; }
27072708

27082709
if (!opt.paintRules && !opt.labelRules && !opt.backgroundColor && !opt.theme) {
@@ -2758,7 +2759,7 @@ function doCommand(cmd) {
27582759
existsalready = true;
27592760
}
27602761
try {
2761-
var opt = cmd.map.opt || {};
2762+
let opt = cmd.map.opt || {};
27622763
if (opt.hasOwnProperty("style")) { opt.style = new Function('return ' + opt.style)(); }
27632764
else {
27642765
opt.style = function(feature) {
@@ -3271,7 +3272,7 @@ function doGeojson(n,g,l,o,i) { // name, geojson, layer, options, icon
32713272
});
32723273
}
32733274
if (!feature.properties.hasOwnProperty("title") && feature.properties.hasOwnProperty("marker-symbol")) {
3274-
if (!feature.properties["marker-symbol"].indexOf('fa-') === 0) {
3275+
if (!(feature.properties["marker-symbol"].indexOf('fa-') === 0)) {
32753276
feature.properties.title = feature.properties["marker-symbol"];
32763277
}
32773278
}
@@ -3422,7 +3423,7 @@ function doTAKMCjson(p) {
34223423
}
34233424

34243425
function convertCOTtoCIFColour(color) {
3425-
const c = parseInt(color);
3426+
// const c = parseInt(color);
34263427
const arr = new ArrayBuffer(4);
34273428
const view = new DataView(arr);
34283429
view.setUint32(0, color, false);

0 commit comments

Comments
 (0)