Browse Source

Setting affects comment links

merge-requests/14/head
Ivan Fonseca 7 years ago
parent
commit
f6420c15cb
No known key found for this signature in database GPG Key ID: 95A9C856EC788689
  1. 7
      tildes/static/js/behaviors/comment-text.js
  2. 5
      tildes/static/js/behaviors/open-new-tab-text-input.js
  3. 1
      tildes/tildes/templates/settings.jinja2

7
tildes/static/js/behaviors/comment-text.js

@ -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');
}
});

5
tildes/static/js/behaviors/open-new-tab-text-input.js

@ -0,0 +1,5 @@
$.onmount('[data-js-open-new-tab-text]', function() {
$(this).change(function() {
localStorage.setItem('open_new_tab_text', $(this).is(':checked'));
});
});

1
tildes/tildes/templates/settings.jinja2

@ -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 %}
>

Loading…
Cancel
Save