Skip to content

Commit

Permalink
ensuring that popup links always open externally
Browse files Browse the repository at this point in the history
  • Loading branch information
LeXofLeviafan committed Aug 25, 2024
1 parent 2de8f63 commit 962bbef
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bukuserver/templates/bukuserver/bookmark_create.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

{% block tail %}
{{ super() }}
{{ buku.limit_navigation_if_popup() }}
{{ buku.script('bookmark.js') }}
{{ buku.fetch_checkbox() }}
{{ buku.focus() }}
{{ buku.link_saved() }}
{{ buku.limit_navigation_if_popup() }}
{% endblock %}
2 changes: 1 addition & 1 deletion bukuserver/templates/bukuserver/bookmark_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

{% block tail %}
{{ super() }}
{{ buku.limit_navigation_if_popup() }}
{{ buku.details_formatting() }}
<script>$('#fa_filter, .table.searchable a').attr('tabindex', 1)</script>
{{ buku.link_saved() }}
{{ buku.limit_navigation_if_popup() }}
{% endblock %}
2 changes: 1 addition & 1 deletion bukuserver/templates/bukuserver/bookmark_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

{% block tail %}
{{ super() }}
{{ buku.limit_navigation_if_popup() }}
{{ buku.script('bookmark.js') }}
{{ buku.focus() }}
{{ buku.link_saved() }}
{{ buku.limit_navigation_if_popup() }}
<script>$('.submit-row').append($('.delete-form'))</script>
{% endblock %}
7 changes: 4 additions & 3 deletions bukuserver/templates/bukuserver/lib.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@

{% macro details_formatting(prefix='') %}
<script>{
const TARGET = {{ (' target="_blank"' if config.get('BUKUSERVER_OPEN_IN_NEW_TAB', False) else '') | tojson }};
$(`{{prefix}} td:nth-child(2)`).html((_, s) => s.trim().replaceAll('\n', '<br/>'));
{% if session.pop('netloc', None) %}
{%- if session.pop('netloc', None) %}
const NEW_TAB = {{ config.get('BUKUSERVER_OPEN_IN_NEW_TAB', False)|tojson }};
const TARGET = (!NEW_TAB && !document.body.matches('.popup') ? '' : ' target="_blank"');
$(`{{prefix}} td:contains({{ _gettext('Url') | tojson }}) + td`).html((_, s) => `<a href="${s.replaceAll('"', '&quot;')}"${TARGET}>${s}</a>`);
{% endif %}
{%- endif %}
}</script>
{% endmacro %}

Expand Down

0 comments on commit 962bbef

Please sign in to comment.