mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-16 13:59:27 +02:00
Fix bugs in user list
* URL is connection-dependent * Open link in new window so as not to lose work * Don't show undefined (fixes #302)
This commit is contained in:
@@ -138,6 +138,10 @@ iD.Connection = function() {
|
||||
});
|
||||
}
|
||||
|
||||
connection.userUrl = function(username) {
|
||||
return apiURL + "/user/" + username;
|
||||
};
|
||||
|
||||
function tileAtZoom(t, distance) {
|
||||
var power = Math.pow(2, distance);
|
||||
return [
|
||||
|
||||
+6
-5
@@ -49,17 +49,18 @@ window.iD = function(container) {
|
||||
var users = {},
|
||||
entities = map.history().graph().intersects(map.extent());
|
||||
for (var i in entities) {
|
||||
users[entities[i].user] = true;
|
||||
if (Object.keys(users).length > 10) break;
|
||||
if (entities[i].user) {
|
||||
users[entities[i].user] = true;
|
||||
if (Object.keys(users).length > 10) break;
|
||||
}
|
||||
}
|
||||
var u = Object.keys(users);
|
||||
var l = d3.select('#user-list')
|
||||
.selectAll('a.user-link').data(u);
|
||||
l.enter().append('a')
|
||||
.attr('class', 'user-link')
|
||||
.attr('href', function(d) {
|
||||
return 'http://api06.dev.openstreetmap.org/user/' + d;
|
||||
})
|
||||
.attr('href', function(d) { return connection.userUrl(d); })
|
||||
.attr('target', '_blank')
|
||||
.text(String);
|
||||
l.exit().remove();
|
||||
}, 1000);
|
||||
|
||||
Reference in New Issue
Block a user