106 lines
4.9 KiB
HTML
106 lines
4.9 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<title>xterm.js demo</title>
|
|
<!--
|
|
WARNING: This demo is a barebones implementation designed for development and evaluation
|
|
purposes only. It is definitely NOT production ready and does not aim to be so. Exposing the
|
|
demo to the public as is would introduce security risks for the host.
|
|
-->
|
|
<link rel="shortcut icon" type="image/png" href="/logo.png">
|
|
<link rel="stylesheet" href="/xterm.css" />
|
|
<link rel="stylesheet" href="/style.css" />
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-promise/4.1.1/es6-promise.auto.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/1.0.0/fetch.min.js"></script>
|
|
</head>
|
|
<body>
|
|
<h1 style="color: #2D2E2C">xterm.js: A terminal for the <em style="color: #5DA5D5">web</em></h1>
|
|
<div id="container">
|
|
<div id="grid">
|
|
<div id="terminal-container"></div>
|
|
</div>
|
|
<div id="grid">
|
|
<div class="tab">
|
|
<button id= "optionsbutton" class="tabLinks" onclick="openSection(event, 'options')">Options</button>
|
|
<button id= "addonsbutton" class="tabLinks" onclick="openSection(event, 'addons')">Addons</button>
|
|
<button id= "stylebutton" class="tabLinks" onclick="openSection(event, 'style')">Style</button>
|
|
<button id= "testbutton" class="tabLinks" onclick="openSection(event, 'test')">Test</button>
|
|
</div>
|
|
<div id="options" class="tabContent">
|
|
<h3>Options</h3>
|
|
<p>These options can be set in the <code>Terminal</code> constructor or by using the <code>Terminal.setOption</code> function.</p>
|
|
<div id="options-container"></div>
|
|
</div>
|
|
<div id="addons" class="tabContent">
|
|
<h3>Addons</h3>
|
|
<p>Addons can be loaded and unloaded on a particular terminal to extend its functionality.</p>
|
|
<div id="addons-container"></div>
|
|
<h3>Addons Control</h3>
|
|
<h4>SearchAddon</h4>
|
|
<div style= "display:flex; flex-direction:column;">
|
|
<label>Find next <input id="find-next"/></label>
|
|
<label>Find previous <input id="find-previous"/></label>
|
|
<label><input type="checkbox" id="regex"/>Use regex</label>
|
|
<label><input type="checkbox" id="case-sensitive"/>Case sensitive</label>
|
|
<label><input type="checkbox" id="whole-word"/>Whole word</label>
|
|
</div>
|
|
<h4>SerializeAddon</h4>
|
|
<div>
|
|
<button id="serialize">Serialize the content of terminal</button>
|
|
<label><input type="checkbox" id="write-to-terminal">Write back to terminal</label>
|
|
<div><pre id="serialize-output"></pre></div>
|
|
</div>
|
|
</div>
|
|
<div id="style" class="tabContent">
|
|
<h3>Style</h3>
|
|
<div style="display: inline-block; margin-right: 16px;">
|
|
<label for="padding">Padding</label>
|
|
<input type="number" id="padding" />
|
|
</div>
|
|
</div>
|
|
<div id="test" class="tabContent">
|
|
<h3>Test</h3>
|
|
<div style="display: inline-block; margin-right: 16px;">
|
|
<button id="dispose" title="This is used to testing memory leaks">Dispose terminal</button>
|
|
<button id="custom-glyph" title="Write custom box drawing and block element characters to the terminal">Test custom glyphs</button>
|
|
<button id="load-test" title="Write several MB of data to simulate a lot of data coming from the process">Load test</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script src="dist/client-bundle.js" defer ></script>
|
|
<script>
|
|
var tab = localStorage.getItem("tab");
|
|
|
|
if(tab === null){
|
|
document.getElementById("options").style.display = "block";
|
|
document.getElementById("optionsbutton").classList.add("active");
|
|
}
|
|
else {
|
|
const tabContent = document.getElementsByClassName("tabContent");
|
|
let itr;
|
|
for (itr = 0; itr < tabContent.length; itr+=1) {
|
|
tabContent[itr].style.display = "none";
|
|
}
|
|
document.getElementById(""+tab+"").style.display = "block";
|
|
document.getElementById(""+tab+"button").classList.add("active");
|
|
}
|
|
function openSection(event, section) {
|
|
const tabContent = document.getElementsByClassName("tabContent");
|
|
let itr;
|
|
for (itr = 0; itr < tabContent.length; itr+=1) {
|
|
tabContent[itr].style.display = "none";
|
|
}
|
|
const tabLinks = document.getElementsByClassName("tabLinks");
|
|
for (itr = 0; itr < tabLinks.length; itr+=1) {
|
|
tabLinks[itr].className = tabLinks[itr].className.replace(" active", "");
|
|
}
|
|
document.getElementById(section).style.display = "block";
|
|
localStorage.setItem("tab", section);
|
|
event.currentTarget.className += " active";
|
|
}
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|