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

32 lines
828 B
JavaScript
Raw Normal View History

const data_get = document.getElementById("data_get");
fetch("./public/projects.json")
.then((x) => x.json())
.then((projects) => {
data_get.innerHTML = projects.reduce(
(html, project) =>
html +
`<h1>${project.name}</h1>
<p><b>${new Date(project.date).toLocaleDateString()}</b></p>
${project.description.reduce(
(html, descfragment) => html + `<p>${descfragment}</p>`,
""
)}
<p>
2023-11-25 05:09:23 +00:00
<button
onclick="window.open('${project.url}')"
>
Open
</button>
or
<button
onclick="window.manager.createWindow('${project.url}', false${
project.size?.[0] ? ", " + project.size[0] : ""
}${project.size?.[1] ? ", " + project.size[1] : ""})"
>
Open Window
</button>
</p>`,
""
);
});