Spaces:
Paused
Paused
Create www/index.html
Browse files- www/index.html +117 -0
www/index.html
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html>
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="utf-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
| 6 |
+
<title>Claude Code</title>
|
| 7 |
+
<link rel="stylesheet" href="/xterm.css" />
|
| 8 |
+
<style>
|
| 9 |
+
html, body {
|
| 10 |
+
margin: 0;
|
| 11 |
+
padding: 0;
|
| 12 |
+
height: 100%;
|
| 13 |
+
background: #1e1e1e;
|
| 14 |
+
overflow: hidden;
|
| 15 |
+
}
|
| 16 |
+
#terminal-wrap {
|
| 17 |
+
position: absolute;
|
| 18 |
+
top: 0;
|
| 19 |
+
left: 0;
|
| 20 |
+
right: 0;
|
| 21 |
+
bottom: 48px;
|
| 22 |
+
}
|
| 23 |
+
#terminal {
|
| 24 |
+
width: 100%;
|
| 25 |
+
height: 100%;
|
| 26 |
+
}
|
| 27 |
+
#toolbar {
|
| 28 |
+
position: fixed;
|
| 29 |
+
bottom: 0;
|
| 30 |
+
left: 0;
|
| 31 |
+
right: 0;
|
| 32 |
+
height: 48px;
|
| 33 |
+
display: flex;
|
| 34 |
+
background: #2d2d2d;
|
| 35 |
+
border-top: 1px solid #444;
|
| 36 |
+
z-index: 1000;
|
| 37 |
+
}
|
| 38 |
+
#toolbar button {
|
| 39 |
+
flex: 1;
|
| 40 |
+
background: #2d2d2d;
|
| 41 |
+
color: #e0e0e0;
|
| 42 |
+
border: none;
|
| 43 |
+
border-right: 1px solid #444;
|
| 44 |
+
font-size: 13px;
|
| 45 |
+
font-family: monospace;
|
| 46 |
+
padding: 0;
|
| 47 |
+
-webkit-tap-highlight-color: rgba(255,255,255,0.2);
|
| 48 |
+
}
|
| 49 |
+
#toolbar button:last-child {
|
| 50 |
+
border-right: none;
|
| 51 |
+
}
|
| 52 |
+
#toolbar button:active {
|
| 53 |
+
background: #454545;
|
| 54 |
+
}
|
| 55 |
+
</style>
|
| 56 |
+
</head>
|
| 57 |
+
<body>
|
| 58 |
+
<div id="terminal-wrap">
|
| 59 |
+
<div id="terminal"></div>
|
| 60 |
+
</div>
|
| 61 |
+
<div id="toolbar">
|
| 62 |
+
<button data-key="Escape">Esc</button>
|
| 63 |
+
<button data-key="Tab">Tab</button>
|
| 64 |
+
<button data-key="ArrowUp">↑</button>
|
| 65 |
+
<button data-key="ArrowDown">↓</button>
|
| 66 |
+
<button data-key="ArrowLeft">←</button>
|
| 67 |
+
<button data-key="ArrowRight">→</button>
|
| 68 |
+
<button data-key="ctrl-c">^C</button>
|
| 69 |
+
<button data-key="ctrl-r">^R</button>
|
| 70 |
+
</div>
|
| 71 |
+
|
| 72 |
+
<script src="/xterm.js"></script>
|
| 73 |
+
<script>
|
| 74 |
+
// ttyd's default client script is loaded separately via /ttyd.js normally,
|
| 75 |
+
// but since we're overriding index.html we hook into the same websocket
|
| 76 |
+
// logic ttyd expects, then bind our toolbar to xterm's key input.
|
| 77 |
+
document.addEventListener('DOMContentLoaded', function () {
|
| 78 |
+
var checkReady = setInterval(function () {
|
| 79 |
+
if (window.term) {
|
| 80 |
+
clearInterval(checkReady);
|
| 81 |
+
bindToolbar(window.term);
|
| 82 |
+
}
|
| 83 |
+
}, 100);
|
| 84 |
+
});
|
| 85 |
+
|
| 86 |
+
function bindToolbar(term) {
|
| 87 |
+
var keyMap = {
|
| 88 |
+
'Escape': '\x1b',
|
| 89 |
+
'Tab': '\t',
|
| 90 |
+
'ArrowUp': '\x1b[A',
|
| 91 |
+
'ArrowDown': '\x1b[B',
|
| 92 |
+
'ArrowLeft': '\x1b[D',
|
| 93 |
+
'ArrowRight': '\x1b[C',
|
| 94 |
+
'ctrl-c': '\x03',
|
| 95 |
+
'ctrl-r': '\x12'
|
| 96 |
+
};
|
| 97 |
+
|
| 98 |
+
document.querySelectorAll('#toolbar button').forEach(function (btn) {
|
| 99 |
+
btn.addEventListener('touchstart', function (e) {
|
| 100 |
+
e.preventDefault();
|
| 101 |
+
var seq = keyMap[btn.dataset.key];
|
| 102 |
+
if (seq && term._core && term._core.coreService) {
|
| 103 |
+
term._core.coreService.triggerDataEvent(seq, true);
|
| 104 |
+
}
|
| 105 |
+
}, { passive: false });
|
| 106 |
+
|
| 107 |
+
btn.addEventListener('click', function (e) {
|
| 108 |
+
var seq = keyMap[btn.dataset.key];
|
| 109 |
+
if (seq && term._core && term._core.coreService) {
|
| 110 |
+
term._core.coreService.triggerDataEvent(seq, true);
|
| 111 |
+
}
|
| 112 |
+
});
|
| 113 |
+
});
|
| 114 |
+
}
|
| 115 |
+
</script>
|
| 116 |
+
</body>
|
| 117 |
+
</html>
|