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