K
K
KRHD2015-10-18 22:55:34
PHP
KRHD, 2015-10-18 22:55:34

Is there a fake console script somewhere??

Hi all. Interested in such a thing.
There is a block. Inside the fake block, the console is blurred
. Type:
load miha.dat... Creating file!
[Connect] User miha, IP 78.25.120.131

Well, how can you make one line added every second?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2015-10-19
@KRHD

I sketched out a simple example for you ( jsfiddle.net/0tv0pv66 ). I hope that it will not be difficult to modify it to suit your requirements.

var data = [
    ['load miha.dat... Creating file!', 2000],
    ['[Connect] User miha, IP 78.25.120.131', 2500],
    ['Connect Ok', 1500],
    ['Uploading virus', 3000],
    ['Uploading Ok', 1500],
    ['Read the personal data', 4000],
    ['Credit Card Number Ok', 1500],
    ['Password Ok', 1500],
    ['Goodbye, money!', 1500],
    ['[Disconnect] User miha', 1000],
    ['Disconnect Ok!', 0]
],
i = 0,
cons = $('#console'),
consH = cons.outerHeight(),
cursor = $('<span id="cursor">&nbsp;</span>');

function addString() {
    if (typeof data[i] != 'undefined') {
        $('<p>' + data[i][0] + '</p>').appendTo(cons).append(cursor);
        if (cons[0].scrollHeight > consH) {
            $('p:first-child', cons).remove();
        }
        setTimeout(addString, data[i][1]);
        i++;
    }
}
addString();

If necessary, you can add "buns" ;)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question