diff --git a/app/filter.py b/app/filter.py index 006cbac..0cda5d3 100644 --- a/app/filter.py +++ b/app/filter.py @@ -22,6 +22,7 @@ class Filter: self.near = config['near'] if 'near' in config else '' self.dark = config['dark'] if 'dark' in config else False self.nojs = config['nojs'] if 'nojs' in config else False + self.new_tab = config['new_tab'] if 'new_tab' in config else False self.mobile = mobile self.secret_key = secret_key @@ -131,6 +132,8 @@ class Filter: if '/advanced_search' in href: a.decompose() continue + elif self.new_tab: + a['target'] = '_blank' result_link = urlparse.urlparse(href) query_link = parse_qs(result_link.query)['q'][0] if '?q=' in href else '' diff --git a/app/models/config.py b/app/models/config.py index 1c866d7..1a53049 100644 --- a/app/models/config.py +++ b/app/models/config.py @@ -57,6 +57,7 @@ class Config: self.dark = False self.nojs = False self.near = '' + self.new_tab = False self.get_only = False for key, value in kwargs.items(): diff --git a/app/static/js/controller.js b/app/static/js/controller.js index e950eb5..02ecdb5 100644 --- a/app/static/js/controller.js +++ b/app/static/js/controller.js @@ -21,6 +21,7 @@ const fillConfigValues = () => { const noJS = document.getElementById("config-nojs"); const dark = document.getElementById("config-dark"); const url = document.getElementById("config-url"); + const newTab = document.getElementById("config-new-tab"); const getOnly = document.getElementById("config-get-only"); // Request existing config info @@ -39,6 +40,7 @@ const fillConfigValues = () => { noJS.checked = !!configSettings["nojs"]; dark.checked = !!configSettings["dark"]; getOnly.checked = !!configSettings["get_only"]; + newTab.checked = !!configSettings["new_tab"]; // Addresses the issue of incorrect URL being used behind reverse proxy url.value = configSettings["url"] ? configSettings["url"] : ""; diff --git a/app/templates/index.html b/app/templates/index.html index 222fa17..33f2153 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -66,6 +66,10 @@ +