|
|
@ -9,15 +9,25 @@ import messages from '../messages'; |
|
|
|
consoleFrames.initialize(window.document); |
|
|
|
consoleFrames.initialize(window.document); |
|
|
|
|
|
|
|
|
|
|
|
const startFollows = (newTab) => { |
|
|
|
const startFollows = (newTab) => { |
|
|
|
let follow = new Follow(window.document, newTab); |
|
|
|
let follow = new Follow(window.document); |
|
|
|
follow.onActivated((element) => { |
|
|
|
follow.onActivated((element) => { |
|
|
|
switch (element.tagName.toLowerCase()) { |
|
|
|
switch (element.tagName.toLowerCase()) { |
|
|
|
case 'a': |
|
|
|
case 'a': |
|
|
|
return browser.runtime.sendMessage({ |
|
|
|
if (newTab) { |
|
|
|
type: messages.OPEN_URL, |
|
|
|
// getAttribute() to avoid to resolve absolute path
|
|
|
|
url: element.href, |
|
|
|
let href = element.getibute('href'); |
|
|
|
newTab |
|
|
|
|
|
|
|
}); |
|
|
|
// eslint-disable-next-line no-script-url
|
|
|
|
|
|
|
|
if (!href || href === '#' || href.startsWith('javascript:')) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return browser.runtime.sendMessage({ |
|
|
|
|
|
|
|
type: messages.OPEN_URL, |
|
|
|
|
|
|
|
url: element.href, |
|
|
|
|
|
|
|
newTab |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return element.click(); |
|
|
|
case 'input': |
|
|
|
case 'input': |
|
|
|
switch (element.type) { |
|
|
|
switch (element.type) { |
|
|
|
case 'file': |
|
|
|
case 'file': |
|
|
|