Browse Source
Setting affects comment links
merge-requests/14/head
Ivan Fonseca
7 years ago
No known key found for this signature in database
GPG Key ID: 95A9C856EC788689
3 changed files with
11 additions and
2 deletions
-
tildes/static/js/behaviors/comment-text.js
-
tildes/static/js/behaviors/open-new-tab-text-input.js
-
tildes/tildes/templates/settings.jinja2
|
|
|
@ -1,4 +1,7 @@ |
|
|
|
$.onmount('[data-js-comment-text]', function() { |
|
|
|
// Make all links in comment open in new tab
|
|
|
|
$(this).find('a').attr('target', '_blank'); |
|
|
|
// Check for setting (default to false if not set)
|
|
|
|
if (localStorage.getItem('open_new_tab_text') == 'true') { |
|
|
|
// Make all links in comment open in new tab
|
|
|
|
$(this).find('a').attr('target', '_blank'); |
|
|
|
} |
|
|
|
}); |
|
|
|
@ -0,0 +1,5 @@ |
|
|
|
$.onmount('[data-js-open-new-tab-text]', function() { |
|
|
|
$(this).change(function() { |
|
|
|
localStorage.setItem('open_new_tab_text', $(this).is(':checked')); |
|
|
|
}); |
|
|
|
}); |
|
|
|
@ -80,6 +80,7 @@ |
|
|
|
type="checkbox" |
|
|
|
id="open_new_tab_text" |
|
|
|
name="open_new_tab_text" |
|
|
|
data-js-open-new-tab-text |
|
|
|
data-js-autosubmit-on-change |
|
|
|
{% if request.user.open_new_tab_text %}checked{% endif %} |
|
|
|
> |
|
|
|
|