|
|
@ -4,6 +4,25 @@ import * as actions from '../shared/actions'; |
|
|
|
|
|
|
|
|
|
|
|
var footer = null; |
|
|
|
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) => { |
|
|
|
const invokeEvent = (action) => { |
|
|
|
if (typeof action === 'undefined' || action === null) { |
|
|
|
if (typeof action === 'undefined' || action === null) { |
|
|
|
return; |
|
|
|
return; |
|
|
@ -11,22 +30,15 @@ const invokeEvent = (action) => { |
|
|
|
|
|
|
|
|
|
|
|
switch (action[0]) { |
|
|
|
switch (action[0]) { |
|
|
|
case actions.CMD_OPEN: |
|
|
|
case actions.CMD_OPEN: |
|
|
|
footer = new FooterLine(document); |
|
|
|
createFooterLine(); |
|
|
|
footer.onPromptChange((e) => { |
|
|
|
break; |
|
|
|
let request = { |
|
|
|
case actions.CMD_TABS_OPEN: |
|
|
|
type: 'event.cmd.suggest', |
|
|
|
if (action[1] || false) { |
|
|
|
text: e.target.value |
|
|
|
// alter url
|
|
|
|
}; |
|
|
|
createFooterLine('open ' + window.location.href); |
|
|
|
browser.runtime.sendMessage(request); |
|
|
|
} else { |
|
|
|
}); |
|
|
|
createFooterLine('open '); |
|
|
|
footer.onEntered((e) => { |
|
|
|
} |
|
|
|
let request = { |
|
|
|
|
|
|
|
type: 'event.cmd.enter', |
|
|
|
|
|
|
|
text: e.target.value |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
browser.runtime.sendMessage(request); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
footer.focus(); |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case actions.SCROLL_UP: |
|
|
|
case actions.SCROLL_UP: |
|
|
|
scrolls.scrollUp(window, action[1] || 1); |
|
|
|
scrolls.scrollUp(window, action[1] || 1); |
|
|
|