var before = document.getElementById("before");
var liner = document.getElementById("liner");
var command = document.getElementById("typer");
var textarea = document.getElementById("texter");
var terminal = document.getElementById("terminal");
var git = 0;
var pw = false;
let pwd = false;
var gt = 0;
var wr = false;
let wrd = false;
let wrr = false;
let wrdd = false;
var commands = [];
setTimeout(function() {
loopLines(banner, "", 80);
textarea.focus();
}, 100);
window.addEventListener("keyup", enterKey);
console.log(
"%cYou hacked my password!😠",
"color: #04ff00; font-weight: bold; font-size: 24px;"
);
console.log("%cPassword: '" + password + "' - I wonder what it does?🤔", "color: grey");
console.log(
"%cYou hacked my password!😠",
"color: #04ff00; font-weight: bold; font-size: 24px;"
);
console.log("%cPassword: '" + who + "' - I wonder what it does?🤔", "color: grey");
//init
textarea.value = "";
command.innerHTML = textarea.value;
function enterKey(e) {
if (e.keyCode == 181) {
document.location.reload(true);
}
if (pw) {
let et = "*";
let w = textarea.value.length;
command.innerHTML = et.repeat(w);
if (textarea.value === password) {
pwd = true;
}
if (pwd && e.keyCode == 13) {
loopLines(secret, "color2 margin", 120);
command.innerHTML = "";
textarea.value = "";
pwd = false;
pw = false;
liner.classList.remove("password");
} else if (e.keyCode == 13) {
addLine("Wrong password", "error", 0);
command.innerHTML = "";
textarea.value = "";
pw = false;
liner.classList.remove("password");
}
}
if (wr) {
// Set the command text to the value of the textarea
command.innerHTML = textarea.value;
// Check if the textarea value matches any of the expected values
if (textarea.value === adil || textarea.value === Adil || textarea.value === ADIL) {
wrd = true;
} else if (textarea.value === jaber) {
wrdd = true;
}
// If the textarea value matches, execute the appropriate function
if (wrd && e.keyCode == 13) {
loopLines(whois, social, "color2 margin", 120);
loopLines(social, "color2 margin", 120);
command.innerHTML = "";
textarea.value = "";
wrd = false;
wr = false;
liner.classList.remove("who");
} else if (wrdd && e.keyCode == 13) {
loopLines(jb, "color2 margin", 120);
loopLines(socialjb, "color2 margin", 120);
command.innerHTML = "";
textarea.value = "";
wrdd = false;
wrr = false;
liner.classList.remove("who");
} else if (e.keyCode == 13) {
// If the textarea value doesn't match, display an error message
addLine("We don't know anything about this person yet", "error", 0);
command.innerHTML = "";
textarea.value = "";
wrr = false;
wr = false;
liner.classList.remove("who");
}
}
else {
if (e.keyCode == 13) {
commands.push(command.innerHTML);
git = commands.length;
addLine("visitor@asadqi.com:~$ " + command.innerHTML, "no-animation", 0);
commander(command.innerHTML.toLowerCase());
command.innerHTML = "";
textarea.value = "";
}
if (e.keyCode == 38 && git != 0) {
git -= 1;
textarea.value = commands[git];
command.innerHTML = textarea.value;
}
if (e.keyCode == 40 && git != commands.length) {
git += 1;
if (commands[git] === undefined) {
textarea.value = "";
} else {
textarea.value = commands[git];
}
command.innerHTML = textarea.value;
}
}
}
function commander(cmd) {
switch (cmd.toLowerCase()) {
case "help":
loopLines(help, "color2 margin", 80);
break;
case "menu":
loopLines(help, "color2 margin", 80);
break;
case "ls":
loopLines(help, "color2 margin", 80);
break;
case "root":
loopLines(root, "color2 margin", 80);
break;
case "whois":
loopLines(whois, "color2 margin", 80);
break;
case "adil":
loopLines(whois, "color2 margin", 120);
break;
case "jaber":
addLine("Jaber Sadqi...", "color2", 80);
loopLines(socialjb, "color2 margin", 120);
break;
case "whoami":
loopLines(whoami, "color2 margin", 80);
break;
case "cloud":
addLine("Opening Cloud...", "color2", 80);
newTab(cloud);
break;
case "youtube":
addLine("Opening Youtube...", "color2", 80);
setTimeout(function() {
window.open('https://www.youtube.com');
}, 1000);
break;
case "google":
addLine("Opening Google...", "color2", 80);
setTimeout(function() {
window.open('https://www.google.com');
}, 1000);
break;
case "update":
addLine("Opening Updater...", "color2", 80);
setTimeout(function() {
var url = '/update';
var win = window.open(url, '_self');
if (win) {
win.addEventListener('load', function() {
win.document.documentElement.requestFullscreen();
});
}
}, 1000);
break;
case "sudo":
addLine("Oh no, you're not admin...", "color2", 80);
addLine("---------------------------","color2", 80);
loopLines(help, "color2 margin", 80);
break;
case "version":
addLine("ASCODES v3.0.1", "color2", 80);
setTimeout(function() {
},800);
break;
case "creator":
addLine("Adil Sadqi", "color2", 80);
setTimeout(function() {
},800);
break;
case "exit":
addLine("Thank you for your visit. Goodbye!", "color2", 80);
setTimeout(function() {
window.open('','_parent','');
window.setTimeout(function() {
window.location.href = 'about:blank';
window.close();
}, 500);
}, 2500);
break;
case "close":
addLine("Thank you for your visit. Goodbye!", "color2", 80);
setTimeout(function() {
window.open('','_parent','');
window.setTimeout(function() {
window.location.href = 'about:blank';
window.close();
}, 500);
}, 2500);
break;
case "update1":
loopLines(update, "color2 margin", 1000);
setTimeout(function() {
location.reload();
}, 17000);
break;
case "social":
loopLines(social, "color2 margin", 80);
break;
case "secret":
liner.classList.add("password");
pw = true;
break;
case "projects":
loopLines(projects, "color2 margin", 80);
break;
case "password":
addLine(" Lol! You're joking, right? You\'re gonna have to try harder than that!😂", "error", 100);
break;
case "weather":
loopLines(weather, "color2 margin", 10);
break;
case "sadqi":
liner.classList.add("who");
wr = true;
wrr = true;
break;
case "history":
addLine("
", "", 0);
loopLines(commands, "color2", 80);
addLine("
", "command", 80 * commands.length + 50);
break;
case "email":
addLine('Opening mailto:adil@asadqi.com...', "color2", 80);
newTab(email);
break;
case "clear":
setTimeout(function() {
terminal.innerHTML = '';
before = document.getElementById("before");
}, 1);
break;
case "banner":
loopLines(banner, "", 80);
break;
// socials
case "cloud":
addLine("Opening Cloud...", "color2", 80);
newTab(cloud);
break;
case "twitter":
addLine("Opening Twitter...", "color2", 0);
newTab(twitter);
break;
case "whatsapp":
addLine("Opening Whatsapp...", "color2", 0);
newTab(whatsapp);
break;
case "discord":
addLine("Opening Discord...", "color2", 0);
newTab(discord);
break;
case "instagram":
addLine("Opening Instagram...", "color2", 0);
newTab(instagram);
break;
case "phone":
addLine("Opening Phone Number...", "color2", 0);
newTab(phone);
break;
case "windows":
addLine("Starting Windows Sadqi...", "color2", 0);
setTimeout(() => {
newTab(website);
}, 2000);
break;
case "curl":
addLine("Opening Website...", "color2", 0);
newTab(curl);
break;
default:
addLine("Command not found. For a list of commands, type 'help'.", "error", 100);
break;
}
}
function newTab(link) {
setTimeout(function() {
window.open(link, "_blank");
}, 500);
}
function addLine(text, style, time) {
var t = "";
for (let i = 0; i < text.length; i++) {
if (text.charAt(i) == " " && text.charAt(i + 1) == " ") {
t += " ";
i++;
} else {
t += text.charAt(i);
}
}
setTimeout(function() {
var next = document.createElement("p");
next.innerHTML = t;
next.className = style;
before.parentNode.insertBefore(next, before);
window.scrollTo(0, document.body.offsetHeight);
}, time);
}
function loopLines(name, style, time) {
name.forEach(function(item, index) {
addLine(item, style, index * time);
});
}