abtmtr-v4/views/projects/scripts/data_get_projects.js

42 lines
1.2 KiB
JavaScript
Raw Normal View History

const data_get = document.getElementById("data_get");
2024-01-19 16:28:16 +00:00
fetch_ask("./public/projects.json")
.then((x) => x.json())
.then((projects) => {
2023-12-07 16:34:09 +00:00
data_get.innerHTML = projects.items
.sort((a, b) => b.date - a.date)
.reduce(
(html, project) =>
html +
2023-12-22 00:32:20 +00:00
`<h1><a href="${project.url}">${project.name}${
2023-12-07 16:34:09 +00:00
/*<span style="vertical-align: middle;
font-size: 0.5em;">${project.tags.reduce(
(html, tag) =>
html +
`<button style="
--accent-color: ${projects.tags[tag]};
--accent-color-fg: #fff;
border-color: #fff;
margin: 0.25em;
">${tag}</button>`,
""
)}</span>*/ ""
2023-12-22 00:32:20 +00:00
}</a></h1>
<p><b>${new Date(project.date).toLocaleDateString()}</b></p>
${project.description.reduce(
(html, descfragment) => html + `<p>${descfragment}</p>`,
""
)}
<p>
<button
onclick="window.manager.createWindow('${project.url}', false${
2023-12-07 16:34:09 +00:00
project.size?.[0] ? ", " + project.size[0] : ""
}${project.size?.[1] ? ", " + project.size[1] : ""})"
>
Open Window
</button>
</p>`,
2023-12-07 16:34:09 +00:00
""
);
2024-01-19 16:28:16 +00:00
});