From 71c271cdf02beca8c706a4e18832c119efa0eeea Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Wed, 20 Sep 2017 20:01:23 +0900 Subject: [PATCH 1/4] ignore keypress for another elements --- src/content/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/content/index.js b/src/content/index.js index 8fb142a..571a927 100644 --- a/src/content/index.js +++ b/src/content/index.js @@ -51,7 +51,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({ From e2b1f0d4d5b5526e61184e2c24186d422b6f8843 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Wed, 20 Sep 2017 20:18:05 +0900 Subject: [PATCH 2/4] open cross-origin links by background --- src/content/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/content/index.js b/src/content/index.js index 571a927..5f50a72 100644 --- a/src/content/index.js +++ b/src/content/index.js @@ -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) { From 9e4e6f847580984fdac9e4a1a7f85fc49b1c9d96 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Wed, 20 Sep 2017 20:19:54 +0900 Subject: [PATCH 3/4] fix miss function cal --- src/content/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/index.js b/src/content/index.js index 5f50a72..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:')) { From c8c76dbde1f507a64efbef56cb01c05f96550b50 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Wed, 20 Sep 2017 20:34:35 +0900 Subject: [PATCH 4/4] remove TODO --- src/content/follow.js | 1 - 1 file changed, 1 deletion(-) 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);