diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-08-13 21:32:24 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-08-15 21:19:46 +0900 |
commit | 5a082b4ea51d283a20c5499c13fd48d9bed67fd2 (patch) | |
tree | d61e4d22480b029d4394cefdf94b3c006a47ca1d /src/content/footer-line.js | |
parent | fe3ecc83cfbc96bbd67d8c9d5210972603ef0efe (diff) |
add command-line bar
Diffstat (limited to 'src/content/footer-line.js')
-rw-r--r-- | src/content/footer-line.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/content/footer-line.js b/src/content/footer-line.js new file mode 100644 index 0000000..2a931f3 --- /dev/null +++ b/src/content/footer-line.js @@ -0,0 +1,39 @@ +import './footer-line.css'; + +export default class FooterLine { + constructor(doc) { + this.title = doc.createElement('p'); + this.title.className = 'vimvixen-footerline-title'; + + this.input = doc.createElement('input'); + this.input.className = 'vimvixen-footerline-input'; + + this.wrapper = doc.createElement('div'); + this.wrapper.className = 'vimvixen-footerline'; + + this.wrapper.append(this.title); + this.wrapper.append(this.input); + doc.body.append(this.wrapper) + + this.input.addEventListener('blur', this.handleBlur.bind(this)); + this.input.addEventListener('keydown', this.handleKeydown.bind(this)); + } + + focus() { + this.input.focus(); + } + + remove() { + this.wrapper.remove(); + } + + handleBlur() { + this.remove(); + } + + handleKeydown(e) { + if (e.keyCode === KeyboardEvent.DOM_VK_ESCAPE) { + this.remove(); + } + } +} |