From e54f2336db1e94c70a5ac596359b722845d2ce2c Mon Sep 17 00:00:00 2001 From: tenkuma Date: Sat, 25 Oct 2025 19:51:28 -0300 Subject: [PATCH] Added tags to search result, search no long matches the project tags (the ones used for filtering) and implemented author page that show up on search. --- _includes/author.njk | 27 ++++++++++++++++ _includes/project.njk | 10 +++--- assets/featured.js | 8 ++--- assets/featured.json | 1 + assets/project.js | 53 ------------------------------- assets/search.js | 30 ++++++++++++----- assets/styles.css | 32 +++++++++++++++++-- authors/authors.json | 4 +++ authors/tenkuma/index.md | 9 ++++++ authors/tenkuma/logo.png | Bin 0 -> 534 bytes eleventy.config.js | 10 ++++-- featured.json | 1 - index.html | 1 + projects/aboukkit/index.md | 9 +++--- projects/consolehud/index.md | 19 +++++++++++ projects/devilwithin/index.md | 40 +++++++++++++++++++++++ projects/devilwithin/logo.png | Bin 0 -> 17319 bytes projects/ghostsandstuff/index.md | 9 +++--- projects/hangglidere/index.md | 7 ++++ projects/projects.json | 1 + projects/tefreezer/index.md | 24 ++++++++++++++ projects/tefreezer/logo.png | Bin 0 -> 1530 bytes projects/tenkumalib/index.md | 9 ++++++ projects/tenkumalib/logo.png | Bin 0 -> 534 bytes projects/timekeeper/index.md | 21 ++++++++++++ projects/timekeeper/logo.png | Bin 0 -> 730 bytes search.html | 8 +++-- 27 files changed, 244 insertions(+), 89 deletions(-) create mode 100644 _includes/author.njk create mode 100644 assets/featured.json delete mode 100644 assets/project.js create mode 100644 authors/authors.json create mode 100644 authors/tenkuma/index.md create mode 100644 authors/tenkuma/logo.png delete mode 100644 featured.json create mode 100644 projects/consolehud/index.md create mode 100644 projects/devilwithin/index.md create mode 100644 projects/devilwithin/logo.png create mode 100644 projects/hangglidere/index.md create mode 100644 projects/projects.json create mode 100644 projects/tefreezer/index.md create mode 100644 projects/tefreezer/logo.png create mode 100644 projects/tenkumalib/index.md create mode 100644 projects/tenkumalib/logo.png create mode 100644 projects/timekeeper/index.md create mode 100644 projects/timekeeper/logo.png diff --git a/_includes/author.njk b/_includes/author.njk new file mode 100644 index 0000000..a993658 --- /dev/null +++ b/_includes/author.njk @@ -0,0 +1,27 @@ + + + + + + + neoBeta + + + +
+ {% include "header.njk" %} +
+ +
+
+

{{ name }}

+
+

{{ subtitle }}

+
+
+
+ {{ content | safe }} +
+
+ + \ No newline at end of file diff --git a/_includes/project.njk b/_includes/project.njk index c292a99..5bb3186 100644 --- a/_includes/project.njk +++ b/_includes/project.njk @@ -11,15 +11,17 @@
{% include "header.njk" %}
+ {% if logoName and logoExtension %} + {% endif %}
-

{{ projectName }}

-

by {{ projectAuthor }}

+

{{ name }}

+

by {{ author }}

-

{{ projectSubtitle }}

+

{{ subtitle }}

