Rename command-line to console

jh-changes
Shin'ya Ueoka 7 years ago
parent f1b9c6ba9d
commit 6e5286ef10
  1. 2
      manifest.json
  2. 18
      src/command-line/command-line.html
  3. 8
      src/console/console-frame.js
  4. 2
      src/console/console-frame.scss
  5. 18
      src/console/console.html
  6. 4
      src/console/console.js
  7. 4
      src/console/console.scss
  8. 8
      src/content/index.js
  9. 6
      webpack.config.js

@ -18,6 +18,6 @@
"sessions" "sessions"
], ],
"web_accessible_resources": [ "web_accessible_resources": [
"build/command-line.html" "build/console.html"
] ]
} }

@ -1,18 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8 />
<title>VimVixen command-line</title>
<script src='command-line.js'></script>
</head>
<body class='vimvixen-command-line'>
<div>
<p class='vimvixen-command-line-title'></p>
<div class='vimvixen-command-line-line'>
<i class='vimvixen-command-line-line-prompt'></i><input
id='vimvixen-command-line-line-input'
class='vimvixen-command-line-line-input'></input>
</div>
</div>
</body>
</html>

@ -1,13 +1,13 @@
import './command-line-frame.scss'; import './console-frame.scss';
export default class CommandLineFrame { export default class ConsoleFrame {
constructor(win, initial = '') { constructor(win, initial = '') {
let url = browser.runtime.getURL('build/command-line.html') + let url = browser.runtime.getURL('build/console.html') +
'#' + encodeURIComponent(initial); '#' + encodeURIComponent(initial);
let element = window.document.createElement('iframe'); let element = window.document.createElement('iframe');
element.src = url; element.src = url;
element.className = 'vimvixen-command-line-frame'; element.className = 'vimvixen-console-frame';
win.document.body.append(element); win.document.body.append(element);
this.element = element; this.element = element;

@ -1,4 +1,4 @@
.vimvixen-command-line-frame { .vimvixen-console-frame {
margin: 0; margin: 0;
padding: 0; padding: 0;
bottom: 0; bottom: 0;

@ -0,0 +1,18 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8 />
<title>VimVixen console</title>
<script src='console.js'></script>
</head>
<body class='vimvixen-console'>
<div>
<p class='vimvixen-console-title'></p>
<div class='vimvixen-console-command'>
<i class='vimvixen-console-command-prompt'></i><input
id='vimvixen-console-command-input'
class='vimvixen-console-command-input'></input>
</div>
</div>
</body>
</html>

@ -1,4 +1,4 @@
import './command-line.scss'; import './console.scss';
const parent = window.parent; const parent = window.parent;
@ -55,7 +55,7 @@ window.addEventListener('load', () => {
initial = decodeURIComponent(hash.substring(1)); initial = decodeURIComponent(hash.substring(1));
} }
let input = window.document.querySelector('#vimvixen-command-line-line-input'); let input = window.document.querySelector('#vimvixen-console-command-input');
input.addEventListener('blur', handleBlur); input.addEventListener('blur', handleBlur);
input.addEventListener('keydown', handleKeydown); input.addEventListener('keydown', handleKeydown);
input.addEventListener('keyup', handleKeyup); input.addEventListener('keyup', handleKeyup);

@ -10,7 +10,7 @@ body {
right: 0; right: 0;
} }
.vimvixen-command-line { .vimvixen-console {
border-top: 1px solid gray; border-top: 1px solid gray;
bottom: 0; bottom: 0;
margin: 0; margin: 0;
@ -32,7 +32,7 @@ body {
@include input-style; @include input-style;
} }
&-line { &-command {
background-color: white; background-color: white;
display: flex; display: flex;

@ -1,7 +1,7 @@
import * as scrolls from './scrolls'; import * as scrolls from './scrolls';
import * as histories from './histories'; import * as histories from './histories';
import * as actions from '../shared/actions'; import * as actions from '../shared/actions';
import CommandLineFrame from '../command-line/command-line-frame'; import ConsoleFrame from '../console/console-frame';
import Follow from './follow'; import Follow from './follow';
let cmd = null; let cmd = null;
@ -13,14 +13,14 @@ const invokeEvent = (action) => {
switch (action[0]) { switch (action[0]) {
case actions.CMD_OPEN: case actions.CMD_OPEN:
cmd = new CommandLineFrame(window); cmd = new ConsoleFrame(window);
break; break;
case actions.CMD_TABS_OPEN: case actions.CMD_TABS_OPEN:
if (action[1] || false) { if (action[1] || false) {
// alter url // alter url
cmd = new CommandLineFrame(window, 'open ' + window.location.href); cmd = new ConsoleFrame(window, 'open ' + window.location.href);
} else { } else {
cmd = new CommandLineFrame(window, 'open '); cmd = new ConsoleFrame(window, 'open ');
} }
break; break;
case actions.SCROLL_LINES: case actions.SCROLL_LINES:

@ -8,7 +8,7 @@ module.exports = {
entry: { entry: {
index: path.join(src, 'content'), index: path.join(src, 'content'),
background: path.join(src, 'background'), background: path.join(src, 'background'),
'command-line': path.join(src, 'command-line', 'command-line.js') console: path.join(src, 'console', 'console.js')
}, },
output: { output: {
@ -43,8 +43,8 @@ module.exports = {
plugins: [ plugins: [
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: path.join(src, 'command-line', 'command-line.html'), template: path.join(src, 'console', 'console.html'),
filename: path.join(dist, 'command-line.html'), filename: path.join(dist, 'console.html'),
inject: false inject: false
}) })
] ]