mirror of
https://github.com/seigler/fhqwhgads
synced 2025-07-27 06:46:10 +00:00
added fake replies of "command not found"
This commit is contained in:
parent
edae59d5e7
commit
adae1b71a7
8 changed files with 90 additions and 56 deletions
|
@ -1,4 +1,16 @@
|
|||
(function() {
|
||||
function escapeHTML(html) {
|
||||
var fn = function(tag) {
|
||||
var charsToReplace = {
|
||||
"&": "&",
|
||||
"<": "<",
|
||||
">": ">",
|
||||
'"': """
|
||||
};
|
||||
return charsToReplace[tag] || tag;
|
||||
};
|
||||
return html.replace(/[&<>"]/g, fn);
|
||||
}
|
||||
function syncTyping() {
|
||||
var beforeSelection, selection, afterSelection;
|
||||
beforeSelection = this.value.slice(0, this.selectionStart);
|
||||
|
@ -12,4 +24,13 @@
|
|||
commandline.onkeydown = syncTyping;
|
||||
commandline.onkeyup = syncTyping;
|
||||
commandline.onselect = syncTyping;
|
||||
function handleForm() {
|
||||
var scrollback = document.getElementById("scrollback");
|
||||
var val = this.command.value;
|
||||
this.command.value = "";
|
||||
document.getElementById("typing").innerHTML = "";
|
||||
scrollback.innerHTML = scrollback.innerHTML + "a>" + escapeHTML(val) + "<br>Command not found.<br>";
|
||||
return false;
|
||||
}
|
||||
document.forms[0].onsubmit = handleForm;
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue