mirror of
https://github.com/misode/misode.github.io.git
synced 2026-05-02 21:52:54 +00:00
Add indentation dropdown and credits
This commit is contained in:
+11
-2
@@ -9,6 +9,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<nav class="navbar navbar-dark bg-dark">
|
<nav class="navbar navbar-dark bg-dark">
|
||||||
<span class="navbar-brand mb-0 h1">Loot Table Generator for Minecraft 1.14</span>
|
<span class="navbar-brand mb-0 h1">Loot Table Generator for Minecraft 1.14</span>
|
||||||
|
<span class="float-right"><a href="https://github.com/misode" style="color: #ddd;">by Misode</a></span>
|
||||||
</nav>
|
</nav>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row my-4">
|
<div class="row my-4">
|
||||||
@@ -20,8 +21,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-5">
|
<div class="col-12 col-md-5">
|
||||||
<div class="btn-group pb-3 float-right">
|
<div class="input-group pb-3 float-right">
|
||||||
<button type="button" class="btn btn-light" onclick="copySource(this)">Copy</button>
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text">Indentation</span>
|
||||||
|
</div>
|
||||||
|
<select id="indentationSelect" class="form-control" style="max-width: 7em;" onchange="updateIndentation(this)">
|
||||||
|
<option value="2">2 Spaces</option>
|
||||||
|
<option value="4">4 Spaces</option>
|
||||||
|
<option value="tab">Tabs</option>
|
||||||
|
</select>
|
||||||
|
<button type="button" class="btn ml-3 btn-secondary" onclick="copySource(this)">Copy</button>
|
||||||
</div>
|
</div>
|
||||||
<textarea id="source" class="form-control"></textarea>
|
<textarea id="source" class="form-control"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
$("#source").val('');
|
$("#source").val('');
|
||||||
|
$('#indentationSelect').val("2");
|
||||||
|
let indentation = 2;
|
||||||
let table = {
|
let table = {
|
||||||
pools: []
|
pools: []
|
||||||
};
|
};
|
||||||
@@ -29,6 +30,15 @@ function removePool(el) {
|
|||||||
invalidated();
|
invalidated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateIndentation(el) {
|
||||||
|
if (el.value === 'tab') {
|
||||||
|
indentation = '\t';
|
||||||
|
} else {
|
||||||
|
indentation = parseInt(el.value);
|
||||||
|
}
|
||||||
|
invalidated();
|
||||||
|
}
|
||||||
|
|
||||||
function updateRollsField(el) {
|
function updateRollsField(el) {
|
||||||
let $pool = $(el).parent().parent().parent();
|
let $pool = $(el).parent().parent().parent();
|
||||||
let value = parseInt($(el).val());
|
let value = parseInt($(el).val());
|
||||||
@@ -37,7 +47,7 @@ function updateRollsField(el) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function invalidated() {
|
function invalidated() {
|
||||||
$('#source').val(JSON.stringify(table, null, 2));
|
$('#source').val(JSON.stringify(table, null, indentation));
|
||||||
$('#source').autogrow();
|
$('#source').autogrow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user