aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/background/key-queue.js2
-rw-r--r--src/content/histories.js8
-rw-r--r--src/content/index.js9
-rw-r--r--src/shared/actions.js6
4 files changed, 23 insertions, 2 deletions
diff --git a/src/background/key-queue.js b/src/background/key-queue.js
index 5693b36..a07c7f4 100644
--- a/src/background/key-queue.js
+++ b/src/background/key-queue.js
@@ -15,6 +15,8 @@ const DEFAULT_KEYMAP = [
{ keys: [{ code: KeyboardEvent.DOM_VK_L }], action: [ actions.TABS_NEXT, 1 ]},
{ keys: [{ code: KeyboardEvent.DOM_VK_F }], action: [ actions.FOLLOW_START, false ]},
{ keys: [{ code: KeyboardEvent.DOM_VK_F, shift: true }], action: [ actions.FOLLOW_START, true ]},
+ { keys: [{ code: KeyboardEvent.DOM_VK_H, shift: true }], action: [ actions.HISTORY_PREV ]},
+ { keys: [{ code: KeyboardEvent.DOM_VK_L, shift: true }], action: [ actions.HISTORY_NEXT ]},
]
export default class KeyQueue {
diff --git a/src/content/histories.js b/src/content/histories.js
new file mode 100644
index 0000000..2e34dc6
--- /dev/null
+++ b/src/content/histories.js
@@ -0,0 +1,8 @@
+const prev = (win) => {
+ win.history.back()
+};
+const next = (win) => {
+ win.history.forward()
+};
+
+export { prev, next };
diff --git a/src/content/index.js b/src/content/index.js
index 78389fd..2bbe39c 100644
--- a/src/content/index.js
+++ b/src/content/index.js
@@ -1,7 +1,8 @@
import * as scrolls from './scrolls';
+import * as histories from './histories';
+import * as actions from '../shared/actions';
import FooterLine from './footer-line';
import Follow from './follow';
-import * as actions from '../shared/actions';
var footer = null;
@@ -56,6 +57,12 @@ const invokeEvent = (action) => {
case actions.FOLLOW_START:
new Follow(window.document, action[1] || false);
break;
+ case actions.HISTORY_PREV:
+ histories.prev(window);
+ break;
+ case actions.HISTORY_NEXT:
+ histories.next(window);
+ break;
}
}
diff --git a/src/shared/actions.js b/src/shared/actions.js
index bb61dbc..e01813b 100644
--- a/src/shared/actions.js
+++ b/src/shared/actions.js
@@ -9,6 +9,8 @@ export const SCROLL_DOWN = 'scroll.down';
export const SCROLL_TOP = 'scroll.top';
export const SCROLL_BOTTOM = 'scroll.bottom';
export const FOLLOW_START = 'follow.start';
+export const HISTORY_PREV = 'history.prev';
+export const HISTORY_NEXT = 'history.next';
const BACKGROUND_ACTION_SET = new Set([
TABS_CLOSE,
@@ -24,7 +26,9 @@ const CONTENT_ACTION_SET = new Set([
SCROLL_DOWN,
SCROLL_TOP,
SCROLL_BOTTOM,
- FOLLOW_START
+ FOLLOW_START,
+ HISTORY_PREV,
+ HISTORY_NEXT
]);
export const isBackgroundAction = (action) => {