Update OSM.org links

This commit is contained in:
John Firebaugh
2014-01-08 16:21:47 -08:00
parent ab8a4ffd7b
commit 1561c366be
3 changed files with 11 additions and 7 deletions
+8 -4
View File
@@ -22,15 +22,19 @@ iD.Connection = function() {
off;
connection.changesetURL = function(changesetId) {
return url + '/browse/changeset/' + changesetId;
return url + '/changeset/' + changesetId;
};
connection.changesetsURL = function(extent) {
return url + '/browse/changesets?bbox=' + extent.toParam();
connection.changesetsURL = function(center, zoom) {
var precision = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
return url + '/history#map=' +
Math.floor(zoom) + '/' +
center[1].toFixed(precision) + '/' +
center[0].toFixed(precision);
};
connection.entityURL = function(entity) {
return url + '/browse/' + entity.type + '/' + entity.osmId();
return url + '/' + entity.type + '/' + entity.osmId();
};
connection.userURL = function(username) {
+1 -1
View File
@@ -34,7 +34,7 @@ iD.ui.Contributors = function(context) {
.attr('target', '_blank')
.attr('tabindex', -1)
.attr('href', function() {
return context.connection().changesetsURL(context.map().extent());
return context.connection().changesetsURL(context.map().center(), context.map().zoom());
})
.text(u.length - limit + 1);
+2 -2
View File
@@ -11,7 +11,7 @@ describe('iD.Connection', function () {
describe('#changesetUrl', function() {
it('provides a changeset url', function() {
expect(c.changesetURL(2)).to.eql('http://www.openstreetmap.org/browse/changeset/2');
expect(c.changesetURL(2)).to.eql('http://www.openstreetmap.org/changeset/2');
});
});
@@ -32,7 +32,7 @@ describe('iD.Connection', function () {
c.switch({
url: "http://example.com"
});
expect(c.changesetURL(1)).to.equal("http://example.com/browse/changeset/1")
expect(c.changesetURL(1)).to.equal("http://example.com/changeset/1")
});
it("emits an auth event", function(done) {