From e3187471f4994c99d53f20e4c9bfb3a2f2454ce3 Mon Sep 17 00:00:00 2001 From: Physcik Date: Tue, 13 Jan 2026 22:15:27 +0500 Subject: Generation automation --- index.js | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) (limited to 'index.js') diff --git a/index.js b/index.js index 25c4313..aeab55d 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,8 @@ function LoadData(data) { const objects = JSON.parse(data).cards; for (i of objects) { - console.log(i); + CreateFace(i); + CreateBack(i); } } @@ -21,3 +22,42 @@ function readFileContent(file) { reader.readAsText(file) }) } + +function CreateFace(card) { + let parent = document.getElementById("row"); + const template = document.getElementById("FaceTempl"); + var clone = template.content.cloneNode(true); + + console.log(card); + clone.getElementById("classname").innerHTML = GetClassDisplayName(card.ClassName); + clone.getElementById("level").innerHTML = card.Level; + clone.getElementById("spellName").innerHTML = card.SpellName; + clone.getElementById("school").innerHTML = card.School; + clone.getElementById("castTime").innerHTML = card.CastTime; + clone.getElementById("distance").innerHTML = card.Distance; + clone.getElementById("components").innerHTML = card.Components; + clone.getElementById("duration").innerHTML = card.Duration; + + parent.appendChild(clone); +} + +function CreateBack(card) { + let parent = document.getElementById("row"); + const template = document.getElementById("BackTempl"); + var clone = template.content.cloneNode(true); + var container = clone.getElementById("description"); + for (i of card.Description) { + var newText = document.createElement("p"); + newText.innerHTML = i; + newText.style.fontSize = `${card.DescriptionScale}px`; + container.appendChild(newText); + } + parent.appendChild(clone); +} + +function GetClassDisplayName(baseClass) { + switch (baseClass) { + case "bard": return "Бард"; + } + return ""; +} -- cgit v1.3