aboutsummaryrefslogtreecommitdiff
path: root/src/content/index.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-09-10 15:49:51 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-09-10 16:05:13 +0900
commit359fdb528821844f3c2fda718b82ce229a64b29f (patch)
tree7ef0778eaeff3f524938d88bd9dd9e4b2f026b02 /src/content/index.js
parent3c67cc0a002aded07e88ea25acc881ff080d1ae4 (diff)
blur as action/reducer
Diffstat (limited to 'src/content/index.js')
-rw-r--r--src/content/index.js26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/content/index.js b/src/content/index.js
index 1a7fa55..4fba516 100644
--- a/src/content/index.js
+++ b/src/content/index.js
@@ -1,24 +1,26 @@
+import '../console/console-frame.scss';
import * as scrolls from './scrolls';
import * as histories from './histories';
import * as actions from '../shared/actions';
-import ConsoleFrame from '../console/console-frame';
+import * as consoleFrames from '../console/frames';
+import actionTypes from '../actions';
import Follow from './follow';
-let vvConsole = new ConsoleFrame(window);
+consoleFrames.initialize(window.document);
browser.runtime.onMessage.addListener((action) => {
switch (action.type) {
case actions.CMD_OPEN:
- return vvConsole.showCommand('');
+ return consoleFrames.showCommand('');
case actions.CMD_TABS_OPEN:
if (action.alter) {
// alter url
- return vvConsole.showCommand('open ' + window.location.href);
+ return consoleFrames.showCommand('open ' + window.location.href);
} else {
- return vvConsole.showCommand('open ');
+ return consoleFrames.showCommand('open ');
}
case actions.CMD_BUFFER:
- return vvConsole.showCommand('buffer ');
+ return consoleFrames.showCommand('buffer ');
case actions.SCROLL_LINES:
scrolls.scrollLines(window, action.count);
break;
@@ -64,24 +66,22 @@ window.addEventListener("keypress", (e) => {
browser.runtime.sendMessage(request)
.catch((err) => {
console.error("Vim Vixen:", err);
- vvConsole.showError(err.message);
+ return consoleFrames.showError(err.message);
});
});
browser.runtime.onMessage.addListener((action) => {
switch (action.type) {
- case 'vimvixen.command.blur':
- if (!vvConsole.isErrorShown()) {
- vvConsole.hide();
- }
- return Promise.resolve();
+ case actionTypes.CONSOLE_HIDE:
+ window.focus();
+ return consoleFrames.blur(window.document);
case 'vimvixen.command.enter':
return browser.runtime.sendMessage({
type: 'event.cmd.enter',
text: action.value
}).catch((err) => {
console.error("Vim Vixen:", err);
- vvConsole.showError(err.message);
+ return consoleFrames.showError(err.message);
});
default:
return Promise.resolve();