diff --git a/config.toml b/config.toml
index 61f7d5f..0ba7103 100644
--- a/config.toml
+++ b/config.toml
@@ -16,7 +16,7 @@ smart_punctuation = true
git = "https://git.filiprojek.cz/fr/website"
nav_items = [
{name="Home", path="/"},
- {name="About", path="/about"},
- {name="Projects", path="/projects/"},
+ #{name="About", path="/about"},
+ #{name="Projects", path="/projects/"},
]
diff --git a/static/js/console.js b/static/js/console.js
index f2a6869..56bd92a 100644
--- a/static/js/console.js
+++ b/static/js/console.js
@@ -1,53 +1,63 @@
const c = document.querySelector(".console")
const ps1 = "[fr@website ~]$ "
+const motd = "Welcome to my website!
You can use `help` for more informations :)"
let line = "";
-let command = ""
function exec(command) {
- console.log(command)
-
switch (command[0]) {
case "help":
- line = "about
projects
contact
"
+ line = "help
author
contact
clear
echo"
break;
case "author":
line = "Filip Rojek, 2023"
break
case "contact":
- line = "Filip Rojek <filip@filiprojek.cz>
web: www.filiprojek.cz
telegram: @filiprojek"
+ line = "Filip Rojek <filip@filiprojek.cz>
web: www.filiprojek.cz
telegram: @filiprojek"
break
case "clear":
write("000ctrll")
+ return false
+ case "echo":
+ line = ""
+ command.forEach((cmd, i) => {
+ if (i === 0) return
+ line += cmd + " "
+ });
+ line = line.substring(0, line.length - 1) // remove last space
break
default:
line = "frsh: " + command[0] + ": command not found"
break;
}
- l = document.createElement("p").innerHTML = line
- c.appendChild(l)
+ return line
}
-function write(key) {
- console.log("KEY:", key)
+function write(key, payload) {
switch(key) {
case "Enter":
+ command = c.lastChild.textContent.replace(ps1, "")
command = command.split(" ");
- exec(command)
- line = document.createElement("p")
- line.innerHTML += ps1
- c.appendChild(line)
+ let out = exec(command)
+ if(out !== false) {
+ line = document.createElement("p")
+ line.innerHTML += out
+ line.innerHTML += "
"
+ c.appendChild(line)
+ line = document.createElement("p")
+ line.innerHTML += ps1
+ c.appendChild(line)
+ }
command = ""
break
case "000ctrll":
c.innerHTML = ""
+ if(payload == motd) c.innerHTML = motd
line = document.createElement("p")
line.innerHTML += ps1
c.appendChild(line)
break
case "000backspace":
- console.log(c.textContent.slice(0, -1))
- console.log(ps1 == c.textContent)
if(c.lastChild.textContent.slice(0, -1) !== ps1.slice(0, -1)) {
c.lastChild.innerHTML = c.lastChild.textContent.slice(0, -1)
}
@@ -55,7 +65,6 @@ function write(key) {
default:
c.lastChild.innerHTML += key
- command += key
}
}
@@ -70,7 +79,14 @@ function customCtrlShortcuts(plusKey) {
// On load init the terminal
window.addEventListener("load", () => {
- write("000ctrll")
+ write("000ctrll", motd)
+ if (navigator.userAgent.toLowerCase().includes("mobile")) {
+ const mi = document.querySelector(".mobile-input")
+ mi.style="opacity: 0; width: 0; height: 0"
+ c.addEventListener("click", e => {
+ mi.focus()
+ })
+ }
})
// Capture the keypress
@@ -89,4 +105,3 @@ window.addEventListener("keydown", e => {
// Register custom ctrl shortcuts
customCtrlShortcuts("l") // ctrl + l
customCtrlShortcuts("c") // ctrl + c
-
diff --git a/templates/console.html b/templates/console.html
index 9337d4c..cd10a87 100644
--- a/templates/console.html
+++ b/templates/console.html
@@ -5,7 +5,8 @@
{% endblock styles %}
{% block content %}
-
+
+
{% endblock content %}