From 134e1a98c4f20a89d6e3f37bb26882b734b3b736 Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Sat, 27 Aug 2022 15:49:19 +0300 Subject: [PATCH] remove fastnav system --- out/res/fastnav.js | 26 -------------------------- src/assets/fastnav.js | 29 ----------------------------- src/index.js | 36 +++++++----------------------------- 3 files changed, 7 insertions(+), 84 deletions(-) delete mode 100644 out/res/fastnav.js delete mode 100644 src/assets/fastnav.js diff --git a/out/res/fastnav.js b/out/res/fastnav.js deleted file mode 100644 index 3fdd4f1..0000000 --- a/out/res/fastnav.js +++ /dev/null @@ -1,26 +0,0 @@ -const map = {"projects.html":"
📘 waffleview >>

Mysterious! This project has no description.

📘 brainlet-reactview >>

a react frontend for waffle (brainlet)

📘 ravenview >>

Simple experimental low-level UI library written in C++.

📘 bridgecordview >>

bridge bot api for discord servers

📘 riceview >>

my personal forks of various software and my dotfiles

📘 hippOSview >>

simple osdev testing

📘 homepageview >>

Mysterious! This project has no description.

📘 brainletview >>

🎤🐢 An open source, self-hosted alternative to Discord

📘 portalview >>

waffletv's interface app

📘 capybaraview >>

simple and fast remote touchpad

📘 rotcpuview >>

Mysterious! This project has no description.

📘 quad-jview >>

a simple upload server

📘 blocklistsview >>

Some pi-hole blocklists

📘 wormholeview >>

A simple websocket abstraction.

📘 mcliview >>

a command-line minecraft launcher written in rust

📘 mustview >>

Helper program for deploying protocol associations needed for running Roblox on Linux

🍴 brainlet-clientview >>

Mysterious! This project has no description.

📘 luapageview >>

Mysterious! This project has no description.

📘 page-simplifyview >>

turn pages into pure html

","index.html":"

hippoz's website

i think

"}; -const content = document.getElementById("content"); - -const load = (page) => content.innerHTML = map[page.substring(1, page.length) || "_notfound"]; -const navigate = (page) => { - history.pushState(null, "", page); - load(page); -}; - -const populate = () => { - const elements = document.querySelectorAll("[href]"); - elements.forEach(element => { - const existingLink = element.getAttribute("href"); - if (map[existingLink]) { - element.setAttribute("href", "#"); - element.onclick = () => navigate(existingLink); - } - }); -}; - -const main = () => { - populate(); - window.onpopstate = () => {load(location.pathname); console.log("a");}; -}; - -main(); diff --git a/src/assets/fastnav.js b/src/assets/fastnav.js deleted file mode 100644 index 97a5a08..0000000 --- a/src/assets/fastnav.js +++ /dev/null @@ -1,29 +0,0 @@ -const map = "{{NAV_DATA}}"; -const content = document.getElementById("content"); - -const load = (page) => { - content.innerHTML = map[page.substring(1, page.length) || "_notfound"]; - console.log("a"); -}; -const navigate = (page) => { - history.pushState(null, "", page); - load(page); -}; - -const populate = () => { - const elements = document.querySelectorAll("[href]"); - elements.forEach(element => { - const existingLink = element.getAttribute("href"); - if (map[existingLink]) { - element.setAttribute("href", ""); - element.onclick = () => navigate(existingLink); - } - }); -}; - -const main = () => { - populate(); - window.onpopstate = () => load(location.pathname); -}; - -main(); diff --git a/src/index.js b/src/index.js index 74d2ab3..b44725a 100644 --- a/src/index.js +++ b/src/index.js @@ -6,7 +6,7 @@ const { html: beautifyHtml } = require('js-beautify'); const data = { outputDirectory: "./out", navigationLinks: [ - {link: "index.html", text: "home", name: "home"}, + {link: "index.html", text: "home", name: "index"}, {link: "projects.html", text: "projects", name: "projects"}, {link: "https://git.hippoz.xyz", text: "git", name: "__ext_git"}, ], @@ -45,14 +45,14 @@ const linkButton = ({ link, text, selected=false }) => ` `; const navigation = ({currentName}) => ` -
+
+ `; const makePage = ({ name, description, title }) => content => [` @@ -67,11 +67,9 @@ const makePage = ({ name, description, title }) => content => [` ${navigation({currentName: name})} -
+
${content} -
- - + `, content]; @@ -79,7 +77,7 @@ const makePage = ({ name, description, title }) => content => [` const indexPage = () => makePage({ title: "hippoz", description: "hippoz website homepage", - name: "home", + name: "index", })(`

hippoz's website

i think

@@ -101,7 +99,7 @@ const projectsPage = async () => makePage({ ${repo.fork ? "🍴" : "📘"} ${repo.name} view >> - ${repo.description ? `

${repo.description}

` : `

Mysterious! This project has no description.

`} + ${repo.description ? `

${repo.description}

` : ""} ` ) .join("\n") @@ -124,25 +122,6 @@ const renderPages = async () => { return renderedPageCache; }; -const deployNavScript = async () => { - let script = await fs.readFile("./src/assets/fastnav.js"); - if (script) script = script.toString(); - - const renderedPages = await renderPages(); - let navMap = {}; - for (let [pageName, content] of Object.entries(renderedPages)) { - if (data.postProcessing.beautifyOutput) { - content = beautifyHtml(content[1], data.postProcessing.minifyOutputOptions); - } - - navMap[pageName] = content; - } - - const content = script.replace(`"{{NAV_DATA}}"`, JSON.stringify(navMap)); - - await fs.writeFile("./out/res/fastnav.js", content); -}; - const deployPages = async () => { const renderedPages = await renderPages(); for (let [pageName, content] of Object.entries(renderedPages)) { @@ -155,7 +134,6 @@ const deployPages = async () => { }; const deployAll = async () => { - await deployNavScript(); await deployPages(); };