mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-02 23:03:59 +01:00
Nicer terminal, fixed scrolling
This commit is contained in:
19
terminal.php
19
terminal.php
@@ -59,8 +59,11 @@ sendCmd = function(command) {
|
||||
// OK reponse?
|
||||
if (xhr.status==200) {
|
||||
// Set the output to also include our response and scroll down to bottom
|
||||
document.getElementById('output').innerHTML += xhr.responseText;
|
||||
document.body.scrollTop = document.body.scrollHeight;
|
||||
var newOutput = document.createElement("DIV");
|
||||
newOutput.innerHTML = xhr.responseText;
|
||||
var cmdElem = document.getElementById("commandLine");
|
||||
cmdElem.parentNode.insertBefore(newOutput, cmdElem);
|
||||
top.document.getElementById("terminal").contentWindow.document.documentElement.scrollTop = document.getElementById('output').scrollHeight;
|
||||
|
||||
// Add command onto end of history array or set as last item in array
|
||||
if (currentLine == 0 || commandHistory[commandHistory.length-1].indexOf("[[ICEcoder]]:") !== 0) {
|
||||
@@ -91,17 +94,13 @@ $cwd = $ICEcoder['docRoot'].$ICEcoder['root'];
|
||||
<span class="close" onclick="top.get('terminal').style.display = 'none'">Close X</span>
|
||||
|
||||
<form name="shell" onsubmit="sendCmd(document.getElementById('command').value); return false" method="POST">
|
||||
<pre class="output" id="output">ICEcoder v <?php echo $ICEcoder["versionNo"];?> terminal
|
||||
<pre class="output" id="output"><span style="color: #0a0">ICEcoder v<?php echo $ICEcoder["versionNo"];?> terminal</span>
|
||||
This is a full powered terminal, but will have the permissions of the '<?php echo $user;?>' user.
|
||||
The more access rights you give that user, the more this terminal has.
|
||||
|
||||
Current dir:
|
||||
<?php echo $cwd;?>
|
||||
|
||||
|
||||
</pre>
|
||||
<div class="commandLine">$> <input type="text" class="command" id="command" onkeyup="key(event)" tabindex="1" autocomplete="off"></div>
|
||||
<div class="commandLine" id="commandLine"><div class="user"> <?php echo $user;?> </div><div class="path"> <?php echo $cwd;?> </div>
|
||||
<div class="promptVLine"></div><div class="promptHLine">─<div class="promptArrow">▶</div></div> <input type="text" class="command" id="command" onkeyup="key(event)" tabindex="1" autocomplete="off"></div></pre>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user