-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
39 lines (35 loc) · 955 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
function draw(string) {
document.getElementById("result").innerHTML += string;
}
function br() {
draw("<br />" + ps1);
}
function execute(string) {
draw("<br />Now loading '" + string + "'...");
}
function blink(){
if (document.getElementById("cursor").style.visibility == "visible") {
document.getElementById("cursor").style.visibility = "hidden";
} else {
document.getElementById("cursor").style.visibility = "visible";
}
setTimeout(blink, 500);
}
window.onload = function() {
document.getElementById("wrapper").innerHTML += init;
document.getElementById("wrapper").innerHTML += "<span id='result'>"+ ps1 +"</span><span id='cursor'>_</span>";
blink();
window.document.onkeydown = function(e) {
if (!e) e = window.event;
if (e.ctrlKey || e.altKey) return;
var kc = e.keyCode;
if (kc == 13) {
br();
return;
}
if (kc in shortcuts) {
execute(shortcuts[kc]["title"]);
location.href = shortcuts[kc]["url"];
}
}
}