dumb beta builder stuffs
This commit is contained in:
parent
9bff24db12
commit
212312e902
3 changed files with 50 additions and 0 deletions
14
code/builder/index.html
Normal file
14
code/builder/index.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
36
code/builder/script.js
Normal file
36
code/builder/script.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
var jsonData = [];
|
||||
fetch('../../story/database.json')
|
||||
.then(response => response.json())
|
||||
.then(data => {jsonData = data;createHTML();});
|
||||
|
||||
function createHTML() {
|
||||
for (i in jsonData) {
|
||||
$("body").append(
|
||||
$(`<details>
|
||||
<summary>${jsonData[i].id}</summary>
|
||||
<form>
|
||||
<label for="id">ID:</label> <input type="text" value="${jsonData[i].id}" name="id"><br />
|
||||
<label for="scene">Scene Name:</label> <input type="text" value="${jsonData[i].scene}" name="scene">
|
||||
<fieldset name="appearing_characters[]">
|
||||
<legend>Characters</legend>
|
||||
${repeat(jsonData[i].appearing_characters.length, (bruh) => {
|
||||
return `<fieldset><legend>${jsonData[i].appearing_characters[bruh][1]}</legend><label for="id">ID:</label> <input type="text" class="idOfThing" value="${jsonData[i].appearing_characters[bruh][0]}" name="id"> <label for="id">Name:</label> <input type="text" class="nameOfThing" value="${jsonData[i].appearing_characters[bruh][1]}" name="name"></fieldset><br />`
|
||||
})}
|
||||
</fieldset>
|
||||
</form>
|
||||
</details>`)
|
||||
);
|
||||
}
|
||||
$(".nameOfThing").change((eo) => {
|
||||
console.log($(eo.currentTarget));
|
||||
$( eo.currentTarget ).parent().find("legend").text(eo.currentTarget.value);
|
||||
})
|
||||
}
|
||||
|
||||
function repeat(n, f) {
|
||||
var returnVal = "";
|
||||
for (var i = 0; i < n; i++) {
|
||||
returnVal += f(i);
|
||||
}
|
||||
return returnVal;
|
||||
}
|
0
code/builder/style.css
Normal file
0
code/builder/style.css
Normal file
Loading…
Reference in a new issue