Better URI replace for messages. Close #16
This commit is contained in:
parent
d00e8803d3
commit
8bcb61bdbd
@ -395,10 +395,19 @@ $(function() {
|
|||||||
|
|
||||||
Handlebars.registerHelper(
|
Handlebars.registerHelper(
|
||||||
"uri", function(text) {
|
"uri", function(text) {
|
||||||
text = escape(text);
|
var urls = [];
|
||||||
return URI.withinString(text, function(url) {
|
text = URI.withinString(text, function(url) {
|
||||||
return "<a href='" + url.replace(/^www/, "//www") + "' target='_blank'>" + url + "</a>";
|
urls.push(url);
|
||||||
|
return "{" + (urls.length - 1) + "}";
|
||||||
});
|
});
|
||||||
|
text = escape(text);
|
||||||
|
for (var i in urls) {
|
||||||
|
text = text.replace(
|
||||||
|
"{" + i + "}",
|
||||||
|
"<a href='" + urls[i].replace(/^www/, "//www") + "' target='_blank'>" + urls[i] + "</a>"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return text;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user