Linkify urls in chat
This commit is contained in:
parent
8049e93703
commit
98331decd6
|
@ -100,7 +100,7 @@
|
||||||
<div class="message {{type}}">
|
<div class="message {{type}}">
|
||||||
<span class="time">{{time}}</span>
|
<span class="time">{{time}}</span>
|
||||||
<a href="{{user}}" class="user">{{mode}}{{user}}</a>
|
<a href="{{user}}" class="user">{{mode}}{{user}}</a>
|
||||||
<span class="text">{{type}} {{text}}</span>
|
<span class="text">{{type}} {{{autoLink text}}}</span>
|
||||||
</div>
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
|
@ -125,7 +125,7 @@
|
||||||
<div class="message {{type}}">
|
<div class="message {{type}}">
|
||||||
<span class="time">{{time}}</span>
|
<span class="time">{{time}}</span>
|
||||||
<a href="{{user}}" class="user">{{mode}}{{user}}</a>
|
<a href="{{user}}" class="user">{{mode}}{{user}}</a>
|
||||||
<span class="text">{{type}} {{text}}</span>
|
<span class="text">{{type}} {{{autoLink text}}}</span>
|
||||||
</div>
|
</div>
|
||||||
{{/messages}}
|
{{/messages}}
|
||||||
</script>
|
</script>
|
||||||
|
@ -136,6 +136,7 @@
|
||||||
<script src="/js/lib/jquery.cookie.js"></script>
|
<script src="/js/lib/jquery.cookie.js"></script>
|
||||||
<script src="/js/lib/jquery.scrollGlue.js"></script>
|
<script src="/js/lib/jquery.scrollGlue.js"></script>
|
||||||
<script src="/js/lib/bootstrap.js"></script>
|
<script src="/js/lib/bootstrap.js"></script>
|
||||||
|
<script src="/js/lib/URI.js"></script>
|
||||||
<script src="/js/chat.js"></script>
|
<script src="/js/chat.js"></script>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -214,3 +214,10 @@ $(function() {
|
||||||
.end();
|
.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