aboutsummaryrefslogtreecommitdiff
path: root/src/content
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-09-19 22:44:42 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-09-19 22:44:42 +0900
commitc5aaaa948f434a10a68b18b2be75c2283674c93b (patch)
treea2ab88d8d7792b595a5c3541e5122980e86390c4 /src/content
parent2c079b0e011e343f120ae502a37aebdc4f80b534 (diff)
parent7c943eb675eba4790b33378f0e5ec1ffcff623c4 (diff)
Merge branch 'improve-follow'
Diffstat (limited to 'src/content')
-rw-r--r--src/content/follow.js1
-rw-r--r--src/content/hint.css3
-rw-r--r--src/content/index.js22
3 files changed, 20 insertions, 6 deletions
diff --git a/src/content/follow.js b/src/content/follow.js
index 7d69b45..eedd1ed 100644
--- a/src/content/follow.js
+++ b/src/content/follow.js
@@ -142,6 +142,7 @@ export default class Follow {
return style.display !== 'none' &&
style.visibility !== 'hidden' &&
element.type !== 'hidden' &&
+ element.offsetHeight > 0 &&
Follow.inWindow(window, element);
});
return filtered;
diff --git a/src/content/hint.css b/src/content/hint.css
index a0f1233..119dd21 100644
--- a/src/content/hint.css
+++ b/src/content/hint.css
@@ -4,4 +4,7 @@
font-weight: bold;
position: absolute;
text-transform: uppercase;
+ z-index: 100000;
+ font-size: 12px;
+ color: black;
}
diff --git a/src/content/index.js b/src/content/index.js
index 159429e..8fb142a 100644
--- a/src/content/index.js
+++ b/src/content/index.js
@@ -9,15 +9,25 @@ import messages from '../messages';
consoleFrames.initialize(window.document);
const startFollows = (newTab) => {
- let follow = new Follow(window.document, newTab);
+ let follow = new Follow(window.document);
follow.onActivated((element) => {
switch (element.tagName.toLowerCase()) {
case 'a':
- return browser.runtime.sendMessage({
- type: messages.OPEN_URL,
- url: element.href,
- newTab
- });
+ if (newTab) {
+ // getAttribute() to avoid to resolve absolute path
+ let href = element.getibute('href');
+
+ // 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':
switch (element.type) {
case 'file':