commit
0183161145
45 changed files with 147 additions and 140 deletions
@ -1,4 +1,4 @@ |
||||
import actions from 'actions'; |
||||
import actions from 'console/actions'; |
||||
|
||||
const showCommand = (text) => { |
||||
return { |
@ -0,0 +1,9 @@ |
||||
export default { |
||||
// console commands
|
||||
CONSOLE_SHOW_COMMAND: 'console.show.command', |
||||
CONSOLE_SET_COMPLETIONS: 'console.set.completions', |
||||
CONSOLE_SHOW_ERROR: 'console.show.error', |
||||
CONSOLE_HIDE: 'console.hide', |
||||
CONSOLE_COMPLETION_NEXT: 'console.completion.next', |
||||
CONSOLE_COMPLETION_PREV: 'console.completion.prev', |
||||
}; |
@ -1,10 +1,10 @@ |
||||
import './console.scss'; |
||||
import messages from 'content/messages'; |
||||
import CompletionComponent from 'components/completion'; |
||||
import ConsoleComponent from 'components/console'; |
||||
import reducers from 'reducers'; |
||||
import { createStore } from 'store'; |
||||
import * as consoleActions from 'actions/console'; |
||||
import './site.scss'; |
||||
import messages from 'shared/messages'; |
||||
import CompletionComponent from 'console/components/completion'; |
||||
import ConsoleComponent from 'console/components/console'; |
||||
import reducers from 'console/reducers'; |
||||
import { createStore } from 'shared/store'; |
||||
import * as consoleActions from 'console/actions/console'; |
||||
|
||||
const store = createStore(reducers); |
||||
let completionComponent = null; |
@ -1,4 +1,4 @@ |
||||
import actions from 'actions'; |
||||
import actions from 'console/actions'; |
||||
|
||||
const defaultState = { |
||||
errorShown: false, |
@ -1,4 +1,4 @@ |
||||
import actions from 'actions'; |
||||
import actions from 'content/actions'; |
||||
|
||||
const enable = (newTab) => { |
||||
return { |
@ -1,12 +1,4 @@ |
||||
export default { |
||||
// console commands
|
||||
CONSOLE_SHOW_COMMAND: 'console.show.command', |
||||
CONSOLE_SET_COMPLETIONS: 'console.set.completions', |
||||
CONSOLE_SHOW_ERROR: 'console.show.error', |
||||
CONSOLE_HIDE: 'console.hide', |
||||
CONSOLE_COMPLETION_NEXT: 'console.completion.next', |
||||
CONSOLE_COMPLETION_PREV: 'console.completion.prev', |
||||
|
||||
// User input
|
||||
INPUT_KEY_PRESS: 'input.key,press', |
||||
INPUT_CLEAR_KEYS: 'input.clear.keys', |
@ -1,4 +1,4 @@ |
||||
import actions from 'actions'; |
||||
import actions from 'content/actions'; |
||||
|
||||
const asKeymapChars = (key, ctrl) => { |
||||
if (ctrl) { |
@ -0,0 +1,43 @@ |
||||
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 'content/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 }; |
@ -1,5 +1,5 @@ |
||||
import * as followActions from 'actions/follow'; |
||||
import messages from 'content/messages'; |
||||
import * as followActions from 'content/actions/follow'; |
||||
import messages from 'shared/messages'; |
||||
import Hint from 'content/hint'; |
||||
import HintKeyProducer from 'content/hint-key-producer'; |
||||
|
@ -1,5 +1,5 @@ |
||||
import * as inputActions from 'actions/input'; |
||||
import * as operationActions from 'actions/operation'; |
||||
import * as inputActions from 'content/actions/input'; |
||||
import * as operationActions from 'content/actions/operation'; |
||||
|
||||
export default class KeymapperComponent { |
||||
constructor(store) { |
@ -1,4 +1,4 @@ |
||||
import actions from 'actions'; |
||||
import actions from 'content/actions'; |
||||
|
||||
const defaultState = { |
||||
enabled: false, |
@ -1,4 +1,4 @@ |
||||
import actions from 'actions'; |
||||
import actions from 'content/actions'; |
||||
|
||||
const defaultState = { |
||||
keys: '', |
@ -0,0 +1,4 @@ |
||||
export default { |
||||
// Settings
|
||||
SETTING_SET_SETTINGS: 'setting.set.settings', |
||||
}; |
@ -1,5 +1,5 @@ |
||||
import actions from 'actions'; |
||||
import messages from 'content/messages'; |
||||
import actions from 'settings/actions'; |
||||
import messages from 'shared/messages'; |
||||
import DefaultSettings from 'shared/default-settings'; |
||||
|
||||
const load = () => { |
@ -1,4 +1,4 @@ |
||||
import * as settingActions from 'actions/setting'; |
||||
import * as settingActions from 'settings/actions/setting'; |
||||
import { validate } from 'shared/validators/setting'; |
||||
|
||||
export default class SettingComponent { |
@ -1,7 +1,7 @@ |
||||
import './settings.scss'; |
||||
import SettingComponent from 'components/setting'; |
||||
import settingReducer from 'reducers/setting'; |
||||
import { createStore } from 'store'; |
||||
import './site.scss'; |
||||
import SettingComponent from 'settings/components/setting'; |
||||
import settingReducer from 'settings/reducers/setting'; |
||||
import { createStore } from 'shared/store'; |
||||
|
||||
const store = createStore(settingReducer); |
||||
let settingComponent = null; |
@ -1,4 +1,4 @@ |
||||
import actions from 'actions'; |
||||
import actions from 'settings/actions'; |
||||
|
||||
const defaultState = { |
||||
settings: {} |
@ -1,6 +1,6 @@ |
||||
import { expect } from "chai"; |
||||
import actions from 'actions'; |
||||
import * as consoleActions from 'actions/console'; |
||||
import actions from 'console/actions'; |
||||
import * as consoleActions from 'console/actions/console'; |
||||
|
||||
describe("console actions", () => { |
||||
describe("showCommand", () => { |
@ -1,6 +1,6 @@ |
||||
import { expect } from "chai"; |
||||
import actions from 'actions'; |
||||
import * as followActions from 'actions/follow'; |
||||
import actions from 'content/actions'; |
||||
import * as followActions from 'content/actions/follow'; |
||||
|
||||
describe('follow actions', () => { |
||||
describe('enable', () => { |
@ -1,6 +1,6 @@ |
||||
import { expect } from "chai"; |
||||
import actions from 'actions'; |
||||
import * as inputActions from 'actions/input'; |
||||
import actions from 'content/actions'; |
||||
import * as inputActions from 'content/actions/input'; |
||||
|
||||
describe("input actions", () => { |
||||
describe("keyPress", () => { |
@ -1,10 +1,10 @@ |
||||
import { expect } from "chai"; |
||||
import FollowComponent from 'components/follow'; |
||||
import FollowComponent from 'content/components/follow'; |
||||
|
||||
describe('FollowComponent', () => { |
||||
describe('#getTargetElements', () => { |
||||
beforeEach(() => { |
||||
document.body.innerHTML = __html__['test/components/follow.html']; |
||||
document.body.innerHTML = __html__['test/content/components/follow.html']; |
||||
}); |
||||
|
||||
it('returns visible links', () => { |
@ -1,6 +1,6 @@ |
||||
import { expect } from "chai"; |
||||
import actions from 'actions'; |
||||
import followReducer from 'reducers/follow'; |
||||
import actions from 'content/actions'; |
||||
import followReducer from 'content/reducers/follow'; |
||||
|
||||
describe('follow reducer', () => { |
||||
it ('returns the initial state', () => { |
@ -1,6 +1,6 @@ |
||||
import { expect } from "chai"; |
||||
import actions from 'actions'; |
||||
import inputReducer from 'reducers/input'; |
||||
import actions from 'content/actions'; |
||||
import inputReducer from 'content/reducers/input'; |
||||
|
||||
describe("input reducer", () => { |
||||
it('return the initial state', () => { |
@ -1,6 +1,6 @@ |
||||
import { expect } from "chai"; |
||||
import actions from 'actions'; |
||||
import settingReducer from 'reducers/setting'; |
||||
import actions from 'settings/actions'; |
||||
import settingReducer from 'settings/reducers/setting'; |
||||
|
||||
describe("setting reducer", () => { |
||||
it('return the initial state', () => { |
@ -1,5 +1,5 @@ |
||||
import { expect } from "chai"; |
||||
import { createStore } from 'store'; |
||||
import { createStore } from 'shared/store'; |
||||
|
||||
describe("Store class", () => { |
||||
const reducer = (state, action) => { |
Reference in new issue