From 2c18dfc637d346ce799b8dd496fe49e336059403 Mon Sep 17 00:00:00 2001 From: Joao Ramos Date: Wed, 15 Jun 2022 18:42:28 +0200 Subject: [PATCH 1/2] change how new_tab is handled --- app/filter.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/filter.py b/app/filter.py index 630401d9b..5ed45e0d6 100644 --- a/app/filter.py +++ b/app/filter.py @@ -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 @@ -482,6 +480,9 @@ 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 From fa6565a5ad5a5fad552a41ab345c8a128b389e70 Mon Sep 17 00:00:00 2001 From: Joao Ramos Date: Wed, 15 Jun 2022 18:48:34 +0200 Subject: [PATCH 2/2] format code --- app/filter.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/filter.py b/app/filter.py index 5ed45e0d6..3162c271b 100644 --- a/app/filter.py +++ b/app/filter.py @@ -480,8 +480,11 @@ 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' + 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: