aboutsummaryrefslogtreecommitdiff
path: root/src/content/footer-line.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-08-13 21:32:24 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-08-15 21:19:46 +0900
commit5a082b4ea51d283a20c5499c13fd48d9bed67fd2 (patch)
treed61e4d22480b029d4394cefdf94b3c006a47ca1d /src/content/footer-line.js
parentfe3ecc83cfbc96bbd67d8c9d5210972603ef0efe (diff)
add command-line bar
Diffstat (limited to 'src/content/footer-line.js')
-rw-r--r--src/content/footer-line.js39
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();
+ }
+ }
+}