Skip to content

Commit df715ef

Browse files
committed
Fix: Terminal project link, JS and docs
1 parent 918e222 commit df715ef

File tree

4 files changed

+60
-21
lines changed

4 files changed

+60
-21
lines changed

Hackerman/script.js

Lines changed: 53 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,58 @@
11
const commandInput = document.querySelector(".commandField");
22
const output = document.querySelector(".output");
33
const outputContainer = document.querySelector(".command-output");
4-
const commands = ["help", "clear"];
4+
const commands = ["help", "clear", "connect", "contribute"];
55

6-
const executeCommand = (cmd) => {
6+
// help cmd output
7+
const showAllAvailableCmds = (messageBox) => {
8+
9+
// list down all commands from array
10+
messageBox.innerHTML += " <br>Available Commands to use are: ";
11+
commands.forEach((cmd) => {
12+
messageBox.innerHTML += `<br> → ${cmd}`;
13+
});
14+
15+
messageBox.innerHTML += "<br><br>» We are looking for contributors to improve this projects, are you interested? <br>» Type \'contribute\' and become a open-source buddy for Web-Projects.";
16+
}
17+
18+
// clear cmd output
19+
const clearTerminal = () => {
20+
// erase everything from output-container
21+
outputContainer.innerHTML = '';
22+
}
23+
24+
// connect cmd output
25+
const openGitHubProfile = () => {
26+
// open my github profile
27+
window.open("https://github.com/Alkaison");
28+
}
29+
30+
// open github repo for contribution
31+
const contributionLink = () => {
32+
// open github repo
33+
window.open("https://github.com/Alkaison/Web-Projects/");
34+
}
35+
36+
// executes functions as per command match
37+
const executeCommand = (cmd, messageBox) => {
738
switch(cmd)
839
{
9-
case 'help':
10-
console.log("Help cmd");
40+
case "help":
41+
showAllAvailableCmds(messageBox);
42+
break;
43+
case "clear":
44+
clearTerminal(messageBox);
1145
break;
12-
case 'clear':
13-
console.log("Clear cmd");
46+
case "connect":
47+
openGitHubProfile();
48+
break;
49+
case "contribute":
50+
contributionLink();
1451
break;
1552
}
1653
}
1754

55+
// validate the commands
1856
commandInput.addEventListener("keydown", (e) => {
1957

2058
// get command from input box
@@ -26,17 +64,19 @@ commandInput.addEventListener("keydown", (e) => {
2664
// create new element and append it on output
2765
const createElement = output.cloneNode(true);
2866
const outputTextMessage = createElement.querySelector(".outputText");
29-
3067
createElement.style.display = "block";
3168
outputTextMessage.textContent = inputCommand;
32-
outputContainer.append(createElement);
33-
34-
// clear the input box
35-
commandInput.value = '';
3669

70+
// append the message
3771
if(commands.includes(inputCommand))
38-
executeCommand(inputCommand);
72+
executeCommand(inputCommand, outputTextMessage);
3973
else
40-
outputTextMessage.setHTML(`<br> ${inputCommand} Command not found. Type \'help\' for list of available commands.`);
74+
outputTextMessage.innerHTML += "<br>Command not found. Type \'help\' for list of available commands.";
75+
76+
// clear the input box and append the element
77+
commandInput.value = '';
78+
79+
if(inputCommand != "clear")
80+
outputContainer.append(createElement);
4181
}
4282
});

Hackerman/style.css

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,15 @@ body {
103103
}
104104
.command-input {
105105
width: 100%;
106-
white-space: nowrap;
106+
/* white-space: nowrap; */
107107
}
108108
.commandLine {
109109
display: inline-block;
110-
width: fit-content;
111110
white-space: nowrap;
112111
color: green;
113112
}
114113
.commandField {
115-
width: 81%;
114+
width: 70%;
116115
font-size: 20px;
117116
letter-spacing: 0.8px;
118117
color: lightgreen;
137 KB
Loading

index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ <h1 id="nameTitle">Alkaison</h1>
3131
<div class="projects-container">
3232

3333
<article class="project-card">
34-
<a href="#">
35-
<img class="project-image" src="./images/comingsoon.png" alt="Demo">
36-
<p class="project-title">Kali Linux Terminal</p>
37-
<p class="project-description">Clone Kali Linux Terminal: Interactive web implementation replicating the Kali Linux terminal.</p>
34+
<a href="./Hackerman/index.html">
35+
<img class="project-image" src="./images/projects/Kali_Linux_Terminal.png" alt="Demo">
36+
<p class="project-title">Linux Terminal [Contribute]</p>
37+
<p class="project-description">Interactive web implementation replicating the Kali Linux terminal, Contribute to increase its features.</p>
3838
<p class="tags">
39-
<span class="project-difficulty">Hard</span>
39+
<span class="project-difficulty">Medium</span>
4040
<span class="project-link">Try »</span>
4141
</p>
4242
</a>

0 commit comments

Comments
 (0)