error title

This commit is contained in:
Shin'ya Ueoka 2017-09-01 12:50:29 +09:00
parent d51b674467
commit d5007a747c
4 changed files with 51 additions and 23 deletions

View file

@ -50,16 +50,23 @@ const handleKeyup = (e) => {
};
window.addEventListener('load', () => {
let hash = window.location.hash;
let initial = '';
if (hash.length > 0) {
initial = decodeURIComponent(hash.substring(1));
}
let input = window.document.querySelector('#vimvixen-console-command-input');
input.addEventListener('blur', handleBlur);
input.addEventListener('keydown', handleKeydown);
input.addEventListener('keyup', handleKeyup);
input.value = initial;
input.focus();
});
messages.receive(window, (message) => {
switch (message.type) {
case 'vimvixen.console.show.command':
if (message.text) {
let input = window.document.querySelector('#vimvixen-console-command-input');
input.value = message.text;
input.focus();
}
break;
case 'vimvixen.console.show.error':
window.document.querySelector('#vimvixen-console-error').textContent = message.text;
break;
}
});