aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/background/key-queue.js2
-rw-r--r--src/content/index.js10
-rw-r--r--src/content/scrolls.js14
-rw-r--r--src/shared/actions.js4
4 files changed, 27 insertions, 3 deletions
diff --git a/src/background/key-queue.js b/src/background/key-queue.js
index d936233..3805305 100644
--- a/src/background/key-queue.js
+++ b/src/background/key-queue.js
@@ -14,6 +14,8 @@ const DEFAULT_KEYMAP = {
'<C-F>': [ actions.SCROLL_PAGES, 1 ],
'gg': [ actions.SCROLL_TOP ],
'G': [ actions.SCROLL_BOTTOM ],
+ '0': [ actions.SCROLL_LEFT ],
+ '$': [ actions.SCROLL_RIGHT ],
'd': [ actions.TABS_CLOSE ],
'u': [ actions.TABS_REOPEN],
'h': [ actions.TABS_PREV, 1 ],
diff --git a/src/content/index.js b/src/content/index.js
index 6bf5d57..9dd3706 100644
--- a/src/content/index.js
+++ b/src/content/index.js
@@ -49,10 +49,16 @@ const invokeEvent = (action) => {
scrolls.scrollPages(window, action[1]);
break;
case actions.SCROLL_TOP:
- scrolls.scrollTop(window, action[1]);
+ scrolls.scrollTop(window);
break;
case actions.SCROLL_BOTTOM:
- scrolls.scrollBottom(window, action[1]);
+ scrolls.scrollBottom(window);
+ break;
+ case actions.SCROLL_LEFT:
+ scrolls.scrollLeft(window);
+ break;
+ case actions.SCROLL_RIGHT:
+ scrolls.scrollRight(window);
break;
case actions.FOLLOW_START:
new Follow(window.document, action[1] || false);
diff --git a/src/content/scrolls.js b/src/content/scrolls.js
index 540703e..bc88e43 100644
--- a/src/content/scrolls.js
+++ b/src/content/scrolls.js
@@ -25,4 +25,16 @@ const scrollBottom = (page) => {
page.scrollTo(x, y);
};
-export { scrollLines, scrollPages, scrollTop, scrollBottom }
+const scrollLeft = (page) => {
+ let x = 0;
+ let y = page.scrollY;
+ page.scrollTo(x, y);
+};
+
+const scrollRight = (page) => {
+ let x = page.scrollMaxX;
+ let y = page.scrollY;
+ page.scrollTo(x, y);
+};
+
+export { scrollLines, scrollPages, scrollTop, scrollBottom, scrollLeft, scrollRight }
diff --git a/src/shared/actions.js b/src/shared/actions.js
index b987026..cd740c2 100644
--- a/src/shared/actions.js
+++ b/src/shared/actions.js
@@ -9,6 +9,8 @@ export const SCROLL_LINES = 'scroll.lines';
export const SCROLL_PAGES = 'scroll.pages';
export const SCROLL_TOP = 'scroll.top';
export const SCROLL_BOTTOM = 'scroll.bottom';
+export const SCROLL_LEFT= 'scroll.left';
+export const SCROLL_RIGHT= 'scroll.right';
export const FOLLOW_START = 'follow.start';
export const HISTORY_PREV = 'history.prev';
export const HISTORY_NEXT = 'history.next';
@@ -34,6 +36,8 @@ const CONTENT_ACTION_SET = new Set([
SCROLL_PAGES,
SCROLL_TOP,
SCROLL_BOTTOM,
+ SCROLL_LEFT,
+ SCROLL_RIGHT,
FOLLOW_START,
HISTORY_PREV,
HISTORY_NEXT