Compare commits
3 Commits
d3bd7a1925
...
342c45bc81
Author | SHA1 | Date | |
---|---|---|---|
342c45bc81 | |||
11f84114db | |||
351b930c85 |
36
biome.json
36
biome.json
@@ -1,15 +1,41 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
|
"$schema": "https://biomejs.dev/schemas/2.2.2/schema.json",
|
||||||
"files": {
|
"vcs": {
|
||||||
"ignore": [".vscode/", "node_modules/", "public/"]
|
"enabled": true,
|
||||||
|
"clientKind": "git",
|
||||||
|
"useIgnoreFile": true
|
||||||
},
|
},
|
||||||
"organizeImports": {
|
"files": {
|
||||||
|
"includes": ["**", "!public", "!content", "!templates", "!static/img", "!**/*.min.js"]
|
||||||
|
},
|
||||||
|
"formatter": {
|
||||||
"enabled": true
|
"enabled": true
|
||||||
},
|
},
|
||||||
"linter": {
|
"linter": {
|
||||||
"enabled": false,
|
"enabled": true,
|
||||||
"rules": {
|
"rules": {
|
||||||
"recommended": true
|
"recommended": true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"javascript": {
|
||||||
|
"formatter": {
|
||||||
|
"lineWidth": 100,
|
||||||
|
"quoteStyle": "double",
|
||||||
|
"jsxQuoteStyle": "double",
|
||||||
|
"trailingCommas": "all",
|
||||||
|
"semicolons": "always"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"json": {
|
||||||
|
"formatter": {
|
||||||
|
"lineWidth": 100
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"css": {
|
||||||
|
"formatter": {
|
||||||
|
"enabled": true,
|
||||||
|
"lineWidth": 100,
|
||||||
|
"quoteStyle": "single"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,30 +1,28 @@
|
|||||||
let codes = document.querySelectorAll("pre")
|
const codes = document.querySelectorAll("pre");
|
||||||
|
|
||||||
codes.forEach(code => {
|
codes.forEach((code) => {
|
||||||
const elWrapper = document.createElement("div")
|
const elWrapper = document.createElement("div");
|
||||||
elWrapper.classList.add("copy-code-wrapper")
|
elWrapper.classList.add("copy-code-wrapper");
|
||||||
|
|
||||||
|
const el = document.createElement("span");
|
||||||
|
el.textContent = "Copy";
|
||||||
|
el.classList.add("copy-code");
|
||||||
|
|
||||||
const el = document.createElement("span")
|
elWrapper.appendChild(el);
|
||||||
el.textContent = "Copy"
|
|
||||||
el.classList.add("copy-code")
|
|
||||||
|
|
||||||
elWrapper.appendChild(el)
|
code.parentNode.insertBefore(elWrapper, code);
|
||||||
|
|
||||||
code.parentNode.insertBefore(elWrapper, code)
|
let textContent = "";
|
||||||
|
code.childNodes.forEach((child) => {
|
||||||
let textContent = ""
|
textContent += child.textContent;
|
||||||
code.childNodes.forEach(child => {
|
});
|
||||||
textContent += child.textContent;
|
|
||||||
})
|
|
||||||
|
|
||||||
elWrapper.addEventListener("click", (e) => {
|
|
||||||
e.preventDefault()
|
|
||||||
navigator.clipboard.writeText(textContent)
|
|
||||||
el.textContent = "Copied!"
|
|
||||||
setTimeout(() => {
|
|
||||||
el.textContent = "Copy"
|
|
||||||
}, 5000);
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
|
elWrapper.addEventListener("click", (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
navigator.clipboard.writeText(textContent);
|
||||||
|
el.textContent = "Copied!";
|
||||||
|
setTimeout(() => {
|
||||||
|
el.textContent = "Copy";
|
||||||
|
}, 5000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@@ -1,107 +0,0 @@
|
|||||||
const c = document.querySelector(".console")
|
|
||||||
const ps1 = "[fr@website ~]$ "
|
|
||||||
const motd = "Welcome to my website!<br>You can use `help` for more informations :)"
|
|
||||||
let line = "";
|
|
||||||
|
|
||||||
function exec(command) {
|
|
||||||
switch (command[0]) {
|
|
||||||
case "help":
|
|
||||||
line = "help<br>author<br>contact<br>clear<br>echo"
|
|
||||||
break;
|
|
||||||
case "author":
|
|
||||||
line = "Filip Rojek, 2023"
|
|
||||||
break
|
|
||||||
case "contact":
|
|
||||||
line = "Filip Rojek <<a href='mailto: filip@filiprojek.cz'>filip@filiprojek.cz</a>><br>web: <a href='https://filiprojek.cz' target='_blank'>www.filiprojek.cz</a><br>telegram: <a href='https://t.me/filiprojek' target='_blank'>@filiprojek</a>"
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
return line
|
|
||||||
}
|
|
||||||
|
|
||||||
function write(key, payload) {
|
|
||||||
switch(key) {
|
|
||||||
case "Enter":
|
|
||||||
command = c.lastChild.textContent.replace(ps1, "")
|
|
||||||
command = command.split(" ");
|
|
||||||
let out = exec(command)
|
|
||||||
if(out !== false) {
|
|
||||||
line = document.createElement("p")
|
|
||||||
line.innerHTML += out
|
|
||||||
line.innerHTML += "<br>"
|
|
||||||
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":
|
|
||||||
if(c.lastChild.textContent.slice(0, -1) !== ps1.slice(0, -1)) {
|
|
||||||
c.lastChild.innerHTML = c.lastChild.textContent.slice(0, -1)
|
|
||||||
}
|
|
||||||
break
|
|
||||||
|
|
||||||
default:
|
|
||||||
c.lastChild.innerHTML += key
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function customCtrlShortcuts(plusKey) {
|
|
||||||
document.addEventListener("keydown", e => {
|
|
||||||
if(e.ctrlKey && e.key == plusKey) {
|
|
||||||
e.preventDefault()
|
|
||||||
write("000ctrl"+plusKey)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// On load init the terminal
|
|
||||||
window.addEventListener("load", () => {
|
|
||||||
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
|
|
||||||
window.addEventListener("keypress", e => {
|
|
||||||
e.preventDefault()
|
|
||||||
write(e.key)
|
|
||||||
})
|
|
||||||
|
|
||||||
window.addEventListener("keydown", e => {
|
|
||||||
if(e.key == "Backspace") {
|
|
||||||
e.preventDefault()
|
|
||||||
write("000backspace")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// Register custom ctrl shortcuts
|
|
||||||
customCtrlShortcuts("l") // ctrl + l
|
|
||||||
customCtrlShortcuts("c") // ctrl + c
|
|
@@ -1,26 +1,24 @@
|
|||||||
const burger = document.querySelector(".hamburger")
|
const burger = document.querySelector(".hamburger");
|
||||||
const links = document.querySelector(".links")
|
const links = document.querySelector(".links");
|
||||||
const body = document.querySelector("body")
|
const body = document.querySelector("body");
|
||||||
const main = document.querySelector("main")
|
const main = document.querySelector("main");
|
||||||
|
|
||||||
let shown = false
|
let shown = false;
|
||||||
|
|
||||||
burger.addEventListener("click", (e) => {
|
burger.addEventListener("click", (e) => {
|
||||||
e.preventDefault()
|
e.preventDefault();
|
||||||
|
|
||||||
if (!shown) {
|
|
||||||
links.style.display = "flex"
|
|
||||||
body.classList.add("disable-scroll")
|
|
||||||
burger.textContent = "x"
|
|
||||||
main.style.visibility = "hidden"
|
|
||||||
} else {
|
|
||||||
links.style.display = "none"
|
|
||||||
body.classList.remove("disable-scroll")
|
|
||||||
burger.textContent = "☰"
|
|
||||||
main.style.visibility = "visible"
|
|
||||||
}
|
|
||||||
|
|
||||||
shown = !shown
|
|
||||||
})
|
|
||||||
|
|
||||||
|
if (!shown) {
|
||||||
|
links.style.display = "flex";
|
||||||
|
body.classList.add("disable-scroll");
|
||||||
|
burger.textContent = "x";
|
||||||
|
main.style.visibility = "hidden";
|
||||||
|
} else {
|
||||||
|
links.style.display = "none";
|
||||||
|
body.classList.remove("disable-scroll");
|
||||||
|
burger.textContent = "☰";
|
||||||
|
main.style.visibility = "visible";
|
||||||
|
}
|
||||||
|
|
||||||
|
shown = !shown;
|
||||||
|
});
|
||||||
|
Reference in New Issue
Block a user