summaryrefslogtreecommitdiff
path: root/index.js
diff options
context:
space:
mode:
authorPhyscik <mynameisgennadiy@vk.com>2026-01-13 22:15:27 +0500
committerPhyscik <mynameisgennadiy@vk.com>2026-01-13 22:15:27 +0500
commite3187471f4994c99d53f20e4c9bfb3a2f2454ce3 (patch)
treef4bab3d0a8f65b1f5fe904f9c56090da9b1ba55c /index.js
parent05968ef0b95c641aa77649a3eeab40c22b2c48a1 (diff)
Generation automation
Diffstat (limited to 'index.js')
-rw-r--r--index.js42
1 files changed, 41 insertions, 1 deletions
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 "";
+}