aboutsummaryrefslogtreecommitdiff
path: root/src/content
diff options
context:
space:
mode:
Diffstat (limited to 'src/content')
-rw-r--r--src/content/index.js3
-rw-r--r--src/content/scrolls.js9
2 files changed, 11 insertions, 1 deletions
diff --git a/src/content/index.js b/src/content/index.js
index b233e27..feb169f 100644
--- a/src/content/index.js
+++ b/src/content/index.js
@@ -45,6 +45,9 @@ const invokeEvent = (action) => {
case actions.SCROLL_LINES:
scrolls.scrollLines(window, action[1]);
break;
+ case actions.SCROLL_PAGES:
+ scrolls.scrollPages(window, action[1]);
+ break;
case actions.SCROLL_TOP:
scrolls.scrollTop(window, action[1]);
break;
diff --git a/src/content/scrolls.js b/src/content/scrolls.js
index ef112a4..540703e 100644
--- a/src/content/scrolls.js
+++ b/src/content/scrolls.js
@@ -6,6 +6,13 @@ const scrollLines = (page, count) => {
page.scrollTo(x, y);
};
+const scrollPages = (page, count) => {
+ let height = page.innerHeight;
+ let x = page.scrollX;
+ let y = page.scrollY + height * count;
+ page.scrollTo(x, y);
+};
+
const scrollTop = (page) => {
let x = page.scrollX;
let y = 0;
@@ -18,4 +25,4 @@ const scrollBottom = (page) => {
page.scrollTo(x, y);
};
-export { scrollLines, scrollTop, scrollBottom }
+export { scrollLines, scrollPages, scrollTop, scrollBottom }