Hi,
I was fancying a way to get the last entered command in the console by pressing the up arrow so I wrote this piece of code in accordance with the actual ending script of "console.php". I think you'll understand where you should put it :
Code
var lastCom;
$('#c-input').keyup(function(e) {
if (e.keyCode == 13) {
val = $('#c-input').val();
$.post('/ajax.php?ajx=command', {cmd: val, u: 'username'});
$('#c-input').val('');
lastCom = val;
setTimeout("getlog()", 500);
} else if (e.keyCode == 38) {
// KeyCode 38 = Up arrow
$('#c-input').val(lastCom);
} else if (e.keyCode == 40) {
//KeyCode 40 = Down arrow
$('#c-input').val('');
}
});
Display More
I tried to do that with a string array to go back further in the command history (by registering each command in an array and setting the value of c-input as array[the number of times the user pressed the up arrow]) but I didn't succeed...
I hope you'll accept my code,
Regards,
Paul