diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-01-13 11:14:55 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-13 11:14:55 +0000 |
commit | 2302a1d8b5472b30fd202070b71dc6c43f7e469c (patch) | |
tree | ad7fd77301dbabd8fce40b34f7088f1ca766f15b /src/content/actions/operation.js | |
parent | 4d4a959162da0a4f1eb16c3ce94e83da0465f865 (diff) | |
parent | 335b9ca47458b1817ef7705f4d999c25f423fad9 (diff) |
Merge pull request #307 from ueokande/smooth-scroll
Smooth scroll
Diffstat (limited to 'src/content/actions/operation.js')
-rw-r--r-- | src/content/actions/operation.js | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/content/actions/operation.js b/src/content/actions/operation.js index 767f14b..1c0a5fb 100644 --- a/src/content/actions/operation.js +++ b/src/content/actions/operation.js @@ -5,9 +5,12 @@ import * as navigates from 'content/navigates'; import * as urls from 'content/urls'; import * as consoleFrames from 'content/console-frames'; import * as addonActions from './addon'; +import * as properties from 'shared/settings/properties'; // eslint-disable-next-line complexity -const exec = (operation) => { +const exec = (operation, repeat, settings) => { + let smoothscroll = settings.properties.smoothscroll || + properties.defaults.smoothscroll; switch (operation.type) { case operations.ADDON_ENABLE: return addonActions.enable(); @@ -24,19 +27,19 @@ const exec = (operation) => { type: messages.FIND_PREV, }), '*'); case operations.SCROLL_VERTICALLY: - return scrolls.scrollVertically(window, operation.count); + return scrolls.scrollVertically(operation.count, smoothscroll, repeat); case operations.SCROLL_HORIZONALLY: - return scrolls.scrollHorizonally(window, operation.count); + return scrolls.scrollHorizonally(operation.count, smoothscroll, repeat); case operations.SCROLL_PAGES: - return scrolls.scrollPages(window, operation.count); + return scrolls.scrollPages(operation.count, smoothscroll, repeat); case operations.SCROLL_TOP: - return scrolls.scrollTop(window); + return scrolls.scrollTop(smoothscroll, repeat); case operations.SCROLL_BOTTOM: - return scrolls.scrollBottom(window); + return scrolls.scrollBottom(smoothscroll, repeat); case operations.SCROLL_HOME: - return scrolls.scrollHome(window); + return scrolls.scrollHome(smoothscroll, repeat); case operations.SCROLL_END: - return scrolls.scrollEnd(window); + return scrolls.scrollEnd(smoothscroll, repeat); case operations.FOLLOW_START: return window.top.postMessage(JSON.stringify({ type: messages.FOLLOW_START, |