fix error.ts gets alwaysExecuted

This commit is contained in:
jonasled 2021-02-28 14:09:57 +01:00
parent bb4479f825
commit a286aa09f4
3 changed files with 17 additions and 9 deletions

View file

@ -56,5 +56,8 @@ if (strpos($_SERVER['HTTP_HOST'], '.onion') !== false) {
]; ];
</script> </script>
<script src="/js/script.js"></script> <script src="/js/script.js"></script>
<script>
startNewTask();
</script>
</body> </body>
</html> </html>

View file

@ -59,6 +59,9 @@ function getError500()
]; ];
</script> </script>
<script src="/js/script.js"></script> <script src="/js/script.js"></script>
<script>
startNewTask();
</script>
</body> </body>
</html> </html>
EOF; EOF;

View file

@ -2,14 +2,14 @@ import Timeout = NodeJS.Timeout;
let intervalTime = 150; let intervalTime = 150;
let terminal:HTMLElement = <HTMLElement> document.getElementsByClassName("terminal")[0];
let historyContainer:HTMLElement = <HTMLElement> terminal.getElementsByClassName("history")[0];
let promptContainer:HTMLElement = <HTMLElement> terminal.getElementsByClassName("prompt")[0];
let dataIndex = 0; let dataIndex = 0;
let stringPosition = 0; let stringPosition = 0;
let printTask: Timeout; let printTask: Timeout;
let terminal:HTMLElement;
let historyContainer:HTMLElement;
let promptContainer:HTMLElement;
function writeOut() { function writeOut() {
// @ts-ignore // @ts-ignore
@ -33,7 +33,9 @@ function writeOut() {
} }
function startNewTask() { function startNewTask() {
terminal = <HTMLElement> document.getElementsByClassName("terminal")[0];
historyContainer = <HTMLElement> terminal.getElementsByClassName("history")[0];
promptContainer = <HTMLElement> terminal.getElementsByClassName("prompt")[0];
printTask = setInterval(writeOut, intervalTime); printTask = setInterval(writeOut, intervalTime);
} }
startNewTask();