aboutsummaryrefslogtreecommitdiff
path: root/src/content/index.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-08-16 20:33:53 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-08-16 20:33:53 +0900
commit13fb726332e9638cb3fafc477cf9fe641cb906ce (patch)
tree407ac0092fcb20c94e407bf1cbc8e5c4844b3bd6 /src/content/index.js
parent85e22063fe522518e70928255349fb1c16b7cb42 (diff)
parentdc860d32f50e2fc21a4f38663bfb0b9099a77513 (diff)
Merge branch 'command-line'
Diffstat (limited to 'src/content/index.js')
-rw-r--r--src/content/index.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/content/index.js b/src/content/index.js
index 03efc5e..17ab308 100644
--- a/src/content/index.js
+++ b/src/content/index.js
@@ -1,12 +1,45 @@
import * as scrolls from './scrolls';
+import FooterLine from './footer-line';
import * as actions from '../shared/actions';
+var footer = null;
+
+const createFooterLine = (initial = '') => {
+ footer = new FooterLine(document, initial);
+ footer.onPromptChange((e) => {
+ let request = {
+ type: 'event.cmd.suggest',
+ text: e.target.value
+ };
+ browser.runtime.sendMessage(request);
+ });
+ footer.onEntered((e) => {
+ let request = {
+ type: 'event.cmd.enter',
+ text: e.target.value
+ };
+ browser.runtime.sendMessage(request);
+ });
+ footer.focus();
+}
+
const invokeEvent = (action) => {
if (typeof action === 'undefined' || action === null) {
return;
}
switch (action[0]) {
+ case actions.CMD_OPEN:
+ createFooterLine();
+ break;
+ case actions.CMD_TABS_OPEN:
+ if (action[1] || false) {
+ // alter url
+ createFooterLine('open ' + window.location.href);
+ } else {
+ createFooterLine('open ');
+ }
+ break;
case actions.SCROLL_UP:
scrolls.scrollUp(window, action[1] || 1);
break;