Skip to content

Commit 24e179c

Browse files
committed
- changed output from div to textarea
1 parent 18613b8 commit 24e179c

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

commandline/library/lCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static function getResult(){
5050
}
5151

5252
static function write($result){
53-
$_SESSION["phpcommandline"]["commandresult"] .= (strlen($_SESSION["phpcommandline"]["commandresult"])==0 ? "" : "<br>").$result;
53+
$_SESSION["phpcommandline"]["commandresult"] .= (strlen($_SESSION["phpcommandline"]["commandresult"])==0 ? "" : "\n").$result;
5454
}
5555

5656
private static function popCommand(){

commandline/programs/help/init.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<?php
22
function helpMain($args, $command){
33
lCommand::write("> $command");
4-
$content = "pre-installed programs:<br>";
4+
$content = "pre-installed programs:\n";
55
$dirs = array_filter(glob('programs/*'), 'is_dir');
66
foreach($dirs as $i=>$s){
7-
$content .= " - ".str_replace("programs/", "", $s).(($i<count($dirs)-1) ? "<br>" : "");
7+
$content .= " - ".str_replace("programs/", "", $s).(($i<count($dirs)-1) ? "\n" : "");
88
}
9-
$content .= "<br>custom programs:<br>";
9+
$content .= "\ncustom programs:\n";
1010
$dirs = array_filter(glob('../programs/*'), 'is_dir');
1111
foreach($dirs as $i=>$s){
12-
$content .= " - ".str_replace("../programs/", "", $s).(($i<count($dirs)-1) ? "<br>" : "");
12+
$content .= " - ".str_replace("../programs/", "", $s).(($i<count($dirs)-1) ? "\n" : "");
1313
}
1414
lCommand::write($content);
1515
}

commandline/programs/more/init.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function moreMain($args, $command){
33
lCommand::write("> $command");
44
if(count($args)==1){
55
if(lSystem::fileExists(lSystem::getPWD()."/".$args[0])){
6-
lCommand::write(nl2br(htmlentities(file_get_contents(lSystem::getPWD()."/".$args[0]))));
6+
lCommand::write(htmlentities(file_get_contents(lSystem::getPWD()."/".$args[0])));
77
}else{
88
lCommand::write("file not found");
99
}

index.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#content{
1515
position: absolute;
1616
bottom: 50px;
17-
max-height: calc(100vh - 50px);
17+
height: calc(100vh - 50px);
1818
overflow: auto;
1919
width: calc(100% - 32px);
2020
}
@@ -83,7 +83,7 @@ class CommandLine{
8383
xhttp.send();
8484
}
8585
static print(content){
86-
document.getElementById("content").innerHTML += "<br>"+content;
86+
document.getElementById("content").innerHTML += "\n"+content;
8787
document.getElementById("content").scrollTop = document.getElementById("content").scrollHeight;
8888
}
8989
static reset(content){
@@ -102,7 +102,7 @@ class CommandLine{
102102
if (this.readyState == 4 && this.status == 200) {
103103
let answer = JSON.parse(xhttp.responseText);
104104
console.log(answer);
105-
if(answer["return"]!=null) document.getElementsByTagName('textarea')[0].value += answer["return"];
105+
if(answer["return"]!=null && answer["return"]!="") document.getElementsByTagName('textarea')[0].value += answer["return"];
106106
}
107107
};
108108
xhttp.open("GET", "commandline/autocomplete.php?input="+encodeURIComponent(input), true);
@@ -114,7 +114,7 @@ class CommandLine{
114114
</script>
115115
</head>
116116
<body ondblclick="document.getElementsByTagName('textarea')[0].focus();">
117-
<div id="content" class="content"></div>
118117
<div class="input"><span>$</span><textarea autocomplete="off" spellcheck="false" autofocus rows="1" onkeydown="CommandLine.parseCommand(event);"></textarea></div>
118+
<textarea disabled id="content" class="content"></textarea>
119119
</body>
120120
</html>

0 commit comments

Comments
 (0)