- +
{{ content | safe }} diff --git a/assets/featured.js b/assets/featured.js index 21157a8..544d6e6 100644 --- a/assets/featured.js +++ b/assets/featured.js @@ -1,7 +1,7 @@ const featuredHelper = document.querySelector("#featuredHelper"); async function getFeaturedJSON() { - const response = await fetch(`featured.json`); + const response = await fetch(`/assets/featured.json`); if (!response.ok) { featuredHelper.innerHTML = `

;( Oopsie! Could not load featured projects...

@@ -17,13 +17,11 @@ async function getFeaturedJSON() { featuredDiv.id = `featured-${project}`; featuredDiv.innerHTML = ` - -

:${project}

+ +

${project}

`; featuredHelper.appendChild(featuredDiv); - - loadProject(project, document.querySelector(`featured-${project} p`), undefined, undefined, undefined, document.querySelector(`featured-${project} img`)) }); } diff --git a/assets/featured.json b/assets/featured.json new file mode 100644 index 0000000..8a93067 --- /dev/null +++ b/assets/featured.json @@ -0,0 +1 @@ +["aboukkit", "ghostsandstuff", "tenkumalib"] \ No newline at end of file diff --git a/assets/project.js b/assets/project.js deleted file mode 100644 index 35bd244..0000000 --- a/assets/project.js +++ /dev/null @@ -1,53 +0,0 @@ -const queryString = window.location.search; -const urlParams = new URLSearchParams(queryString); -const projectID = urlParams.get('id'); - -async function getProjectJSON(id = projectID) { - const response = await fetch(`projects/${id}/project.json`); - if (!response.ok) throw new Error("Failed to fetch project JSON"); - return response.json(); -} - -async function getProjectDescription(obj, id = projectID) { - const response = await fetch(`projects/${id}/description.md`); - if (response.ok) { - const text = await response.text(); - obj.innerHTML = marked.parse(text.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/, "")); - } -} - -async function loadProject(id = projectID, objTitle, objSubtitle, objAuthor, objDescription, objLogo, objDownloadLink, changeColor, changeBackground) { - try { - const jsonData = await getProjectJSON(id); - document.title = `${jsonData.project.author}:${id}@neoBeta` - - if (objTitle) objTitle.innerText = jsonData.project.title; - if (objSubtitle) objSubtitle.innerText = jsonData.project.subtitle; - if (objAuthor) objAuthor.innerText = `by ${jsonData.project.author}`; - - if (objDescription) await getProjectDescription(objDescription, id); - - if (jsonData.project.downloadLink) { - if (objDownloadLink) objDownloadLink.href = jsonData.project.downloadLink; - } else { - if (objDownloadLink) objDownloadLink.innerText = "Download unavailable"; - } - - if (jsonData.project.displayLogo == true) { - if (objLogo) objLogo.src = `projects/${id}/logo.png`; - } else { - objLogo.remove(); - } - if (jsonData.project.backgroundColor) { - changeColor.style.backgroundColor = jsonData.project.backgroundColor; - } - if (jsonData.project.backgroundImage) { - changeBackground.style.backgroundImage = `url(${jsonData.project.backgroundImage})`; - } - if (jsonData.project.backgroundImageSize) { - changeBackground.style.backgroundSize = jsonData.project.backgroundImageSize; - } - } catch (error) { - console.error("Error loading project:", error); - } -} diff --git a/assets/search.js b/assets/search.js index dc1b6fc..fe6d015 100644 --- a/assets/search.js +++ b/assets/search.js @@ -3,22 +3,36 @@ fetch('/search_index.json') .then(data => { const idx = elasticlunr.Index.load(data); const docs = idx.documentStore.docs; - console.log(Object.values(docs)[0]) const searchInput = document.getElementById('search'); const out = document.getElementById('searchResults'); const filterSelect = document.getElementById('searchMode'); - function runSearch(q, tags) { - return idx.search(q, { expand: true }) - .map(r => docs[r.ref] ) - .filter(d => tags === 'all' || d.tags.includes(tags)); + function runSearch(q, tags = 'all') { + let result = idx.search(q, { expand: true }).map(r => docs[r.ref] ) + if (tags === 'all') { + return result; + } + + result = result.filter(d => tags === 'all' || d.tags.includes(tags)); + + return result; } function render(doc) { - return `
- - ${doc.title} + console.log(doc.imageq) + let tagsHTML = ""; + console.log(doc.tags) + + doc.tags.forEach(tag => { + tagsHTML += `
${tag}
` + }); + + return `
+

${doc.image ? `` : ''} ${doc.title}${doc.author ? ` by ${doc.author}` : ''}

${doc.subtitle}

+
+ ${tagsHTML} +
`; } diff --git a/assets/styles.css b/assets/styles.css index 6fa9e00..d3a7219 100644 --- a/assets/styles.css +++ b/assets/styles.css @@ -55,6 +55,16 @@ code { margin-right: 2px; */ } +input, select { + padding: .4em; + background-color: black; + color: white; +} + +p, ul { + padding-bottom: .6em; +} + #linksBox { padding: 10px; display: flex; @@ -149,7 +159,7 @@ code { padding-top: 20px; gap: 20px; display: flex; - text-shadow: 2px 2px gray; + /* text-shadow: 2px 2px gray; */ } #downloadButton { @@ -163,7 +173,7 @@ code { margin-bottom: auto; margin-left: auto; text-align: right; - text-shadow: 2px 2px black; + /* text-shadow: 2px 2px black; */ } #downloadButton:hover { @@ -173,7 +183,8 @@ code { #projectHeader img { outline: 2px solid gray; - height: 100%; + height: 5em; + image-rendering: pixelated; } #projectDescription li { @@ -199,6 +210,21 @@ code { margin-left: auto; } +.searchItemTagHolder { + display: flex; + padding-top: .2em; + gap: .4em; +} + +.searchItemTagHolder div { + border: thin solid greenyellow; + padding: .1em .2em .1em .2em; +} + +.searchItemDescription { + margin-bottom: 0px; +} + @media only screen and (max-width: 1280px) { #everythingHelper { diff --git a/authors/authors.json b/authors/authors.json new file mode 100644 index 0000000..5c47c84 --- /dev/null +++ b/authors/authors.json @@ -0,0 +1,4 @@ +{ + "layout": "author.njk", + "tags": "author" +} \ No newline at end of file diff --git a/authors/tenkuma/index.md b/authors/tenkuma/index.md new file mode 100644 index 0000000..946f032 --- /dev/null +++ b/authors/tenkuma/index.md @@ -0,0 +1,9 @@ +--- +name: "tenkuma" +subtitle: "A bear doing things on the internet." +downloadLink: "https://modrinth.com/plugin/tenkumalib/versions" +logoName: "logo" +logoExtension: "png" +--- + +I'm tenkuma. \ No newline at end of file diff --git a/authors/tenkuma/logo.png b/authors/tenkuma/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..312682a39aafa7092e89d67c07411e73d931eb8d GIT binary patch literal 534 zcmWIYbaUflVqge&bqWXzu<&7IVqnlee`qtq{ev0|494ljzt-0?l-v;yG#2 zt-Hxn3T~a3+CQUG!fn!&i~=Kt!bM-or~m9{Qfgpik#JC8V3#al&`4lp;i~ay>Ni`! z^uakofGwCs4sY_oqlY1Dl=NegufbcWp~!M!~)Y#_Z)XrI(RxqX8B#P-ST6F67@=QtMBJYDSY_Cw}}`wzt*;y=`X zc>1BA{r`VpqWlk+Jb$?V$p4Z2Blt)95C0#27XLrWV?n%exA_0_{TKfy@K5HS=s)o~ z37j@>JG}m|{^9qB-yh09oPX#$ZkzLdr2KICk@3UhN5zkjADK99p2cm?FVC(2TRyH# e%uX7oy~_^YKYagC{NeS7^bb8hoQ~68AqD_S3NtAH literal 0 HcmV?d00001 diff --git a/eleventy.config.js b/eleventy.config.js index 0d09f23..fdbb489 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -7,13 +7,17 @@ export default function (eleventyConfig) { eleventyConfig.addPassthroughCopy("projects/**/*.png"); eleventyConfig.addPassthroughCopy("projects/**/*.jpg"); eleventyConfig.addPassthroughCopy("projects/**/*.jpeg"); + eleventyConfig.addPassthroughCopy("authors/**/*.png"); + eleventyConfig.addPassthroughCopy("authors/**/*.jpg"); + eleventyConfig.addPassthroughCopy("authors/**/*.jpeg"); eleventyConfig.addPassthroughCopy("assets"); eleventyConfig.addCollection('searchIndex', (collectionApi) => { const result = collectionApi.getAll().map(item => { return { - title: item.data.projectName, - subtitle: item.data.projectSubtitle || "", + title: item.data.name, + subtitle: item.data.subtitle || "", + author: item.data.author, url: item.url, image: (item.data.logoName && item.data.logoExtension) ? item.url + item.data.logoName + '.' + item.data.logoExtension : '', tags: item.data.tags @@ -29,7 +33,7 @@ export default function (eleventyConfig) { this.setRef('url'); this.addField('title', { boost: 2 }); this.addField('subtitle'); - this.addField('tags') + // this.addField('tags') so search does not match allPlugins.forEach(doc => this.addDoc(doc)); }); diff --git a/featured.json b/featured.json deleted file mode 100644 index 5aa081b..0000000 --- a/featured.json +++ /dev/null @@ -1 +0,0 @@ -["aboukkit", "ghostsandstuff"] \ No newline at end of file diff --git a/index.html b/index.html index 1b3e1ce..9ff8241 100644 --- a/index.html +++ b/index.html @@ -2,6 +2,7 @@ layout: "base.njk" --- +

Welcome.

This is a project that aims to preserve Minecraft Beta mods and plugins through archives of documentation and JARs and showcase new plugins for beta.