mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 17:23:02 +00:00
Merge pull request #3064 from openstreetmap/warn-on-google-mention
Add a warning to the changeset page if a user mentions google
This commit is contained in:
@@ -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"
|
||||
|
||||
4
dist/locales/en.json
vendored
4
dist/locales/en.json
vendored
@@ -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}",
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user