aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/content/follow.js1
-rw-r--r--src/content/index.js15
2 files changed, 13 insertions, 3 deletions
diff --git a/src/content/follow.js b/src/content/follow.js
index eedd1ed..b1d2f5c 100644
--- a/src/content/follow.js
+++ b/src/content/follow.js
@@ -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);
diff --git a/src/content/index.js b/src/content/index.js
index 8fb142a..7ce41c1 100644
--- a/src/content/index.js
+++ b/src/content/index.js
@@ -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({