diff --git a/index.html b/index.html index 782d4b32f..fa957b991 100644 --- a/index.html +++ b/index.html @@ -44,6 +44,7 @@ + diff --git a/js/id/id.js b/js/id/id.js index cdd8260d6..58232fba4 100644 --- a/js/id/id.js +++ b/js/id/id.js @@ -44,28 +44,10 @@ window.iD = function(container) { } } - var showUsers = _.debounce(function() { - var users = {}, - entities = map.history().graph().intersects(map.extent()); - for (var i in entities) { - 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 connection.userUrl(d); }) - .attr('target', '_blank') - .text(String); - l.exit().remove(); - }, 1000); - map.on('move.disable-buttons', disableTooHigh) - .on('move.show-users', showUsers); + .on('move.contributors', _.debounce(function() { + contributors.call(iD.contributors(map)); + }, 1000)); buttons.append('span') .attr('class', function(d) { @@ -237,10 +219,10 @@ window.iD = function(container) { var contributors = about.append('div') .attr('id', 'user-list') .attr('class','about-block fillD pad1'); - contributors.append('span') - .attr('class', 'icon nearby icon-pre-text'); - contributors.append('pan') - .text('Viewing contributions by '); + contributors.append('span') + .attr('class', 'icon nearby icon-pre-text'); + contributors.append('pan') + .text('Viewing contributions by '); history.on('change.buttons', function() { var undo = history.undoAnnotation(), diff --git a/js/id/taginfo.js b/js/id/taginfo.js index 103c7e565..77e9b3f0d 100644 --- a/js/id/taginfo.js +++ b/js/id/taginfo.js @@ -14,7 +14,6 @@ iD.taginfo = function() { line: 'ways' }; - function sets(parameters, n, o) { if (parameters.geometry && o[parameters.geometry]) { parameters[n] = o[parameters.geometry]; diff --git a/js/id/ui/contributors.js b/js/id/ui/contributors.js new file mode 100644 index 000000000..6ac0e9d36 --- /dev/null +++ b/js/id/ui/contributors.js @@ -0,0 +1,32 @@ +iD.contributors = function(map) { + + function contributors(selection) { + + var users = {}, + entities = map.history().graph().intersects(map.extent()); + for (var i in entities) { + if (entities[i].user) { + users[entities[i].user] = true; + if (Object.keys(users).length > 10) break; + } + } + var u = Object.keys(users); + var l = selection.selectAll('a.user-link').data(u); + l.enter().append('a') + .attr('class', 'user-link') + .attr('href', function(d) { return map.connection().userUrl(d); }) + .attr('target', '_blank') + .text(String); + l.exit().remove(); + + if (!u.length) { + selection.transition().style('opacity', 0); + } else if (selection.style('opacity') === '0') { + selection.transition().style('opacity', 1); + } + + } + + return contributors; + +};