aboutsummaryrefslogtreecommitdiff
path: root/src/content
diff options
context:
space:
mode:
Diffstat (limited to 'src/content')
-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
4 files changed, 22 insertions, 17 deletions
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;