mirror of
https://git.srhtnin.garden/sarah/srhtnin.github.io.git
synced 2026-10-13 18:38:11 +02:00
Added guide page
This commit is contained in:
1 parent
ce6dced3ad
commit
40db65d955
6 files changed
+449
No files matched your search
@@ -0,0 +1,81 @@
|
||||
async function StartGuide() {
|
||||
try {
|
||||
await LoadGameContent();
|
||||
RenderGuideRecipePlants();
|
||||
} catch (Error) {
|
||||
console.error(
|
||||
"Couldn't load Guide plant images:",
|
||||
Error
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function RenderGuideRecipePlants() {
|
||||
const Cells =
|
||||
document.querySelectorAll(
|
||||
".GuideRecipePlant[data-plant-key]"
|
||||
);
|
||||
|
||||
|
||||
for (
|
||||
const Cell
|
||||
of Cells
|
||||
) {
|
||||
const PlantKey =
|
||||
Cell.dataset.plantKey;
|
||||
|
||||
const Plant =
|
||||
Plants[PlantKey];
|
||||
|
||||
const Images =
|
||||
PlantImages[PlantKey] ?? [];
|
||||
|
||||
|
||||
if (
|
||||
Plant === undefined ||
|
||||
Images.length === 0
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
const Image =
|
||||
document.createElement(
|
||||
"img"
|
||||
);
|
||||
|
||||
Image.className =
|
||||
"GuideRecipeImage";
|
||||
|
||||
Image.src =
|
||||
Images[
|
||||
Images.length - 1
|
||||
];
|
||||
|
||||
Image.alt = "";
|
||||
|
||||
|
||||
const Label =
|
||||
Cell.querySelector(
|
||||
".GuideRecipeLabel"
|
||||
);
|
||||
|
||||
|
||||
if (Label !== null) {
|
||||
Label.textContent =
|
||||
Plant.Name;
|
||||
}
|
||||
|
||||
|
||||
Cell.prepend(
|
||||
Image
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
document.addEventListener(
|
||||
"DOMContentLoaded",
|
||||
StartGuide
|
||||
);
|
||||
Reference in new issue
Block a user