Merge branch 'improve-follow'
This commit is contained in:
commit
2b6aca17b0
2 changed files with 13 additions and 3 deletions
|
@ -10,7 +10,6 @@ export default class Follow {
|
|||
this.keys = [];
|
||||
this.onActivatedCallbacks = [];
|
||||
|
||||
// TODO activate input elements and push button elements
|
||||
let links = Follow.getTargetElements(doc);
|
||||
|
||||
this.addHints(links);
|
||||
|
|
|
@ -15,7 +15,7 @@ const startFollows = (newTab) => {
|
|||
case 'a':
|
||||
if (newTab) {
|
||||
// getAttribute() to avoid to resolve absolute path
|
||||
let href = element.getibute('href');
|
||||
let href = element.getAttribute('href');
|
||||
|
||||
// eslint-disable-next-line no-script-url
|
||||
if (!href || href === '#' || href.startsWith('javascript:')) {
|
||||
|
@ -27,6 +27,15 @@ const startFollows = (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();
|
||||
case 'input':
|
||||
switch (element.type) {
|
||||
|
@ -51,7 +60,9 @@ const startFollows = (newTab) => {
|
|||
};
|
||||
|
||||
window.addEventListener('keypress', (e) => {
|
||||
if (e.target instanceof HTMLInputElement) {
|
||||
if (e.target instanceof HTMLInputElement ||
|
||||
e.target instanceof HTMLTextAreaElement ||
|
||||
e.target instanceof HTMLSelectElement) {
|
||||
return;
|
||||
}
|
||||
browser.runtime.sendMessage({
|
||||
|
|
Reference in a new issue