]> git.openstreetmap.org Git - rails.git/blob - public/javascripts/site.js
start editing at the correct lat/lon, not slightly off
[rails.git] / public / javascripts / site.js
1 function updatelinks(lon,lat,zoom) {
2   var links = new Array();
3   links['viewanchor'] = '/index.html';
4   //links['editanchor'] = 'edit.html';
5   links['uploadanchor'] = '/traces';
6   links['loginanchor'] = '/login.html';
7   links['logoutanchor'] = '/logout.html';
8   links['registeranchor'] = '/create-account.html';
9
10   var node;
11   var anchor;
12   for (anchor in links) {
13     node = document.getElementById(anchor);
14     if (! node) { continue; }
15     node.href = links[anchor] + "?lat=" + lat + "&lon=" + lon + "&zoom=" + zoom;
16   }
17
18   node = document.getElementById("editanchor");
19   if (node) {
20     if ( zoom >= 14) {
21       node.href = '/edit.html?lat=' + lat + '&lon=' + lon + "&zoom=" + zoom;
22       node.style.fontStyle = 'normal';
23     } else {
24       node.href = 'javascript:alert("zoom in to edit map");';
25       node.style.fontStyle = 'italic';
26     }
27   }
28 }