From 39fb5400370b818760dc7bcfe42e74b2512a840d Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 8 Oct 2017 15:04:55 +0900 Subject: separate content --- src/actions/follow.js | 29 ----------------------------- src/actions/index.js | 20 -------------------- src/actions/input.js | 23 ----------------------- src/actions/operation.js | 43 ------------------------------------------- 4 files changed, 115 deletions(-) delete mode 100644 src/actions/follow.js delete mode 100644 src/actions/index.js delete mode 100644 src/actions/input.js delete mode 100644 src/actions/operation.js (limited to 'src/actions') diff --git a/src/actions/follow.js b/src/actions/follow.js deleted file mode 100644 index 708cd95..0000000 --- a/src/actions/follow.js +++ /dev/null @@ -1,29 +0,0 @@ -import actions from 'actions'; - -const enable = (newTab) => { - return { - type: actions.FOLLOW_ENABLE, - newTab, - }; -}; - -const disable = () => { - return { - type: actions.FOLLOW_DISABLE, - }; -}; - -const keyPress = (key) => { - return { - type: actions.FOLLOW_KEY_PRESS, - key: key - }; -}; - -const backspace = () => { - return { - type: actions.FOLLOW_BACKSPACE, - }; -}; - -export { enable, disable, keyPress, backspace }; diff --git a/src/actions/index.js b/src/actions/index.js deleted file mode 100644 index 0b3749d..0000000 --- a/src/actions/index.js +++ /dev/null @@ -1,20 +0,0 @@ -export default { - // User input - INPUT_KEY_PRESS: 'input.key,press', - INPUT_CLEAR_KEYS: 'input.clear.keys', - INPUT_SET_KEYMAPS: 'input.set,keymaps', - - // Completion - COMPLETION_SET_ITEMS: 'completion.set.items', - COMPLETION_SELECT_NEXT: 'completions.select.next', - COMPLETION_SELECT_PREV: 'completions.select.prev', - - // Settings - SETTING_SET_SETTINGS: 'setting.set.settings', - - // Follow - FOLLOW_ENABLE: 'follow.enable', - FOLLOW_DISABLE: 'follow.disable', - FOLLOW_KEY_PRESS: 'follow.key.press', - FOLLOW_BACKSPACE: 'follow.backspace', -}; diff --git a/src/actions/input.js b/src/actions/input.js deleted file mode 100644 index 61acb76..0000000 --- a/src/actions/input.js +++ /dev/null @@ -1,23 +0,0 @@ -import actions from 'actions'; - -const asKeymapChars = (key, ctrl) => { - if (ctrl) { - return ''; - } - return key; -}; - -const keyPress = (key, ctrl) => { - return { - type: actions.INPUT_KEY_PRESS, - key: asKeymapChars(key, ctrl), - }; -}; - -const clearKeys = () => { - return { - type: actions.INPUT_CLEAR_KEYS - }; -}; - -export { keyPress, clearKeys }; diff --git a/src/actions/operation.js b/src/actions/operation.js deleted file mode 100644 index a27cd02..0000000 --- a/src/actions/operation.js +++ /dev/null @@ -1,43 +0,0 @@ -import operations from 'shared/operations'; -import messages from 'shared/messages'; -import * as scrolls from 'content/scrolls'; -import * as navigates from 'content/navigates'; -import * as followActions from 'actions/follow'; - -const exec = (operation) => { - switch (operation.type) { - case operations.SCROLL_LINES: - return scrolls.scrollLines(window, operation.count); - case operations.SCROLL_PAGES: - return scrolls.scrollPages(window, operation.count); - case operations.SCROLL_TOP: - return scrolls.scrollTop(window); - case operations.SCROLL_BOTTOM: - return scrolls.scrollBottom(window); - case operations.SCROLL_HOME: - return scrolls.scrollLeft(window); - case operations.SCROLL_END: - return scrolls.scrollRight(window); - case operations.FOLLOW_START: - return followActions.enable(false); - case operations.NAVIGATE_HISTORY_PREV: - return navigates.historyPrev(window); - case operations.NAVIGATE_HISTORY_NEXT: - return navigates.historyNext(window); - case operations.NAVIGATE_LINK_PREV: - return navigates.linkPrev(window); - case operations.NAVIGATE_LINK_NEXT: - return navigates.linkNext(window); - case operations.NAVIGATE_PARENT: - return navigates.parent(window); - case operations.NAVIGATE_ROOT: - return navigates.root(window); - default: - browser.runtime.sendMessage({ - type: messages.BACKGROUND_OPERATION, - operation, - }); - } -}; - -export { exec }; -- cgit v1.2.3