mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 17:23:02 +00:00
Drop more/less toggle and just use a scrollbar for long comments
This commit is contained in:
@@ -133,9 +133,12 @@
|
||||
.comment-text {
|
||||
color: #333;
|
||||
margin-top: 10px;
|
||||
overflow-y: hidden; /* TODO: give scroll bar or replace with accordion */
|
||||
overflow-y: auto;
|
||||
max-height: 250px;
|
||||
}
|
||||
.comment-text::-webkit-scrollbar {
|
||||
border-left: none;
|
||||
}
|
||||
|
||||
#new-comment-input {
|
||||
width: 100%;
|
||||
|
||||
@@ -615,8 +615,6 @@ en:
|
||||
title: Edit note
|
||||
anonymous: anonymous
|
||||
closed: "(Closed)"
|
||||
more: More
|
||||
less: Less
|
||||
commentTitle: Comments
|
||||
close: Resolve
|
||||
reopen: Reopen
|
||||
|
||||
7
dist/locales/en.json
vendored
7
dist/locales/en.json
vendored
@@ -747,8 +747,7 @@
|
||||
"note": "Note",
|
||||
"title": "Edit note",
|
||||
"anonymous": "anonymous",
|
||||
"more": "More",
|
||||
"less": "Less",
|
||||
"closed": "(Closed)",
|
||||
"commentTitle": "Comments",
|
||||
"close": "Resolve",
|
||||
"reopen": "Reopen",
|
||||
@@ -6689,7 +6688,7 @@
|
||||
"attribution": {
|
||||
"text": "Terms & Feedback"
|
||||
},
|
||||
"description": "Premium DigitalGlobe satellite imagery.",
|
||||
"description": "DigitalGlobe-Premium is a mosaic composed of DigitalGlobe basemap with select regions filled with +Vivid or custom area of interest imagery, 50cm resolution or better, and refreshed more frequently with ongoing updates.",
|
||||
"name": "DigitalGlobe Premium Imagery"
|
||||
},
|
||||
"DigitalGlobe-Premium-vintage": {
|
||||
@@ -6703,7 +6702,7 @@
|
||||
"attribution": {
|
||||
"text": "Terms & Feedback"
|
||||
},
|
||||
"description": "Standard DigitalGlobe satellite imagery.",
|
||||
"description": "DigitalGlobe-Standard is a curated set of imagery covering 86% of the earth’s landmass, with 30-60cm resolution where available, backfilled by Landsat. Average age is 2.31 years, with some areas updated 2x per year.",
|
||||
"name": "DigitalGlobe Standard Imagery"
|
||||
},
|
||||
"DigitalGlobe-Standard-vintage": {
|
||||
|
||||
@@ -67,55 +67,14 @@ export function uiNoteComments() {
|
||||
|
||||
mainEnter
|
||||
.append('div')
|
||||
.attr('class', function(d) {
|
||||
var trunc = (d.text.length > commentLimit);
|
||||
return 'comment-text' + (trunc ? ' truncated' : '');
|
||||
})
|
||||
.text(function(d) {
|
||||
var trunc = (d.text.length > commentLimit);
|
||||
return trunc ? d.text.slice(0, commentLimit) + '…' : d.text;
|
||||
});
|
||||
|
||||
mainEnter
|
||||
.each(function(d) {
|
||||
var selection = d3_select(this);
|
||||
var trunc = (d.text.length > commentLimit);
|
||||
if (!trunc) return;
|
||||
|
||||
selection
|
||||
.append('a')
|
||||
.attr('class', 'comment-toggle-more')
|
||||
.attr('href', '#')
|
||||
.attr('tabindex', -1)
|
||||
.attr('target', '_blank')
|
||||
.text(t('note.more'))
|
||||
.on('click', toggleMore);
|
||||
});
|
||||
.attr('class', 'comment-text')
|
||||
.text(function(d) { return d.text; });
|
||||
|
||||
comments
|
||||
.call(replaceAvatars);
|
||||
}
|
||||
|
||||
|
||||
function toggleMore() {
|
||||
d3_event.preventDefault();
|
||||
|
||||
var selection = d3_select(this.parentNode); // select .comment-main
|
||||
var commentText = selection.selectAll('.comment-text');
|
||||
var commentToggle = selection.selectAll('.comment-toggle-more');
|
||||
var trunc = !commentText.classed('truncated');
|
||||
|
||||
commentText
|
||||
.classed('truncated', trunc)
|
||||
.text(function(d) {
|
||||
return trunc ? d.text.slice(0, commentLimit) + '…' : d.text;
|
||||
});
|
||||
|
||||
commentToggle
|
||||
.text(t('note.' + (trunc ? 'more' : 'less')));
|
||||
}
|
||||
|
||||
|
||||
function replaceAvatars(selection) {
|
||||
var osm = services.osm;
|
||||
if (!osm) return;
|
||||
|
||||
Reference in New Issue
Block a user