aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/console/index.html2
-rw-r--r--src/console/site.scss5
-rw-r--r--src/content/components/common/follow.js3
-rw-r--r--src/content/components/common/hint.css2
-rw-r--r--src/content/console-frame.scss3
-rw-r--r--src/content/navigates.js31
6 files changed, 27 insertions, 19 deletions
diff --git a/src/console/index.html b/src/console/index.html
index 52ecb76..e049b5e 100644
--- a/src/console/index.html
+++ b/src/console/index.html
@@ -7,7 +7,7 @@
</head>
<body class='vimvixen-console'>
<p class='vimvixen-console-message'></p>
- <div id='vimvixen-console-command'>
+ <div id='vimvixen-console-command' class='vimvixen-console-command-wrapper'>
<ul id='vimvixen-console-completion' class='vimvixen-console-completion'></ul>
<div class='vimvixen-console-command'>
<i class='vimvixen-console-command-prompt'></i><input
diff --git a/src/console/site.scss b/src/console/site.scss
index cd40db5..5aaea12 100644
--- a/src/console/site.scss
+++ b/src/console/site.scss
@@ -12,7 +12,6 @@ body {
}
.vimvixen-console {
- border-top: 1px solid gray;
bottom: 0;
margin: 0;
padding: 0;
@@ -24,6 +23,10 @@ body {
line-height: 16px;
}
+ &-command-wrapper {
+ border-top: 1px solid gray;
+ }
+
&-completion {
background-color: white;
diff --git a/src/content/components/common/follow.js b/src/content/components/common/follow.js
index 7a35105..7717154 100644
--- a/src/content/components/common/follow.js
+++ b/src/content/components/common/follow.js
@@ -4,7 +4,8 @@ import * as dom from 'shared/utils/dom';
const TARGET_SELECTOR = [
'a', 'button', 'input', 'textarea', 'area',
- '[contenteditable=true]', '[contenteditable=""]', '[tabindex]'
+ '[contenteditable=true]', '[contenteditable=""]', '[tabindex]',
+ '[role="button"]'
].join(',');
diff --git a/src/content/components/common/hint.css b/src/content/components/common/hint.css
index 119dd21..1f2ab20 100644
--- a/src/content/components/common/hint.css
+++ b/src/content/components/common/hint.css
@@ -4,7 +4,7 @@
font-weight: bold;
position: absolute;
text-transform: uppercase;
- z-index: 100000;
+ z-index: 2147483647;
font-size: 12px;
color: black;
}
diff --git a/src/content/console-frame.scss b/src/content/console-frame.scss
index 33bfff3..dece648 100644
--- a/src/content/console-frame.scss
+++ b/src/content/console-frame.scss
@@ -6,7 +6,8 @@
width: 100%;
height: 100%;
position: fixed;
- z-index: 10000;
+ z-index: 2147483647;
border: none;
+ background-color: unset;
pointer-events:none;
}
diff --git a/src/content/navigates.js b/src/content/navigates.js
index 64e5fc0..3e12a6f 100644
--- a/src/content/navigates.js
+++ b/src/content/navigates.js
@@ -2,13 +2,14 @@ const PREV_LINK_PATTERNS = [
/\bprev\b/i, /\bprevious\b/i, /\bback\b/i,
/</, /\u2039/, /\u2190/, /\xab/, /\u226a/, /<</
];
+
const NEXT_LINK_PATTERNS = [
/\bnext\b/i,
/>/, /\u203a/, /\u2192/, /\xbb/, /\u226b/, />>/
];
const findLinkByPatterns = (win, patterns) => {
- let links = win.document.getElementsByTagName('a');
+ const links = win.document.getElementsByTagName('a');
return Array.prototype.find.call(links, (link) => {
return patterns.some(ptn => ptn.test(link.textContent));
});
@@ -22,30 +23,32 @@ const historyNext = (win) => {
win.history.forward();
};
-const linkPrev = (win) => {
- let link = win.document.querySelector('a[rel=prev]');
+const linkCommon = (win, rel, patterns) => {
+ let link = win.document.querySelector(`link[rel~=${rel}][href]`);
+
if (link) {
- return link.click();
+ win.location = link.getAttribute('href');
+ return;
}
- link = findLinkByPatterns(win, PREV_LINK_PATTERNS);
+
+ link = win.document.querySelector(`a[rel~=${rel}]`) ||
+ findLinkByPatterns(win, patterns);
+
if (link) {
link.click();
}
};
+const linkPrev = (win) => {
+ linkCommon(win, 'prev', PREV_LINK_PATTERNS);
+};
+
const linkNext = (win) => {
- let link = win.document.querySelector('a[rel=next]');
- if (link) {
- return link.click();
- }
- link = findLinkByPatterns(win, NEXT_LINK_PATTERNS);
- if (link) {
- link.click();
- }
+ linkCommon(win, 'next', NEXT_LINK_PATTERNS);
};
const parent = (win) => {
- let loc = win.location;
+ const loc = win.location;
if (loc.hash !== '') {
loc.hash = '';
return;