diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-08-29 20:56:56 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-08-29 20:56:56 +0900 |
commit | a129c9665832c1c8f77bafd05bb2367221af3a51 (patch) | |
tree | 972870a91a253188658f33931dd17c22b40ea5a6 /src/content/footer-line.js | |
parent | dc4286460791c3b76fe29d085502a11c61c78551 (diff) |
remove footer-line
Diffstat (limited to 'src/content/footer-line.js')
-rw-r--r-- | src/content/footer-line.js | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/src/content/footer-line.js b/src/content/footer-line.js deleted file mode 100644 index fc1dc7b..0000000 --- a/src/content/footer-line.js +++ /dev/null @@ -1,78 +0,0 @@ -import './footer-line.css'; - -export default class FooterLine { - constructor(doc, initial = '') { - this.initUi(doc); - - this.enteredCallback = () => {} - this.promptChangeCallback = () => {} - - this.input.addEventListener('blur', this.handleBlur.bind(this)); - this.input.addEventListener('keydown', this.handleKeydown.bind(this)); - this.input.addEventListener('keyup', this.handleKeyup.bind(this)); - this.input.value = initial; - } - - initUi(doc) { - this.title = doc.createElement('p'); - this.title.className = 'vimvixen-footerline-title'; - - let containerInner = doc.createElement('div'); - containerInner.className = 'vimvixen-footerline-container-inner'; - - let containerOuter = doc.createElement('div'); - containerOuter.className = 'vimvixen-footerline-container-outer'; - - this.input = doc.createElement('input'); - this.input.className = 'vimvixen-footerline-input'; - - this.wrapper = doc.createElement('div'); - this.wrapper.className = 'vimvixen-footerline'; - - containerOuter.append(containerInner); - containerInner.append(this.input); - this.wrapper.append(this.title); - this.wrapper.append(containerOuter); - doc.body.append(this.wrapper) - } - - focus() { - this.input.focus(); - } - - remove() { - this.wrapper.remove(); - } - - onPromptChange(callback) { - this.promptChangeCallback = callback; - } - - onEntered(callback) { - this.enteredCallback = callback; - } - - handleBlur() { - this.remove(); - } - - handleKeydown(e) { - this.prevValue = e.target.value; - switch(e.keyCode) { - case KeyboardEvent.DOM_VK_ESCAPE: - this.remove(); - break; - case KeyboardEvent.DOM_VK_RETURN: - this.enteredCallback(e); - break; - } - } - - handleKeyup(e) { - if (e.target.value === this.prevValue) { - return; - } - this.promptChangeCallback(e); - this.prevValue = e.target.value; - } -} |