Linkify urls in chat
This commit is contained in:
parent
8049e93703
commit
98331decd6
|
@ -100,7 +100,7 @@
|
|||
<div class="message {{type}}">
|
||||
<span class="time">{{time}}</span>
|
||||
<a href="{{user}}" class="user">{{mode}}{{user}}</a>
|
||||
<span class="text">{{type}} {{text}}</span>
|
||||
<span class="text">{{type}} {{{autoLink text}}}</span>
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
|
@ -125,7 +125,7 @@
|
|||
<div class="message {{type}}">
|
||||
<span class="time">{{time}}</span>
|
||||
<a href="{{user}}" class="user">{{mode}}{{user}}</a>
|
||||
<span class="text">{{type}} {{text}}</span>
|
||||
<span class="text">{{type}} {{{autoLink text}}}</span>
|
||||
</div>
|
||||
{{/messages}}
|
||||
</script>
|
||||
|
@ -136,6 +136,7 @@
|
|||
<script src="/js/lib/jquery.cookie.js"></script>
|
||||
<script src="/js/lib/jquery.scrollGlue.js"></script>
|
||||
<script src="/js/lib/bootstrap.js"></script>
|
||||
<script src="/js/lib/URI.js"></script>
|
||||
<script src="/js/chat.js"></script>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -214,3 +214,10 @@ $(function() {
|
|||
.end();
|
||||
};
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("autoLink", function(text) {
|
||||
var text = Handlebars.Utils.escapeExpression(text);
|
||||
return URI.withinString(text, function(url) {
|
||||
return "<a href='" + url + "' target='_blank'>" + url + "</a>";
|
||||
});
|
||||
});
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue