From 41e4af0e11267d7059c6abd666383e7b033834db Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Mon, 19 Jan 2015 19:05:41 +0100 Subject: [PATCH] Use dot notation for static object keys --- cunimb.js | 62 +++++++++++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/cunimb.js b/cunimb.js index fedb360..f9b57f7 100644 --- a/cunimb.js +++ b/cunimb.js @@ -1044,13 +1044,13 @@ function task(cont) { var res = JSON.parse(cont); var tc,tn,ltp; var tp = new Array(); - var tasks= res['tasks']; + var tasks= res.tasks; for(var i= 0; i < tasks.length; i++) { - tn = tasks[i]['name'] || "task"+i; - tc = tasks[i]['color'] || "FFFFFF"; + tn = tasks[i].name || "task"+i; + tc = tasks[i].color || "FFFFFF"; tp.length=0; - for (var ii=0; ii< tasks[i]['legs'].length; ii++) { - if (typeof tasks[i]['legs'][ii][1] == 'undefined') { // circle + for (var ii=0; ii< tasks[i].legs.length; ii++) { + if (typeof tasks[i].legs[ii][1] == 'undefined') { // circle aatCircle = new google.maps.Circle({ strokeColor: '#'+tc, strokeOpacity: 0.5, @@ -1059,11 +1059,11 @@ function task(cont) { fillOpacity: 0.1, map: map, center: ltp, - radius: tasks[i]['legs'][ii][0] + radius: tasks[i].legs[ii][0] }); taska.push(aatCircle); } else { - ltp=new google.maps.LatLng(tasks[i]['legs'][ii][0],tasks[i]['legs'][ii][1]); + ltp=new google.maps.LatLng(tasks[i].legs[ii][0], tasks[i].legs[ii][1]); tp.push(ltp); } } @@ -1118,16 +1118,16 @@ function initialize() } // parameter c=lat,lon (center of the map) - if (typeof(parh['c']) != 'undefined') { - cent=parh['c'].split(','); + if (typeof(parh.c) != 'undefined') { + cent=parh.c.split(','); vlat=parseFloat(cent[0]); vlon=parseFloat(cent[1]); hashc= "c="+vlat.toFixed(5)+","+vlon.toFixed(5); } // parameter o=1 (display offline) - if (typeof(parh['o']) != 'undefined') { - if (parh['o']==1) { all=1; hasho="&o=1";} + if (typeof(parh.o) != 'undefined') { + if (parh.o==1) { all=1; hasho="&o=1";} } /* @@ -1233,9 +1233,9 @@ function initialize() var tmid = { "r" : "ROADMAP", "t" : "TERRAIN", "s": "SATELLITE", "h": "HYBRID"}; // parameter m= map type - if (typeof(parh['m']) != 'undefined') { - mid = tmid[parh['m']]; - hashm="&m="+parh['m']; + if (typeof(parh.m) != 'undefined') { + mid = tmid[parh.m]; + hashm="&m="+parh.m; } map.setMapTypeId(google.maps.MapTypeId[mid]); @@ -1275,7 +1275,7 @@ function initialize() }); // parameter z= zoom level - if (typeof(parh['z']) != 'undefined') map.setZoom(parseInt(parh['z'])); + if (typeof(parh.z) != 'undefined') map.setZoom(parseInt(parh.z)); else { var southWest = new google.maps.LatLng(vlatmin, vlonmin); var northEast = new google.maps.LatLng(vlatmax, vlonmax); @@ -1390,8 +1390,8 @@ function initialize() document.getElementById("menu").innerHTML = "
Hide new gliders
Ignore Offline
Bounds

       
Auto Set to map
..:: Layers ::..
Weather
Clouds
Wind
Pressure
AirSpaces ( openaip.net )
Airports ( openaip.net )
Receivers
Tasks

..::Units::..
Met. Imp.
..::Path length::..
5' 10' All
"; // parameter b=lat1,lon1,lat2,lon2 bounds - if (typeof(parh['b']) != 'undefined') { - cent=parh['b'].split(','); + if (typeof(parh.b) != 'undefined') { + cent=parh.b.split(','); document.getElementById('latmax').value = parseFloat(cent[0]); document.getElementById('latmin').value = parseFloat(cent[1]); document.getElementById('lonmax').value = parseFloat(cent[2]); @@ -1403,9 +1403,9 @@ function initialize() } // parameter l= active layers - if (typeof(parh['l']) != 'undefined') { - for (var i = 0; i < parh['l'].length; i++) { - switch(parh['l'][i]) { + if (typeof(parh.l) != 'undefined') { + for (var i = 0; i < parh.l.length; i++) { + switch(parh.l[i]) { case 'w': // weather document.getElementById('weabox').checked=true; wea(); @@ -1437,10 +1437,10 @@ function initialize() } } - if (typeof(parh['t']) != 'undefined') { + if (typeof(parh.t) != 'undefined') { var xhr = new XMLHttpRequest(); - xhr.open("GET", parh['t'], true); + xhr.open("GET", parh.t, true); xhr.onreadystatechange = function() { if (xhr.readyState === 4) { var status = xhr.status; @@ -1457,8 +1457,8 @@ function initialize() // parameter w=0 (Don't display the warning) var warn=1; - if (typeof(parh['w']) != 'undefined') { - if (parh['w'] === 0) { warn=0; hashw="&w=0";} + if (typeof(parh.w) != 'undefined') { + if (parh.w === 0) { warn=0; hashw="&w=0";} } if (warn==1) { @@ -1467,8 +1467,8 @@ function initialize() } // parameter s=1 auto set bounds to the map - if (typeof(parh['s']) != 'undefined') { - if (parh['s']==1) { + if (typeof(parh.s) != 'undefined') { + if (parh.s==1) { document.getElementById('astmbox').checked=true; vstm=true; hashs="&s=1"; @@ -1476,8 +1476,8 @@ function initialize() } // parameter u=i units imperial ou metric (default)) - if (typeof(parh['u']) != 'undefined') { - if (parh['u']=="i") { + if (typeof(parh.u) != 'undefined') { + if (parh.u=="i") { document.getElementById('uni').checked=true; unit="i"; hashs="&u=i"; @@ -1486,12 +1486,12 @@ function initialize() // parameter p=1,2 or 3 path length 5", 10" or all points - if (typeof(parh['p']) != 'undefined') { - if (parh['p']==2) { // 10 minutes + if (typeof(parh.p) != 'undefined') { + if (parh.p==2) { // 10 minutes pathl=60; document.getElementById('rp2').checked=true; hashp="&p=2"; - } else if (parh['p']==3) { // all points + } else if (parh.p==3) { // all points pathl=99999; document.getElementById('rp3').checked=true; hashp="&p=3";