Browse Source
Use data attribute for open text links in new tabs setting
merge-requests/14/head
Ivan Fonseca
7 years ago
No known key found for this signature in database
GPG Key ID: 95A9C856EC788689
2 changed files with
6 additions and
2 deletions
-
tildes/static/js/behaviors/external-links-new-tabs.js
-
tildes/tildes/templates/macros/comments.jinja2
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
$.onmount('[data-js-comment-text]', function() { |
|
|
|
$.onmount('[data-js-external-links-new-tabs]', function() { |
|
|
|
// Make all links in comment open in new tab
|
|
|
|
$(this).find('a[href^="http"]').attr('target', '_blank'); |
|
|
|
}); |
|
|
|
@ -94,7 +94,11 @@ |
|
|
|
</ul> |
|
|
|
{% endif %} |
|
|
|
|
|
|
|
<div class="comment-text" data-js-comment-text> |
|
|
|
<div class="comment-text" |
|
|
|
{% if request.user and request.user.open_new_tab_text %} |
|
|
|
data-js-external-links-new-tabs |
|
|
|
{% endif %} |
|
|
|
> |
|
|
|
{% if comment.is_removed and 'admin' in request.effective_principals %} |
|
|
|
<p class="text-warning">Comment removed</p> |
|
|
|
{% endif %} |
|
|
|
|