blob: f07d8ab442d2311d2dec488f57a2b8d07aeb9a0a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
import './console-frame.scss';
export default class ConsoleFrame {
constructor(win) {
let element = window.document.createElement('iframe');
element.src = browser.runtime.getURL('build/console.html');
element.className = 'vimvixen-console-frame';
win.document.body.append(element);
this.element = element;
this.errorShown = true;
this.hide();
}
showCommand(text) {
this.showFrame();
let message = {
type: 'vimvixen.console.show.command',
text: text
};
this.errorShown = false;
return browser.runtime.sendMessage(message);
}
showError(text) {
this.showFrame();
let message = {
type: 'vimvixen.console.show.error',
text: text
};
this.errorShown = true;
this.element.blur();
return browser.runtime.sendMessage(message);
}
showFrame() {
this.element.style.display = 'block';
}
hide() {
this.element.style.display = 'none';
this.element.blur();
this.errorShown = false;
}
isErrorShown() {
return this.element.style.display === 'block' && this.errorShown;
}
setCompletions(completions) {
return browser.runtime.sendMessage({
type: 'vimvixen.console.set.completions',
completions: completions
});
}
}
|