|
|
@ -15,7 +15,7 @@ const startFollows = (newTab) => { |
|
|
|
case 'a': |
|
|
|
case 'a': |
|
|
|
if (newTab) { |
|
|
|
if (newTab) { |
|
|
|
// getAttribute() to avoid to resolve absolute path
|
|
|
|
// getAttribute() to avoid to resolve absolute path
|
|
|
|
let href = element.getibute('href'); |
|
|
|
let href = element.getAttribute('href'); |
|
|
|
|
|
|
|
|
|
|
|
// eslint-disable-next-line no-script-url
|
|
|
|
// eslint-disable-next-line no-script-url
|
|
|
|
if (!href || href === '#' || href.startsWith('javascript:')) { |
|
|
|
if (!href || href === '#' || href.startsWith('javascript:')) { |
|
|
@ -27,6 +27,15 @@ const startFollows = (newTab) => { |
|
|
|
newTab |
|
|
|
newTab |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (element.href.startsWith('http://') || |
|
|
|
|
|
|
|
element.href.startsWith('https://') || |
|
|
|
|
|
|
|
element.href.startsWith('ftp://')) { |
|
|
|
|
|
|
|
return browser.runtime.sendMessage({ |
|
|
|
|
|
|
|
type: messages.OPEN_URL, |
|
|
|
|
|
|
|
url: element.href, |
|
|
|
|
|
|
|
newTab |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
return element.click(); |
|
|
|
return element.click(); |
|
|
|
case 'input': |
|
|
|
case 'input': |
|
|
|
switch (element.type) { |
|
|
|
switch (element.type) { |
|
|
@ -51,7 +60,9 @@ const startFollows = (newTab) => { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
window.addEventListener('keypress', (e) => { |
|
|
|
window.addEventListener('keypress', (e) => { |
|
|
|
if (e.target instanceof HTMLInputElement) { |
|
|
|
if (e.target instanceof HTMLInputElement || |
|
|
|
|
|
|
|
e.target instanceof HTMLTextAreaElement || |
|
|
|
|
|
|
|
e.target instanceof HTMLSelectElement) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
browser.runtime.sendMessage({ |
|
|
|
browser.runtime.sendMessage({ |
|
|
|