mirror of
https://github.com/syssecfsu/witty.git
synced 2024-11-01 09:39:26 +01:00
wip
This commit is contained in:
parent
eedf025867
commit
aa283ec188
@ -12,11 +12,12 @@
|
||||
<script src="xterm-addon-attach.js"></script>
|
||||
<script src="xterm-addon-fit.js"></script>
|
||||
<script src="xterm-addon-web-links.js"></script>
|
||||
<script src="main.js"></script>
|
||||
|
||||
<script src="main.js"></script>
|
||||
|
||||
<link rel="stylesheet" href="xterm.css" />
|
||||
<link rel="stylesheet" href="main.css" />
|
||||
|
||||
<title>Websocket Terminal</title>
|
||||
</head>
|
||||
|
||||
@ -50,9 +51,6 @@
|
||||
].join('\n\r');
|
||||
|
||||
term.writeln(str);
|
||||
term.writeln(str);
|
||||
term.writeln(str);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
@ -14,12 +14,15 @@
|
||||
.xterm-viewport.xterm-viewport {
|
||||
scrollbar-width: thin;
|
||||
}
|
||||
|
||||
.xterm-viewport::-webkit-scrollbar {
|
||||
width: 10px;
|
||||
}
|
||||
|
||||
.xterm-viewport::-webkit-scrollbar-track {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.xterm-viewport::-webkit-scrollbar-thumb {
|
||||
min-height: 20px;
|
||||
background-color: #ffffff20;
|
||||
|
@ -1,5 +1,6 @@
|
||||
function createTerminal() {
|
||||
// vscode-snazzy https://github.com/Tyriar/vscode-snazzy
|
||||
// copied from xterm.js website
|
||||
var baseTheme = {
|
||||
foreground: '#eff0eb',
|
||||
background: '#282a36',
|
||||
@ -26,13 +27,14 @@ function createTerminal() {
|
||||
fontFamily: `'Fira Code', monospace`,
|
||||
fontSize: 12,
|
||||
theme: baseTheme,
|
||||
convertEol: true,
|
||||
});
|
||||
|
||||
term.open(document.getElementById('terminal_view'));
|
||||
term.resize(120, 36);
|
||||
|
||||
const weblinksAddon = new WebLinksAddon.WebLinksAddon();
|
||||
term.loadAddon(weblinksAddon)
|
||||
term.loadAddon(weblinksAddon);
|
||||
|
||||
// fit the xterm viewpoint to parent element
|
||||
const fitAddon = new FitAddon.FitAddon();
|
||||
@ -40,10 +42,9 @@ function createTerminal() {
|
||||
fitAddon.fit();
|
||||
|
||||
// create the websocket and connect to the server
|
||||
const ws_uri = "ws://" + window.location.host + "/ws"
|
||||
const socket = new WebSocket(ws_uri)
|
||||
console.log("Attempting to connect to" + ws_uri);
|
||||
const attachAddon = new AttachAddon.AttachAddon(socket)
|
||||
const ws_uri = "ws://" + window.location.host + "/ws";
|
||||
const socket = new WebSocket(ws_uri);
|
||||
const attachAddon = new AttachAddon.AttachAddon(socket);
|
||||
term.loadAddon(attachAddon);
|
||||
|
||||
return term;
|
||||
|
Loading…
Reference in New Issue
Block a user