From d5007a747cdc39b2978847cd7c012515e5169ff7 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Fri, 1 Sep 2017 12:50:29 +0900 Subject: error title --- src/console/console-frame.js | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) (limited to 'src/console/console-frame.js') diff --git a/src/console/console-frame.js b/src/console/console-frame.js index cf72f25..f8aeeeb 100644 --- a/src/console/console-frame.js +++ b/src/console/console-frame.js @@ -1,19 +1,43 @@ import './console-frame.scss'; +import * as messages from '../shared/messages'; export default class ConsoleFrame { constructor(win, initial = '') { - let url = browser.runtime.getURL('build/console.html') + - '#' + encodeURIComponent(initial); - let element = window.document.createElement('iframe'); - element.src = url; + element.src = browser.runtime.getURL('build/console.html'); element.className = 'vimvixen-console-frame'; win.document.body.append(element); this.element = element; + + this.hide(); + } + + showCommand(text) { + this.showFrame(); + + let message = { + type: 'vimvixen.console.show.command', + text: text + }; + messages.send(this.element.contentWindow, message); + } + + showError(text) { + this.showFrame(); + + let message = { + type: 'vimvixen.console.show.error', + text: text + }; + messages.send(this.element.contentWindow, message); + } + + showFrame() { + this.element.style.display = 'block'; } - remove() { - this.element.remove(); + hide() { + this.element.style.display = 'none'; } } -- cgit v1.2.3