Version 2.1.0 release

This commit is contained in:
Maciej Pędzich 2020-12-13 18:01:59 +01:00
parent 121373f114
commit 761638ebb0
4 changed files with 118 additions and 92 deletions

View File

@ -1,5 +1,11 @@
# Changelog # Changelog
## v2.1.0
- Remove unnecessary "exit" command
- Remove native webstie scrollbar
- Add command retyping using up and down arrows
## v2.0.1 ## v2.0.1
- Fix "unkown" typo - Fix "unkown" typo
@ -7,4 +13,4 @@
## v2.0.0 ## v2.0.0
- Initial version 2.x.x release - Initial version 2.x.y release

View File

@ -1,10 +1,11 @@
@font-face { @font-face {
font-family: "VGA 437"; font-family: 'VGA 437';
src: url("../fonts/vga437.ttf"); src: url('../fonts/vga437.ttf');
} }
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
body, #cmd { body,
#cmd {
color: whitesmoke; color: whitesmoke;
} }
@ -14,7 +15,8 @@
} }
@media (prefers-color-scheme: light) { @media (prefers-color-scheme: light) {
body, #cmd { body,
#cmd {
color: black; color: black;
} }
@ -23,8 +25,13 @@
} }
} }
body, #cmd { body {
font-family: "VGA 437"; overflow: hidden;
}
body,
#cmd {
font-family: 'VGA 437';
font-size: 1.5rem; font-size: 1.5rem;
} }
@ -36,7 +43,9 @@ body, #cmd {
margin: 0.5rem auto; margin: 0.5rem auto;
} }
#header > #hint, #input-container, #cmd-history { #header > #hint,
#input-container,
#cmd-history {
margin-top: 1.8rem; margin-top: 1.8rem;
} }
@ -54,9 +63,10 @@ body, #cmd {
#cmd { #cmd {
border: none; border: none;
background: none; background: none;
flex: 1 flex: 1;
} }
#cmd:active, #cmd:focus { #cmd:active,
#cmd:focus {
outline: none; outline: none;
} }

View File

@ -18,13 +18,13 @@ window.addEventListener('keypress', (evt) => {
cmdToSave.textContent = `> ${command}`; cmdToSave.textContent = `> ${command}`;
cmdHistoryElement.append(cmdToSave); cmdHistoryElement.append(cmdToSave);
switch (command) { switch (command.toLowerCase()) {
default: default:
output.style.color = 'red'; output.style.color = 'red';
output.textContent = `ERROR: Unknown command '${command}'`; output.textContent = `ERROR: Unknown command '${command}'`;
break; break;
case 'about': case 'about':
const age = today.getFullYear() - new Date('2005-05-08').getFullYear() const age = today.getFullYear() - new Date('2005-05-08').getFullYear();
output.textContent = `Maciej Pedzich is a ${age}-year-old high school student from Kielce, Poland. output.textContent = `Maciej Pedzich is a ${age}-year-old high school student from Kielce, Poland.
He makes web applications using Vue.js, Node.js, Express and MongoDB/PostgreSQL, but he likes experimenting with other solutions too. He makes web applications using Vue.js, Node.js, Express and MongoDB/PostgreSQL, but he likes experimenting with other solutions too.
He believes that by being creative and cooperating with others, you can achieve success. He believes that by being creative and cooperating with others, you can achieve success.
@ -34,19 +34,16 @@ window.addEventListener('keypress', (evt) => {
output.innerHTML = `Email address: output.innerHTML = `Email address:
<a href="mailto:contact@maciejpedzi.ch">contact@maciejpedzi.ch</a>`; <a href="mailto:contact@maciejpedzi.ch">contact@maciejpedzi.ch</a>`;
break; break;
case 'exit':
window.close();
break;
case 'github': case 'github':
window.open('https://github.com/maciejpedzich'); window.open('https://github.com/maciejpedzich');
break; break;
case 'help': case 'help':
output.innerHTML = `<p>about - shows everything you need to know about Maciej</p> output.innerHTML = `<p>about - shows everything you need to know about Maciej</p>
<p>contact - displays contact information</p> <p>contact - displays contact information</p>
<p>exit - closes this page</p>
<p>github - shows Maciej's Github profile</p> <p>github - shows Maciej's Github profile</p>
<p>help - displays a list of available commands</p> <p>help - displays a list of available commands</p>
<p>skills - presents a set of current skills</p>`; <p>skills - presents a set of current skills</p>
<p>Use up and down arrows to retype previous commands</p>`;
break; break;
case 'skills': case 'skills':
output.innerHTML = `<p>Frontend: HTML, CSS, JavaScript, TypeScript, Vue.js</p> output.innerHTML = `<p>Frontend: HTML, CSS, JavaScript, TypeScript, Vue.js</p>
@ -63,3 +60,15 @@ window.addEventListener('keypress', (evt) => {
input.scrollIntoView(); input.scrollIntoView();
} }
}); });
window.addEventListener('keydown', (evt) => {
if (cmdHistory.length > 0) {
if (evt.key === 'ArrowUp') {
cmdIndex - 1 >= 0 ? cmdIndex-- : (cmdIndex = cmdHistory.length - 1);
input.value = cmdHistory[cmdIndex];
} else if (evt.key === 'ArrowDown') {
cmdIndex + 1 < cmdHistory.length ? cmdIndex++ : (cmdIndex = 0);
input.value = cmdHistory[cmdIndex];
}
}
});

View File

@ -1,24 +1,25 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8" />
<meta name="description" content="Maciej Pędzich - full-stack web developer, high school student, retro video games and F1 fan. All in one person."> <meta
<meta name="viewport" content="width=device-width, initial-scale=1.0"> name="description"
content="Maciej Pędzich - full-stack web developer, high school student, retro video games and F1 fan. All in one person."
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Maciej Pędzich</title> <title>Maciej Pędzich</title>
<link rel="stylesheet" href="./assets/css/style.css"> <link rel="stylesheet" href="./assets/css/style.css" />
</head> </head>
<body> <body>
<div id="header"> <div id="header">
<p>maciejpedzi.ch [Version 2.0.1]</p> <p>maciejpedzi.ch [Version 2.1.0]</p>
<p> <p>(c) Maciej Pedzich, 2020-<span id="currentYear"></span></p>
(c) Maciej Pedzich, 2020-<span id="currentYear"></span>
</p>
<p id="hint">Welcome! Type 'help' for more information</p> <p id="hint">Welcome! Type 'help' for more information</p>
</div> </div>
<div id="cmd-history"></div> <div id="cmd-history"></div>
<div id="input-container"> <div id="input-container">
<div id="bracket">></div> <div id="bracket">></div>
<input type="text" id="cmd"> <input type="text" id="cmd" />
</div> </div>
<script src="./assets/js/script.js"></script> <script src="./assets/js/script.js"></script>
</body> </body>