aboutsummaryrefslogtreecommitdiff
path: root/src/content
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-09-20 21:06:16 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-09-20 21:06:16 +0900
commit2b6aca17b04f687f5a52fe930fdd0b0b45f62d23 (patch)
treed2be1947b283352453f2132af6145e783ee16bfa /src/content
parentc5aaaa948f434a10a68b18b2be75c2283674c93b (diff)
parentc8c76dbde1f507a64efbef56cb01c05f96550b50 (diff)
Merge branch 'improve-follow'
Diffstat (limited to 'src/content')
-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({