aboutsummaryrefslogtreecommitdiff
path: root/src/content/footer-line.js
diff options
context:
space:
mode:
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();
+ }
+ }
+}