Only open external links in a new tab (#380)

main
Laurent le Beau-Martin 2021-08-24 11:06:41 -04:00 committed by GitHub
parent 8e91564600
commit 1a3790c7b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -255,8 +255,6 @@ class Filter:
# Temporarily removing all links to that tab for now. # Temporarily removing all links to that tab for now.
link.decompose() link.decompose()
return return
elif self.new_tab:
link['target'] = '_blank'
result_link = urlparse.urlparse(href) result_link = urlparse.urlparse(href)
q = extract_q(result_link.query, href) q = extract_q(result_link.query, href)
@ -286,6 +284,9 @@ class Filter:
# Add no-js option # Add no-js option
if self.nojs: if self.nojs:
append_nojs(link) append_nojs(link)
if self.new_tab:
link['target'] = '_blank'
else: else:
if href.startswith(MAPS_URL): if href.startswith(MAPS_URL):
# Maps links don't work if a site filter is applied # Maps links don't work if a site filter is applied