Added config option for opening links in new tab (#49)
parent
0e9bbc737d
commit
3123789584
|
@ -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 ''
|
||||
|
|
|
@ -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():
|
||||
|
|
|
@ -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"] : "";
|
||||
|
|
|
@ -66,6 +66,10 @@
|
|||
<label for="config-dark">Dark Mode: </label>
|
||||
<input type="checkbox" name="dark" id="config-dark">
|
||||
</div>
|
||||
<div class="config-div">
|
||||
<label for="config-new-tab">Open Links in New Tab: </label>
|
||||
<input type="checkbox" name="new_tab" id="config-new-tab">
|
||||
</div>
|
||||
<div class="config-div">
|
||||
<label for="config-get-only">GET Requests Only: </label>
|
||||
<input type="checkbox" name="get_only" id="config-get-only">
|
||||
|
|
Loading…
Reference in New Issue