Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve newtab #790

Merged
merged 2 commits into from
Jun 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,6 @@ def update_link(self, link: Tag) -> None:
self._av.add(netloc)
append_anon_view(link, self.config)

if self.config.new_tab:
link['target'] = '_blank'
else:
if href.startswith(MAPS_URL):
# Maps links don't work if a site filter is applied
Expand All @@ -482,6 +480,12 @@ def update_link(self, link: Tag) -> None:
else:
link['href'] = href

if self.config.new_tab and (
link["href"].startswith("http")
or link["href"].startswith("imgres?")
):
link["target"] = "_blank"

# Replace link location if "alts" config is enabled
if self.config.alts:
# Search and replace all link descriptions
Expand Down