-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathterminal.html
243 lines (221 loc) · 8.02 KB
/
terminal.html
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
/* CSS Styles */
/* Body styling */
body {
font-family: 'Courier New', monospace;
background-color: #000;
color: #00ff00;
margin: 0;
padding: 0;
}
/* Terminal Button */
.terminal-button {
position: fixed;
bottom: 20px;
right: 20px;
background-color: #00ff00;
color: #000;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
z-index: 1000;
}
/* Terminal Popup */
.terminal-popup {
display: none;
position: fixed;
bottom: 0;
right: 0;
width: 400px;
height: 300px;
background-color: #000;
color: #00ff00;
border: 2px solid #00ff00;
border-radius: 5px;
overflow: hidden;
}
/* Terminal Header */
.terminal-header {
background-color: #111;
padding: 10px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
.terminal-button-close {
float: right;
cursor: pointer;
font-size: 20px;
line-height: 1;
}
/* Terminal Content */
.terminal-content {
padding: 10px;
max-height: 230px;
overflow-y: scroll;
background-color: #000;
}
/* Terminal Input */
.terminal-input-container {
background-color: transparent;
padding: 10px;
display: flex;
align-items: center;
}
.terminal-prompt {
color: #00ff00;
margin-right: 5px;
}
.terminal-input {
background-color: transparent;
color: #00ff00;
border: none;
outline: none;
width: 100%;
font-family: 'Courier New', monospace;
font-size: 16px;
}
/* Terminal Output Styles */
.terminal-output {
color: #00ff00;
font-weight: bold;
}
/* Command List Styles */
.terminal-content ul {
list-style-type: none;
margin: 0;
padding: 0;
}
.terminal-content li {
padding: 5px 0;
}
/* Cursor Blinking Animation */
@keyframes cursor-blink {
0%, 100% {
border-right: 2px solid transparent;
}
50% {
border-right: 2px solid #00ff00;
}
}
/* Apply cursor blink animation to the input */
.terminal-input:focus {
animation: cursor-blink 0.8s infinite;
}
</style>
<title>Portfolio</title>
</head>
<body>
<!-- Your website content goes here -->
<!-- Terminal Button -->
<button class="terminal-button" id="openTerminalButton">Open Terminal</button>
<!-- Terminal Popup -->
<div class="terminal-popup" id="terminalPopup">
<div class="terminal-header">
<span class="terminal-button-close" id="closeButton">×</span>
Terminal
</div>
<div class="terminal-content">
<p>Welcome to My Portfolio Terminal</p>
<p>Type one of the following commands:</p>
<ul>
<li>home - Go to the Home page</li>
<li>about - Go to the About Me page</li>
<li>portfolio - Go to the Portfolio page</li>
<li>contact - Go to the Contact page</li>
<li>blog - Go to the Blog page</li>
<li>clear - Clear the terminal</li>
<li>help - Display this help message</li>
</ul>
</div>
<div class="terminal-input-container">
<span class="terminal-prompt">$</span>
<input class="terminal-input" id="terminalInput" type="text" autofocus>
</div>
</div>
<!-- JavaScript -->
<script>
document.addEventListener("DOMContentLoaded", function () {
const terminalPopup = document.getElementById("terminalPopup");
const closeButton = document.getElementById("closeButton");
const terminalInput = document.getElementById("terminalInput");
const terminalContent = document.querySelector(".terminal-content");
const openTerminalButton = document.getElementById("openTerminalButton");
// Function to open the terminal popup
function openTerminal() {
terminalPopup.style.display = "block";
}
// Function to close the terminal popup
function closeTerminal() {
terminalPopup.style.display = "none";
}
// Event listeners
closeButton.addEventListener("click", closeTerminal);
openTerminalButton.addEventListener("click", openTerminal);
// Function to handle user input
function handleCommand(command) {
switch (command.toLowerCase()) {
case "home":
// Redirect to the Home page
window.location.href = "home.html";
break;
case "about":
// Redirect to the About Me page
window.location.href = "about.html";
break;
case "portfolio":
// Redirect to the Portfolio page
window.location.href = "portfolio.html";
break;
case "contact":
// Redirect to the Contact page
window.location.href = "contact.html";
break;
case "blog":
// Redirect to the Blog page
window.location.href = "blog.html";
break;
case "clear":
// Clear the terminal content
terminalContent.innerHTML = "";
break;
case "help":
// Display the help message
terminalContent.innerHTML += `
<p>Type one of the following commands:</p>
<ul>
<li>home - Go to the Home page</li>
<li>about - Go to the About Me page</li>
<li>portfolio - Go to the Portfolio page</li>
<li>contact - Go to the Contact page</li>
<li>blog - Go to the Blog page</li>
<li>clear - Clear the terminal</li>
<li>help - Display this help message</li>
</ul>`;
break;
default:
// Display an error message for invalid commands
terminalContent.innerHTML += `<p>Invalid command: ${command}. Type "help" for a list of commands.</p>`;
}
// Clear the input field
terminalInput.value = "";
}
// Listen for user input
terminalInput.addEventListener("keydown", function (event) {
if (event.key === "Enter") {
const input = terminalInput.value;
terminalContent.innerHTML += `<p><span class="terminal-output">$</span> ${input}</p>`;
handleCommand(input);
}
});
// Open the terminal when the page loads (you can remove this if not needed)
openTerminal();
});
</script>
</body>
</html>