diff --git a/data/core.yaml b/data/core.yaml index 40b90ce91..be85da56e 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -206,6 +206,8 @@ en: created: Created about_changeset_comments: About changeset comments about_changeset_comments_link: //wiki.openstreetmap.org/wiki/Good_changeset_comments + google_warning: "You mentioned Google in this comment: remember that copying from Google Maps is strictly forbidden." + google_warning_link: http://www.openstreetmap.org/copyright contributors: list: "Edits by {users}" truncated_list: "Edits by {users} and {count} others" diff --git a/dist/locales/en.json b/dist/locales/en.json index cd4eef459..726eb99a8 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -253,7 +253,9 @@ "deleted": "Deleted", "created": "Created", "about_changeset_comments": "About changeset comments", - "about_changeset_comments_link": "//wiki.openstreetmap.org/wiki/Good_changeset_comments" + "about_changeset_comments_link": "//wiki.openstreetmap.org/wiki/Good_changeset_comments", + "google_warning": "You mentioned Google in this comment: remember that copying from Google Maps is strictly forbidden.", + "google_warning_link": "http://www.openstreetmap.org/copyright" }, "contributors": { "list": "Edits by {users}", diff --git a/js/id/ui/commit.js b/js/id/ui/commit.js index b5691ff88..4b97108e5 100644 --- a/js/id/ui/commit.js +++ b/js/id/ui/commit.js @@ -40,6 +40,8 @@ iD.ui.Commit = function(context) { .property('value', context.storage('comment') || '') .on('input.save', enableDisableSaveButton) .on('change.save', enableDisableSaveButton) + .on('input.save', detectForClippy) + .on('change.save', detectForClippy) .on('blur.save', function() { context.storage('comment', this.value); }); @@ -49,6 +51,22 @@ iD.ui.Commit = function(context) { .attr('disabled', (this.value.length ? null : true)); } + function detectForClippy() { + var googleWarning = clippyArea + .html('') + .selectAll('a') + .data(this.value.match(/google/i) ? [true] : []); + googleWarning.exit().remove(); + googleWarning.enter() + .append('a') + .attr('target', '_blank') + .attr('tabindex', -1) + .call(iD.svg.Icon('#icon-alert', 'inline')) + .attr('href', t('commit.google_warning_link')) + .append('span') + .text(t('commit.google_warning')); + } + commentField.node().select(); context.connection().userChangesets(function (err, changesets) { @@ -68,6 +86,10 @@ iD.ui.Commit = function(context) { commentField.call(d3.combobox().data(comments)); }); + var clippyArea = commentSection.append('div') + .attr('class', 'clippy-area'); + + var changeSetInfo = commentSection.append('div') .attr('class', 'changeset-info'); @@ -251,6 +273,11 @@ iD.ui.Commit = function(context) { .suppressMenu(true)); } } + + // Call the enableDisableSaveButton and detectForClippy methods + // off the bat, in case a changeset comment is recovered from + // localStorage + commentField.trigger('input'); } return d3.rebind(commit, dispatch, 'on');