mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-22 00:07:03 +02:00
+11
-3
@@ -213,10 +213,17 @@ export function uiSuccess(context) {
|
||||
.attr('href', d.url)
|
||||
.text(t('community.' + d.id + '.name'));
|
||||
|
||||
var descriptionHTML = t('community.' + d.id + '.description', replacements);
|
||||
|
||||
if (d.type === 'reddit') { // linkify subreddits #4997
|
||||
descriptionHTML = descriptionHTML
|
||||
.replace(/(\/r\/\w*\/*)/i, function(match) { return linkify(d.url, match); });
|
||||
}
|
||||
|
||||
selection
|
||||
.append('div')
|
||||
.attr('class', 'community-description')
|
||||
.html(t('community.' + d.id + '.description', replacements));
|
||||
.html(descriptionHTML);
|
||||
|
||||
if (d.extendedDescription || (d.languageCodes && d.languageCodes.length)) {
|
||||
selection
|
||||
@@ -345,8 +352,9 @@ export function uiSuccess(context) {
|
||||
}
|
||||
|
||||
|
||||
function linkify(url) {
|
||||
return '<a target="_blank" href="' + url + '">' + url + '</a>';
|
||||
function linkify(url, text) {
|
||||
text = text || url;
|
||||
return '<a target="_blank" href="' + url + '">' + text + '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user